I ask for help from specialists in differential equations, dynamical systems, optimal control and general control theory;
I have the following system of differential equations:
\begin{cases} \frac{dx(t)}{dt}=G(t) \\ \frac{dz(t)}{dt}+z(t)=\frac{df}{dt} \\ \frac{dG(t)}{dt}+G(t)=z(t) \cdot \alpha \sin(\omega t) \\ \frac{dH(t)}{dt}+H(t)=z(t) \cdot (\frac{16}{\alpha^2}(\sin(\omega t)-\frac{1}{2})) \\ \frac{dX(t)}{dt}+X(t)=\frac{dx(t)}{dt} \end{cases}
where, $x,z,G,H,X$ - variables; $f=-(x(t)+\alpha \sin(\omega t)-x_e)^2$; $\alpha, \omega$ - parameters.
As an output $y$, I assign:
$y=\tanh(k \cdot H(t))$
As an reference signal $r_1$, I assign:
$r_1=-1$
As an constant time $p_1$, I assign:
$p_1=-1$
Well, I tried to program this in the Mathematica program and ran into a difficulty that I can't get over yet. Question: in which of the equations should the control signal $u(t)$ be placed?
I chose the first equation, then the original system of equations will look like this:
\begin{cases} \frac{dx(t)}{dt}=G(t)+u(t) \\ \frac{dz(t)}{dt}+z(t)=\frac{df}{dt} \\ \frac{dG(t)}{dt}+G(t)=z(t) \cdot \alpha \sin(\omega t) \\ \frac{dH(t)}{dt}+H(t)=z(t) \cdot (\frac{16}{\alpha^2}(\sin(\omega t)-\frac{1}{2})) \\ \frac{dX(t)}{dt}+X(t)=\frac{dx(t)}{dt} \end{cases}
(***)
Clear["Derivative"]
ClearAll["Global`*"]
Needs["Parallel`Developer`"]
S[t] = \[Alpha] Sin[\[Omega] t]
M[t] = 16/\[Alpha]^2 (Sin[\[Omega] t] - 1/2)
f = -(x[t] + S[t] - xe)^2
Parallelize[
asys = AffineStateSpaceModel[{x'[t] == G[t] + u[t],
z'[t] + z[t] == D[f, t], G'[t] + G[t] == z[t] S[t],
H'[t] + H[t] == z[t] M[t],
1/k X'[t] + X[t] == D[x[t], t]}, {{x[t], xs}, {z[t], 0.1}, {G[t],
0}, {H[t], 0}, {X[t], 0}}, {u[t]}, {Tanh[k H[t]]}, t] //
Simplify]
pars1 = {Subscript[r, 1] -> -1, Subscript[p, 1] -> -1}
Parallelize[
fb = AsymptoticOutputTracker[asys, {-1}, {-1, -1}] // Simplify]
pars = {xs = -1, xe = 1, \[Alpha] = 0.3, \[Omega] = 2 Pi*1/2/Pi,
k = 100, \[Mu] = 1}
Parallelize[
csys = SystemsModelStateFeedbackConnect[asys, fb] /. pars1 //
Simplify // Chop]
plots = {OutputResponse[{csys}, {0, 0}, {t, 0, 1}]}
At the end, I get an error.
At t == 0.005418556209176463`, step size is effectively zero; \
singularity or stiff system suspected
It seems to me that this is due to the fact that either in the system there is a $\csc$ somewhere, or I have put the control input signal in the wrong equation. I need the support of a theorist who can help me choose the right sequence of actions to solve the problem.
I would be glad to any advice and help.