I was wondering if I could get some help to find out how the PieceWiseLinearVoltageSource implementation in PySpice works, as from what I was able to find about it, I am not able to get it successfully running, as I clearly do something wrong in how I use it and sadly there is not really documentation on the PySpice webpage.
I tried: circuit.PieceWiseLinearVoltageSource(1, '1', '0',values=[(0, 0), (10@u_ms, 0), (11@u_ms, 5@u_V), (20@u_ms, 5@u_V)],)
But that doesn't work.
From the website there this: PieceWiseLinearVoltageSource( circuit, 'pwl1', '1', '0', values=[(0, 0), (10@u_ms, 0), (11@u_ms, 5@u_V), (20@u_ms, 5@u_V)], )
So, how would I integrate this into a simulation?
Thank you ahead for any answer!
circuit = Circuit('Complete Circuit Diagram')
circuit.PieceWiseLinearVoltageSource(1, '1', '0',values=[(0, 0), (10@u_ms, 0), (11@u_ms, 5@u_V), (20@u_ms, 5@u_V)],)
circuit.R('Sh1', 'in', out, 10000@u_Ω)
circuit.C(1, 'in', circuit.gnd, 10@u_nF)
NameError: name 'PieceWiseLinearVoltageSource' is not defined
The error could be because you might need to use a string for the name of the voltage source (first identifier). Also specifying the units of all seconds and voltages could help:
circuit.PieceWiseLinearVoltageSource('pwlvs1', '1', '0', values=[(0@u.s, 0@u.V), (10@u.ms, 0@u.V), (11@u.ms, 5@u.V), (20@u.ms, 5@u.V)])