MATLAB: Are S-Functions compatible with Simscape or other Physical Modeling Tools

SimscapeSimscape DrivelineSimscape ElectronicsSimscape FluidsSimscape Multibody

I would like to develop my own custom blocks to interact with SimScape blocks and associated physical modeling tools (SimMechanics, SimHydraulics, etc). I would like to know if S-Functions can be written to work with these products.

Best Answer

You can connect blocks created from S-Functions to Simscape networks. The interface is done via Simulink signals. This will be OK for certain types of models or effects (calculating a spring force, for example). For others, it will introduce an algebraic loop which you will have to break using a transfer function or a unit delay.
If at all possible, you should consider using the Simscape language or assembling your component from the Foundation library. This will ensure you have a block that can be easily connected into your physical model, will permit Simscape to use symbolic methods to reduce the equations, and provide good diagnostics during simulation.
You can find out more about the Simscape Language here:
--Steve