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

actuation modesimmechanics

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!

Best 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
Related Question