MATLAB Answers

How to Filter a Commanded Position to have Velocity and Acceleration Limits in Simulink

7 views (last 30 days)
Sonoma Rich
Sonoma Rich on 5 Oct 2021
Commented: Paul on 7 Oct 2021
I want to filter a commanded position signal to limit (saturate) its velocity and acceleration. I made the following model, but it has issue with the initial conditions and drift. If the signal is not saturated, I want it to equal the commanded position signal. Any suggestions on how to best model this?

Accepted Answer

Paul on 6 Oct 2021
I'm not sure that it's feasible to meet all of the stated requirements, particularly "If the signal is not saturated, [it should] equal the commanded position signal." One option that may be close to what you want is to drive the input through a high bandwidth, low pass filter, and use the appropriate thresholds on the states in the filter. Like this:
Set the velocity and the acceleeration limits in the block parameters of the second order integrator. Choose the gains to give a smooth and fast response relative to your input. One option would be:
K1 = w^3; K2 = 3*w/K1; K3 = 3*w^2/K1;
where w is chosen such w/3 is about 10 times larger than the largest frequency in the position command. You might have to play with that parameter for the specific position commands of interest.
This approach should yield position, velocity, and acceleration that are consistent with each other, but the position won't ever be exactly equal to the position command. It will get closer as w increases, which will also decrease the simulation step size, assuming use of a variable step solver.
Paul on 7 Oct 2021
I do think there will be some sensitivity of this approach to the gains, the thresholds, the input frequency, and the solver settings. If only interested in sine wave inputs, there might be a way to come up with a rule of thumb to set the gains based on the other parameters. For this particular example, I used:
w = 150*3; K1 = w^3; K2 = 3*w/K1; K3 = 3*w^2/K1;
and the result was
which doesn't look too bad. But the solution never did reach the acceleration saturation threshold. Increasing the gains yields
w = 3*150*3; K1 = w^3; K2 = 3*w/K1; K3 = 3*w^2/K1;

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!