How to control two values from a matrix with one PID-controller?
Show older comments
Hi, is it possible to control two values (velocities) at once from one matrix with a PID-controller? In this task, there is a car accelerated with the force F. A trailer is coupled with the car by a spring (k). The car has a velocity v1 (shown in matrix C = [0 1 0 0]) and the trailer has a velocity v2 (shown in matrix C = [0 0 0 1]).
g = 9.81;
M1=1000; % mass car in kg
M2=1000; % mass trailer in kg
k=10; % spring constant in N/m
F=2600; % accelerating force in N
u=0.015; % friction constant in s/m
A=[ 0 1 0 0; % matrix with dynamic equations
-k/M1 -u*g k/M1 0;
0 0 0 1;
k/M2 0 -k/M2 -u*g];
B=[ 0;
1/M1;
0;
0];
C=[0 1 0 0
0 0 0 1]; %Graphs velocities
D=[0];
v=ss(A,B,C,D);
stepplot (v, 100)
title(' v1 und v2')
hold on
[Eigenwerte, Eigenvektoren] = eig (A)
%-----> the following does NOT work to control both velocities (car and trailer)
Kp=350;
Ki=300;
Kd=5000;
contr= Kp;
sys_cl= feedback (contr*v, 1);
t = 0: 0.0001: 100;
step(sys_cl,100)
Accepted Answer
More Answers (0)
Categories
Find more on PID Controller Tuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!