sharpie7 / circuitjs1

Electronic Circuit Simulator in the Browser
GNU General Public License v2.0
2.29k stars 633 forks source link

Bug- Analog Reciprocal circuit missing #627

Closed carpetbugs closed 3 years ago

carpetbugs commented 3 years ago

Hi,

I have noticed that the Analog Reciprocal example circuit is not present in the latest version of the simulator on http://www.falstad.com/circuit/ but it does seem to currently exist on http://lushprojects.com/circuitjs/ .

pfalstad commented 3 years ago

Apparently it's not a realistic circuit; it doesn't work in spice. So I took it out.

ormaaj commented 3 years ago

I think that was based on my comment. The analog reciprocal example was dependant on realistic small-signal behaviour so I tested using extremely low betas, as the default "20m" is still an extremely high value. What I didn't realize at the time is that the "simulate body diode" option is really dumb and (I think) it basically just inserts the "default diode" model in parallel with the mosfet without scaling. The default diode has an extremely unrealistic reverse leakage (for an ordinary small signal planar CMOS process) which dominates at low beta making my test invalidish.

So "not a realistic circuit"... meh kind of a matter of perspective. The mosfet model is unrealistic, but if you want realism then you absolutely must have realistic capacitances too, which requires dealing with parallel capacitors, another issue.

pfalstad commented 3 years ago

I think the bigger problem with the circuit is that I suspect someone came up with it on their own when playing with the simulator. I couldn't find it anywhere else. I want the example circuits to be based on real circuits people use.

20m is high? I had someone else complain that it was too low! We decided that 20m was a good value for signal MOSFETs, but for power MOSFETs, it should be 80 (no m).

I should really replace the "simulate body diode" thing using a model from spice. But all the mosfets in the analog reciprocal circuit have that option turned off, and it wouldn't apply even if it were on, so I'm not sure how that's relevant.