Clear Filters
Clear Filters

Inverse model for feedforward control

6 views (last 30 days)
Martin
Martin on 10 Jun 2024
Commented: Martin on 14 Jun 2024
Hello,
I want to implement a feedforward control for good trajectory tracking (feedback path for disturbance rejection comes afterwards).
The system model is an electrical RL-circuit in series with a voltage source. (schematics).
I determined the continuous transfer function to be:
The inverse of this is
(I know that this transfer function can not be realized in physical systems since, but I would hope that simulink lets me simulate the ideal system).
If I combine G^-1 and G in simulink, I would expect to obtain ideal trajectory tracking, because G^-1 * G = 1
However the following model only achieves ideal tracking, if I add a factor of 6 at the marked position. (R=3, L - 0.004, solver is fixed step ode4, 1e-4s stepsize)
Why do I need to add a factor of 6 there?

Accepted Answer

Sam Chak
Sam Chak on 14 Jun 2024
In my previous Answer, I used to Transfer Function (frequency version) to describe the process plant. I have revisited the problem and built a continuous-time version of the process plant model and implemented your proposed feedforward controller in Simulink.
Here, I have intentionally set the initial value of the current, , to 1 in order to assess how quickly the controller is able to drive the system's output to track the desired reference sine wave, .
From the Differential Equation form
,
the ODE is rearranged
to become the Integral Equation form
because the Integrand is the input signal to the Integrator block.
Figure 1: Block diagram
Figure 2: The actual current signal (yellow) quickly tracks the desired current signal (blue).
  1 Comment
Martin
Martin on 14 Jun 2024
Thank you. This is in principle the same structure as in my question. The fact that it works for you, led me to revisit my initial model and I found that choosing a different solver results in different solutions.
This was an indication that there was some kind of modelling error. In fact the rate transition in the original screenshot was causing the unexplained behavior. Removing it leads to comparable results for all solvers.
Summary: The calculation for inverting the plant to implement a feed forward path was correct. The unexplained factor of 6 was compensating a modelling error and is not needed when modelling is correct.

Sign in to comment.

More Answers (3)

Sam Chak
Sam Chak on 11 Jun 2024
Transfer function:
Math model in continuous-time:
This linear 1st-order ODE is 100% solvable and the ideal feedforward control law will be in the form of the Lambert 𝒲 function (but usually not taught in the first course in Differential Equations).
However, given that the RL circuit is stable and the value of the inductance L is relatively small, you can approximate the ideal feedforward control law simply as .
tspan = [0 0.1];
I0 = 1;
[t, I] = ode45(@RLcircuit, [0 0.1], I0);
plot(t, I), grid on, xlabel('t'), ylabel('I(t)')
%% RL circuit
function dI = RLcircuit(t, I)
% Parameters
L = 0.004;
R = 3;
% input Voltage
Vin = R; % Since L ≈ 0, G^{-1} ≈ R
% ODE
dI = (Vin - R*I)/L;
end
  1 Comment
Martin
Martin on 11 Jun 2024
Thank you for your answer. However the target trajectory for this system has frequency components in the close of the the time constant of the system. Therefore I would like to compensate the time constant of the plant as good as possible.

Sign in to comment.


Sam Chak
Sam Chak on 12 Jun 2024
As the target trajectory contains frequency components, a factor of 600, rather than 6, must be employed in this secondary solution to effectively track the sinusoidal target, which has a period of 1 second, or a frequency of 1 Hertz.
tspan = [0, 1];
I0 = [0; 0];
[t, x] = ode45(@RLcircuit, tspan, I0);
plot(t, [x(:,1), sin(2*pi*t)]), grid on, xlabel('t'), ylabel('I(t)')
legend('Actual I(t)', 'Desired I(t)', 'fontsize', 12)
%% RL circuit
function dx = RLcircuit(t, x)
% states
x1 = x(1); % current I(t)
x2 = x(2); % internal state
% Parameters
L = 0.004;
R = 3;
K = 600; % tune this parameter only!
% input Voltage
ref = sin(2*pi*t); % sinusoidal reference signal
err = ref - x1; % error
Vin = 1*x2 + K*L*err; % input Voltage signal
% ODE
dx = [(Vin - R*x1)/L;
K*R*err];
end
  1 Comment
Martin
Martin on 13 Jun 2024
While this produces an acceptable tracking for the shown frequency, this is a steady-state feedforward path with a P-controller in the feedback path.
The original question however was how to implement a pure feedforward path, which not only compensates the steady-state behaviour, but also the transient behavior.

Sign in to comment.


Sam Chak
Sam Chak on 13 Jun 2024
Thanks for your feedback in the comment. The provided first-order ODE:
,
suggests that the "pure" feedforward control voltage signal could be designed as:
.
This approach would theoretically compensate for the transient behavior by accounting for the time derivative of the current. However, while you can pull this off in Simulink, accurately measuring the time derivative of the current may present practical challenges that would need to be addressed in the real-time implementation.
Figure 1: Block diagram
Figure 2: The desired current signal (blue) perfectly overlaps with actual current signal (yellow).

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!