MATLAB: Is it possible to use Real-Time Workshop on a Simulink model containing blocks from the SimPowerSystems Blockset

circuitcompabilitypowerrealrtwSimscape Electricalsystemtime

I would like to know if the blocks used in the powerlib libraries are able to support the code generation available with the Real-Time Workshop. I would like to see the individual elements and labels of each of my powerlib blocks.

Best Answer

You can use the Real-Time Workshop on models that contain Power System blocks, however, there are a couple of caveats:
1. You will not see in the generated code the individual powerlib elements and labels. You will only see the equivalent State-Space representation of the elements that Simulink uses in its dynamic simulation. For more on how this representation is created, see following documentation by entering the following command in MATLAB:
web([docroot '\toolbox\physmod\powersys\powersys_product_page.html'])
2. Real-Time Workshop currently does not support the variable step stiff solvers that are often the most optimal for use with the SimPowerSystems Blockset. Therefore, code generated with Real-Time Workshop will currently have to use one of our fixed-step Solvers.
For Release 12 and higher:
------------------------------------------
If you are using Release 12 or higher of MATLAB (version 6.0) and version 2.0 or higher of the SimPowerSystems Blockset, you can discretize the power system portion of your Simulink model. This allows you to run fixed-step solvers on your model and, in turn, generate code through Real-Time Workshop with a fixed-step solver.
This capability also has the effect of removing (ignoring) aspects of your simulation that cause stiffness in the ODEs. Sometimes this is appropriate and sometimes it isn't. If discretizing your model works for your applications, then this methods can be used to generate code through Real-Time Workshop.
For more information on this, see pg. 1-22 of the Power System's User's Guide or enter the following at the MATLAB command prompt:
web([docroot '\toolbox\physmod\powersys\ug_coll.html'])