How to control two values from a matrix with one PID-controller?

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)

 채택된 답변

Arkadiy Turevskiy
Arkadiy Turevskiy 2012년 6월 15일
what do you mean when you say "control two velocities". You can have a PID controller on car speed or trailer speed that would bring both speeds to the same desired level in steady state.
D=zeros(2,1);
v=ss(A,B,C,D);
contr=pidtune(v(1,1),'pid');
feedin=[1];
feedout=[1];
ol=contr*v;
cloop=feedback(ol,1,feedin,feedout);
step(cloop(1,:));
hold on;
step(cloop(2,:),'r');
legend('car speed','trailer speed');

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Control System Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by