Stateflow    

Stateflow and Simulink Design Approaches

You can design a model starting with a Stateflow (control) perspective and then later build the Simulink model. You can also design a model starting from a Simulink perspective and then later add Stateflow diagrams. You might have an existing Simulink model that would benefit if you replace Simulink logic blocks with Stateflow diagrams. The approach you use determines how, and in what sequence, you develop various parts of the model.

Stateflow and Simulink Build Simulation (sfun) Targets

The collection of all Stateflow blocks in the Simulink model is a machine. When you use Simulink together with Stateflow for simulation, Stateflow generates an S-function (MEX-file) for each Stateflow machine to support model simulation. This generated code is a simulation target and is called the sfun target within Stateflow.

Stateflow, Simulink and RTW Build RTW (rtw) Targets

Stateflow Coder generates integer or floating-point code based on the Stateflow machine. Real-Time Workshop (RTW) generates code from the Simulink portion of the model and provides a framework for running generated Stateflow code in real time. The code generated by Stateflow Coder is seamlessly incorporated into code generated by Real-Time Workshop. You might want to design a solution that targets code generated from both products for a specific platform. This generated code is specifically a Real-Time Workshop target and within Stateflow is called the RTW target.

Stateflow Builds Stand-Alone Custom Targets

Using Stateflow and Stateflow Coder you can generate code exclusively for the Stateflow machine portion of the Simulink model. This generated code is for stand-alone custom targets, which you uniquely name as something other than sfun and rtw in Stateflow.


  Stateflow Works with Simulink and Real-Time Workshop Quick Start