Simulation - Graphic Simulation of Circuits

A short test project…

I reviewed a several Graphic Simulators, focusing on those that:
• Are simple to use
• Clean GUI
• Enough Bells, Whistles (circuit components) and Tools
• Could possibly work with Kicad Plugin

Result:
My favorite is the Falstad Circuit Simulator

  • It meets 97% of above (shortcoming: the need to Parse Kicad Netlist to use Kicad Circuit)

• The Stand-Alone version has all that’s needed and, Can run from a Kicad Plugin (especially if the plugin does the Parsing)

• Parsing not too difficult for the circuit shown but will take effort to encompass enough capability for a reasonably robust Kicad tool

You can Build a Circuit and run the Simulator Online and/or Off-Line. A slew of stock circuits, components and tools (menubar and Right-Click to access). There is excellent documentation for Flastad.

Very Quick Example: Running the Stand-Alone Offline Version
• Kicad Circuit
• Parsed/Tweaked Netlist-to-Text needed for simulation
For Reference, here’s the Falstad List (raw text) - you can see how it compares to a Netlist, thus, how easily Parsing is (just component locations and component parameters…)

I’m putting this on my ToDo list (for Fall/Winter) and, will look forward to seeing ‘if/what’ others might do with this idea… :wink:

circuit_JS1_Cap1

2 Likes

I have mild interest in this discussion. I have recently used TINA-TI, Simplis-Simetrix, LTSpice. PSIM some years ago. Also programmable calculators. And in college I used some sort of simulator which ran on a mainframe computer under Fortran. By “graphic simulator” do you mean that it provides for input via a schematic drawing (instead of a text format netlist?)

Yes, if what you mean is what ‘I’ think. Using Falstad either Online or Offline, No Netlist is involved But, the file of your circuit (if saved) is a simple Text file. Thus, a curious user might think it will be simple to Parse a Kicad Exported Netlist (making it runable in Falstad. Falstad will open a Files).

You build the schematic by Dropping widgets. And, related to using it with Kicad, you can use a Net output from Kicad, parse it, Open it in the Falstad and run it. Even better than Parsing it, is to Create a Plugin to do what’s needed (take a look at the Netlist Plugins for Kicad, you’ll see what I mean…) and, the plugin can run Falstad (easy)…

Back to the building a schematic, go the Site (link above) and what you see is circuit (probably running). Check out the Menubar, click around and explore you can Add/Delete from that circuit or File>New and build one with the Click&Draw widgets (Select one, click in the window at Start-Point and Drag to the End-Point. But, best to watch some tutorials on youtube… Open one of the Circuits (menubar) to see good examples. Many of the widgets seem to have Sliders (checkbox in widget when you double click)

Looked into Parsing Kicad’s Schematic to get the Needed Data…

No doubt, I can grab the data from the PCB file but, ‘what if’ I/user doesn’t want to make a PCB or bother saving/exporting Netlist. Meaning, 'what if’ wanting to use only the Schematic?

After messing around enough, it dawned on me to Create the needed Fields and Data in the Schematic’s Symbol Properties Panel.
Then, to use for Falstad Simulation, parse the Schematic file. To better understand this, I added several widgets to a Falstad blank circuit and reviewed the file’s output - pretty clean and simple.

Thus, I added the necessary info to a new Field in the Kicad symbol’s property panel. Parsed the file to extract the info and create a text file. Then, Opened the file in Falstad. Bingo! Will be easy to do with Python.

Thus - can build circuit in Kicad, Add needed Fields, Parse the file and use resulting parsed/saved file in Falstad.

Example/Screenshots - for One Component (resistor) I took the Start1 and End2 points from the x-y info at bottom of Kicad’s panel and used them in the Field input.
I manually changed the X/Y values in the file for position and Units testing but, that’s not important for this posting. Just consider difference in Units being used between Falstad and Kicad and make correct adjustment to values…

Some Key Points:
• Falstad uses a combination of Text and/or Numbers to identify circuit elements (r for resistor, c for capacitor… But, numbers are also used e.g., a variable resistor is not marked as ‘r’ but, rather with a number. Making a list of them for the many circuit components will be a rainy-day effort. But, a short list for most-used common items won’t take too long. See Example screenshot

I may spend time on this, I may-not… but, now you Programmers know where to start…

And, ‘Yes’ can make it NetList-like plugin to Run/Call from Export Netlist (just create the New Custom command and point to the Plugin file… just like the stock one’s.

Examples Of Component/Data

Kicad’s Symbol Property Panel and Parsed Output File

Result of the Parsed File, Opened in Falstad

I’ve been using a spin-off of Falstad, Lushprojects, which generates HTML5 instead of JavaVM opcodes so no Java plugin is required, only a modern web browser. I daresay it even runs smoother but that’s just my impression.

If anybody knows of a .kicad_sch from/to Falstad format converter do tell. Otherwise it’s just one of a pile of round tuits I’m collecting. :wink:

1 Like

Just registering my interest here. I like the lushprojects/falstad simulator too, for quickly trying things out. It would also be great to have a converter to allow the import of the Falstad schematic into Kicad so a more sophisticated simulation could also be run on ngspice.