MATLAB: Does the SimPowerSystems 4.5 (R2007b) S-Function Block execute slower than the normal Simulink Model

extraguiheiarchypowers-functionSimscape Electricalsimulinksimulink coderslowsteps;time

I have created a SimPowerSystems model and it executes at reasonable times in Normal and Accelerator mode. However, once I create a subsystem into S-Function block for encryption purposes, the model has a significantly longer simulation time.

Best Answer

The performance issues are likely to be a result of different solver settings. The generated S-Function is using the solver setting in Simulink's configuration parameters if the PowerGUI is not included in the subsystem. This can be verified by observing the order of the magnitude of time steps during simulation.
To resolve this issue please place the PowerGUI inside the subsystem prior to generating the S-Function. This will properly set the right solver for the S-Function to the one specified in PowerGUI.
In SimPowerSystems 5.1 (R2009a), an error message will be displayed for creating a S-Function from SimPowerSystem subsystem without a PowerGUI.