Design a Feedback Controller for a Mixing Tank
Design a Feedback Controller for a Mixing Tank
The equations for a chemical's concentration in a mixing tank with two inflows and one outflow are Taylor linearized about an operating point to produce a descriptor state-space model.
eqns = {Derivative[1][v][t] == Subscript[q, 1][t] + Subscript[q, 2][t] - q[t], Subscript[∂, t](c[t] v[t]) == Subscript[c, 1] Subscript[q, 1][t] + Subscript[c, 2] Subscript[q, 2][t] - c[t] q[t], q[t] == (Subscript[q, 0]/Sqrt[Subscript[v, 0] / A]) Sqrt[(v[t]/A)]};lsys = StateSpaceModel[eqns, {{v[t], Subscript[v, 0]}, {c[t], (Subscript[c, 1] Subscript[q, 10] + Subscript[c, 2] Subscript[q, 20]) / Subscript[q, 0]}, {q[t], Subscript[q, 0]}}, {{Subscript[q, 1][t], Subscript[q, 10]}, {Subscript[q, 2][t], Subscript[q, 20]}}, {q[t], c[t]}, t] /. Subscript[q, 0] -> Subscript[q, 10] + Subscript[q, 20] /. {Subscript[c, 1] -> 10., Subscript[c, 2] -> 20., Subscript[v, 0] -> 1000, Subscript[q, 10] -> 10., Subscript[q, 20] -> 20.}SystemsModelOrder[lsys]κ = StateFeedbackGains[lsys, {-0.2, -0.15}]csys = SystemsModelStateFeedbackConnect[lsys, κ]//Chopres1 = OutputResponse[{csys, {0, 0.1, 0}}, {0, 0}, {t, 0, 175}];
res2 = OutputResponse[{lsys, {0, 0.1, 0}}, {0, 0}, {t, 0, 175}];Plot[{res1, res2}, {t, 0, 175}, PlotStyle -> {Thick, Thick, Dashed, Dashed}, PlotRange -> All, ImageSize -> Medium]