Looking for help getting the Esource in my simulation working.
I may need help figuring out how to turn on XSPICE too.
From the I have placed an Esource into a schematic for simulation.
I found it in the Simulation_SPICE library.
However when I examine the properties I see no simulation pin or similar information like I see for the current source for example.
When I try to set up the simulation I get the error: Error reading simulation model from symbol ‘E1’
which makes sense because I have found no way to give the E1 such model information.
From the NGSPICE user manual
I expect some way to give this kind of information to the sumulation
E voltage source, G current source
General form:
EXXXX N + N - POLY ( ND ) NC1 + NC1 - ( NC2 + NC2 -...) P0 ( P1 ...)
Example:
ENONLIN 100 101 POLY (2) 3 0 4 0 0.0 13.6 0.2 0.005
Possibly related,
While searching the internet for the ESOURCE I found advise saying I needed to turn on XPICE simulation in KiCAD but no indication how to do so.
While I do not yet have success, I have some insight.
I opened up the Symbol Fields Editor and after examining the PWL source I made guesses at the ESOURCE and filled them in.
Now I can set up the simulation with out the Error reading simulation model from symbol ‘E1’
Now the simulation fails. Perhaps do to an error the way I have entered the data or perhaps because of a deeper problem.
The simulation report with error at the end.
Background thread stopped with timeout = 0
Note: No compatibility mode selected!
Circuit: KiCad schematic
Reducing trtol to 1 for xspice 'A' devices
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Warning: singular matrix: check node 3
Note: Starting dynamic gmin stepping
Trying gmin = 1.0000E-03 Warning: singular matrix: check node 3
Warning: Further gmin increment
Trying gmin = 5.6234E-03 Warning: singular matrix: check node 3
Warning: Further gmin increment
Trying gmin = 8.6596E-03 Warning: singular matrix: check node 3
Warning: Further gmin increment
Trying gmin = 9.6466E-03 Warning: singular matrix: check node 3
Warning: Further gmin increment
Trying gmin = 9.9105E-03 Warning: singular matrix: check node 3
Warning: Further gmin increment
Trying gmin = 9.9775E-03 Warning: Further gmin increment
Trying gmin = 9.9944E-03 Warning: Further gmin increment
Trying gmin = 9.9986E-03 Warning: Further gmin increment
Trying gmin = 9.9996E-03 Warning: Last gmin step failed
Warning: Dynamic gmin stepping failed
Note: Starting true gmin stepping
Trying gmin = 1.0000E-03 Warning: Further gmin increment
Trying gmin = 5.6234E-03 Warning: Further gmin increment
Trying gmin = 8.6596E-03 Warning: Further gmin increment
Trying gmin = 9.6466E-03 Warning: Further gmin increment
Trying gmin = 9.9105E-03 Warning: Further gmin increment
Trying gmin = 9.9775E-03 Warning: Further gmin increment
Trying gmin = 9.9944E-03 Warning: Further gmin increment
Trying gmin = 9.9986E-03 Warning: Further gmin increment
Trying gmin = 9.9996E-03 Warning: Last gmin step failed
Warning: True gmin stepping failed
Note: Starting source stepping
Supplies reduced to 0.0000%
Trying gmin = 1.0000E-02 Warning: gmin step failed
Warning: source stepping failed
Note: Transient op started
Error: Transient op failed, timestep too small
Transient solution failed -
Last Node Voltages
------------------
Node Last Voltage Previous Iter
---- ------------ -------------
tempjacket 0 0
probe_int_tempcfc_r4 0 0
tempcfc 0 0
probe_int_tempjacket_c3 0 0
probe_int_tempjacket_r3 0 0
probe_int_0_c2 0 0
net-_r5-pad1_ 0 0
3 0 0
4 0 0
probe_int_net-_e1-c+__r5 0 0
net-_e1-c+_ 0 0
probe_int_tempcfc_i1 0 0
probe_int_tempjacket_i2 0 0
tempin 0 0
probe_int_0_c1 0 0
probe_int_unconnected-_r2-pad2__r2 0 0
unconnected-_r2-pad2_ 0 0
probe_int_tempin_r1 0 0
r1#branch 0 0
r2#branch 0 0
c1#branch 0 0
i2#branch 0 0
i1#branch 0 0
r5#branch 0 0
v1#branch 0 0
c2#branch 0 0
r3#branch 0 0
c3#branch 0 0
r4#branch 0 0
a$poly$e1#branch_1_0 0 0
No. of Data Rows : 0
doAnalyses: TRAN: Timestep too small; initial timepoint: cause unrecorded.
run simulation(s) aborted
The ESOURCE symbol in Simulation_SPICE is made for the VCVS as described in chapter 4.2.2 of the ngspice manual. It has the input nodes 3 and 4 and the output nodes 1 and 2. Its usage is ugly in Eeschema and not self-explanatory:
Double-click onto the symbol to open the Symbol Properties window. ignore any error message. → Simulation Model… → Built-in SPICE model → Raw Spice Element → Code → 3.
3 is the gain of the output (nodes 1,2) versus the input (nodes 3,4): E1 1 2 3 4 3
It is good engineering practise: if I do not understand a device, I isolate the device and test it, independent from a complex circuit (see the circuit diagram).
XSPICE support is always on in Eeschema/ngspice.
The warning message
Warning: singular matrix: check node 3
is taken to be serious. Your invocation of the E1 has input nodes 3 0 4 0, but these nodes are not connected to any other device in your circuit. A controlling node as 3 (input of the poly E source) cannot be left open.
Which produces this simulation with error in the output: “Warning: singular matrix: check node 3”
I am not sure how to “check node 3” in any further way.
I infer from the error message that the net is now connected and that the problem is related to gmin
Here is the full simulation results.
Background thread stopped with timeout = 0
Note: Compatibility modes selected: ps lt a
Circuit: KiCad schematic
Reducing trtol to 1 for xspice 'A' devices
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Warning: singular matrix: check node 3
Note: Starting dynamic gmin stepping
Trying gmin = 1.0000E-03 Warning: singular matrix: check node 3
Warning: Further gmin increment
Trying gmin = 5.6234E-03 Warning: singular matrix: check node 3
Warning: Further gmin increment
Trying gmin = 8.6596E-03 Warning: singular matrix: check node 3
Warning: Further gmin increment
Trying gmin = 9.6466E-03 Warning: singular matrix: check node 3
Warning: Further gmin increment
Trying gmin = 9.9105E-03 Warning: singular matrix: check node 3
Warning: Further gmin increment
Trying gmin = 9.9775E-03 Warning: Further gmin increment
Trying gmin = 9.9944E-03 Warning: Further gmin increment
Trying gmin = 9.9986E-03 Warning: Further gmin increment
Trying gmin = 9.9996E-03 Warning: Last gmin step failed
Warning: Dynamic gmin stepping failed
Note: Starting true gmin stepping
Trying gmin = 1.0000E-03 Warning: Further gmin increment
Trying gmin = 5.6234E-03 Warning: Further gmin increment
Trying gmin = 8.6596E-03 Warning: Further gmin increment
Trying gmin = 9.6466E-03 Warning: Further gmin increment
Trying gmin = 9.9105E-03 Warning: Further gmin increment
Trying gmin = 9.9775E-03 Warning: Further gmin increment
Trying gmin = 9.9944E-03 Warning: Further gmin increment
Trying gmin = 9.9986E-03 Warning: Further gmin increment
Trying gmin = 9.9996E-03 Warning: Last gmin step failed
Warning: True gmin stepping failed
Note: Starting source stepping
Supplies reduced to 0.0000%
Trying gmin = 1.0000E-02 Warning: gmin step failed
Warning: source stepping failed
Note: Transient op started
Error: Transient op failed, timestep too small
Transient solution failed -
Last Node Voltages
------------------
Node Last Voltage Previous Iter
---- ------------ -------------
tempin 0 0
probe_int_0_c1 0 0
probe_int_tempin_r1 0 0
probe_int_unconnected-_r2-pad2__r2 0 0
unconnected-_r2-pad2_ 0 0
tempjacket 0 0
probe_int_0_c2 0 0
probe_int_tempjacket_i2 0 0
3 0 0
tempcfc 0 0
net-_r5-pad1_ 0 0
probe_int_net-_e1-c+__r5 0 0
net-_e1-c+_ 0 0
probe_int_tempcfc_r4 0 0
probe_int_tempjacket_c3 0 0
probe_int_tempjacket_r3 0 0
probe_int_tempcfc_i1 0 0
i1#branch 0 0
r3#branch 0 0
c3#branch 0 0
r4#branch 0 0
v1#branch 0 0
r5#branch 0 0
i2#branch 0 0
c2#branch 0 0
r2#branch 0 0
r1#branch 0 0
c1#branch 0 0
a$poly$e1#branch_1_0 0 4 *
No. of Data Rows : 0
doAnalyses: TRAN: Timestep too small; initial timepoint: cause unrecorded.
run simulation(s) aborted
I am happy to repeat myself:
The ESOURCE symbol in the Simulation_SPICE library is made for the Exxxx VCVS source as described in chapter 4.2.2 of the manual.
Poly sources are not supported by this symbol. Probably they may be invoked by a subcircuit.
states (according to the ngspice manual) that there is one controlling source, whose nodes are directly following the POLY (1) statement. This node pair is 3 0 in your example. However node 3 is not connected to any net in your circuit. Thus you will get this simulation error. This kind of statement (POLY) is simpy not supported by Eeschema, and you have to act by editing it manually.
3 0 has to be replaced by suitable net names from your circuit. 4 0 has to be deleted, as POLY(1) defines only a single controlling source.
.options RSHUNT ... will add a resistor from node 3 to ground, the simulation runs with control voltage 0.