Online Java Circuit Simulator

Posted: 5/9/2009 5:28:27 AM
GordonC

From: Croxley Green, Hertfordshire, UK

Joined: 10/5/2005

This is a split thread from here (http://www.thereminworld.com/forum.asp?cmd=p&T=3983&F=3&p=2).

There is an online java circuit simulator here (http://www.falstad.com/circuit/e-ohms.html).

Directions for its use are here (http://www.falstad.com/circuit/directions.html).

I'm trying it out. My knowledge of electronics comes from learning physics at high school a long time ago, so I have a load of misconceptions about the subject. Please forgive my ignorance.

I have started to build a simple ring-modulator circuit, but have come to the limit of my knowledge. To see how far I have got, copy the code at the end of this post (not including the bits in [b]bold[/b]), open the simulator using the second link in this post, right click (mac users, control-click) on a black part of the simulator, select File-->Import in the contextual menu that appears, paste my code into the window that opens and click on the Import button. (*)

The output is not quite as I expected. It has corners, but the inputs are both sine waves.

Questions...

What is an appropriate primary inductance for the tapped transformers?

Am I right to put a resistor across the outputs to simulate a load? How many Ohms?

[b]Code Starts[/b]

$ 1 5.0E-6 13.654669808981877 31 5.0 50
d 208 112 256 64 1 0.805904783
d 256 64 304 112 1 0.805904783
d 304 112 256 160 1 0.805904783
d 256 160 208 112 1 0.805904783
169 80 80 144 80 0 1.0 1.0 -6.047907177736401 8.200832295068906
w 144 80 144 64 0
169 432 144 368 144 0 1.0 1.0 -2.8990260628714717 6.458960171845058
w 304 80 304 112 0
w 368 144 368 192 0
w 208 192 208 112 0
w 208 192 368 192 0
w 368 80 304 80 0
w 144 64 256 64 0
w 144 144 144 160 0
w 144 160 256 160 0
w 144 112 176 112 0
w 176 112 176 224 0
w 176 224 224 224 0
w 368 112 336 112 0
w 336 112 336 224 0
w 336 224 272 224 0
v 464 80 464 144 0 1 30.0 20.0 0.0 0.0 0.5
v 48 80 48 144 0 1 20.0 20.0 0.0 0.0 0.5
w 48 80 80 80 0
w 48 144 80 144 0
w 432 144 464 144 0
w 432 80 464 80 0
w 224 224 224 272 0
w 272 224 272 272 0
r 224 272 272 272 0 1.0
o 21 32 0 38 20.0 6.4 0 -1
o 22 32 0 38 20.0 6.4 0 -1
o 29 64 0 38 2.3384026197294445 0.7482888383134223 1 -1

[b]Code Ends[/b]

(*) Update. Damnit! The simulator's import routine is sensitive to font data or something - at least on my Mac - so the above instructions don't work as given. To work around this (for Mac users), after copying the code from this post, paste it into TextWrangler (free download (http://www.barebones.com/products/TextWrangler/)) then copy the text from the TextWrangler window. This removes whatever is causing the problem. (I also tried this in TextEdit but it didn't work. :-( ) Also - you must include a line feed at the end, but no blank line.
Posted: 5/10/2009 12:17:16 AM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

[b]Please note .. comments below are based on about 15 minutes playing with this simulator - And I may well have made some stupid mistakes and/or missed some important issues. I will update ASAP. [/b]

Gordon,
I have your circuit running, and see what you mean - things are not quite right! I need to examine the simulator primitives a bit to determine what sort of model is being used for the (critical) transformer.. Things which 'jump out' immediately are the values - The 1R load, for example, would cause huge currents.. in a real circuit these could saturate the transformer and cause the kind of 'squaring' which is being seen. The other issue which 'jumps out' is the frequencies chosen.. Too low for a 'real' circuit.
I have never come across a simulator like this, and some standard 'rules' which apply to all other simulators I have worked with (and definately all SPICE simulators) are not obviously in operation on this simulator.. The most dramatic deviation from 'normal' is the lack of any obvious 'Ground' or '0V' node.
All simulators I know MUST have some 0V node, as all voltage calculations and matrix operations are performed with reference to this node.. The simulators have deliberate resistances (extremely high - usually >10e9 ohms) from any floating point to the 0V node so as to overcome impossible maths generated at unconnected (floating) nodes.
Your entire circuit is 'floating' - And I do not understand how this simulator is working at all .. There obviously is a 0V node somewhere -

I tried doing some edits (changing load and frequencies, and introducing a filter with 0V node) but it crashed my PC completely - I never exported the netlist, so will start again soon.... :(

But - Apart from the above teething problems, this does look like it might be an extremely useful tool .. It could facilitate a means for mutual exploration of circuits, and also be a mechanism for on-line tuition of basic electronics.

BTW - I had no problem cutting / pasting your netlist into the simulator under windows.



[i]What is an appropriate primary inductance for the tapped transformers? [/i]

At this stage (not actually wanting to make this a 'real' circuit) almost any value should work - optimum will depend on frequencies.. but say 20mH.

[i]Am I right to put a resistor across the outputs to simulate a load? How many Ohms?[/i]

This is one place for the load - Resistance of about 10k..
The voltage across the resistor is a function of current through it, current is a function of input signals / transformer charactaristics / resistance. If this transformer does NOT saturate, almost any value resistance is ok to get a representation of output waveform... If the transformer saturates, or there are ANY other limits on the values from the computation of the results, then the resistor needs to be chosen so that the values are all within the range of the simulator and do not 'clip'.

I have found simulation of transformer based circuits to be the most troublesome and inacurate of all simulations.. even using some 'advanced' simulators - I have never had entirely satisfactory results making multipliers based on transformers, and use the SPICE 4Q Multiplier primitive, which is trouble-free. I will try to locate (or design) a 4QM primitive which can be plugged into this simulator.
Posted: 5/10/2009 1:10:20 AM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

Gordon,
Reduce the amplitude of the input signals to 2V
Increase the frequency to 200Hz and 300Hz
Things will look a lot better!

Put both frequencies the same - say 200Hz - and the output frequency will be 400Hz... This proves that the circuit is working (sum + difference = 200+200+0 = 400)

I changed primary inductance to 100mH, but it makes little difference. Increasing load resistor does not do what I expected.. leave it a 1R.

I expect there is a maths overflow problem causing the clipping seen when input amplitudes are too high.

[b]UPDATE:[/b]

Have now spent some time playing with this simulator.. Conclusions are:
1.) This is a great little on-line learning aid, but not much use for anything serious - It has the potential to become useful, but will need far better documentation and better editing facilities to attain its potential.
2.) Whilst simple for a student to use ONCE the circuit has been PAINSTAKINGLY developed by a tutor, modification of any 'working' circuit can introduce problems which are NOT REAL.. The behaviour of this simulator cannot be trusted to give consistent 'true' results for anything other than circuits using the basic R,L,C components.. It is fine for ohms law and basic electronics only.
3.) I would not have the patience to develop circuits on this package, nor the patience to debug problems produced by this package.
4.) I think that anyone wanting to play with circuit simulation would be far better off spending a bit more time getting to grips with a real simulator (SPICE based) - You will recover this 'extra' time quickly by not having to waste many frustrating hours 'debugging' circuits which do not actually have a problem.

Apart from the above, this simulator appears to be limited to 25kHz signals, so is of no real use for anything at the Theremin front-end.

I strongly advise anyone interested, to visit Linear Technology (http://www.linear.com/) and download their excellent free simulator LTSPICE (http://www.linear.com/designtools/software/ltspice.jsp). This simulator will accept standard SPICE files, so one can get models for almost any IC one is likely to need.. But it comes complete with all the basic primitives and all the components one needs to get started.. it also has comprehensive user manuals, and an on-line support group which is really friendly, helpful and knowledgable.. Helmut, one of the LTSPICE designers, is on this forum and I am astounded how he manages to deal with every issue that comes up and do anything else.
I will be happy to assist with Theremin / Music related circuits developed using LTSPICE.
Posted: 5/10/2009 3:22:14 AM
GordonC

From: Croxley Green, Hertfordshire, UK

Joined: 10/5/2005

Thank you Fred, it looks much better now.

I've sent a copy of the amended version to the guy that created the simulator for inclusion on his website - knowing that people are using his program may encourage him to keep developing and improving it.

(Here's the updated netlist...)

$ 17 5.0E-6 2.3728258192205156 41 5.0 50
d 208 112 256 64 1 0.805904783
d 256 64 304 112 1 0.805904783
d 304 112 256 160 1 0.805904783
d 256 160 208 112 1 0.805904783
169 80 80 144 80 0 0.1 1.0 -0.23465218338446156 4.631053465049984E-4
w 144 80 144 64 0
169 432 144 368 144 0 0.1 1.0 -0.5319967317662956 0.5944740957225769
w 304 80 304 112 0
w 368 144 368 192 0
w 208 192 208 112 0
w 208 192 368 192 0
w 368 80 304 80 0
w 144 64 256 64 0
w 144 144 144 160 0
w 144 160 256 160 0
w 144 112 176 112 0
w 176 112 176 224 0
w 176 224 224 224 0
w 368 112 336 112 0
w 336 112 336 224 0
w 336 224 272 224 0
v 464 80 464 144 0 1 300.0 2.4 0.0 0.0 0.5
v 48 80 48 144 0 1 200.0 2.0 0.0 0.0 0.5
w 224 224 224 272 0
w 272 224 272 272 0
r 224 272 272 272 0 1.0
w 432 144 464 144 0
w 432 80 464 80 0
w 48 144 80 144 0
w 48 80 80 80 0
o 21 8 0 38 2.5 0.4 0 -1
o 22 8 0 38 2.5 0.4 0 -1
o 25 8 0 38 1.093625362391506 0.3499601159652819 1 -1


Posted: 5/10/2009 5:19:48 PM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

I have not done any Java programming, but have downloaded the source code, and it looks about as friendly as any of the high-level object-oriented languages - I hate them all!

There is a definate bug in the potentiometer component (one cannot use this, for example, with the ramp generator circuit as a means of changing from ramp to triangle by putting it in the charge / discharge path) - I was trying to make a ring modulator with adjustable waveshape inputs - I thought this could be a useful demo of possible output waveforms from pre-mixer waveshaping in a Theremin.. But gave up - Some Circuits which work perfectly on all other simulators (and in real life) produce bizarre and nonsensical behaviour on this one..

I know the Potentiometer has some problems, I also suspect that diode models are quirky under some circumstances, and the op-amp outputs at times produce irrational outputs, or, at least outputs one would expect from an extremely slow op-amp - a lot slower than a 741!

If I get bored and want a break from what I am boing, I may dig deep into the code -

I think perhaps some problems are due to the auto-ranging of the 'scope display - this can cause artifacts to appear on the trace.

But, for now - I strongly advise that one should not rely on ANY results seen from this simulator ..

Gordon, you did extremely well to get the circuit working so well - you must have "The Knack" ;)
Posted: 5/10/2009 8:10:45 PM
GordonC

From: Croxley Green, Hertfordshire, UK

Joined: 10/5/2005

[i]Gordon, you did extremely well to get the circuit working so well - you must have "The Knack" ;)[/i]

I do have a bit of an intuition for computer programs - I used to dabble - but I don't think it's that, because I got a nice email from the programs author - apparently he couldn't get ring-mod to work either - and he surely should be able to - it really wasn't hard at all.

I think it is more likely attributable to my ignorance of analogue electronics (*). As you said - the circuit is "floating", so should not work at all. I didn't know that. I still don't know exactly what it means (not earthed, I think) or why that is a bad thing. If I had, I guess I probably would not have even considered doing it the way I did.



(*) What I do know is that there are two sorts of electricity - conventional and the other sort, they never mention its name, and they are either current, which means moving through wires, or static, which means not moving, like in a battery full of electricity that is not being used, and you can make it by scraping the electrons off a balloon with a piece of fur and you can't tell if it's conventional or not because it's not current, but if you connect wires to it the electricity flows through the metal - the conventional sort goes cautiously forwards, which is the conventional thing to do, riding on electrons and bumping into atoms, but the other sort rushes off backwards into the holes left behind by the electrons at the speed of light, and it's magnetised too so when it leaks out of a "light bulb" it radiates outwards and that's what light is - electro-magnetic radiation - which is why you can see lightning which is big bolts of electricity but sometimes the conventional electricity leaks out of a circuit too and that's a sort of blue smoke so obviously that's the sort of electricity that does the actual work because the circuit stops working when the blue smoke escapes whereas the sort that isn't conventional is just flashy. Also current electricity can be AC or DC and we can tell which is which because AC (the main or domestic sort) is joined up with male and female connectors ("plugs" and "sockets") whereas batteries are DC and join up front to back but both sorts are perfectly valid and legal and it is wrong to discriminate against them.
Posted: 5/11/2009 5:07:50 PM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

[i]"As you said - the circuit is "floating", so should not work at all. I didn't know that. I still don't know exactly what it means (not earthed, I think) or why that is a bad thing.[/i]

At its most basic, the problem with 'floating nodes' in a simulator comes down to one simple thing.. There is no such thing as a "voltage" on its own - every voltage must be measured with respect to some point (or node).. What this 'node' is actually "sitting" at is irrelevant - as long as one knows what it is, or at least know what 'node' the voltage you are measuring is referenced to. This applies to all circuit design and testing - the convention is to have a 0V or 'ground' node in the circuit, and (unless stated otherwise) all voltages are measured with respect to this '0V' node.

With simulations, the above becomes far more critical - The simulation maths must compute the instantanious voltage on every circuit node, so as to be able to compute the operation of the circuit.. These voltages are continuously changing and effecting each other (as are currents and charges across capacitors and inductors etc) and the maths is performed in a matrix.. The time-step between computation samples is also (usually) changing dynamically to allow fine adjustment to get the maths results to "converge".
Without a SPECIFIED (by means of attaching a GND symbol or attribute to a net) 0V or other 'reference' node against which voltages are referenced, how does the computation engine form any sensible values in the matrix? I dont know! .. I can only assume that every circuit node has an invisible resistor (a few Gigohms perhaps) connected to an invisible 0V node.. But with a floating circuit using transformers, I still do not see how this would solve the problem - I do not see how the output voltage was found, or why it was 'right'! ... Perhaps the load resistor is assumed to be connected to 0V at the other end from the 'scope point.. But this sort of hidden action is an extremely bad idea - and may (if it is what is being done) be the reason other circuits do not work as expected.


[i]"(*) What I do know is that there are two sorts of electricity - conventional and the other sort, they never mention its name"[/i]

Generally, I think the term "Electrostatic" is applied to "the other sort".. I spent a wonderful highly paid year researching on-line "free energy" devices for a client - I had told this client that the vast majority (if not all) of this stuff was bogus at best, and fraudulent at worst - but he insisted I did this for him, and paid me, so I never argued too much! ;).. Most of this stuff can be understood by imagining the earth and its atmosphere / electrosphere as a capacitor - there is a conductive 'skin' (the electrosphere) as one 'plate' a dielectric (the atmosphere between the electrosphere and ground) and the other 'plate' which is ground. The electrosphere is highly charged, and there is a potential running through the dielectric which can be as high as 100V/M (I have a picture of a contraption I built to monitor this, which I later changed to produce sounds - See Pics/Electronics TherAsynth Myspace (http://www.myspace.com/therasynth)) - But there is virtually no current (one needs an electrostatic voltmeter to measure anything).. The entire electrosphere, if discharged once instantly (and destroy earths atmosphere in that instant) would have enough power to perhaps blast the Pentagon out of existence, but not much more - despite Tesla's claims that it could be focussed as a weapon to destroy any city on earth)

All electronic equipment, and everything we 'see' (and, I believe, a lot of what we feel - our moods, national disposition etc) is subject to our continuous 'immersion' in this charged dielectric which we breath and permeates every aspect of our being..

To me, the difference between "conventional and the other sort" is that "conventional" is like the water you get from a tap.. "the other
Posted: 5/11/2009 7:50:03 PM
GordonC

From: Croxley Green, Hertfordshire, UK

Joined: 10/5/2005

[i] HAARP[/i]

As the plummeting man said; so far, so good.
Posted: 5/11/2009 9:33:09 PM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

[i]"As the plummeting man said; so far, so good."[/i]

From what I have read, they have hardly even warmed it up yet - probably taken its output to 10% of full power.

And we may be ok - like the H-Bomb.. No one knew for sure whether detonating it would cause a hydrogen chain reaction which would run out of control... We were lucky... Those who believed there was a risk were proved wrong ..

And those who believe that focussed heating of the ionosphere could 'rip' a bloody great hole in it and cause a catastrophic 'leak' of our atmosphere into the vaccuum, might be wrong...

But, if they are right, they will never get credit for being right... and those who are wrong will never stand trial for their arrogant folly..

Because life on earth will have ended. permanently.

So I stand by my statement - those BLOODY ARROGANT FOOLS taking risks with ALL the life on this planet, should be SHOT! NOW!

You must be logged in to post a reply. Please log in or register for a new account.