Hello everyone, another problem with the simulation. I would like to simulate switching a switch to see the phase change on a circuit with an OPAMP. I have defined a sinusoidal input generator at 1Khz and 50mV signal V1. On the negative input of the OPAmp I want to simulate the grounding via the SW1 here is the diagram:
Eeschema sends vsw1 sw vm cmd vm switch
to ngspice.
This is wrong because the first letter v tell ngspice to add a voltage source (instead of a switch). The correct line would be sw1 sw vm cmd vm switch
(without the leading v). A reason might be the switch symbol selected. It looks like a manually actuated switch, not a relay (electrically driven switch like the ngspice ones).
I have made my own generic relay symbol for this purpose. At least you should try the following: Double click on the switch symbol. There is an entry in the line ‘Reference’. Change it to Sw.
Hello holger and thanks for the suggestion, unfortunately there is no relay on my diagram, SW1 is a double switch named SW1. Are you saying it would be better to replace it with a relay? The coil on the V2 pulse generator?
Yes, because you want to have a voltage controlled switch (aka a relay), not a manually actuated double pole single throw switch. But still you have to take care that the Reference name of the new symbol starts with an S (not a V, not a K …).
As ngspice says, there is no model.
You have to add:
.model ADW11 SW (Ron=1m Roff=1G Vt=2.5 )
and you have to change the node sequence:
Double click onto the symbol->Edit Spice Model->Check box ‘alternate node sequence’-> add node sequence
3 5 1 6
into the text field right to the box.
If this does not work, please post your *sch file.
KiCAD 5.1.9 does not accept a switch as a standard model. Therefore the assignment of an alternate node sequence has not been successful. The simulation runs, but due to wrong nodes in the switch (as one can see by having a look at the nespice Netlist) is not o.k.
The only way is to define a subcircuit model which contains the switch. This model then has to be assigned to the switch symbol. I will make a suggestion by tomorrow.
Hello Holger thank you for your help.
I understand the principle better now.
It is therefore necessary to define a sub-circuit (quadric-pole here) via the relay S1 with the parameters as well as the Alternate node sequence:
Hello Holger, I would like to thank you for your support on the spice simulation.
I think that this artifice must be exploitable for other configurations of simulations (probably !).
Although the documentation is complete and downloadable here: http://ngspice.sourceforge.net/docs.html
It is nevertheless quite difficult to understand, the examples remain sufficient but rudimentary.