Simple PID Controller with Simulink

92 views (last 30 days)
I want to develop a simple PID controller for hovering, please see the attachment. The mass M (10 lbs) will start at h0 = 0 and the goal is to hover at h (6’ for example). The input to the plant is the throttle (from 0 to 100%, 0 to 20 lbs thrust) and the output is the altitude. So the desired altitude is the reference value and the equation of motion is simply f=ma. Could someone help me with the Simulink diagram? This not a homework problem, I'm helping to develop a VTOL propulsion system with undergrad students at USC and this would help us to jumpstart the project.
  6 Comments
Jeff Dillon
Jeff Dillon on 29 Jul 2023
Edited: Jeff Dillon on 29 Jul 2023
@Aquatris Great suggestion. Also I'll probably need to convert to Newtons so 14 * 4.45. And this block would go just before the transfer function?
Aquatris
Aquatris on 30 Jul 2023
That kinda depends on the model of your system. For linear system with sufficiently fast response, the difference might be negligible. But there might be cases where the difference is significant, as when you put the block before the transfer function, the states of your system moves faster than the observed output (e.g., you apply step input to the system, the system output becomes 10 in 0.1 sec, the output takes 5 sec to reach that equilibrium due to rate limiter, you send 0 input 2 sec after the step input, at this point the rate limiter output value is around 4, and transfer function output is 10. within that 0.1 sec your transfer function takes to reach equlibrium, the observed output will still rise until your transfer function output is less than the observed output. Is this desired behaviour? If so then you should put it after transfer function, however if it is not, then you should put it before transfer function)

Sign in to comment.

Accepted Answer

Sam Chak
Sam Chak on 28 Sep 2022
Not a VTOL person, but from the free-body diagram, Newton's 2nd Law can be applied with the basic assumptions of relatively low altitude compared to the Earth radius, and air resistance is neglected. The basic equation of motion is given by
where the weight of VTOL system, . Rearranging that
.
Since the accelation of the VTOL is the second-order derivative of the altitude with respect to time, , then
.
Taking the Laplace transform with zero initial conditions, you get
which can be rearranged to obtain the transfer function from plant inputs to plant output
Here, is the command input and is the disturbance.
If can be accurately estimated, then you can design
to counter the effect of the disturbance, and is the PID thing that you need to design
m = 10*0.45359237; % mass of VTOL
g = -9.80665; % gravitational acceleration
W = m*g % weight of VTOL
W = -44.4822
Gp = tf(1, [m 0 0])
Gp = 1 --------- 4.536 s^2 Continuous-time transfer function.
Lmax = 20*4.4482216153; % max lift force available
Umax = Lmax + W % design limit for U(s) or output of Gu(s)
Umax = 44.4822
% Design of U(s)
Gc = pidtune(Gp, 'PIDF', 0.95)
Gc = 1 s Kp + Ki * --- + Kd * -------- s Tf*s+1 with Kp = 0.76, Ki = 0.0338, Kd = 4.2, Tf = 0.193 Continuous-time PIDF controller in parallel form.
Gcl = minreal(feedback(Gc*Gp, 1))
Gcl = 4.961 s^2 + 0.8757 s + 0.03861 ------------------------------------------------ s^4 + 5.181 s^3 + 4.961 s^2 + 0.8757 s + 0.03861 Continuous-time transfer function.
Gu = minreal(feedback(Gc, Gp))
Gu = 22.5 s^4 + 3.972 s^3 + 0.1752 s^2 ------------------------------------------------ s^4 + 5.181 s^3 + 4.961 s^2 + 0.8757 s + 0.03861 Continuous-time transfer function.
t = linspace(0, 50, 5001);
hd = 6*0.3048; % desired altitude
u = hd*heaviside(t);
% Check if output of Gcl tracks hd
lsim(Gcl, u, t), grid on
% Check if output of Gu exceeds 44.4822
lsim(Gu, u, t/10), grid on
The Simulink model should look like this:
  34 Comments
Jeff Dillon
Jeff Dillon on 17 Jul 2023
Edited: Jeff Dillon on 17 Jul 2023
@Sam Chak Your reply (including others, now deleted) are not relevant. I've explained in good detail regarding the input/response behavior of a jet engine. You don't need to know how it works for the same reason you don't need to know how a battery works at the electro-chemical level in order to model it's behavior. I'm not looking for a ramp controller. I simply stated that the throttle response of the jet turbine is slow. It's exactly like turning on a heater (with a step input) and the heater takes 7 seconds to warm up to full temperature, linearly. Or when you step on the gas in an automobile, it takes 7 seconds to achieve full speed. I need a PID controller that ACCOMODATES this response behavior, not induces it. And you ignored my last comment regarding the use of EDF's and apparently did not view the video I shared, the problem now allows instantaneous response using electric fans, similar to a quadcopter controller. The jet engine can be completely ignored, it's only used in steady state to offset the majority of the vehicle mass with the remainder of the control done by the electric fans. Google for "EDF electric ducted fan"
Jeff Dillon
Jeff Dillon on 19 Jul 2023
@Sam Chak I get that you may be a little embarrassed on your misunderstanding of the problem statement and is why you removed your posts, hopefully it's clear now! Is there anyone else at Mathworks that you can ask? You had presented a non-linear MATLAB method previously that would likely apply, however you were not able to show it in the context of an updated Simulink model. It's ok. FYI, I'm following the course here http://apmonitor.com/pdc/index.php/Main/ArduinoTemperatureControl on Control Systems, hopefully I'll be able to answer my own questions in due time! Thanks for your help so far.

Sign in to comment.

More Answers (0)

Categories

Find more on General Applications in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!