I am using qucs-s with ngspice.
I am trying to analyse a circuit's transient startup behaviour, like peak supply current surges before the feedback control is working properly, etc. This analysis is working satisfactory, if the transient simulation is included and the initial DC operating point analysis is turned off. I get stable behaviour after 1-2 seconds.
I have two problems.
qucs-s has a function called "Calculate DC bias", which is doing the nigspice operating point analysis.
This function does not converge to the known long term stable operating point.
Second problem is that the AC simulation does not show a reasonable response, I assume this is becuause the operating point is not established properly before the analysis.
It seems that the .op analysis finds some intermediate convergence point much too early and stops.
qucs-s has an optional file for ngspice parameters, where I can put .op and .option statements.
My question is the following:
How should a .op line be composed to force the operating point simulation to run for a longer time, e.g. 1-2 seconds?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Second problem is that the AC simulation does not show a reasonable response,
I assume this is becuause the operating point is not established properly before the
analysis.
Does your circuit have a conventional single OP (fixed node voltages and branch currents), or does it have a Periodical Steady State (like an oscillator, switching circuit, or state machine)?
I think you are saying your circuit has a PSS, and that after reaching the PSS you want to turn something on (feed-back?) to disrupt that state and study the results. If so, then don't do a .OP. Use a .TRAN instead, and enable the feedback signals after a startup time (using an analog switch and some logic, or with a behavioral source).
Note that a circuit with a PSS can not (usefully) be studied with a .AC analysis -- you will have to instrument it to find its Jacobian, or go for the FFT of its impulse response.
-marcel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am sorry, since I am a qucs-s (are you familiar with it?) user I have not worked with explicit ngspice directives, most of the action is behind the scenes for me. The only "access" I have is a text file for "extra simulator parameters". qucs-s is quite robust, it gives more often useful results compared to e.g. KiCad PCB disgn circuit simulation. It is unclear why, both are using ngspice as the simulation engine. Maybe qucs-s is more adaptive. But as I said, this is behind the scenes for me.
I would assume that extra parameters file would contain things such as
.op
.options ....
etc.
I can verify that the simulator reads and is trying to this file, my sim log file reports changes.
Ok.
As expected, we have a terminology problem as a starter. I am sorry to be a nuisance here.
OP means Operational amplifier? I have a quad TL04.
PSS? Anything to do with power supply?
I order to see the whole chain of events I am inlcuding a 50Hz 18V AC voltage with a bridge rectifier and capacitors, feeding a 78L12 and 79L12 regulator pair, finally feeding the TL084's. and the rest of the circuit.
The transient simulation works fine, I can see the cap voltages ramping up and the regulators coming to life, and what the rest of the circuit is doing.
The qucs-s function "DC Bias" normally gives a full overview of voltages at each node in the schematic, which is very useful. This is what i do not get. Or, I get useless values.
I understand that it may not be possible (or easy) to do an AC analysis when the transient setup is used, I can live with that. I can make a different setup without the power supply circuit to do the AC analysis.
The operating point however, would be very useful to have.
I have read section 15.3.5 but I cannot get much out of it, reading is not understanding, unfortunately.
Last edit: Bengt Nilsson 2024-05-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You cannot extract a dc operating point from an ac power supply. And if you do not have a dc operating point, you cannot start an ac simulation.
To obtain the dc operating point or do an ac simulation of your circuit, temporarily remove the ac source, the bridge rectifier and the capacitors, and replace them by appropriate dc voltage sources.
The other option indeed is using optran, with parameters modified according to the timing of the circuit, and then start tran or ac simulation.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for misunderstanding your questions (OP is "operating point", PSS is "periodic steady state").
Apart from all the good advice from Holger, for a very quick result that may be adequate for your purposes, replace the "50Hz 18V AC voltage source" by a 25.5V DC voltage source. Qucs should then give you a useful "DC bias" and .AC analysis.
A transient ( .TRAN ) analysis is only necessary when load or input changes dynamically over a large range, or if your buffer capacitors are very small. If they're ok, the other analyses should give equivalent results much quicker.
-marcel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please have a look at chapter 15.3.5 .OP: Operating Point Analysis of the ngspice manual for the available variants. Options for improving convergence behaviour are named in chapter 15.1.2 OP and DC Solution Options.
The .op line does not recognize any parameters.
Of interest may be the optran command (use tran simulation until a specified time and use the results as the operating point for another tran or ac sim). The default setting is given in example 2. It may be overriden by anoptran command in .spiceinit.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for the information that .op does not take parameters. I did not understand this.
I did read the .OP section in the manual.
How should the .op section look like when using optran?
.op optran 0 0 0 1u 1000m 0
giver me no syntax error, but not the result that I want.
To me, it looks like .op indeed takes the optran line as a parameter in this case?
I have to admit I have not studied the complete manual.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, thanks. I will have to find where qucs-s handles .spiceinit.
Is it possible to say how optran (which parameters) should be used to do what I want, once it is entered properly in .spiceinit?
Would the optran example 1 described in the manual do the job?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What is the time constant of your circuit? How long will it take to charge the capacitors of your power supply? I can imagine that optran 0 0 0 0.1m 100m 0 is a good starting point.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As I mentioned, my circuit has some startup behaviour that I want to improve.
It is stable after 2 seconds, and I would like the .op to run to this point for my convenience. optran 0 0 0 0.1m 2000m 0did not produce the result that I wanted.
But I now realise that my "realistic" and naive sceme to include a AC source and a diode rectifier will NEVER reach a stable point and this is maybe why it will not work. I should instead try to arrange a DC source with a similar rise time.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am using qucs-s with ngspice.
I am trying to analyse a circuit's transient startup behaviour, like peak supply current surges before the feedback control is working properly, etc. This analysis is working satisfactory, if the transient simulation is included and the initial DC operating point analysis is turned off. I get stable behaviour after 1-2 seconds.
I have two problems.
qucs-s has a function called "Calculate DC bias", which is doing the nigspice operating point analysis.
This function does not converge to the known long term stable operating point.
Second problem is that the AC simulation does not show a reasonable response, I assume this is becuause the operating point is not established properly before the analysis.
It seems that the .op analysis finds some intermediate convergence point much too early and stops.
qucs-s has an optional file for ngspice parameters, where I can put .op and .option statements.
My question is the following:
How should a .op line be composed to force the operating point simulation to run for a longer time, e.g. 1-2 seconds?
Does your circuit have a conventional single OP (fixed node voltages and branch currents), or does it have a Periodical Steady State (like an oscillator, switching circuit, or state machine)?
I think you are saying your circuit has a PSS, and that after reaching the PSS you want to turn something on (feed-back?) to disrupt that state and study the results. If so, then don't do a .OP. Use a .TRAN instead, and enable the feedback signals after a startup time (using an analog switch and some logic, or with a behavioral source).
Note that a circuit with a PSS can not (usefully) be studied with a .AC analysis -- you will have to instrument it to find its Jacobian, or go for the FFT of its impulse response.
-marcel
I am sorry, since I am a qucs-s (are you familiar with it?) user I have not worked with explicit ngspice directives, most of the action is behind the scenes for me. The only "access" I have is a text file for "extra simulator parameters". qucs-s is quite robust, it gives more often useful results compared to e.g. KiCad PCB disgn circuit simulation. It is unclear why, both are using ngspice as the simulation engine. Maybe qucs-s is more adaptive. But as I said, this is behind the scenes for me.
I would assume that extra parameters file would contain things such as
.op
.options ....
etc.
I can verify that the simulator reads and is trying to this file, my sim log file reports changes.
Ok.
As expected, we have a terminology problem as a starter. I am sorry to be a nuisance here.
OP means Operational amplifier? I have a quad TL04.
PSS? Anything to do with power supply?
I order to see the whole chain of events I am inlcuding a 50Hz 18V AC voltage with a bridge rectifier and capacitors, feeding a 78L12 and 79L12 regulator pair, finally feeding the TL084's. and the rest of the circuit.
The transient simulation works fine, I can see the cap voltages ramping up and the regulators coming to life, and what the rest of the circuit is doing.
The qucs-s function "DC Bias" normally gives a full overview of voltages at each node in the schematic, which is very useful. This is what i do not get. Or, I get useless values.
I understand that it may not be possible (or easy) to do an AC analysis when the transient setup is used, I can live with that. I can make a different setup without the power supply circuit to do the AC analysis.
The operating point however, would be very useful to have.
I have read section 15.3.5 but I cannot get much out of it, reading is not understanding, unfortunately.
Last edit: Bengt Nilsson 2024-05-26
This seems to be a more basic problem.
You cannot extract a dc operating point from an ac power supply. And if you do not have a dc operating point, you cannot start an ac simulation.
To obtain the dc operating point or do an ac simulation of your circuit, temporarily remove the ac source, the bridge rectifier and the capacitors, and replace them by appropriate dc voltage sources.
The other option indeed is using
optran
, with parameters modified according to the timing of the circuit, and then start tran or ac simulation.Sorry for misunderstanding your questions (OP is "operating point", PSS is "periodic steady state").
Apart from all the good advice from Holger, for a very quick result that may be adequate for your purposes, replace the "50Hz 18V AC voltage source" by a 25.5V DC voltage source. Qucs should then give you a useful "DC bias" and .AC analysis.
A transient ( .TRAN ) analysis is only necessary when load or input changes dynamically over a large range, or if your buffer capacitors are very small. If they're ok, the other analyses should give equivalent results much quicker.
-marcel
Please have a look at chapter
15.3.5 .OP: Operating Point Analysis
of the ngspice manual for the available variants. Options for improving convergence behaviour are named in chapter15.1.2 OP and DC Solution Options
.The
.op
line does not recognize any parameters.Of interest may be the
optran
command (use tran simulation until a specified time and use the results as the operating point for another tran or ac sim). The default setting is given in example 2. It may be overriden by anoptran
command in.spiceinit
.Thank you for the information that .op does not take parameters. I did not understand this.
I did read the .OP section in the manual.
How should the .op section look like when using optran?
.op optran 0 0 0 1u 1000m 0
giver me no syntax error, but not the result that I want.
To me, it looks like .op indeed takes the optran line as a parameter in this case?
I have to admit I have not studied the complete manual.
The
.op
line in ngspice does not recognize any parameters.The optran command has to be set in a file called
.spiceinit
(see ngspice manual16.6 User defined configuration file .spiceinit
).I am not familiar with Qucs-S and its is handling of the interface to ngspice.
Ok, thanks. I will have to find where qucs-s handles .spiceinit.
Is it possible to say how optran (which parameters) should be used to do what I want, once it is entered properly in .spiceinit?
Would the optran example 1 described in the manual do the job?
What is the time constant of your circuit? How long will it take to charge the capacitors of your power supply? I can imagine that
optran 0 0 0 0.1m 100m 0
is a good starting point.As I mentioned, my circuit has some startup behaviour that I want to improve.
It is stable after 2 seconds, and I would like the .op to run to this point for my convenience.
optran 0 0 0 0.1m 2000m 0
did not produce the result that I wanted.But I now realise that my "realistic" and naive sceme to include a AC source and a diode rectifier will NEVER reach a stable point and this is maybe why it will not work. I should instead try to arrange a DC source with a similar rise time.