S-functions in Simulink allow the user to implement C code within an external file for his model following a strict syntax. An S-function is called inline when the C is written in a tlc file. This case is fully transparent to the user.
For the other cases where the S-function is non-inline, the user has to follow these actions to succeed in importing his model to HYPERSIM:
If the non-inline S-function is embedded in the SPS library (Simscape Power Systems) as Discrete Transport Delay, it’s transparent for the user and there is nothing to do.
For others:
- Only .c files are supported for S-function in the HYPERSIM importation.
- Put the .c external file in the same directory of the model .slx or .mdl.
- Before running the model which contains the S-function in Simulink, do mex fileSfunction.c.
- Then proceed with the HYPERSIM importation method described in “Importing a Simulink model in HYPERSIM”.