Giter Club home page Giter Club logo

electric-circuits's Introduction

GitHub Super-Linter Run Tests and Deploy License Release State

Electrical Circuit Design Studio

This repository contains a web-based application for designing analog electrical circuits and serves as a testbed for exploring AI-assisted techniques in CPS. It is built using WebGME. This project is still in early stages and is not yet suitable for production usage!

circuit-editorce-amplifier

Noteworthy Features

While it can be used as a general purpose circuit editor, this project offers the following capabilities:

  1. Import SPICE Netlists and create schematic/diagram for the circuit.
  2. Export SPICE Netlists from a circuit for further processing/simulation.
  3. Using deep learning models, get recommendations on the next components/wires in the circuit.

Quick Start

Installing this repository requires NodeJS (currently tested for versions 12 and 14), MongoDB and Python > 3.8 with conda. For a native installation, clone this repository:

$ git clone https://github.com/symbench/electric-circuits

Then, create a conda environment using environment.yml:

$ cd electric-circuits
$ conda env create --file environment.yml

After that, install node dependencies and start the server.

$ npm install
$ npm start

Finally, navigate to http://localhost:8888 to start using electric-circuits.

Docker Quick Start

We also offer a docker image for this repository with all the dependencies installed. To start a docker container (without user accounts enabled) for this repository, use docker-compose:

$ docker-compose --file docker-compose-local.yml up

Funding Information

This work is supported by DARPA’s Symbiotic Design for CPS project and by the Air Force Research Laboratory (FA8750-20-C-0537).

LICENSE

Apache-2.0

electric-circuits's People

Contributors

brollb avatar umesh-timalsina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

electric-circuits's Issues

Analytics/Assistant Integration

It would be great to be able to integrate a trained model to assist with model building. There are many different possibilities so I thought I would create this issue to track some of the ideas as well as any discussion about integration.

A couple ideas for analytics integration:

  • suggest the next component
  • detect errors (or possible anomalies which may be errors)
  • search existing models using similarity/dissimilarity

GraphGym recommendations

It would be nice to add a checkpoint from GraphGym for recommendations. Currently, the one I am considering has reached about 36% on the hold out set and 50% on the training data.

Spice DeviceLibrary

It might be nice to create a device library using open source Spice device models available. This would mean:

  1. Adding a Mixin family of DeviceModels to each nodes in the ComponentBase category.
  2. Finding large sources of open source and device models and creating a Library of these Nodes using a Plugin. For example https://github.com/kicad-spice-library/KiCad-Spice-Library library has a huge collection of device models for KiCad.
  3. After #44, make these components available for it as well.

Current Controlled Sources Issue

It might be nice to sort out what the reference voltage name in the current controlled voltage sources mean and change the containment if so needed.

Unsupported SPICE Conversion Components

At this current stage, ConvertCircuitToNetlist is unable to process the following Components.

  • VariableResistor
  • VariableConductor
  • VariableCapacitor
  • VariableInductor
  • SaturatingInductor
  • OpAmp
  • OpAmpDetailed
  • Gyrator
  • OpAmpDetailed
  • Potentiometer
  • Transformer

Incorporate Units

It might be nice to incorporate units support into the components itself.

Default plugins for metanodes

I noticed that it appears that CreateElectricCircuitsMeta is enabled by default on Circuit nodes which seems a bit counterintuitive - I would expect it to only be enabled on the "language container" (ie, ElectricCircuits in the root node).

It would also be nice if

  • the recommendation plugin was enabled by default on circuits
  • the export plugin was enabled by default on circuits
  • the import plugin was enabled on circuit folders

Access config information from python plugin

Currently, there isn't any way to access the plugin configuration from within the python plugin. This is required for the analysis capabilities as I intend on having multiple models available that can be explicitly selected (so different approaches can be compared).

Circuit to SPICE Netlist

There are three parts to a netlist: 1. Decorations(labels, end, start). 2. Components and SubCircuits 3. Analysis (Transient, Noise, Pole-Zero, Small Signal etc... among others).

  1. In any netlist, decorations are always the same, so a code generator can take care of it trivially.
  2. According to what I gleaned from the meeting on Monday, the focus should not be simulation. Although, I would argue that for a meaningful metric that can be used for evaluating ML/RL methods we comeup with, simulation will be the part of the pipeline. But, for now we could ignore this.
  3. The components aspect is a little bit tricky. Lets look at op-amp for example:
    • There is no direct way to specify an Op-AMP, with different regions of operations. Whether its an ideal op-amp with infinite gain etc.... The first thought here (at least the most st. forward) is to modify the metamodel to add an attribute (Spice-Model/Configurations) for each component that is a dictionary of some sort and could be specified on component drag to the circuit from the PartBrowser to the Model Editor. An alternative is to create different nodes for different configurations , which might be easier.
  4. SubCircuits. Handling subcircuits should be trivial because the way we can specify them in the current metamodel.

So, with the current state of the project and decorated metamodel, we need the following steps to be able to generate a SPICE netlist.

  1. Parse the PySpice package to get the Spice Component Attributes hence creating any extra metanodes not already in the current metamodel. Once parsed, a domain expert (Peter and Akos) can verify that. (I will work on this first)
  2. Add a plugin for spice netlist, using a Python plugin using PySpice. This should be trivial with excluding analysis and model parts.

DeepForge Extension

This Library should be integrated with DeepForge. Primarily, after #44. This should be easy considering, after #23, we should be able to create a PySpice Circuit Object/ Some other Pythonic representation of the Circuit.

Uncaught TypeError in ElectricCircuitsDecorator.FourTerminalComponent.js

Uncaught TypeError: Cannot set property '/k/3' of undefined
    at ElectricCircuits.FourTerm.js:65
    at Array.map (<anonymous>)
    at ElectricCircuitsDecorator.FourTerminalComponent.planPins (ElectricCircuits.FourTerm.js:50)
    at ElectricCircuitsDecorator.FourTerminalComponent._updatePorts (ElectricCircuits.FourTerm.js:27)
    at ElectricCircuitsDecoratorCore._update (ElectricCircuitDecorator.Core.js:240)
    at ElectricCircuitsDecoratorCore.update (ElectricCircuitDecorator.Core.js:218)
    at ElectricCircuitsDecoratorCore._renderContent (ElectricCircuitDecorator.Core.js:214)
    at ElectricCircuitsDecorator.on_addTo (ElectricCircuitsDecorator.DiagramDesignerWidget.js:48)
    at DesignerItem._callDecoratorMethod (DesignerItem.js:326)
    at DesignerItem.addToDocFragment (DesignerItem.js:177)

This is causing problems when dragging FourTerminalComponents from PartBrowser to ModelEditor.

Example Component Recommender Analytic

As a concrete example of an analytic (referenced generally in #59), it would be nice to add a component recommender/completer to make sure everything is in place so we can experiment with models trained from https://github.com/symbench/spice-completion/.

For the purposes of this issue, the "mock" recommender could simply return the top 3 most commonly used components in the netlist. Concretely, it might be nice to have the mock recommender use the netlist representation (not the GME nodes) and return the top three components with confidences (probably just some hard-coded values for the mock analytic).

Decorator Enhancements

Here's a non-exhaustive list of decorator enhancements

  1. @brollb suggested not to hard-
    code meta-node Concepts with the decorator. So, an alternative should be followed.
  2. Improve pin planning for Circuits
  3. It might also be useful to display pin names.

Uncaught Error: importScripts failed for AutoRouterActionApplier at /lib/autorouter/action-applier.min.js

Uncaught Error: importScripts failed for AutoRouterActionApplier at /lib/autorouter/action-applier.min.js
http://requirejs.org/docs/errors.html#importscripts
at makeError (require.js:168)
at Function.req.load (require.js:1984)
at Object.load (require.js:1685)
at Module.load (require.js:834)
at Module.fetch (require.js:824)
at Module.check (require.js:856)
at Module.enable (require.js:1176)
at Object.enable (require.js:1557)
at Module. (require.js:1161)

This is happening in webgme.symbench.org

JointJS Integration

#44 has grown quite large to act as a standalone PR. It might be nice to refactor it into several smaller Pieces such that it all makes sense.

  1. Integrate JointJS, Dagre, loadash, GraphLib and a custom circuits domain for JointJS.
  2. A base visualizer which serves as a base for #44.
  3. Non-Interactive CircuitEditorVisualizer that subclasses visualizer in 2.
  4. More Ideas around integration.

Uncaught `assert.AssertionError`

The autorouter is throwing the following error when using the decorated components.

assert.AssertionError
actual: false
expected: true
generatedMessage: false
message: "AREdgeList.getEdgeByPointer: edge !== null FAILED!"
name: "AssertionError"
operator: "=="
stack: "AssertionError: AREdgeList.getEdgeByPointer: edge !== null FAILED!↵    at AutoRouterEdgeList.getEdgeByPointer (https://webgme.symbench.org/lib/autorouter/action-applier.min.js:2:12209)↵    at AutoRouterGraph._deleteSamePointsAt (https://webgme.symbench.org/lib/autorouter/action-applier.min.js:4:2888)↵    at AutoRouterGraph._deleteTwoEdgesAt (https://webgme.symbench.org/lib/autorouter/action-applier.min.js:4:1240)↵    at AutoRouterGraph._simplifyPaths (https://webgme.symbench.org/lib/autorouter/action-applier.min.js:4:4138)↵    at AutoRouterGraph._optimize (https://webgme.symbench.org/lib/autorouter/action-applier.min.js:4:18148)↵    at optimizeFn (https://webgme.symbench.org/lib/autorouter/action-applier.min.js:4:16896)"
__proto__: Error

Device Model Pointer

It might be nice to integrate DeviceModel Pointer for each component that can represent a standard SPICE Model associated with it. This will be more helpful for running simulations with SPICE simulator of choice while generating the netlist.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.