I’m trying to simulate a simple inverting op amp amplifier with the subcircuit description
for the ua741 from the pspice evaluation library. I have added a file .spiceinit with the line set ngbehavior=ps to my home directory. When simulating the circuit I see the bias voltage at the out node is around 80mV which is normal for this circuit, however I don’t get the expected results from the ac-analysis, when using add signals and clicking at v(/out) I get the following error messages:
Error: vector frequency not found!
Error: vector frequency not found!
I have attached the kicad-files and the subcircuit description file.
I am using KiCAD version 5.1.5-52549c5~84~ubuntu18.04.1, release build invamp.zip (4.7 KB)
The simulation sequence is:
grabbing the data from ngspice by calling the eeschema plot data
However after op simulation you are in a different ngspice plot. op1 has become the current plot. The ac data are still available, but are no longer in the current plot, and thus are not accessible by eeschema.
You either have to switch back to the ac plot by setplot ac1
before creating the eeschema plot, or set the variable keepopinfo by option keepopinfo
before simulating the ac. Then there is no need for an extra op step. This option will automatically keep the op data in its own plot, so before printing these data you have to switch to this op1 plot by setplot op1
However, a reliable ‘before the ac simulation’ is not possible from within a .control section. So this statement should go into .spiceinit.
Please note the different notions of the word ‘plot’ (see the ngspice manual).
You van figure out what plots are available by giving setplot
without parameters. And you can show the available vectors of the current plot by giving display
Thanks a lot for taking the time to look into my problem. Even though I do understand the order of simulations and the fact whether a plot is active or not determines the result, I’m still not able to achieve my goal:
1.Run the simulation and 2. see both the op-information printed on screen and have the ac-waveforms available. Could you show me how I should adjust my control-section to accomplish this? (I have been trying out all kinds of permutations of your suggestions but to no avail, I always get either the waveforms or the op printed, but not both) Maybe I have to add an extra text-line command in the schematic? Can it be done without adding a .spiceinit file?
I’m also still wondering why the bias point is not printed by default when you do an AC-analysis, that was also how it was in Spice 2g6 and it also is done when doing a transient analysis in Ngspice. After all when an AC-analysis does not give the expected result, the first thing you do is check the bias point.
Another thing that puzzles me: with the setplot command I can indeed see which plots are available. It seems every single plot made is kept which makes it difficult to select the latest one by a unique name as the names-number increases every time you rerun a simulation.
Thanks in advance for having patience with me
The latest (current) plot is available in a variable named curplot. You have a look at it by command echo $curplot
You may also use its contents in a script, as any other variable.
If you do a simulation of a larger circuit (or with a complex OpAmp model etc.) the op printout would cover several pages. So it is availablle on request only.
Transient analysis delivers the first tran iteration point, which is often similar to the op, but is the first data point in plot tran1. There is a command option noinit
that suppresses the lengthy output, and I set this routinely in .spiceinit.
The .control sequence may look like this (not tested with the ac simulation, I have no KiCad here on-site):
An alternative (again not tested) may be
The ac plot via Eeschema then has to be initiated manually, as usual.
I think it would be more consistent to show the bias point (necessary to start an AC-analysis) by default and give the user the chance to suppress it by the option noinit in .spiceinit. That way it would be consistent with the behavior for the transient analysis and it also would avoid the problem which I ran into and which made me start this thread.
B.t.w. I use Spice mostly for small circuits and my bias points rarely take more than one page.