Main Content

Multirate Output Feedback Control of Rotary Flexible Link System

R2026b
Since R2026b

This example shows how to control a rotary flexible link system using a multirate output feedback (MOF) approach where the rate at which the output is sampled is different from the rate at which the control input is applied. The example also shows how to estimate the system states by combining the asynchronously sampled output data with the control inputs. The controller uses these estimated states to achieve the desired system performance. This multirate configuration closely resembles practical digital-control scenarios where output sensing and actuation occur asynchronously.

Additionally, this example shows the implementation of an observer-based control strategy where you estimate the system states using a Kalman filter.

Rotary Flexible Link System

In the rotary flexible link system, the base of the flexible link is mounted on the load gear of the rotary servo system. The control input for the system is the servo motor voltage V. This voltage generates a torque τ at the load gear of the servo, which in turn rotates the base of the link. This servo experiences viscous friction, characterized by the coefficient Beq, which opposes the applied torque at the load gear. The servo has a moment of inertia Jeq about the pivot joint.

The flexible link is modeled as a linear spring with stiffness Ks and is subject to viscous damping, characterized by the coefficient Bl. This link has a total length Ll, a mass ml, and a moment of inertia Jl about the pivot joint.

When the control input is negative, that is, V<0, the servo and the flexible link rotate in the clockwise direction due to the resulting torque. Consequently, the servo angle θ and the deflection angle of the link α decrease. In this example, you design a controller to achieve these objectives:

  • Control the servo position to track a desired reference angle.

  • Minimize the deflection of the flexible link as the servo changes positions.

Rotary flexible link system showing the servo angle and the link deflection angle

These are the values for the parameters of the rotary flexible link system.

Parameter

Value

Beq

0.004 Nmrad/s

Jeq

2.08e-3 kgm2

ml

0.065 kg

Ll

0.419 m

Ks

1.71 Nm/rad

Jl

0.00381 kgm2

The state x and output y variables of this system are defined as

x=[θαθ˙α˙]y=[θα], where

  • θ is the servo angular position.

  • θ˙ is the servo angular velocity.

  • α is the link deflection angle.

  • α˙ is the rate of link deflection.

The control input u is the servo motor voltage V. The dynamics of the system in the state-space form is given by

x˙=Ax+Buy=Cx+Du, where

A=[001000010KsJeq-BeqJeq00-Ks(Jl+Jeq)JlJeqBeqJeq0], B=[001Jeq-1Jeq], C=[10000100], D=[00].

To create this rotary flexible link system, first specify all parameter values. Then, calculate the matrices A, B, C, and D. You will use these matrices later in this workflow.

Beq  = 0.004;    % N.M/(rad/s)
Jeq  = 2.08e-3;  % Kg.m^2
ml   = 0.065;    % Kg
Ll   = 0.419;    % m
Ks   = 1.71;     % Nm/rad
Jl   = 0.00381;  % Kg.m^2 

A=[0 0 1 0;0 0 0 1;0 Ks/Jeq -Beq/Jeq 0;0 -Ks*(Jl+Jeq)/(Jl*Jeq) Beq/Jeq 0];
B=[0;0;1/Jeq;-1/Jeq];
C=[1 0 0 0;0 1 0 0];
D=[0;0];

Fast Output Sampling Based Control

One technique for MOF control is fast output sampling (FOS). In FOS, the rate at which you sense the output is faster than the rate at which you apply the control input.

You can use FOS only with a system that is both controllable and observable. The system used in this example is controllable and observable.

If you use different parameter values, then to proceed further with this workflow, first check whether the system is controllable and observable by using the rank command.

if rank((ctrb(A,B)))~=4
    disp("The system is not controllable. This method cannot be used.");
end
if rank(obsv(A,C))~=4
    disp("The system is not observable. This method cannot be used.");
end

Calculate States

A discrete-time system sampled at τ seconds is given by:

x(k+1)=G1x(k)+H1u(k)y(k)=Cx(k)

Similarly, a discrete-time system sampled at δ seconds is given by:

x(k+1)=G2x(k)+H2u(k)y(k)=Cx(k)

Here, G1 and G2 are system matrices and H1 and H2 are input matrices for the corresponding systems.

The combined discrete-time MOF system is represented as:

x(k+1)=G1x(k)+H1u(k)y(k+1)=C0x(k)+D0u(k), where y(k)=[y((k-1)τ)y((k-1)τ+δ)..y(kτ-δ)] is a column vector containing N outputs from sampling time (k-1)τ to kτ-δ,

C0=[CCG2..CG2N-1], and D0=[0CH2..CΣi=0N-2G2iH2].

The states of the system are represented as a function of past control and present output column vector as

x(k)=Lyy(k)+Luu(k-1), where

Ly=G1(C0TC0)-1C0T and Lu=H1-LyD0.

To represent the states in this form, first create a continuous-time state-space model object using ss (Control System Toolbox).

plantConts=ss(A,B,C,D);

Then, discretize the defined continuous state-space system using c2d (Control System Toolbox). Apply the control input every τ=0.001 seconds and sample the output every δ seconds, where δ=τ/N and Nis a number greater than or equal to the observability index of the system. For this example, specify N as 4. Obtain two discrete-time systems using two different sample times.

tau=0.001;
N=4;
delta=tau/N;
plantDiscreteTau=c2d(plantConts,tau);
plantDiscreteDelta=c2d(plantConts,delta); 

Extract the state and input-to-state matrices from both of the discretized systems.

G1=plantDiscreteTau.A;
H1=plantDiscreteTau.B;
G2=plantDiscreteDelta.A;
H2=plantDiscreteDelta.B;

Finally, calculate the matrices C0 and D0 and in turn calculate Ly and Lu.

C0=[C;C*G2;C*G2*G2;C*G2*G2*G2];
D0=[zeros(size(C,1),1);C*H2;C*G2*H2;C*G2^2*H2];
Ly=G1*inv(C0'*C0)*C0';
Lu=H1-(Ly*D0);

Design Controller

To design a linear-quadratic regulator (LQR) controller, calculate the optimal gain matrix Kf of the closed-loop system by using lqr (Control System Toolbox).

Q=diag([1.8 1 1 0.1]);
R=1;
Kf=lqr(A,B,Q,R);

Simulate Model

To activate FOS in the Simulink® model, set the variant parameter FastOutputSwitchingControl to 1 and the variant parameter ObserverbasedControl to 0.

FastOutputSwitchingControl=1;
ObserverbasedControl=0;  

Open the model. Specify the solver type by using the SolverType configuration parameter. Update the model by using the SimulationCommand configuration parameter.

open_system("flexibleManipulatorMROF.slx");
set_param("flexibleManipulatorMROF","SolverType","Fixed-step");
set_param("flexibleManipulatorMROF","SimulationCommand","update");

Simulink model of the rotary flexible link system with an FOS-based LQR controller.

This model calculates states using FOS. The output and control input are sampled at different rates. The model shows the difference in the rates using different colors and labels. It shows the output sensing rate using red with the label D1. It shows the control input rate using green with the label D2. The error in θ is measured continuously.

The FOS-based LQR Controller subsystem uses the gain K=Kf. The sample time for the control input is set to τ seconds.

Block diagram of the FOS-based LQR controller. The control input sample time is set to tau seconds, where tau = 0.001.

In the Rotary Flexible Link subsystem, the sample time of the plant output is set to δ seconds, which is different from the sample time of the control input.

Block diagram of the Rotary Flexible Link subsystem. The plant output sample time is set to delta seconds, where delta = tau/N.

The State Calculation subsystem estimates the states by using FOS. The subsystem uses K=Ly as the gain for the plant output and K=Lu as the gain for the control input.

State Calculation subsystem showing different sample rates for plant output and control input by using different colors

Simulate the model.

out= sim("flexibleManipulatorMROF.slx");

Figure Rotary Flexible Link Manipulator Animation contains an axes object and other objects of type uicontrol. The axes object with xlabel X, ylabel Y contains 8 objects of type rectangle, line. One or more of the lines displays its values using only markers

In the Rotary Flexible Link Manipulator animation, the red dotted line represents the servo reference angle θ. The blue line represents the flexible link and the black line represents how the link would behave if it were a rigid body.

Plot the servo reference angle θ and the measured output angle θ over time by using the stairs command. The FOS-based controller tracks the reference angle well.

figure;
stairs(out.tr.time,out.tr.signals(1).values,"r:",LineWidth=1.5);
hold on;
stairs(out.tr.time,out.tr.signals(2).values,"b",LineWidth=1.5);
grid on;
axis([0 30 -2.5 2.5]);
xlabel("Time (sec)");
ylabel("Reference and Measured \theta (rad)");
legend("Reference \theta","Measured \theta",Location="northwest");
title("Trajectory tracking of Reference \theta using FOS-Based Controller");

Figure contains an axes object. The axes object with title Trajectory tracking of Reference theta using FOS-Based Controller, xlabel Time (sec), ylabel Reference and Measured theta (rad) contains 2 objects of type stair. These objects represent Reference \theta, Measured \theta.

Plot the measured output angle α. Whenever the servo angle changes, the deflection angle α increases temporarily before the controller reduces it back to zero.

figure;
stairs(out.alpha.time,out.alpha.signals.values,"b");
grid on;
xlabel("Time (sec)");
ylabel("\alpha (rad)");
title("Deflection, \alpha using FOS-Based Controller");

Figure contains an axes object. The axes object with title Deflection, alpha using FOS-Based Controller, xlabel Time (sec), ylabel alpha (rad) contains an object of type stair.

Compare the measured output states θ and α with the estimated states θ and α.

figure;
tiledlayout(2,1);
nexttile;
stairs(out.logsout{1}.Values.Time,out.logsout{1}.Values.Data(:,1),"b",LineWidth=1.5);
hold on;
stairs(out.logsout{2}.Values.Time,out.logsout{2}.Values.Data(:,1),"r:",LineWidth=1.5);
grid on;
xlabel("Time in Seconds");
ylabel("Measured \theta and Estimated \theta");
legend("Measured \theta","Estimated \theta",Location="southwest");
title("Estimation of \theta using FOS");
hold off;
nexttile;
stairs(out.logsout{1}.Values.Time,out.logsout{1}.Values.Data(:,2),"b",LineWidth=1.5);
hold on;
stairs(out.logsout{2}.Values.Time,out.logsout{2}.Values.Data(:,2),"r:",LineWidth=1.5);
grid on;
xlabel("Time in Seconds");
ylabel("Measured \alpha and Estimated \alpha");
axis([0 30 -0.3 0.3]);
legend("Measured \alpha","Estimated \alpha",Location="southwest");
title("Estimation of deflection \alpha using FOS");
hold off;

Figure contains 2 axes objects. Axes object 1 with title Estimation of theta using FOS, xlabel Time in Seconds, ylabel Measured \theta and Estimated \theta contains 2 objects of type stair. These objects represent Measured \theta, Estimated \theta. Axes object 2 with title Estimation of deflection alpha using FOS, xlabel Time in Seconds, ylabel Measured \alpha and Estimated \alpha contains 2 objects of type stair. These objects represent Measured \alpha, Estimated \alpha.

For both θ and α, the estimated state closely aligns with the measured output state, so the estimated state is accurate.

Observer Based Control

In contrast to FOS, in the observer-based control strategy, you continuously sample the output and control input and estimate the states by using a state observer.

Calculate States

In this control strategy, you estimate states by using a Kalman filter, which serves as a state observer. For more information, see Kalman Filter (Control System Toolbox).

Design Controller

To design a linear-quadratic regulator (LQR) controller, calculate the optimal gain matrix Ko of the closed-loop system using lqr (Control System Toolbox).

Ko=lqr(A,B,Q,R);

Simulate Model

To activate observer-based control in the Simulink model, set the variant parameter FastOutputSwitchingControl to 0 and the variant parameter ObserverbasedControl to 1.

FastOutputSwitchingControl = 0;
ObserverbasedControl = 1;

Open the model. Specify the solver type and update the model.

set_param("flexibleManipulatorMROF","SolverType","Variable-step");
set_param("flexibleManipulatorMROF","SimulationCommand","update");

Simulink model of the rotary flexible link system with an observer-based LQR controller.

This model calculates states using a Kalman filter. The plant output, the control input, and the error in the servo angle θ are all sampled continuously.

The observer-based LQR Controller subsystem uses the gain K=Ko.

Block diagram of the observer-based LQR controller.

In the Rotary Flexible Link subsystem, the control input and the plant output are both sampled continuously, as reflected in the top-level Simulink model.

Block diagram of the Rotary Flexible Link subsystem.

The State Calculation subsystem estimates the states using a Kalman Filter block.

State Calculation subsystem

Simulate the model.

out1= sim("flexibleManipulatorMROF.slx");

Figure Rotary Flexible Link Manipulator Animation contains an axes object and other objects of type uicontrol. The axes object with xlabel X, ylabel Y contains 8 objects of type rectangle, line. One or more of the lines displays its values using only markers

Plot the servo reference angle θ and the measured output angle θ over time using the stairs command. The observer-based controller tracks the reference servo angle well.

figure;
stairs(out1.tr.time,out1.tr.signals(1).values,"r:",LineWidth=1.5);
hold on;
stairs(out1.tr.time,out1.tr.signals(2).values,"b",LineWidth=1.5);
grid on;
axis([0 30 -2.5 2.5]);
xlabel("Time in Seconds");
ylabel("Reference and Measured \theta");
legend("Reference \theta","Measured \theta",Location="northwest");
title("Tracking of Reference \theta using an Observer–Based Controller");

Figure contains an axes object. The axes object with title Tracking of Reference theta using an Observer–Based Controller, xlabel Time in Seconds, ylabel Reference and Measured theta contains 2 objects of type stair. These objects represent Reference \theta, Measured \theta.

Plot the measured output angle α. Whenever the servo angle changes, the deflection angle α increases temporarily before the controller reduces it back to zero.

figure;
stairs(out1.alpha.time,out1.alpha.signals.values,"b");
grid on;
xlabel("Time in Seconds");
ylabel("\alpha");
title("Deflection, \alpha using an Observer-Based Controller");

Figure contains an axes object. The axes object with title Deflection, alpha using an Observer-Based Controller, xlabel Time in Seconds, ylabel alpha contains an object of type stair.

Compare the measured output states θ and α with the estimated states θ and α. The measured and estimated states are almost the same, which indicates that the Kalman filter estimates the states accurately.

figure;
tiledlayout(2,1);
nexttile;
stairs(out1.logsout{1}.Values.Time,out1.logsout{1}.Values.Data(:,1),"b:",LineWidth=1.5);
hold on;
stairs(out1.logsout{2}.Values.Time,out1.logsout{2}.Values.Data(:,1),"r:",LineWidth=1.5);
grid on;
xlabel("Time in Seconds");
ylabel("Measured \theta and Estimated \theta");
legend("Measured \theta","Estimated \theta",Location="southwest");
title("Estimation of \theta using an Observer–Based Controller");
hold off;
nexttile;
stairs(out1.logsout{1}.Values.Time,out1.logsout{1}.Values.Data(:,2),"b:",LineWidth=1.5);
hold on;
stairs(out1.logsout{2}.Values.Time,out1.logsout{2}.Values.Data(:,2)',"r:",LineWidth=1.5);
grid on;
axis([0 30 -0.3 0.3]);
xlabel("Time in Seconds");
ylabel("Measured \alpha and Estimated \alpha");
legend("Measured \alpha","Estimated \alpha",Location="southwest");
title("Estimation of deflection \alpha using an Observer–Based Controller");
hold off;

Figure contains 2 axes objects. Axes object 1 with title Estimation of theta using an Observer–Based Controller, xlabel Time in Seconds, ylabel Measured \theta and Estimated \theta contains 2 objects of type stair. These objects represent Measured \theta, Estimated \theta. Axes object 2 with title Estimation of deflection alpha using an Observer–Based Controller, xlabel Time in Seconds, ylabel Measured \alpha and Estimated \alpha contains 2 objects of type stair. These objects represent Measured \alpha, Estimated \alpha.

Comparison of Both Approaches

Plot the following over time: the reference θ, the θ that you measured using FOS-based control, and the θ that you measured using observer-based control. Compare how the two techniques perform at tracking the reference θ.

figure;
stairs(out1.tr.time,out1.tr.signals(1).values,"k",LineWidth=1.5);
hold on;
stairs(out1.tr.time,out1.tr.signals(2).values,"b",LineWidth=1.5);
stairs(out.tr.time,out.tr.signals(2).values,"r:",LineWidth=1.5);
grid on;
axis([0 30 -2.5 2.5]);
xlabel("Time in Seconds");
ylabel("Reference and Measured \theta");
legend("Reference \theta","\theta using Kalman filter","\theta using FOS",Location="northwest");
title("Comparison of tracking performance using both techniques");

Figure contains an axes object. The axes object with title Comparison of tracking performance using both techniques, xlabel Time in Seconds, ylabel Reference and Measured theta contains 3 objects of type stair. These objects represent Reference \theta, \theta using Kalman filter, \theta using FOS.

Plot the following over time: the deflection α that you measured using FOS-based control, and the deflection α that you measured using observer-based control. Compare how the two techniques perform at bringing the deflection back to 0.

figure;
stairs(out1.alpha.time,out1.alpha.signals.values,"b",LineWidth=1.5);
hold on;
stairs(out.alpha.time,out.alpha.signals.values,"r:",LineWidth=1.5);
grid on;
axis([0 30 -0.3 0.3]);
xlabel("Time in Seconds");
ylabel("\alpha");
legend("\alpha using Kalman filter","\alpha using FOS",Location="northwest");
title("Comparison of deflection performance using both techniques");

Figure contains an axes object. The axes object with title Comparison of deflection performance using both techniques, xlabel Time in Seconds, ylabel alpha contains 2 objects of type stair. These objects represent \alpha using Kalman filter, \alpha using FOS.

Both the techniques perform well at tracking the reference angle and bringing the deflection back to 0. The primary distinction between both these approaches lies in state estimation. The observer in FOS uses multirate simulation to estimate the system states in finite time while the Kalman filter achieves state estimation only asymptotically.

References

[1] Janardhanan, S., and B. Bandyopadhyay. “Discrete Sliding Mode Control of Systems With Unmatched Uncertainty Using Multirate Output Feedback.” IEEE Transactions on Automatic Control 51, no. 6 (2006): 1030–35. https://doi.org/10.1109/TAC.2006.876810.

See Also

Functions

  • (Control System Toolbox) | (Control System Toolbox) | (Control System Toolbox)

Blocks