1

I have been attempting to model the following circuit using KVL and Simulinks:

enter image description here

Applying KVL generated these coupled differential equations:

$$ 0 = -V + \frac{q_1}{c_1} + R ( \frac{dq_1}{dt} - \frac{dq_2}{dt} ) $$

$$ 0 = -R ( \frac{dq_1}{dt} - \frac{dq_2}{dt} ) + L \frac{d^2q_2}{dt^2} + \frac{q_2}{c_2} $$

Rearranging,

$$ \frac{dq_1}{dt} = \frac{V- \frac{q_1}{c_1}}{R} + \frac{dq_2}{dt} $$

$$ \frac{d^2q_2}{dt^2} = \frac{R ( \frac{dq_1}{dt} - \frac{dq_2}{dt} ) - \frac{q_2}{c_2}}{L} $$

From here it seems straightforward to implement these equations using block diagrams in Simulink:

enter image description here

However the output is oscillatory in the extreme and requires very small step sizes to even resolve for values of V=12, R=100, C1=1e-6, C2=1e-6, L=1e-6.

enter image description here

I've played with other values for V, L, and C1/2, and am met with varying amplitudes of the oscillation, but the output loop currents never settle in the way that I believe they should.

An LTSpice simulation of the circuit shows:

enter image description here

enter image description here

Which shows the inductor voltage ringing before settling to zero. This does not occur in Simulink, and I think this is why: the step size is too large, and thus the oscillation tricks Simulinks into performing non-representative arithmetic.

When I reduce the step size (and zoom in on the transient behavior):

enter image description here

enter image description here

This is still extremely oscillatory. Is my intuition that this shouldn't happen correct? Is Simulink simply not a good tool for this kind of problem?

FawltyPlay
  • 11
  • 2
  • Have you set the maximum time step size in the Simulink model parameters? Can you post a screenshot of that dialog also? – AJN Feb 08 '22 at 01:57
  • @AJN I've updated the question with an image of what happens when the step size is set to auto. For the last graph I set the step size to fixed 0.00000001 with the auto solver. – FawltyPlay Feb 08 '22 at 09:04
  • Have you tried comparing both to the theoretical solution ? – AJN Feb 08 '22 at 14:26

0 Answers0