MATLAB: Is it possible to specify discrete sample time in a subsystem containing blocks from SimMechanics 2.4 (R2006a)

continuouscontrollerdiscreteplants-functionsamplesimmechanicsSimscape Multibodystatetime

I have a Simulink model which consists of a "Controller" subsystem and a "Plant" subsystem. The Controller consists of mainly Simulink blocks and the Plant consists of SimMechanics blocks.
I want to use Rate-Transition blocks to specify the rate between the controller unit and the plant unit, i.e., I require my Plant subsystem to run at a rate much slower than the Controller unit and hence want to specify a discrete sample time for this subsystem.

Best Answer

It is not possible to specify discrete sample time for a subsystem consisting of blocks from SimMechanics 2.4 (R2006a). This is because SimMechanics reduces the physical model (represented by the Physical Modeling blocks) into an equivalent state space system containing only continuous states. This requires the subsystem to operate at continuous sample time. Hence you cannot specify a discrete sample time for the subsystem block or by using Rate-Transition blocks.
To work around this issue, you can create an S-function for the plant subsystem containing SimMechanics blocks using the S-function Target and then specify a discrete sample rate to this S-function block.