# Running a feedback control system problem

I'm trying to work with a feedback control system. The general scheme is:

So the input $u(t)$ is supposed to be: $u(t)=k_a\cdot k_{st}\cdot h_c \cdot e(t)$ where $k_a,k_{st},k_c$ are the transfers functions (given in the directions). $e(t)$ is the error function used as input in the controller, then $e(t)=y(t)-y_d(t)$ where y(t) is the output of the system and $y_d(t)$ is the input reference (the output that I want to get).

So, if we simulate the problem using another input (in order to get $y(t)$ all is ok. The code for that is:

l1 = 20 10^(-3);
c1 = 250 10^(-6);
l2 = 20 10^(-3);
c2 = 250 10^(-6);
R = 12;
il10 = 4.11703;
il20 = 3.3333;
vc10 = 72.3858;
vc20 = 40;
d1 = 0.600962;
do = 0.552595;
Δd = d1 - do;
A = {{-64.383, 0, -22.35, 0}, {0, 0, 27.65, -50}, {1788, -2212, 0,
0}, {0, 4000, 0, -333.333}};
B = {3619.3, 3619.3, -29800, 0};
Cc = {0, 3619.3, 0, -333.333};
u[t_] = Δd/(80 10^(-3)) (Ramp[t - 30 10^(-3)] -
Ramp[t - 110 10^(-3)]);
eqns = {x1'[t], x2'[t], x3'[t], x4'[t]};
sol1 = NDSolve[{eqns ==
A.{x1[t], x2[t], x3[t], x4[t]} + B (u[t] - Δd),
x1[0] == 0, x2[0] == 0, x3[0] == 0, x4[0] == 0}, {x1[t], x2[t],
x3[t], x4[t]}, {t, 0, 300 10^(-3)}];


So far, so good but after that I'm supposed to work with the feedback. For the feedback, I have:

kst = 1/10;
ka = 1/20;
kc = 0.8;
vc21 = 45;
Δvc2d[t_] =
kst (vc21 - vc20)/(80 10^(-3))*(Ramp[t - 30 10^(-3)] -
Ramp[t - 110 10^(-3)])
uu[t_] = (-x4[t] + Δvc2d[t]) kc ka
eqns1 = {x11'[t], x22'[t], x33'[t], x44'[t]};
sol1 = NDSolve[{eqns1 ==
A.{x11[t], x22[t], x33[t], x44[t]} +
B (uu[t] - Δd), x11[0] == 0, x22[0] == 0,
x33[0] == 0, x44[0] == 0}, {x11[t], x22[t], x33[t], x44[t]}, {t,
0, 300 10^(-3)}];


$vc2d[t]$ is the given reference i.e $y_d(t)$. If we do that I get

"NDSolve::underdet: There are more dependent variables, {x11[t],x22[t],x33[t],x4[t],x44[t]}, than equations, so the system is underdetermined."

which probably means that $x_4(t)$ in $uu[t]$ isn't properly defined. And that is where my doubt comes up. When I run the first system we get a set of rules for $x_4(t)$ but then I want to use $x_4(t)$ in another funtion and there is the problem. Any suggestions? Thanks in advance

## 1 Answer

I solved it using

sol2 = NDSolve[{eqns1 ==
A.{x11[t], x22[t], x33[t], x44[t]} +
B (( -1*First[Evaluate[x4[t] /. sol1]] + \[CapitalDelta]vc2d[
t]) kc ka), x11[0] == 0, x22[0] == 0, x33[0] == 0,
x44[0] == 0}, {x11[t], x22[t], x33[t], x44[t]}, {t, 0,
300 10^(-3)}]


By looking similar problems on this forum I found that "First" works to fix my problem. However I'm not sure why it actually solves it. I just know that it worked for me.