Simple PID Controller with Simulink

42 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.

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:
  10 Comments
Jeff Dillon
Jeff Dillon on 3 Oct 2022
Here is my first draft of the implementation, it will be interesting to compare actual vs simulated. I'm using ROS2 and UDP to compare latency. If ROS2 proves fast enough, I'll use it throughout.

Sign in to comment.

More Answers (0)

Categories

Find more on Communications Toolbox 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!