Arranging input data (nonlinear control systems)

• To: mathgroup at smc.vnet.net
• Subject: [mg77563] Arranging input data (nonlinear control systems)
• From: Maris To~nso <mtonso at staff.ttu.ee>
• Date: Wed, 13 Jun 2007 07:24:37 -0400 (EDT)

Dear group,

I am writing a Mathematica package dealing with nonlinear control systems.
I have a problems with organizing input data. I try to describe my problem
so that people, who are not aquainted with control systems theory, can
understand, too.

There are different types of nonlinear control systems.

____________1. Discrete system

classical state equations are in the form

x(t+1) = f(x(t),u(t)), (here f = (f1,f2,...) is nonlinear function)
y(t) = h(x(t))

for example,

x1(t+1) = x1(t) + x2(t) u2(t)
x2(t+1) = u1(t)
y(t) =  x1(t)

So far I have entered and hold above system like this:

f = {x1[t] + x2[t] u2[t],  u1[t]};
Xt = {x1[t], x2[t]};
Ut = {u1[t], u2[t]};
h = {x1[t]};
Yt = {y[t]};
dstateeqs = DStateSpace[f, Xt, Ut, t, h, Yt];

The head DStateSpace indicates it is a discrete system and keeps the
system data together. Now a user can apply package functions to the
system, entering the single argument. For example,

Observability[ dstateeqs ] (* checks observability *)

ClassicStatesToIO[ dstateeqs ] (* finds input-output equations *)

BookForm[ dstateeqs ] (* acts like TraditionalForm, i.e. prints the system
in normal way x1[t+1] = ... *)

__________2. Continuous system:

classical state equations are in the form

\dot x = f(x,u) (Here \dot x is time derivative)
y = h(x)

for example,

\dot x1 = u1 + u2
\dot x2 = x1*x2
\dot x3 = x3
y =  x1 + x2

So far I have entered and hold above system like this:

f = {u1[t] + u2[t],  x1[t]*x2[t], x3[t]};
Xt = {x1[t], x2[t], x3[t]};
Ut = {u1[t], u2[t]};
h = {x1[t] + x2[t]};
Yt = {y[t]};
cstateeqs = CStateSpace[f, Xt, Ut, t, h, Yt];

Though continuous systems are traditionally written without time argument
t, I have chosen to write it, to keep analogy with discrete case.
CStateSpace indicates it is a continuous system. Package functions can be
applied to it exactly like in discrete case.

Observability[ cstateeqs ]
ClassicStatesToIO[ cstateeqs ]
BookForm[ cstateeqs ]

The sysem worked quite properly and was easy to understand and use, but no
a big trouble has appeared. My professor says there will be more cases
than just discrete and continuous!

__________3. General case:

classical state equations have form

x^<1> = f(x,u)
y = h(x)

here x^<1> (x with superscripted "<1>" ) is a changeable operator,
depending on two functions: generalized shift and pseudoderivative. Of
course, the general case covers discrete and continuous systems, if shift
and pseudoderivative are chosen in a right way. Some examples:

Discrete:     Shift[a_, t_]:= a/.t->t+1; PseudoD[a_, t_]:= 0
Continuous:   Shift[a_, t_]:= a;         PseudoD[a_, t_]:= Dt[a, t]
Difference:   Shift[a_, t_]:= a/.t->t+1; PseudoD[a_, t_]:= Shift[a,t]-a
q-shift:      Shift[a_, t_]:= a/.t->q*t; PseudoD[a_, t_]:= 0
q-difference: Shift[a_, t_]:= a/.t->q*t; PseudoD[a_, t_]:= Shift[a,t]-a
... and there are more of them.

Now, the the expression of state equations should carry also an
information about shift and pseudoderivative operators. Something like

StateSpace[f, Xt, Ut, t, h, Yt, Hold[{Shift[a_, t_]:= a/.t->t+1,
PseudoD[a_, t_]:= 0]}]

If I don't use Hold, it gives simply Null. Unfortunately, I have never
seen a Mathematica function, which arguments should be entered with Hold.

An alternative is to define two global variables Shift[a_,t_] and
PseudoD[a_,t_]. I am bit afraid of global variables, because Mathemativa
built-in functions and Standard packages use them really rarely.

So, were should I put these shift and pseudoderivative?

It is also clear classical discrete and continuous systems are used much
more often than those other cases, so there should be an oportunity to
enter these systems easily, without thinking about shifts and
pseudoderivatives. So, I should probably keep the old heads DStateSpace
and CStateSpace, too. Or would it be better to use complete words,
something like

StateSpace[f, Xt, Ut, t, h, Yt, "Discrete"] and

StateSpace[f, Xt, Ut, t, h, Yt, "Continuous"] ?

Thank you for reading. I am not expecting a complete solution, any ideas

Yours sincerely
Maris Tõnso

--------------------------------------------------------

Maris Tõnso
Control Systems Department
Institute of Cybernetics at TUT