Handle nonlinear behaviour
Linearise around an operating point and examine where local models fail. This module has 3 lessons and takes about 2h 25m. Each lesson has a practice exercise that runs real Python in your browser and a short quiz.
Start module 17 in the Learning LabEquilibria and local linearisation
Derive a local model for a nonlinear tank.
For a gravity-drained tank, A*dh/dt=q-c*sqrt(h), with h>=0. At equilibrium q0=c*sqrt(h0). Choose deviations delta_h=h-h0 and delta_q=q-q0.
The derivative of the outflow with respect to height is c/(2*sqrt(h0)). Linearisation gives delta_h_dot=-(c/(2*A*sqrt(h0)))*delta_h+(1/A)*delta_q. This requires h0>0 and small enough deviations.
The local time constant is 2*A*sqrt(h0)/c. It changes with operating height. A controller tuned at one height may be too aggressive or too slow elsewhere. The model is singular at h0=0, so do not apply this derivative there.
See it in action
import math
area, coefficient, h0 = 2.,0.5,1.
q0=coefficient*math.sqrt(h0)
a=-coefficient/(2*area*math.sqrt(h0))
b=1/area
print('Equilibrium flow:',q0,'Local a,b:',a,b,'tau:',-1/a)
A local model needs an operating point and a stated useful range.
Lyapunov reasoning and nonlinear limits
Use an energy-like function to reason beyond local poles.
For a nonlinear state model x_dot=f(x), a Lyapunov function V(x) is positive away from the equilibrium and zero at it. If its derivative along trajectories is negative, V decreases, which can establish stability over a stated region.
For x_dot=-x-x^3, choose V=x^2/2. Then V_dot=x*(-x-x^3)=-x^2-x^4, which is negative for every nonzero x. V is also radially unbounded, supporting a global asymptotic stability argument for this scalar system.
A local linearisation can miss distant equilibria and saturation effects. For x_dot=x-x^3, the origin is unstable while x=+1 and x=-1 are stable equilibria. Simulate different initial conditions and identify the region each argument covers.
See it in action
import numpy as np
x=np.array([-2.,-1.,0.,1.,2.])
V=0.5*x*x
Vdot=x*(-x-x**3)
print('V:',V,'Vdot:',Vdot)
Say whether a stability conclusion is local, regional, or global.
Practical: schedule gains across tank levels
Compare a fixed PI design with a simple scheduled design.
For the local tank model delta_h_dot=a*delta_h+b*delta_q, PI feedback gives characteristic polynomial s^2+(b*Kp-a)*s+b*Ki. Match to s^2+2*zeta*wn*s+wn^2 to get Kp=(2*zeta*wn+a)/b and Ki=wn^2/b.
Because a changes with equilibrium height, Kp changes with the operating point. This lab schedules by a commanded equilibrium height and adds its equilibrium feedforward q0. A schedule must change smoothly and preserve integral command to avoid a jump.
Simulate the nonlinear square-root outflow as the true plant. Keep height nonnegative and enforce flow limits. Stable local designs do not prove stability during transitions, so test the transitions as well as each equilibrium.
Your experiment plan
Use the browser editor or the downloadable notebook. All plant data are simulated. Keep a notebook with parameters, predictions, results, and units.
- Tune at h0=1 and simulate small deviations around that level.
- Test the fixed design at h0=0.25 and h0=4.
- Compare scheduled gains and equilibrium feedforward across the same cases.
- Test a ramp between operating levels with flow saturation and preserved integral command.
What to hand in
- Local model parameters at three levels.
- Fixed-versus-scheduled response and command plots.
- A documented transition rule and limits.
Reflect on your results
Which assumption matters most? Describe one result that surprised you and one experiment that would test your explanation.
The automatic exercise checks the core code behaviour. Review observations and written deliverables yourself or with a mentor.
See it in action
import math
area, coefficient, zeta, wn = 2.,0.5,0.8,0.3
for h0 in [0.25,1.,4.]:
a=-coefficient/(2*area*math.sqrt(h0)); b=1/area
kp=(2*zeta*wn+a)/b
ki=wn**2/b
print('Height:',h0,'Kp:',kp,'Ki:',ki,'Feedforward:',coefficient*math.sqrt(h0))
Local tuning must be followed by transition tests on the nonlinear plant.
Free, open and run by a nonprofit.
This page is part of Control Engineering, a free course of 20 modules and 60 lessons in the engineering.fit( ) Learning Lab. The Learning Lab is built and run by engineering.fit( ), a nonprofit founded by Abdullateef Opeyemi Bakare that helps African engineering students gain research experience. You do not need an account or pay a fee to learn.