below is the exscript from https://github.com/GProtoZeroW/skidl/blob/master/skidl/libs/skidl_2_pyspice_check.ipynb where I tried to create coupled inductors in skidl but couldn’t figure it out. Was able to create them in pyspice.
K | Coupled (Mutual) Inductors
PySpice/PySpice/Spice/BasicElement.py; class CoupledInductor(AnyPinElement)
skidl/skidl/libs/pyspice_sklib.py; name=“K”
ngspice 3.2.11 Coupled (Mutual) Inductors:
KXXXXXXX LYYYYYYY LZZZZZZZ value
Notes
- need to get Dave’s help on using K inside skidl
- the inductors must already exist for pyspice to work
reset()
net_1=Net('N1'); net_2=Net('N2')
skidl_L1=L(ref='1', value=5, m=5, temp=5, dtemp=5, ic=5); skidl_L1['p', 'n']+=net_1, net_2
skidl_L2=L(ref='2', value=5, m=5, temp=5, dtemp=5, ic=5); skidl_L2['p', 'n']+=net_1, net_2
#need to find out how to use this
#skidl_K=K()
skidl_circ=generate_netlist()
print(skidl_circ)
No errors or warnings found during netlist generation.
.title L1 N1 N2 5 dtemp=5 ic=5 m=5 temp=5 L2 N1 N2 5 dtemp=5 ic=5 m=5 temp=5
pyspice_circ=Circuit('')
#inductors need to exsist to then be coupled
pyspice_circ.L('1', 'N1', 'N2', 5, m=5, temp=5, dtemp=5, ic=5)
pyspice_circ.L('2', 'N1', 'N2', 5, m=5, temp=5, dtemp=5, ic=5)
pyspice_circ.K('1', 'L1', 'L2', coupling_factor=5)
print(pyspice_circ)
.title L1 N1 N2 5 dtemp=5 ic=5 m=5 temp=5 L2 N1 N2 5 dtemp=5 ic=5 m=5 temp=5 K1 L1 L2 5