In SimMechanics, can we have an actuator that has the ability to change its actuation modes online?

In SimMechanics, it seems that each actuator can have only one actuation mode, i.e., passive, motion-actuation or force actuation. Usually, we set actuation modes for all the actuators then we run the simulation. Can we have an actuator that has the ability to change its actuation modes automatically during the simulation? Many thanks!

 Accepted Answer

You cannot change the actuation mode mid-simulation because SimMechanics generates all the equations when the model updates prior to simulation.
There is, however, a workaround that you could use. There is a functionality in Simulink called SimState, in which the values of all the system's states are saved at the end of simulation. Then, you can start the next simulation with those states that you previously saved.
So, you could run one simulation with force actuation, save the final states, change to motion actuation, and run the simulation with those saved states.
Note that I haven't tried this. It may be the case that changing the actuation mode actually changes the number of states in your system, thus making it incompatible. If not, then you'll likely still have to be careful that the states at the end of the first simulation match with the initial conditions of the second simulation. For example, I don't think Simulink would like it if you made the mechanical system "teleport" between simulations.
Maybe give that a try with a simple model (like a pendulum) to see if it works first.
- Sebastian

1 Comment

Hi Sebastian, thank you very much. I have tried to use SimState, but I failed. Since the system blocks in the two states are different, some errors are generated during the compilation process. It is a pity that variant subsystems cannot be used to connect two frames in SimMechanics. One potential solution is to use force control, by adjusting the force, the joint may change its state between actuation and passive. However, it is hard to ensure the motions of a joint by controlling the input force. Can I get the source code that describes the relation between the motion and applied force of an actuator block?

Sign in to comment.

More Answers (0)

Categories

Find more on General Applications in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!