PySpice
PySpice copied to clipboard
How to pass parameter in a subcircuit and received in subcircui
I want to initialize voltage across capacitor with a parameter in a subcircuit during SubCircuitElement creation. I simulated my subcircuit in pyspice. Below is netlist and error.
NETLIST:-------------------------
.title memristor in PySpice .subckt memristor TE BE x .ic V(x)=x0 Cx x 0 1 Gx 0 x TE BE 1 Bb1 b 0 v={(1e-6+180e-6*V(TE,BE))*V(x,0)} Gmem TE BE b 0 1 .ends memristor X1 TE BE x memristor x0=0.01V Vinput TE 0 DC 0V AC 1V SIN(0V 1V 1Hz 0s 0Hz) R1 BE 0 0.1Ohm .options TEMP = 25C .options TNOM = 25C .end
ERROR:------------------------
2021-10-04 17:09:32,548 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Original line no.: 9, new internal line no.: 11: 2021-10-04 17:09:32,548 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Mismatch: 0 formal but 1 actual params. 2021-10-04 17:09:32,548 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Original line no.: 0, new internal line no.: 4: 2021-10-04 17:09:32,548 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Undefined number [x0] 2021-10-04 17:09:32,549 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Original line no.: 0, new internal line no.: 4: 2021-10-04 17:09:32,549 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Cannot compute substitute
‘x0’ is parameter value
Any one please Suggest any idea or give example. Thank you.