Need for a web-based circuit simulator

Thread Starter

rapidcoder

Joined Jan 16, 2011
37
We are buildling a new circuit simulation software. We are planning to make it the best simulation software ever, so tell us, what features would you like to have in such a simulator?
 

beenthere

Joined Apr 20, 2004
15,819
What features will it have (already planned) that will make it superior to the various flavors of Spice? How will the device models be made? If they are not Spice compatible, how will you keep up with new devices?
 

tom66

Joined May 9, 2009
2,595
falstad.com/circuit is a good example to go by.

Make it possible to copy and paste a circuit design as a text file, and open it on the web.

If it's going to be a paid service *at least* make it possible to open the schematic and view it.
 

beenthere

Joined Apr 20, 2004
15,819
How secure is your simulation going to be? Say you wish to simulate a circuit that is fundamental to a patentable device. Can you be certain that the circuit will not be retained as a copy on a server somewhere, and in effect enter the public domain?

If you find a device on the market with your circuit inside, what then? Will there be a guarantee of intellectual property rights being protected?
 

Thread Starter

rapidcoder

Joined Jan 16, 2011
37
What features will it have (already planned) that will make it superior to the various flavors of Spice? How will the device models be made? If they are not Spice compatible, how will you keep up with new devices?
One of the killer features will be easy behavioral modelling of new devices:
1. by equations
2. by writing code in a high level language (mostly for digital devices)
3. by specifying a subcircuit
4. by taking an existing generic model and setting its parameters

All the methods can be used together, even in a single model. Adding new device model does not require recompiling sources, restarting the program, installing any dlls etc. - it is accesible directly from the GUI and models are loaded dynamically.

As far as I know, SPICE flavors do not allow for options 1. and 2 at all. If you wanted to do that, you would have to grab Spice source code in C, and add several hundreds lines of code just to model something even just as plain simple as an ideal resistor. Of course, before you do that you have to study the internals of SPICE code, e.g. how you should "load the matrix" (one of the twenty or so functions you have to provide), and if you screw something up, you would easily break the simulator completely. In our simulator, you would have to write just well... a single equation and that is all.

Another feature all that SPICE things don't have is interactive simulation. You would be able to change not only the parameters of the elements without restarting the simulation, but also change the circuit topology, model equations or even model code. Should be great for prototyping, e.g. algorithms for controling power switching circuits.

falstad.com/circuit is a good example to go by.
Don't get me start laughing :D Falstad is a good example how not to build a simulator. This is a toy. Its GUI is awful and nonintuitive (e.g. you have to rewire elements everytime you move something). Its simulation engine uses an O(n^3) algorithm, is slow and numerically unstable even for linear circuits. The code is unmaintainable - the whole simulation engine in a single 2k+ LOC file? Device equations and symbol graphics in a single class? WTF?

If it's going to be a paid service *at least* make it possible to open the schematic and view it.
Not only that. In the free edition, you will be able to also create/edit the schematics, run the simulation, create your own models. There probably will be some limitations if you don't want to pay us a buck, but we also investigate possibilities to make it completely free for the end users and earn on something else. It depends very much on how many people will use it.
Thus this post on the forum. We want to know you opinion, before we write most of the code (and it occurs noone need that features). We first wanted to concentrate on beginners and educational aspects, but recently we talked to some professionals, and it seems they may be also interested, especially with the modelling features. I know a guy who wrote almost half of the simulation engine completely in MATLAB just to have the possibility to model power devices with equations. Oh, and they use PSim Professional Edition and pay lots of bucks just to have the behavioral digital modelling option (the C-block - you can supply code to control the output pins of the block placed on the schematic).

How secure is your simulation going to be? Say you wish to simulate a circuit that is fundamental to a patentable device. Can you be certain that the circuit will not be retained as a copy on a server somewhere, and in effect enter the public domain?
For professional use, you can get the whole server software and deploy it on your local network. Of course, this will be a paid option. Hmm, if there were enough professionals interested in such option, the web thing could be free. Well, there are two of us working on this project, and we want to work on it full time, but to do so we have to support our families somehow - currently it is a spare-time project, and we get all the money from consulting, training, etc.
 
Last edited:

tom66

Joined May 9, 2009
2,595
One of the killer features will be easy behavioral modelling of new devices:
1. by equations
2. by writing code in a high level language (mostly for digital devices)
3. by specifying a subcircuit
4. by taking an existing generic model and setting its parameters

All the methods can be used together, even in a single model. Adding new device model does not require recompiling sources, restarting the program, installing any dlls etc. - it is accesible directly from the GUI and models are loaded dynamically.

As far as I know, SPICE flavors do not allow for options 1. and 2 at all. If you wanted to do that, you would have to grab Spice source code in C, and add several hundreds lines of code just to model something even just as plain simple as an ideal resistor. Of course, before you do that you have to study the internals of SPICE code, e.g. how you should "load the matrix" (one of the twenty or so functions you have to provide), and if you screw something up, you would easily break the simulator completely. In our simulator, you would have to write just well... a single equation and that is all.
It's a nice idea, but electronics engineers don't like to write code. What are you talking about which could be modelled? I mean, you should at least have the basics: resistors, capacitors, inductors, diodes and transistors. All other things are pretty difficult to model with simple equations. For #2, writing a digital device in a high level language (what in particular?) would make the simulator slow.

Another feature all that SPICE things don't have is interactive simulation. You would be able to change not only the parameters of the elements without restarting the simulation, but also change the circuit topology, model equations or even model code. Should be great for prototyping, e.g. algorithms for controling power switching circuits.
I liked this on Falstad but it doesn't really matter to me. Most simulations care about the start up and initial operating point of a circuit: once oscillating or started (for example, for a buck converter), they generally remain stable. I'd actually prefer a more detailed simulation that wasn't real time.

Don't get me start laughing :D Falstad is a good example how not to build a simulator. This is a toy. Its GUI is awful and nonintuitive (e.g. you have to rewire elements everytime you move something).
It's a basic simulator. But it is a nice one which I can use on any computer with any operating system and in a pinch.

Its simulation engine uses an O(n^3) algorithm, is slow and numerically unstable even for linear circuits.
It works for me, I have simulated an entire constant current buck converter in it for an LED. It does have problems at higher frequencies and in certain conditions, but you just need to get the simulation parameters right. Like SPICE.

The code is unmaintainable - the whole simulation engine in a single 2k+ LOC file? Device equations and symbol graphics in a single class? WTF?
Paul Falstad seems to manage the occasional update. I have designed a few symbols and components for it (none released yet.) It's a pain, but it works.

Not only that. In the free edition, you will be able to also create/edit the schematics, run the simulation, create your own models. There probably will be some limitations if you don't want to pay us a buck, but we also investigate possibilities to make it completely free for the end users and earn on something else. It depends very much on how many people will use it.
If you don't have a free version then forget about people using it! Why not just use LTspice? It's free and powerful, it does everything I need... Why should I pay for a web based simulator? You could consider making two versions: one which allows you to place 50 components, and one which is unlimited.
 

Thread Starter

rapidcoder

Joined Jan 16, 2011
37
It's a nice idea, but electronics engineers don't like to write code.
Therefore, we decided on a scripting language - because you can learn it in a day. And you can model a DAC converter in it in a few lines of code (like three or four?), instead of building the DAC model from gates, comparators, analogue elements etc.

What are you talking about which could be modelled? I mean, you should at least have the basics: resistors, capacitors, inductors, diodes and transistors. All other things are pretty difficult to model with simple equations.
All these basic things will be included (well, we have them already up and running). But what if there is no model for what you want to do? Or the existing model is just too complex and too slow or the other way round, it is too simplified and inaccurate? In SPICE the only option is to wait for the authors of the simulator to create these models for you, or try to model it with subcircuits and controlled sources, which is a lot more work than just writing code or equations. Here you could just take any of the internal models of the simulator and adapt it to your needs in a few minutes (and share the result with the others, growing the model database).

All the model code will be open-source. And there is no distinction between the internal builtin models and user defined models. The simulation engine is totally generic. Even a resistor model or a digital gate model is defined as a library you can change. Anyways, advanced modelling is a feature for power users. For people that spend half a year doing their simulations in MATLAB. Or for people who want to know what they are simulating (and why sometimes they get different results than in reality, which is unavoidable in any simulation software).

For #2, writing a digital device in a high level language (what in particular?) would make the simulator slow.
It doesn't. It is translated to machine code. It can also run your code in parallel, on multiple cores, transparently. The aim of providing your code in a high level scripting-like language is fast prototyping. Just to check, if the idea works, without getting down to the details of fitting the program into 64k RAM etc. For the low level work you have the software that comes from your microcontroller vendor. Usually for free or almost for free.

It's a basic simulator. But it is a nice one which I can use on any computer with any operating system and in a pinch.
It is nice, except its usability, extensibility, performance and accuracy suck. :) We can make a better one in a few months. And it also runs on any operating system and in a pinch. :)

If you don't have a free version
Where have I said, we don't? I even said we are planning to make it completely free, without any limits, if the alternate business model we think of will work. But we are not sure. Eitherway, the basic functionality, much beyond that thing that Falstad wrote will be free.

Why not just use LTspice?
Let me paraphrase your question: Why not just use Windows Media Player, instead of using YouTube?

Because you have to download and install it.
Because you cannot play with others without inviting them home.
Because it is not interactive.
Because you cannot place comments or discuss.
Because you have to manually find and install content (models, circuits; codecs in case of WMP) from Internet.
And many many more. Web is the future, desktop is over.

There is nothing wrong with LTSpice. But it is simply a different thing. Not a competition. Just like WMP is not a competition for YouTube or Microsoft Office is not a competition for Google Docs. Except, we don't have something similar to Google Docs in the world of electronic simulators. Falstad's applet could be, if it has been done better (= rewritten from scratch).
 
Last edited:

tom66

Joined May 9, 2009
2,595
All these basic things will be included (well, we have them already up and running). But what if there is no model for what you want to do? Or the existing model is just too complex and too slow or the other way round, it is too simplified and inaccurate? In SPICE the only option is to wait for the authors of the simulator to create these models for you, or try to model it with subcircuits and controlled sources, which is a lot more work than just writing code or equations. Here you could just take any of the internal models of the simulator and adapt it to your needs in a few minutes (and share the result with the others, growing the model database). All the model code will be open-source. Anyways, this is a feature for power users. For people that spend half a year doing their simulations in MATLAB.
But what in particular? How do you expect to model complex time and frequency domain stuff with simple equations? Most devices do not have a simple equation modelling them. Like a MOSFET. For an ideal model, maybe a few lines. Include the non-ideal parts and you'd be writing a book of equations.

It won't. It will be translated to machine code. It can also run your code in parallel, on multiple cores, transparently.
What language are you using which lets you run this on a web browser while utilising SMP and machine code? What if I'm on an ARM laptop? I'd be very surprised if you can run machine code from a web applet.

The aim of providing your code in high level DSL is fast prototyping. Just to check, if the idea works, without getting down to the details of fitting the program into 64k RAM etc. For the low level work you have the software that comes from your microcontroller vendor. Usually for free or almost for free.
Yeah, that's pretty much no good. For example, if you are simulating a PIC microcontroller. Let's say PIC24/dsPIC33F; pretty good processors - I use them on a daily basis. They are midrange processors. Even for this basic 16-bit processor you need a fully assembly interpreter (85 instructions, complex addressing modes, even more complicated PSV modes.) And on the dsPIC33F/24H a whole DMA engine with DPSRAM and a DSP engine. Then peripherals add their own difficulties. I like MPSIM for this as it is written by Microchip. It is accurate. Simulators with combined microcontroller simulation do not usually "cut the mustard".

It is nice, except its usability, extensibility, performance and accuracy suck. :) We can make a better one in a few months. And it also runs on any operating system and in a pinch. :)
It's a web applet. It does what it does and it only does that. Like a good phone, it only makes calls and texts. If possible hide away the complicated useless features. As for accuracy? It's fine. If you expect precision decimal point accuracy, forget it, but once I've done the initial prototype in this simulator I'll take it to LTspice and tweak it to make it perfect. You have to understand Falstad's circuit sim is an ideal simulator, whereas LTspice builds in parasitics, so you can expect different results.

Where have I said, we don't? I even said we are planning to make it completely free,vwithout any limits, if the alternate business model we think of will work. But we are not sure. Eitherway, the basic functionality, much beyond that thing that Falstad wrote will be free.
I was just warning you that it may not go well without a free version.
 

Thread Starter

rapidcoder

Joined Jan 16, 2011
37
What language are you using which lets you run this on a web browser while utilising SMP and machine code? What if I'm on an ARM laptop? I'd be very surprised if you can run machine code from a web applet
JVM applets run with full CPU speed and make use of SMP.
It will run on ARM laptop. It runs perfectly on Solaris Sparc and 64-bit AMD/Intel processors, so why not on ARM too?

But what in particular? How do you expect to model complex time and frequency domain stuff with simple equations?
1. You don't need to model frequency domain equations. They can be immediately established from the time domain equations.

2. Mosfets are complex, I agree. You don't need to supply all the stuff that is required e.g. in the Falstad's or SPICE code: you don't need the derivatives for loading the Jacobian matrix, you also don't need the frequency domain things. You may create an equivalent model by creating a subcircuit and write additional equations for controlling the parameters. This pretty much saves you 90% or more of equations.

Yeah, that's pretty much no good. For example, if you are simulating a PIC microcontroller. Let's say PIC24/dsPIC33F; pretty good processors - I use them on a daily basis. They are midrange processors. Even for this basic 16-bit processor you need a fully assembly interpreter (85 instructions, complex addressing modes, even more complicated PSV modes.)
If you want, you can model a PIC in our simulator just as well as many other processor kinds (you just have to create machine code interpreter for it - lots of work, but definitely doable). But I don't see the point. I completely agree - vendors have immediate advantage - they have to provide interpreters and other tools just for their products. If someone is serious enough to implement the program for the certain microcontroller, she already has the tools fro the vendor and knows how to use them. No need to use a general purpose simulator for it.

It's a web applet.
It is a bad excuse. Applets are just applications. It doesn't mean that if you are making an applet you can be more sloppy than when doing a desktop app.

You have to understand Falstad's circuit sim is an ideal simulator, whereas LTspice builds in parasitics, so you can expect different results
I didn't mean the model accuracy. Ideal models are sometimes much better than accurat nonlinear models (they are faster and sometimes simply you don't need that level of accuracy). I meant the core simulation engine accuracy and scalability. It works only because the models are simplified. It would choke on any real world model. It chokes even on more complex circuits using that simple models. It supports a constant step simulation only - so it is extremely slow or inaccurate for switching circuits, regardless how accurate the models were.
 

tom66

Joined May 9, 2009
2,595
JVM applets run with full CPU speed and make use of SMP.
It will run on ARM laptop. It runs perfectly on Solaris Sparc and 64-bit AMD/Intel processors, so why not on ARM too?
Java... Good choice, but machine code...?

1. You don't need to model frequency domain equations. They can be immediately established from the time domain equations.
Okay. I don't know much about circuit modelling here I was just suggesting potential pitfalls.

2. Mosfets are complex, I agree. You don't need to supply all the stuff that is required e.g. in the Falstad's or SPICE code: you don't need the derivatives for loading the Jacobian matrix, you also don't need the frequency domain things. You may create an equivalent model by creating a subcircuit and write additional equations for controlling the parameters. This pretty much saves you 90% or more of equations.
But SPICE already does this.

If you want, you can model a PIC in our simulator just as well as many other processor kinds (you just have to create machine code interpreter for it - lots of work, but definitely doable).
Uh huh. Why would I, or anyone else do this? MPSIM works well. In MPLAB X, it's even cross platform.

But I don't see the point. I completely agree - vendors have immediate advantage - they have to provide interpreters and other tools just for their products. If someone is serious enough to implement the program for the certain microcontroller, she already has the tools fro the vendor and knows how to use them. No need to use a general purpose simulator for it.
Vendors also have the exact intricities documented and can implement a perfect simulator with all hardware quirks.

It is a bad excuse. Applets are just applications. It doesn't mean that if you are making an applet you can be more sloppy than when doing a desktop app.
It can when it's a quick and dirty prototyping program. For example my breadboarded projects do not use wires cut to perfect sizes, components go diagonally, etc. etc. But it works, and it is quicjk.

I didn't mean the model accuracy. Ideal models are sometimes much better than accurat nonlinear models (they are faster and sometimes simply you don't need that level of accuracy). I meant the core simulation engine accuracy and scalability. It works only because the models are simplified. It would choke on any real world model. It chokes even on more complex circuits using that simple models. It supports a constant step simulation only - so it is extremely slow or inaccurate for switching circuits, regardless how accurate the models were.
Actually it supports frequency domain simulation. Here is an example. Based on the same engine. But it isn't exposed in the GUI, which is annoying.
 

Thread Starter

rapidcoder

Joined Jan 16, 2011
37
Java... Good choice, but machine code...?
Java bytecodes are compiled to machine code by the HotSpot compiler. Falstad's applet takes benefit of this - therefore it is quite fast for even not so good algorithms it has.

But SPICE already does this.
Their equations are BSD/MIT licensed. We will have them, too. :D

But there are lots of things that SPICE doesn't do. For example - a lightbulb model. Here you have an article how to model a lightbulb: http://www.ee.bgu.ac.il/~pel/pdf-files/conf104.pdf. This is extremely simple when modelled by differential equations - you just need three: two for evaluating the temperature, and one for the resistance. I can put those equations directly in 5 minutes into our engine, and you have a working lightbulb model.

A corresponding SPICE model is much more complex - just because you cannot put equations directly into the simulator and you have to express them as controlled sources, voltages and currents (no variable for temperature). So, some transformation is needed. This makes it not only that model is complex, but actually looking at the final model, you don't have a slightest idea, what does it model (unlike looking at the equations).

Why would I, or anyone else do this? MPSIM works well. In MPLAB X, it's even cross platform.
I've written - there is probably no point in doing it. But, we don't care. The engine is powerful enough that it is possible. However, this is not its main purpose. The purpose is that you do not need to write C or asm code for a certain processor. It is for fast prototyping, not making a final product.

Vendors also have the exact intricities documented and can implement a perfect simulator with all hardware quirks.
Agreed.

It can (be sloppy) when it's a quick and dirty prototyping program.
I don't think so. If something is for prototyping, it has to be fast, reliable, convenient to use and intuitive. We see it more like Python or Ruby - serious programming languages, great for prototyping. You seem to see it more like Basic - inconsistent, limited, nonscalable, feels like a toy for non-programmers, but sure, you can definitely program in it.

Actually it supports frequency domain simulation
I've meant not the frequency domain simulation, but the variable timestep transient simulation. It suports only constant timestep transient simulation. Constant timestep is bad - because the slopes in switching circuits are very fast - you need to keep very small timestep to simulate them accurately. But then, everything becomes slow, because between the switch times, almost nothing happens - and you are wasting CPU time and memory for too many data points. A solution is variable timestep simulation - small time step on slopes, large time step between them. Doing it requires much more advanced maths than that in Falstads applet.
 
Last edited:

thatoneguy

Joined Feb 19, 2009
6,359
I think a simulator that does all that Falstad's does and more would be nice to look at.

The biggest thing missing in simulations, including PSPICE is Power Dissipation in each component. Especially linear regulators and transistors.

At least a warning that "This will not function in the real world due to power issues". Some people have made circuits that "work" in SPICE, but need only a few kilowatts of power. Keeping the user aware of the power would be good. It's not required to use the app, but would be a great feature.
 

tom66

Joined May 9, 2009
2,595
The biggest thing missing in simulations, including PSPICE is Power Dissipation in each component. Especially linear regulators and transistors.
I'm not sure what you mean. Either use (V(in)-V(out))*I(out), or in LTspice, alt-click on the device to get watts dissipated. If you want degrees C, multiply by thermal resistance.
 

thatoneguy

Joined Feb 19, 2009
6,359
I'm not sure what you mean. Either use (V(in)-V(out))*I(out), or in LTspice, alt-click on the device to get watts dissipated. If you want degrees C, multiply by thermal resistance.
Yes, we know that, but there will be a lot of people not familiar with electronics that will try out an idea, and since it works in simulation, they'll wire it up, and wonder why it smoked.

Maybe I should have worded it better.
 

Thread Starter

rapidcoder

Joined Jan 16, 2011
37
Or even better: the elements usually have some other limits - they could be destroyed not only because of overheating. Capacitors or junctions can be destroyed by applying too high voltage, electrolytic capacitors can be destroyed by wrong polarisation etc. This feature is a high-priority one and quite easy to implement. Really don't know, why other simulators don't have it.

Either use (V(in)-V(out))*I(out), or in LTspice, alt-click on the device to get watts dissipated.
I know, but the user simply might forget to check the watts dissipated. Such things should be displayed in red as a warning.
 

tom66

Joined May 9, 2009
2,595
Or even better: the elements usually have some other limits - they could be destroyed not only because of overheating. Capacitors or junctions can be destroyed by applying too high voltage, electrolytic capacitors can be destroyed by wrong polarisation etc. This feature is a high-priority one and quite easy to implement. Really don't know, why other simulators don't have it.
They do and it's quite annoying, to be honest. Functional verification BEFORE physical verification. Yenka, a crappy education simulator. It will blow up logic gates if the input voltage exceeds 5V. When in practice, that doesn't happen - the clamp diodes will conduct and the excess current may lead to overheating but this can be eliminated with a series resistor. There are way too many things to account for - just don't bother with it.

I know, but the user simply might forget to check the watts dissipated. Such things should be displayed in red as a warning.
Thermal simulation is a whole 'nother ballpark and not for an electronics simulator to have. °C/W is an imprecise, ballpark measurement, and to add what you're thinking of, you'd need to simulate precise thermal characteristics, including thermal resistance, black body radiation, thermal inertia, cooling... and so on.
 

Thread Starter

rapidcoder

Joined Jan 16, 2011
37
There are way too many things to account for - just don't bother with it.
I feel you are trying to say: "Dude, leave it, it is too hard for you". ;)
But it is not too hard to create generic support for limits in the simulation engine and document how to add those limits to the models. These are just a few more equations. We are not planning to make it all by ourselves. Also not all the models. It should be an open platform. Anyone could add models to it. Anyone could fix it. Like Wikipedia. I think this is the actual power of the web. Enabling things that are not possible for standalone, desktop simulators.

They do and it's quite annoying, to be honest.
You see, if the models were open, you could easily fix it. Such feature can be also easily switched off, if someone doesn't like it. Nevertheless exceeding 5V is a bug in the design. It is better to sometimes warn about something not so critical instead of silently simulating a circuit that is likely to cause problems. I would not like to go to a shop to buy new set of gates just because I set their power supply voltage to 10 V by accident.
 
Top