I have a circuit with a pulsed voltage source connected across a resistor and inductor that are in series:
The solution by LTSpice gives:
Potential difference across the inductor:
Now I solve this problem for current and potential difference of L1 in Mathematica 11.3:
ClearAll["Global`*"]
(*inductance*) l1 = 0.001;
(*resistance*) r1 = 3;
(*pulsed voltage 1*) vUp = 24;
(*pulsed voltage 0*) vDown = 0;
(*voltage source definition*)
v1[t_] :=
Piecewise[{{vUp, 0.001 <= t <= 0.011}, {vUp, 0.013 <= t <= 0.023}},
vDown];
(*ImageSize in plots*) imgSize = 350;
(*Model time*) time = 0.025;
eq1 = v1[t] == i[t]*r1 + l1*i'[t];
ic1 = i[0] == 0;
sol = NDSolveValue[{eq1, ic1}, i, {t, 0, time}];
p1 = Plot[v1[t], {t, 0, time},
PlotRange -> All,
PlotPoints -> 200,
AxesOrigin -> {0, 0},
Frame -> True,
GridLines -> Automatic,
GridLinesStyle -> LightGray,
PlotLabel -> "Applied potential difference",
PlotStyle -> Thick,
Exclusions ->
None (*for connection of piecewise function v1 in step up/down*),
ImageSize -> imgSize
];
p2 = Plot[sol[t], {t, 0, time},
PlotRange -> All,
PlotPoints -> 200,
AxesOrigin -> {0, 0},
Frame -> True,
GridLines -> Automatic,
GridLinesStyle -> LightGray,
PlotLabel -> "Current through resistor r1 and inductor l1",
PlotStyle -> Thick,
ImageSize -> imgSize
];
p3 = Plot[sol'[t]*l1, {t, 0, time},
PlotRange -> All,
PlotPoints -> 300,
AxesOrigin -> {0, 0},
Frame -> True,
GridLines -> Automatic,
GridLinesStyle -> LightGray,
PlotLabel -> "Potential difference across inductor l1",
PlotStyle -> Thick,
Exclusions -> None,
ImageSize -> imgSize
];
Grid[{{p2, p1}, {p3}}, Frame -> True]
The solution by Mathematica corresponds to what I have in LTSpice (so I can assume that my model functions well):
Now let's switch resistance of the resistor R1 to 1.0 Ohm
(*resistance*) r1 = 1;
This results in current ramping up to 24 amps:
However, my real power supply can provide only up to 10 amps. How to do I properly setup a current limit in this model?