Stirred tank

H. Kwakernaak, R. Sivan, Linear optimal control systems, Wiley-Interscience, 1972, p. 449.
Let us introduce the Ore algebra A of shift operators defined by

A=OreAlgebra[S[t],θ,κ,(Subscript[c, 0]),(Subscript[c, 1]),(Subscript[c, 2]),(Subscript[v, 0])]

and the matrix R of shift operators, which defines the system

R0=
{{S[t]-κ,0,-2θ (1-κ),-2θ (1-κ)},
{0,(Subscript[v, 0])(S[t]-(κ^2)),-(θ ((Subscript[c, 1])-(Subscript[c, 0]))(1-(κ^2))),-(θ ((Subscript[c, 2])-(Subscript[c, 0]))(1-(κ^2)))}};
MatrixForm[R=ToOrePolynomial[R0,A]]

and the left A-module, finitely presented by R, defined by M = (A^(1×4))/(A^(1×2))R.

Let us compute the adjoint of R:

MatrixForm[Radj=Involution[R,A]]

Let us check whether or not M is torsion-free:

MatrixForm/@({Ann,Rp,Q}=Exti[Radj,A,1])

Since the first matrix is identity, M is torsion-free. Let us now compute the obstructions for M to be projective:

P=ObstructionToProjectiveness[R,A]

Let us deduce the obstructions in the parameters θ,κ,(Subscript[c, 0]),(Subscript[c, 1]),(Subscript[c, 2]),(Subscript[v, 0]) for M to be a projective left A-module.

int=OreIntersection[Flatten@P,{θ,κ,(Subscript[c, 0]),(Subscript[c, 1]),(Subscript[c, 2]),(Subscript[v, 0])},A]

obst=Factor/@iOrePolynomialToNormal[int]

We obtain that the system is controllable i.e. flat if one of the entries obst is not equal to zero.
In what follows, we assume that the system is flat (one of the entries of obst is not zero). Let us compute flat output of the system.

B=OreAlgebra[S[t]]

MatrixForm[R=ToOrePolynomial[
{{S[t]-κ,0,-2θ (1-κ),-2θ (1-κ)},
{0,(Subscript[v, 0])(S[t]-(κ^2)),-(θ ((Subscript[c, 1])-(Subscript[c, 0]))(1-(κ^2))),-(θ ((Subscript[c, 2])-(Subscript[c, 0]))(1-(κ^2)))}},B]]

MatrixForm[Radj=Involution[R,B]]

MatrixForm/@({Ann,Rp,Q}=Exti[Radj,B,1])

Finally the flat output ξ = ((Subscript[ξ, 1]),(Subscript[ξ, 2])) is defined by:

T=LeftInverse[Q,B]

Thread[{(Subscript[ξ, 1])[t],(Subscript[ξ, 2])[t]}-> ApplyMatrix[T,{(Subscript[x, 1])[t],(Subscript[x, 2])[t],(Subscript[u, 1])[t],(Subscript[u, 2])[t]}]]