I have the following 2 state space models
\begin{array}{rcl} \dot{x}_1&=&A_1x_1+B_{11}u_{11}+B_{12}u_{12}\\ y_1&=&C_1x_1+D_{11}u_{11}+D_{12}u_{12} \end{array}
\begin{array}{rcl} \dot{x}_2&=&A_2x_2+B_{2}u_{2}\\ y_2&=&C_2x_2+D_{2}u_{2}\\ \end{array}
The first system is a controller which feeds the second system, The output of the second system then feeds back as one of the inputs to the first system:
\begin{array}\dot{y}_{1}&= u_{2}\end{array}
And: \begin{array}\dot{u}_{12}&= y_{2}\end{array}
Algebraically, if I plug in y1 in u2 it works, but when I try plug y2 into u12, I get a loop as they are dependant on either other.
I am unsure how to combine these? It feels like I need to make the second system output a state not an input/output. I am just unsure how to do it.
Ok... I was not satisfied by my comment, so here is the derivation :P
NOTE: I changed the output equation of the controller to $y_2=C_2x_2+D_{2}u_{2}$
\begin{align} \dot{x}_1&=A_1x_1+B_{11}u_{11}+B_{12}u_{12}\\ \dot{x}_2&=A_2x_2+B_{2}u_{2}\\ y_1&=C_1x_1+D_{11}u_{11}+D_{12}u_{12} \\ y_2&=C_2x_2+D_{2}u_{2}\\ y_1&=u_2 \\ u_{12} & = y_2 \end{align} substituting $y_1=u_2$: \begin{align} \dot{x}_1&=A_1x_1+B_{11}u_{11}+B_{12}u_{12}\\ \dot{x}_2&=A_2x_2+B_{2}(C_1x_1+D_{11}u_{11}+D_{12}u_{12})\\ y_2&=C_2x_2+D_{2}(C_1x_1+D_{11}u_{11}+D_{12}u_{12})\\ u_{12} & = y_2 \end{align} now substituting $u_{12} = y_2$ in the last equation results in \begin{align} y_2 & =C_2x_2+D_{2}C_1x_1+D_{2}D_{11}u_{11}+D_{2}D_{12}y_2, \iff \\ (I-D_{2}D_{12}) y_2 & = C_2x_2+D_{2}C_1x_1+D_{2}D_{11}u_{11}, \iff \\ y_2 & = (I-D_{2}D_{12})^{-1}(C_2x_2+D_{2}C_1x_1+D_{2}D_{11}u_{11}) \end{align} We can now substitute $u_{12} = y_2$ in the remaining \begin{align} \dot{x}_1&=A_1x_1+B_{11}u_{11}+B_{12}(I-D_{2}D_{12})^{-1}(C_2x_2+D_{2}C_1x_1+D_{2}D_{11}u_{11})\\ \dot{x}_2&=A_2x_2+B_{2}(C_1x_1+D_{11}u_{11}+D_{12}(I-D_{2}D_{12})^{-1}(C_2x_2+D_{2}C_1x_1+D_{2}D_{11}u_{11})) \end{align} which you may simplify yourself ;-)
Either way, this system is well-posed if the inverse of $I-D_{2}D_{12}$ exists, i.e., $\det(I-D_{2}D_{12})\neq0$
The interpretation here is that the matrix $D_{2}D_{12}$ cannot be full rank, which implies that we have some free variables that we can use to iteratively solve the associated system of equations (we do not have strict dependency, which causes an algebraic loop)