Hi,
I suspect that this is a numerical issue related to the If function. If you plot the DutyCycle function with your parameters over time you get:
Plot[DutyCycle[Td, Ts, t], {t, -nc Ts, nc Ts}]
As
$t$ changes from negative to positive the vector field changes.
Manipulate[VectorPlot[Evaluate[{-((Rs (1 - st1) + (Rd st1))/L) iL - st1/L vc + (E1 - (st1 Vf))/L /. {R -> 10, L -> 0.2 10^-3, C1 -> 0.2 10^-3, t -> d}, st1/C1 iL - 1/(R C1) vc} /. {R -> 10, L -> 0.2 10^-3, C1 -> 0.2 10^-3, t -> d}], {iL, 0, 16}, {vc, 28, 30}], {d, -0.1 nc Ts, 0.1 nc Ts}]
If you plot the trajectory in the phase plane (the initial point is marked by a red dot)
DutyCycle[d_, Ts_, t_] := If[0 <= Mod[t, Ts] <= d Ts, 1, 0];
E1 = 16;
Vf = 0.8;
Ts = 100 10^-6;
Td = 0.25;
Rs = 0.001;
Rd = 0.001;
iL0 = 3;
vc0 = 30;
nruns = 5;
nc = 2;
st1 = DutyCycle[Td, Ts, t];
Eqns1 = {iL'[t] == -((Rs (1 - st1) + (Rd st1))/L) iL[t] -
st1/L vc[t] + (E1 - (st1 Vf))/L,
vc'[t] == st1/C1 iL[t] - 1/(R C1) vc[t], iL[0] == iL0,
vc[0] == vc0} /. {R -> 10, L -> 0.2 10^-3, C1 -> 0.2 10^-3};
Do[sol[i] = NDSolve[Eqns1, {iL[t], vc[t]}, {t, 0, nc Ts}], {i, nruns}];
GraphicsRow[{ParametricPlot[{Table[{vc[t], iL[t]} /. sol[i], {i,
nruns}]}, {t, 0, nc Ts}, AspectRatio -> 1, ImageSize -> Medium,
Epilog -> {Red, PointSize[Large], Point[{vc0, iL0}]}],
Plot[{Table[vc[t] /. sol[i], {i, nruns}]}, {t, 0, nc Ts},
PlotPoints -> 40, ImageSize -> Medium]}]
you get
If you start anywhere near (but numerically close to) time zero, you only obtain one solution. So
DutyCycle[d_, Ts_, t_] := If[0 <= Mod[t, Ts] <= d Ts, 1, 0];
E1 = 16;
Vf = 0.8;
Ts = 100 10^-6;
Td = 0.25;
Rs = 0.001;
Rd = 0.001;
iL0 = 3;
vc0 = 30;
nruns = 5;
nc = 2;
st1 = DutyCycle[Td, Ts, t];
Eqns1 = {iL'[t] == -((Rs (1 - st1) + (Rd st1))/L) iL[t] -
st1/L vc[t] + (E1 - (st1 Vf))/L,
vc'[t] == st1/C1 iL[t] - 1/(R C1) vc[t], iL[10^-10] == iL0,
vc[10^-10] == vc0} /. {R -> 10, L -> 0.2 10^-3, C1 -> 0.2 10^-3};
Do[sol[i] = NDSolve[Eqns1, {iL[t], vc[t]}, {t, 10^-10, nc Ts}], {i,
nruns}];
GraphicsRow[{ParametricPlot[{Table[{vc[t], iL[t]} /. sol[i], {i,
nruns}]}, {t, 0, nc Ts}, AspectRatio -> 1],
Plot[{Table[vc[t] /. sol[i], {i, nruns}]}, {t, 0, nc Ts},
PlotPoints -> 40]}]
and
DutyCycle[d_, Ts_, t_] := If[0 <= Mod[t, Ts] <= d Ts, 1, 0];
E1 = 16;
Vf = 0.8;
Ts = 100 10^-6;
Td = 0.25;
Rs = 0.001;
Rd = 0.001;
iL0 = 3;
vc0 = 30;
nruns = 5;
nc = 2;
st1 = DutyCycle[Td, Ts, t];
Eqns1 = {iL'[t] == -((Rs (1 - st1) + (Rd st1))/L) iL[t] -
st1/L vc[t] + (E1 - (st1 Vf))/L,
vc'[t] == st1/C1 iL[t] - 1/(R C1) vc[t], iL[-10^-10] == iL0,
vc[-10^-10] == vc0} /. {R -> 10, L -> 0.2 10^-3,
C1 -> 0.2 10^-3};
Do[sol[i] = NDSolve[Eqns1, {iL[t], vc[t]}, {t, -10^-10, nc Ts}], {i,
nruns}];
GraphicsRow[{ParametricPlot[{Table[{vc[t], iL[t]} /. sol[i], {i,
nruns}]}, {t, 0, nc Ts}, AspectRatio -> 1],
Plot[{Table[vc[t] /. sol[i], {i, nruns}]}, {t, 0, nc Ts},
PlotPoints -> 40]}]
both give
Ok, now we can try to define the DutyCycle function using Piecewise, which is recommended in the context of ODES.
DutyCycle[d_, Ts_, t_] :=
Piecewise[{{1, t < d Ts}, {0, t < d Ts}, {1, 5/4 Ts > t > Ts}, {0,
t > 5/4 Ts}}];
E1 = 16;
Vf = 0.8;
Ts = 100 10^-6;
Td = 0.25;
Rs = 0.001;
Rd = 0.001;
iL0 = 3;
vc0 = 30;
nruns = 5;
nc = 2;
st1 = DutyCycle[Td, Ts, t];
Eqns1 = {iL'[t] == -((Rs (1 - st1) + (Rd st1))/L) iL[t] -
st1/L vc[t] + (E1 - (st1 Vf))/L,
vc'[t] == st1/C1 iL[t] - 1/(R C1) vc[t], iL[0] == iL0,
vc[0] == vc0} /. {R -> 10, L -> 0.2 10^-3, C1 -> 0.2 10^-3};
Do[sol[i] = NDSolve[Eqns1, {iL[t], vc[t]}, {t, 0, nc Ts}], {i, nruns}];
GraphicsRow[{ParametricPlot[{Table[{vc[t], iL[t]} /. sol[i], {i,
nruns}]}, {t, 0, nc Ts}, AspectRatio -> 1, ImageSize -> Medium,
Epilog -> {Red, PointSize[Large], Point[{vc0, iL0}]}],
Plot[{Table[vc[t] /. sol[i], {i, nruns}]}, {t, 0, nc Ts},
PlotPoints -> 40, ImageSize -> Medium]}]
This results in
So not there is only one solution, which I hope coincides with your favourite solution.
Cheers,
Marco