Model-Based Design – Things to Know
Matlab Simulink and Stateflow based model design
The availability of sophisticated tools and new development techniques has provided great support to control engineers in overcoming these challenges. For instance, the model-based control design software, such as Matlab's Simulink and Stateflow, helps control engineers to recognize problems early on and reduce risk. With built-in mathematical functions and routines these tools are optimized for designing and analyzing control strategies through off-line simulation. Moreover these tools can be integrated with real-time hardware which means integrating traditional off-line simulation with real-world testing.
- Elimination of errors early in the design
- Robust control system
- Fewer iterations in the development cycle
- Reduced development time and cost
Design validation using Simulink simulation
Simulink facilitates designing of the control algorithm and also helps in executing off-line simulation on the desktop. But it doesn't mean that with software simulations all the distinctive behaviors of an actual dynamic environment can be accounted for.
Code Generation using RealTime Workshop or TargetLink
Tools such as Matlab's Real-Time Workshop (RTW) or dSPACE's Targetlink helps to create the prototype as well as the production code directly from the control design models. The greatest advantage of this process is the significant time and cost savings thanks to the inherent reproducibility and testability of the generated code.
Model-In-Loop validation (MIL)
The Model-in-the-loop simulation captures the specified behavior of the model that is to be implemented in C code later on. These simulated results are validated with the requirements. Also it acts as the verification reference for the next stages of development cycle. Since the model acts as the design document, it reduces the defects slippage due to translation of requirements to design.
Software-In-Loop validation (SIL)
The Software-in-the-loop simulation captures the behavior of the generated C code in simulator environment of the target controller. The simulated results when validated with the simulated Model-in-the-Loop simulation results both the results should be identical. If found otherwise the results can be used to evaluate the cause of deviation.
Automated Testing using Reactis, Embedded Tester, WinAMS, HEW Testing Tools
In the case of Simulink/Stateflow models the Software-in-the-loop simulation is improved by creating test cases using Reactis/Embedded Tester. These test cases not only simulate Simulink/Stateflow but also generate C code. This C code is then tested in WINAMS or HEW environment.
Hardware-In-Loop validation (HIL)
In hardware-in-the-loop (HIL) testing, the designer can verify the production system controller by simulating the real-time behavior and characteristics of the final system without the physical hardware or operational environment. While the system is simulated in real-time on a test computer the control code can be run on the target controller hardware. Though it is possible to connect the target hardware with the actual engine, testing against a simulated engine offers several advantages. When compared to a physical plant, a desktop simulator, often called a hardware-in-the-loop (HIL) tester, is far more cost-efficient, and easier to reproduce. The simulated engine also can simulate a variety of operating conditions or even fault conditions, such as engine stall, that would be difficult, costly, and/or dangerous with the actual plant. If measured data from HIL simulation deviates from Model-in-the-Loop simulation, the most likely cause is a bug in the target compiler or a problem with the processor.
Reverse Engineering of legacy code to Simulink models
The existing legacy C code is converted to equivalent Simulink/Stateflow models. This acts as specification for the legacy code, and maintenance of these specification will be easier, which may lead to auto code generation possible for future updates.