Smart way to limit motions in Simulink model

16 views (last 30 days)
For a Simulink model of a vehicle moving back and forth along a track in response to environmental and motor forces, the motor force obeys a control algorithm that implements some mission objectives. But when the vehicle approaches/exceeds the position limit, the motor applies an additional force to push the vehicle back towards a neutral position (collision avoidance). In my model, this is implemented as (1) a Matlab function block using if/then to check if limits are exceeded and (2) a switch to apply a large opposing force if the position limits are exceeded. The unintended result is that the vehicle 'flutters' around the limit, eventually returning to the acceptable zone. The goal of the model is to track the applied motor force; however it may be ping-ponging between the mission and collision avoidance directives.
Is there a smarter way to implement collision avoidance in Simulink that might produce smoother behavior? This is a very simple model (ideal motor and vehicle).

Accepted Answer

Guy Rouleau
Guy Rouleau on 3 Apr 2012
Very good question.
I would say that it depends on what you mean by "smoother"
I see 2 options to implement limits:
- The Ideal: If you model your system using Integrator blocks, it should be possible to use the saturation to implement the 2 modes: free motion between the limits and frozen when outside the saturation. For an example of that, you can look at demos like "sf_electrohydraulics"; look at the "Integrator, Second-Order Limited" block modeling the piston. The bouncing ball demo is also implemented in a somehow similar way, using the reset port to bounce the ball up when it touches the ground. This modeling approach can make your model runs fast, but often this is not what I would call a "smooth" transition.
- The realistic: The other approach is to switch between 2 stiffness. An example of that is the Simscape hard-stop block. When reaching a limit, you do not reach a pure saturation, instead, you reach a very stiff spring and damper. In this case, the only way to avoid oscillations as you describe is to find a good damping value that will dissipate energy properly. To high, the system will be too stiff and take too small steps. Too low and the system will oscillate forever.
In this last case, it is important to use a stiff solver.
I hope this helps.
  4 Comments
K E
K E on 9 Apr 2012
Thanks so much Guy. I like the continuous function approach, but the other ideas are good eye openers too.
K E
K E on 25 Apr 2012
A good example of using tanh to transition between two discontinuous functions is here,
http://www.j-raedler.de/2010/10/smooth-transition-between-functions-with-tanh/

Sign in to comment.

More Answers (0)

Categories

Find more on Automotive Applications in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!