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.