Is it at all possible to run the simple phase-shift oscillator shown in sosc.plecs? Once the oscillation starts, the diodepair damps the gain slightly. The circuit works in SPICE, but also in at least one other PWL-based simulator. The picture shows the SPICE prototype on the right (with an emitter follower instead of an opamp).
In PLECS there is no convergence. If I decrease the timestep to below 1ns, the simulator crashes and has to be killed with task manager.
sosc.plecs (14.7 KB)
I suspect that the operation of your Op-Amp circuit depends on the internal supply voltage of the operational amplifier. The Op-Amp block from the PLECS components library, however, does not have any limits, and so the output voltage will just increase indefinitely.
Try the Op-Amp with Limited Output instead.
> Try the Op-Amp with Limited Output instead.
Yes, then it oscillates… but delivers a square wave. VM2 is a 10V square wave too: it appears the clipping network with R6 and the two diodes does nothing. Putting a resistor of 1000 Ohms between the opamp output and the feedback network (C1||C2||C3) decreases the amplitude of VM2, but it never becomes a sine shape (as it does in SPICE when I replace the BJT with an ideal opamp and the 1N914 diodes with a PWL diode model (500mV Vfwd, 100 Ohm Ron).
I guess I should not expect these analog non-linear circuits to work in PLECS.
[edit: added d_ideal2.sub and sosc2.sp for the SPICE limiter]
sosc.plecs (15.2 KB)
d_ideal2.sub (353 Bytes)
sosc2.sp (438 Bytes)
It is hard to discuss about screenshots. Here are two obvious differences:
The resistor R7 in your SPICE schematic has a value of 130kΩ - the corresponding resistor in your PLECS model (called R6) has a value of 10kΩ.You write that your SPICE model uses diodes with a forward voltage of 500mV - the diodes in your PLECS model have a forward voltage of 1V.Besides, it is not clear to me that the Op-Amp circuit in your PLECS schematic is really equivalent to the controlled voltage source in your SPICE schematic. (Did you know that PLECS also has a controlled voltage source?)
> It is hard to discuss about screenshots.
You did not see the attached sosc.plecs? I changed values in the SPICE circuit to try and make it not work (unsuccessful) and left the latest values, sorry.
Thank you for mentioning the controlled voltage source, I had not found it yet. With the controlled source, PLECS gets results that are much nearer those of SPICE: 4Vpp vs 1.6Vpp, h2 = -78dB vs -45dB.
I also checked SPICE with an (ideal) opamp (with limited output) and that doesn’t work at all – it behaves more or less the same as PLECS does.
> You did not see the attached sosc.plecs?
I did, and I noticed the differences that I mentioned above. But I am lacking the SPICE model that you use as reference and therefore cannot judge whether your PLECS model is truly equivalent. A screenshot of your SPICE schematic is not sufficient for this.
In the file “sosc2.sp” that you subsequently added to your comment above your diodes have Ron=10Ω and Vfwd=1V, which is again different from your written description.
I am attaching the corresponding PLECS model. It produces very similar results compared to an LTspice simulation of your schematic: 4.2Vpp and 46.5kHz in PLECS compared to 4.1Vpp and 46.2kHz in LTspice.
sosc2.plecs (14.3 KB)
I am really sorry for not providing the exact information right away. Let me say that Plecs technical support is really phenomenal, and thank you for your patience!
The last model you provided shows the right amplitude, and there is visually some distortion (which is an unexpectedly good result that I did not dare expect).
As an FFT can be done while simulating, THD while simulating should also be possible but I couldn’t find it (base-frequency must be supplied which in this case is a bit cumbersome). Any hints?