Engineers who use Simulink® and Stateflow® within Model-Based Design often need to integrate state machines and control logic designed in Stateflow with Simulink blocks, subsystems, and components. Common tasks include calling a Lookup Table block from Simulink to perform interpolation on a specific Stateflow variable. Stateflow is often used to enable or disable Simulink subsystems that represent specific tasks, such as startup and shutdown, or individual controller types. Another common procedure involving both Simulink and Stateflow is controlling the behavior of system components, such as the guidance and navigation system of an airplane or a set of sensors located in an automobile.
To complete tasks and procedures like these requires a seamless interface between Simulink and Stateflow. Starting with R2008b, Stateflow users can create and embed Simulink functions directly inside their Stateflow charts. This article reviews three design patterns for using Simulink functions inside Stateflow: modeling algorithms, scheduling tasks and controllers, and controlling components.
By Michael Carone, The MathWorks
This article was published in MATLAB Digest, January 2009