Modelling, analysis and synthesis of nonlinear control systems with Mathematica

Maris Tõnso, Juri Belikov, Vadim Kaparin, Heli Rennik, Ülle Kotta

Institute of Cybernetics, Tallinn University of Technology, Akadeemia tee 21, Tallinn, 10918, Estonia

maris@cc.ioc.ee, jbelikov@cc.ioc.ee, vkaparin@cc.ioc.ee, heli@cc.ioc.ee, kotta@cc.ioc.ee

Control system

Control systems are systems that have at least one variable that  can be changed (within certain limits) in order to control other system’s variables.

Example

A simple example of control system is TV remote control. 

We can change input variable (by pushing the channel button on the remote) in order to control output variable (channel on TV).

Input-output and state equations

Control system can be described in many ways, including:

Input-output equations

Single-input single-output continuous-time system
	(y^((n))) = ϕ(y, (Overscript[y,  .]), … , (y^((n-1))), u, (Overscript[u,  .]), … , (u^((s)))),
u ∈ ℝ  is input and y ∈ ℝ is output and s <n.

State equations

Single-input single-output continuous-time system 
	(Overscript[x,  .])= f(x,u)
y=h(x),
x ∈ (ℝ^n) is state, u ∈ ℝ is input and y ∈ ℝ is output.

State is a function of inputs, outputs and their derivatives.

Why we need software for nonlinear control systems?

Some software tools are avaliable for numercal calculations for nonlinear control systems, but very few implementations are devoted to symbolic computations

Control Systems Professional deals mainly with linear systems

There exists a need for nonlinear control software, because computations are especially labour-consuming in nonlinear case

NLControl — Mathematica package for nonlinear control systems

Using NLControl

In research — allows to check system properties easily.

Teaching control courses to MSc and Phd students.

In some cases we have succeeded to prove new theoretical results using NLControl (See the presentation by P. Kotta and Ü. Kotta, Mathematica assistance in proving theorems in nonlinear control.)

So far we have not distributed NLControl openly. It has been used by our reasearch team in Tallinn and by our collegues from France, UK, Poland and  Mexico.

About NLControl package

Oriented purely to nonlinear systems

Both continuous-time and discrete-time (described in terms of shift operator) systems are supported.

Some functions work aslo with systems defined on homogeneous time-scales. Homogeneous time-scale unifies continuous-time and discrete-time systems, if the discrete-time system is described in terms of difference operator.

Implemented only for symbolic computations, no numerical methods included

Two main theories behind the NLControl package

Algebraic approach of differential forms

The theory of noncommutative polynomial rings

Algebraic approach of differential forms

Based on sequences of subspaces of differential one-forms.

Algebraic approach allows to solve many nonlinear control problems e.g. irreducibility, realizability, accessibility and linearizability.

Consider a single-input single-output continuous-time system given by state equations
	(Overscript[x,  .])= f(x,u)
y=h(x)

Let 𝒦 denote the field of meromorphic functions in a finite number of the variables {x,(u^((k))), k ≥ 0}.

𝒦 is differential field

The differentiation operator s= (d/(d t)), s: 𝒦-> 𝒦.

Example

(Subscript[(Overscript[x,  .]), 1])= u+(Subscript[x, 1])
(Subscript[(Overscript[x,  . ]), 2])= (Subscript[x, 1])(u^2)
y=(Subscript[x, 1])

s((Subscript[x, 1])·u) = (Subscript[(Overscript[x,  .]), 1])u+(Subscript[x, 1])(Overscript[u,  .]) = (u+(Subscript[x, 1]))u + (Subscript[x, 1])(Overscript[u,  .])

Algebraic approach of differential forms  (part 2)

Define a differential vector space ℰ := (Subscript[span,  𝒦]){ dϕ | ϕ ∈ 𝒦}.

The elements of ℰ are called one-forms.

The operator s: 𝒦-> 𝒦 induces operator s : ℰ -> ℰ.

The relative degree r of a one-form  ω∈ ℰ is defined to be the least integer such that 
	(s^r)ω∈ (Subscript[span , 𝒦]){(Subscript[dx, 1]),(Subscript[dx, 2]), . . . , (Subscript[dx, n])}
If such an integer does not exist, we set r = ∞.

Algebraic approach of differential forms  (part 3)

Define a sequence of subspaces {(Subscript[ℋ, k])} of  ℰ associated with control system:

(Subscript[ ,   ])(Subscript[ℋ, 1]) = (Subscript[span,  𝒦]){(Subscript[dx, 1]), (Subscript[dx, 2]), … (Subscript[dx, n])}
(Subscript[ℋ, k+1])= (Subscript[span,  𝒦]){ω ∈ (Subscript[ℋ, k ])|(Overscript[ω,  . ]) ∈ (Subscript[ℋ, k])}, k ≥ 1

(Subscript[ℋ, k ]) contains the one-forms whose relative degree r ≥ k

There exists an integer (SuperStar[k]) such that for 0 ≤ k ≤ (SuperStar[k]) , (Subscript[ℋ, k+1])⊂ (Subscript[ℋ, k]), but (Subscript[ℋ, k+1])≠ (Subscript[ℋ, k]) and  (Subscript[ℋ, (SuperStar[k])+1])= (Subscript[ℋ, (SuperStar[k])+2]) = ... = (Subscript[ℋ, ∞])

Subspaces (Subscript[ℋ, k ]) carry a lot of useful information about properties of the control system.

Example

(Subscript[(Overscript[x,  .]), 1])= u+(Subscript[x, 1])
(Subscript[(Overscript[x,  . ]), 2])= (Subscript[x, 1])(u^2)
y=(Subscript[x, 1])

(Subscript[ℋ, 1]) = (Subscript[span,  𝒦]){(Subscript[dx, 1]), (Subscript[dx, 2])}
(Subscript[ℋ, 2])= (Subscript[span,  𝒦]){-2u (Subscript[x, 1])(Subscript[dx, 1]) + (Subscript[dx, 2])}
(Subscript[ℋ, ∞])={0}

Modelling problem 1: Irreducibility

Consider the i/o equation
	(y^((n))) = ϕ(y, (Overscript[y,  .]), … , (y^((n-1))), u, (Overscript[u,  .]), … , (u^((s))))

Definition. A function (Subscript[ψ, r])  is said to be an autonomous variable for control system if ∃μ ≥ 1 and exists a meromorphic function F ≠0 so that 
	F((Subscript[ψ, r]), s (Subscript[ψ, r]), …, (s^μ)(Subscript[ψ, r]))=0.

Definition. The system is irreducible if there does not exist any non-zero autonomous variable.

Theorem. System is irreducible if and only if (Subscript[ℋ, ∞])={ 0 }.

Irreducibility. Example

Needs["NLControl`Master`"] (* loading package *)
SetOptions[BookForm,TimeArgument->False]; (* hides t in formatted output *)

eq=y'''[t]->2((y[t])^2)u'[t]+2y[t]u'[t]y'[t]+((y[t])^2)u''[t]-2y''[t];
ioeq=IO[eq,u[t],y[t],t,TimeDerivative];
BookForm[ioeq]

BookForm[Hk=SequenceH[ioeq,All]]

Reduced system is

BookForm[iored=Reduction[ioeq,Method->SubspaceH]]

({{(1/2) ((y^2) u'-y''), =, 0}})

Modelling problem 2: Realization

Consider the i/o equation
	(y^((n))) = ϕ(y, (Overscript[y,  .]), … , (y^((n-1))), u, (Overscript[u,  .]), … , (u^((s))))

Definition. The i/o system is said to be realizable, if it is possible to find state coordinates  x= ψ(y, …, (y^((n-1))), u,…,(u^((s)))) such that in these coordinates system has a classical state space form
	(OverDot[x])= f(x,u)
y=h(x).

Theorem. The i/o system has an observable and accessible state space realization if and only if for 1 ≤ k ≤ s+2  the subspaces (Subscript[ℋ, k ]) are completely integrable.

The state coordinates can be found by integrating the basis functions of (Subscript[ℋ, s+2 ]).

Realization. Example 1

BookForm[iored]

BookForm[Hk=SequenceH[iored,3]]

Integrability/@Hk

psi=IntegrateOneForms[Hk[[3]]]

State equations are

BookForm[{steq,repl}=Realization[iored,(Subscript[x, #])[t]&,psi]]

Realization. Example 2. (Discrete-time system)

The model describes a laboratory-scale liquid-level system.

M. S. Ahmed. Neural-net-based direct adaptive control for a class of nonlinear plants. IEEE Trans. on Automatic Control, 2000, 45, No. 1, 119--124.
Sales, K. R., and Billings, S. A., 1990, Self-tuning control of nonlinear ARMAX models. Int. J. Control, 51, (4), 753--769.

eq2=y[t+3]->0.0431u[t+2]-0.0036u[t+1]+1.2159y[t+2]-0.5456y[t+1]+0.088y[t]-0.0234((u[t+2])^2)+0.0247((u[t+1])^2)-1.0535((y[t+2])^2)-0.0723u[t+2]u[t+1]-0.5094u[t+2]y[t+2]+0.3935u[t]y[t+1]+0.093((u[t+1])^3)-0.1273u[t+2]((u[t+1])^2)-1.5736u[t+2]((y[t+2])^2);
ioeq2=IO[eq2,u[t],y[t],t,Shift];

BookForm[Hk=SequenceH[ioeq2,4]]

Integrability[ Hk[[4]] ]

Realization. Example 3.

eq3=y'''[t]->Sqrt[u''[t]y'[t]];
ioeq3=IO[eq3,u[t],y[t],t,TimeDerivative];BookForm[ioeq3]

BookForm[Hk=SequenceH[ioeq3,4]]

Noncommutative polynomials

Let 𝒦 be differential field

Differentation operator s induces a ring of polynomials 𝒦[s]

A polynomial p(s) ∈ 𝒦[s] is written as

p(s) = (Subscript[a, m])(s^m)+ (Subscript[a, m-1])(s^(m-1))+ … + (Subscript[a, 1])s + (Subscript[a, 0]),

where (Subscript[a, i]) ∈ 𝒦.

Multiplication of the polynomials is not commutative since s · a ≠ a · s, a ∈ 𝒦.

Multiplication is defined by the following rule:

s · a = a · s + (Overscript[a,   .])

𝒦[s] is proved to be an Ore ring.

In nonlinear control theory noncommutative polynomials play the same role as ordinary polymials in linear control.

Example

p(s) = (s^2)+u(t)
q(s) =y(t)s+2

$OreRing=DefineOreRing[s,t,TimeDerivative];
p=OreP[1,0,u[t]];
q=OreP[y[t],2];

BookForm[p**q]

BookForm[q**p]

Polynomial system description

Consider the i/o equation
	(y^((n))) = ϕ(y, (Overscript[y,  .]), … , (y^((n-1))), u, (Overscript[u,  .]), … , (u^((n-1)))).

Differentiate the i/o equation. Since

(dy^(( i ))) = (s^(i ))dy  
	(du^(( i ))) = (s^(i )) du,

the i/o equation can be rewritten as

p(s) dy = q(s) du,

where

p(s)=(s^n) - (∑_( i =0)^(n-1))((∂ ϕ)/(dy^(( i ))))
q(s)=(∑_( i =0)^(n-1))((∂ ϕ)/(du^(( i ))))

Modelling problem 1: Irreducibility

Theorem. Nonlinear system described by i/o equation
	(y^((n))) = ϕ(y, (Overscript[y,  .]), … , (y^((n-1))), u, (Overscript[u,  .]), … , (u^((n-1))))
is irreducible if and only if the polynomials p(s) and q(s) have no common left divisiors.

The greatest common left divisior can be found by applying the left Euclidean algorithm to p(s)  and q(s).

Extension for MIMO systems has been implemented also.

Irreducibility. Example

BookForm[ioeq]

K=DefineOreRing[s,ioeq];
{{{p}},{{q}}}=FromIOToOreP[ioeq];BookForm[{p,q},K]

BookForm[g=OreGCD[p,q,Left,K],K]

p1 = OreQuotient[p, g, Left, K];
q1 = OreQuotient[q, g, Left, K];
sp=SimplifyBasis[ FromOrePToSpanK[ {{p1}}, {{q1}}, ioeq ]];
psi=IntegrateOneForms[sp];
BookForm[iored=IO[Thread[psi==0],u[t],y[t],t,TimeDerivative]]

Modelling problem 2: Realization

Theorem. For realizable system described by i/o equation 
	(y^((n))) = ϕ(y, (Overscript[y,  .]), … , (y^((n-1))), u, (Overscript[u,  .]), … , (u^((n-1))))
the state coordinates (Subscript[x, i]) can be calculated from one-forms

(Subscript[ω, l]) =(Subscript[(Overscript[p, —]), i])(s) dy +  (Subscript[(Overscript[q, —]), i])(s) du,   i=1, …, n.

Ore polynomials (Subscript[(Overscript[p, —]), i])(s)  and (Subscript[(Overscript[q, —]), i])(s) can be recursively computed as left quotients from equations

(Subscript[(Overscript[p, —]), i-1])(s) = s· (Subscript[(Overscript[p, —]), i])(s)  + (Subscript[r, i])
(Subscript[(Overscript[q, —]), i-1])(s) = s· (Subscript[(Overscript[q, —]), i])(s)  + (Subscript[ρ, i]),

where initial polynomials (Subscript[(Overscript[p, —]), 0])(s) = p(s) and  (Subscript[(Overscript[q, —]), 0])(s) = q(s).

This method is applicable only for SISO systems so far.

Realization. Example

BookForm[iored]

K=DefineOreRing[s,iored];
{{{p}},{{q}}}=FromIOToOreP[iored];
n=Length[p]-1;
pList = NestList[ OreQuotient[#, OreP[1,0], Left, K]&, p, n];
qList = NestList[ OreQuotient[#, OreP[1,0], Left, K]&, q, n];
TableForm[BookForm[{pList,qList},K],TableSpacing->{1.5,3},
TableHeadings->{{"(Subscript[p, i])(s)","(Subscript[q, i])(s)"},Array["i="<>ToString[#]&,n+1]}]

sp=FromOrePToSpanK[ Transpose[{Rest@pList}], Transpose[{Rest@qList}], iored ];
psi=IntegrateOneForms[sp];
BookForm[Realization[iored,(Subscript[x, #])[t]&,psi]]

Linear algebraic method vs polynomial method

Algebraic method is more widely applicable. Polynomial method can be used only for reduction, checking transfer equivalence, i/o equivalence and SISO realization, so far.

Polynomial method is faster and more direct for reduction. In MIMO case, algebraic method often gives unsufficent result.

Noncommutative polynomials can be considered as a generalization of commutative polynomials used in linear control.

Noncommutative polynomials provide a key for finding the third representation of the control sysem — transfer function.

The list of the problems NLControl can solve

Irreducibility & Reduction

Realizability & Realization (including SISO composite systems)

Lower the order of the input shifts/derivatives in the generalized state equations

Transfer functions for i/o end state equations

(Forward) accessiblity, decomposition of the system into accessible and nonaccessible subsystems

Observability, decomposition of the system into observable and nonobservable subsystems

Identifiability of the system unknown parameters

Controller canonical form & static state feedback linearization (full and partial)

Normal form (a good starting point for applying the inversion-based control algorithms and for computing the zero dynamics of the system)

Prime form, using the state feedback, state and output diffeomorphisms

Discretization of the continuous-time system by using either Taylor series expansion or direct integration methods.

Limits of the package

It is difficult to estimit how large or how complex systems NLControl is able to handle. Sometimes it may fail with quite simple equations, sometimes it can manage with surprisingly complex systems.

NLControl seems to manage better with discrete-time systems, since continuous-time systems require applying derivation operator, which increases the complexity of the expressions quickly.

With discrete-time systems the crucial point is finding the 'inverse' system. If the 'inverse' system is complex (contains roots) or cannot be found, the process fails.

The package is not pretending to be a commercial product. It needs more testing, it does not have any protection for uncorrect input data a user may enter and it has not respectable help system.

Conclusions

A Mathematica package NLControl for modelling, analysis and synthesis of nonlinear control sysems has been presented

Two main mathematical theorys applied in the package — algebraic approach of differential forms and polynomial approach have been shortly explaned

Package functions are demonstrated on sample of reduction, realization and linearization

Some NLControl functions are avaliable via webMathematica (see presentation by H. Rennik, M. Tõnso, Ü. Kotta, Solving Problems for Nonlinear Control Systems Using webMathematica, http://webmathematica.cc.ioc.ee/webmathematica/NLControl/index.html)