TransWikia.com

Limiting transfer function of PID to upper and lower bounds

Mathematica Asked by Levy Ehrstein on August 21, 2020

I have a question about Limiting the output of a transfer function in my system model.
(Im fairly new to control theory and control systems)

I have a model where a PID controller is directly controlling the acceleration of a quadcopter. The quadcopter is "trying" to fly at a set hight.

Currently, I have the following:
Copter PID

My question is: how can I limit the acceleration (the PID output) in the system?

I’ve tried the solution from question 133541. But that didn’t work out for me. Mathematica tells me the transfer function of the PID controller cant be converted into a nonlinearStateSpaceModel? I don’t really know why or how as I’m new to the field.

enter image description here

Thank you in advance!

2 Answers

The core problem is that NonlinearStateSpaceModel does not support descriptor systems.

When there are pure derivative terms, the state-space representation will need a singular descriptor matrix. This is supported by StateSpaceModel but not by NonlinearStateSpaceModel.

Through@{StateSpaceModel, NonlinearStateSpaceModel}@TransferFunctionModel[s, s]

enter image description here

A workaround is to do away with the derivative term or use a filter on the derivative terms. (These are done in applications where there is large sensor noise or abrupt reference changes.)

SystemsModelSeriesConnect[TransferFunctionModel[kp + ki/s + kd s/(s + α), s], 
 NonlinearStateSpaceModel[{{}, Clip[u]}, {}, u]]

enter image description here

Correct answer by Suba Thomas on August 21, 2020

Due to the double pole representing the copter, a simple PD will suffice. Follows a layman procedure to find an acceptable solution. The procedure consists in searching through a minimization procedure, the nearest response regarding a reference response to a step. Here the reference response is given by

stepref = InverseLaplaceTransform[(a^2 + b^2)/((s + a)^2 + b^2)/s, s, t]

the actual step response is obtained as follows:

PID = kp + ki/s + s kd;
COPTER = 1/s^2;
model = COPTER PID/(1 + COPTER PID)
stepresponse = InverseLaplaceTransform[model/s, s, t];

then follows the minimization procedure

parms = {a -> 2, b -> 2};
tmax = 4;
n = 20;
stepref0 = stepref /. parms;
tab = Sum[Abs[stepresponse - stepref0], {t, 0, tmax, tmax/n}];
sol = NMinimize[{tab, kp > 0, ki > 0, kd > 0}, {kp, ki, kd}]
stepresponse0 = stepresponse /. sol[[2]]

Follows a plot showing in blue the reference response and in red the response found.

enter image description here

Answered by Cesareo on August 21, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP