 StateObserver[Observer] - MapleSim Help

ControlDesign[StateObserver]

 Observer
 construct the static gain (Luenberger) observer for a given system and observer gain Calling Sequence Observer(sys, L, opts) Parameters

 sys - System; system object; L - Matrix or Vector; observer gain opts - (optional) equation(s) of the form option = value; specify options for the Observer command Options

 • parameters = {list, set}(name = complexcons)
 Specifies numeric values for the parameters of sys. These values override any parameters previously specified for sys. The numeric value on the right-hand side of each equation is substituted for the name on the left-hand side in the sys equations. The default is the value of sys given by DynamicSystems:-SystemOptions(parameters). Description

 • The Observer command constructs the static gain (Luenberger) observer for the given system sys and observer gain L.
 • The system sys is a continuous or discrete-time linear system object created using the DynamicSystems package. The system object must be in state-space (SS) form.
 • All sys inputs are assumed known (deterministic), and all sys outputs are assumed to be measured.
 • The Observer command returns the observer object in the state-space form. The observer system object gets the input(s) and output(s) of sys as inputs and generates the estimates of the state(s) and output(s) of sys as its outputs.
 • Suppose the sys state-space realization is given as

$\begin{array}{c}\stackrel{\cdot }{x}=\mathrm{Ax}+\mathrm{Bu}\\ y=\mathrm{Cx}+\mathrm{Du}\end{array}$

The observer equations are given by

$\stackrel{\cdot }{\stackrel{ˆ}{x}}=\left(A-\mathrm{LC}\right)\stackrel{^}{x}+\left[\begin{array}{cc}B-\mathrm{LD}& L\end{array}\right]\left[\begin{array}{c}u\\ y\end{array}\right]$

$\left[\begin{array}{c}\stackrel{^}{x}\\ \stackrel{^}{y}\end{array}\right]=\left[\begin{array}{c}I\\ C\end{array}\right]\stackrel{^}{x}+\left[\begin{array}{cc}0& 0\\ \mathrm{D}& 0\end{array}\right]\left[\begin{array}{c}u\\ y\end{array}\right]$

 • In the discrete-time domain, the Observer command uses the same state-space matrices as in the continuous-time case to generate estimates for state(s) $x\left[\begin{array}{c}n\end{array}\right]$ and output(s) $y\left[\begin{array}{c}n\end{array}\right]$ as $\stackrel{^}{x}\left[\begin{array}{c}n\end{array}|n-1\right]$ and $\stackrel{^}{y}\left[\begin{array}{c}n\end{array}|n-1\right]$, respectively, based on the past measurements up to $y\left[\begin{array}{c}\mathrm{n-1}\end{array}\right]$. The sampling time of the generated observer object is the same as the sampling time of the system sys. Examples

 > $\mathrm{with}\left(\mathrm{ControlDesign}\right):$
 > $\mathrm{with}\left(\mathrm{DynamicSystems}\right):$

State-space system in continuous time (5 states, 3 inputs and 2 outputs)

 > $\mathrm{Amat}≔\mathrm{Matrix}\left(\left[\left[1,-2,3,-5,12\right],\left[0,4,-1,2,-3\right],\left[2,5,7,-4,3\right],\left[-2,4,3,8,7\right],\left[19,14,1,-4,7\right]\right]\right):$
 > $\mathrm{Bmat}≔\mathrm{Matrix}\left(\left[\left[3,6,3\right],\left[9,7,5\right],\left[5,2,1\right],\left[4,-1,7\right],\left[6,-8,2\right]\right]\right):$
 > $\mathrm{Cmat}≔\mathrm{Matrix}\left(\left[\left[3,9,5,4,6\right],\left[1,0,-4,5,7\right]\right]\right):$
 > $\mathrm{Dmat}≔\mathrm{Matrix}\left(\left[\left[1,-2,0\right],\left[3,0,-1\right]\right]\right):$
 > $\mathrm{sys}≔\mathrm{StateSpace}\left(\mathrm{Amat},\mathrm{Bmat},\mathrm{Cmat},\mathrm{Dmat}\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{sys}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{2 output\left(s\right); 3 input\left(s\right); 5 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right){,}{\mathrm{u2}}{}\left({t}\right){,}{\mathrm{u3}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right){,}{\mathrm{y2}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right){,}{\mathrm{x3}}{}\left({t}\right){,}{\mathrm{x4}}{}\left({t}\right){,}{\mathrm{x5}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{ccccc}{1}& {-2}& {3}& {-5}& {12}\\ {0}& {4}& {-1}& {2}& {-3}\\ {2}& {5}& {7}& {-4}& {3}\\ {-2}& {4}& {3}& {8}& {7}\\ {19}& {14}& {1}& {-4}& {7}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{ccc}{3}& {6}& {3}\\ {9}& {7}& {5}\\ {5}& {2}& {1}\\ {4}& {-1}& {7}\\ {6}& {-8}& {2}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{ccccc}{3}& {9}& {5}& {4}& {6}\\ {1}& {0}& {-4}& {5}& {7}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{ccc}{1}& {-2}& {0}\\ {3}& {0}& {-1}\end{array}\right]\end{array}\right$ (1)

Desired observer poles

 > $p≔\left[-3,-4,-5+3I,-5-3I,-7\right]:$

Get the observer gain Matrix L for the desired poles

 > $L≔\mathrm{StateObserver}:-\mathrm{PolePlacement}\left(\mathrm{sys},p\right)$
 ${L}{≔}\left[\begin{array}{cc}{5.61387999503205}& {4.25288865156743}\\ {-3.33851876208653}& {-2.63895066630918}\\ {2.08444493183947}& {0.857378214523433}\\ {-0.743810167611436}& {-0.297617195815009}\\ {5.06290232118361}& {3.86362016334715}\end{array}\right]$ (2)

Construct the observer object for sys with gain L

 > $\mathrm{Obsv}≔\mathrm{StateObserver}:-\mathrm{Observer}\left(\mathrm{sys},L\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{Obsv}\right)$ 