I reached the maximum number of calculations when using DSolve to calculate differential equations, which makes it impossible to fully solve. How can I expand the number of calculations of DSolve?
Here is my code:
system = {vi q[t] == l iL'[t] + vC[t],
vC'[t] == iL[t]/c - vC[t]/(r c), vC[0] == 0, iL[0] == 0};
control = {q[0] == 1,
WhenEvent[Mod[t, \[Tau]] == (2/3) \[Tau], q[t] -> 0],
WhenEvent[Mod[t, \[Tau]] == 0, q[t] -> 1]};
pars = {vi -> 24, r -> 22, l -> 2 10^-2,
c -> 1 10^-4, \[Tau] -> 2.5 10^-5};
sol = DSolve[{system, control} /. pars, {vC, iL, q}, {t, 0, .2},
DiscreteVariables -> q];
a = Evaluate[iL[t] /. sol];
b = Evaluate[vC[t] /. sol];
Plot[a, {t, 0, 0.2}, AxesLabel -> {"s", "il[t]/A"},
PlotLegends -> {"LinearlyImplicitEuler"}, PlotStyle -> {Red},
PlotRange -> All]
Plot[b, {t, 0, 0.2}, AxesLabel -> {"s", "vc[t]/V"},
PlotLegends -> {"LinearlyImplicitEuler"}, PlotStyle -> {Blue},
PlotRange -> All]