| Contents | Index |
| On this page… |
|---|
Types of Simulation and Prototyping in the V-Model |
The V-model is a representation of system development that highlights verification and validation steps in the system development process. As the following figure shows, the left side of the V identifies steps that lead to code generation, including requirements analysis, system specification, detailed software design, and coding. The right side of the V focuses on the verification and validation of steps cited on the left side, including software integration and system integration.

Depending on your application and its role in the process, you might focus on one or more of the steps called out in the V-model or repeat steps at several stages of the V-model. Code generation technology and related products provide tooling that you can apply at each step.
The following table compares the types of simulation and prototyping identified on the left side of the V-model diagram.
| Host-Based Simulation | Standalone Rapid Simulations | Rapid Prototyping | On-Target Rapid Prototyping | |
|---|---|---|---|---|
| Purpose | Test and validate functionality of concept model | Refine, test, and validate functionality of concept model in nonreal time | Test new ideas and research | Refine and calibrate designs during development process |
| Execution hardware | Host computer | Host computer Standalone executable runs outside of MATLAB and Simulink environments | PC or nontarget hardware | Embedded computing unit (ECU) or near-production hardware |
| Code efficiency and I/O latency | Not applicable | Not applicable | Less emphasis on code efficiency and I/O latency | More emphasis on code efficiency and I/O latency |
| Ease of use and cost | Can simulate component (algorithm or controller) and environment (or plant) Normal mode simulation in Simulink enables you to access, display, and tune data during verification Can accelerate Simulink simulations with Accelerated and Rapid Accelerated modes | Easy to simulate models of hybrid dynamic systems that include components and environment models Ideal for batch or Monte Carlo simulations Can repeat simulations with varying data sets, interactively or programmatically with scripts, without rebuilding the model Can connect to Simulink to monitor signals and tune parameters | Might require custom real-time simulators and hardware Might be done with inexpensive off-the-shelf PC hardware and I/O cards | Might use existing hardware, thus less expensive and more convenient |
The following table compares the types of in-the-loop testing for verification and validation identified on the right side of the V-model diagram.
| SIL Testing | PIL Testing on Embedded Hardware | PIL Testing on Instruction Set Simulator | HIL Testing | |
|---|---|---|---|---|
| Purpose | Verify component source code | Verify component object code | Verify component object code | Verify system functionality |
| Fidelity and accuracy | Two options: Same source code as target, but might have numerical differences Changes source code to emulate word sizes, but is bit accurate for fixed-point math | Same object code Bit accurate for fixed-point math Cycle accurate because code runs on hardware | Same object code Bit accurate for fixed-point math Might not be cycle accurate | Same executable code Bit accurate for fixed-point math Cycle accurate Use real and emulated system I/O |
| Execution platforms | Host | Target | Host | Target |
| Ease of use and cost | Desktop convenience Executes only in Simulink No cost for hardware | Executes on desk or test bench Uses hardware — process board and cables | Desktop convenience Executes only on host computer with Simulink and integrated development environment (IDE) No cost for hardware | Executes on test bench or in lab Uses hardware — processor, embedded computer unit (ECU), I/O devices, and cables |
| Real-time capability | Not real time | Not real time (between samples) | Not real time (between samples) | Hard real time |
The following tables list goals that you might have, as you apply code generation technology, and where to find guidance on how to meet those goals. Each table focuses on goals that pertain to a step of the V-model for system development.
Documenting and Validating Requirements
| Goals | Related Product Information | Demos | |||
|---|---|---|---|---|---|
Capture requirements in a document, spreadsheet, data base, or requirements management tool | Simulink Report Generator documentation Third-party vendor tools such as Microsoft Word, Microsoft Excel®, raw HTML, or IBM®Rational® DOORS® | ||||
Associate requirements documents with objects in concept models Generate a report on requirements associated with a model | Simulink Verification and Validation™ Requirements Traceability in the Simulink Verification and Validation documentation Bidirectional tracing in Microsoft Word, Microsoft Excel, HTML, and Telelogic® DOORS | slvnvdemo_fuelsys_docreq | |||
| Include requirements tags in generated code | Simulink Verification and Validation Requirements Information in Generated Code in the Simulink Verification and Validation documentation | rtwdemo_requirements | |||
| Trace model blocks and subsystems to generated code and vice versa | rtwdemo_hyperlinks | ||||
| Verify, refine, and test concept model in nonreal time on a host system | Model Architecture and Design in the Simulink Coder documentation Model Architecture and Design in the Embedded Coder documentation Running Simulations and Accelerating Models in the Simulink documentation |
| |||
Run standalone rapid simulations Run batch or Monte-Carlo simulations Repeat simulations with varying data sets, interactively or programmatically with scripts, without rebuilding the model Tune parameters and monitor signals interactively Simulate models for hybrid dynamic systems that include components and an environment or plant that requires variable-step solvers and zero-crossing detection |
| ||||
Distribute simulation runs across multiple computers | SystemTest documentation MATLAB Distributed Computing Server™ documentation Parallel Computing Toolbox™ documentation |
Developing a Model Executable Specification
| Goals | Related Product Information | Demos | ||||
|---|---|---|---|---|---|---|
Produce design artifacts for algorithms that you develop in MATLAB code for reviews and archiving | MATLAB Report Generator documentation | |||||
Produce design artifacts from Simulink and Stateflow models for reviews and archiving | Simulink Report Generator System Design Description Report | rtwdemo_codegenrpt | ||||
Add one or more components to another environment for system simulation Refine a component model Refine an integrated system model Verify functionality of a model in nonreal time Test a concept model | Real-Time System Rapid Prototyping | |||||
Schedule generated code | rtwdemos, select Multirate Support folder | |||||
Specify function boundaries of systems | Subsystems |
| ||||
Specify components and boundaries for design and incremental code generation | Model Architecture and Design | rtwdemo_mdlreftop | ||||
Specify function interfaces so that external software can compile, build, and invoke the generated code | Function Prototype Control and C++ Encapsulation Interface Control in the Embedded Coder documentation |
| ||||
Manage data packaging in generated code for integrating and packaging data | Data, Function, and File Definition in the Embedded Coder documentation | rtwdemos, select Function, File and Data Packaging folder | ||||
Generate and control the format of comments and identifiers in generated code | Configure Code Comments in Embedded System Code and Configure Symbols in the Embedded Coder documentation |
| ||||
Create a zip file that contains generated code files, static files, and dependent data to build generated code in an environment other than your host computer | Relocate Code to Another Development Environment (PacknGo) | rtwdemo_buildinfo | ||||
Export models for validation in a system simulator using shared libraries | Shared Object Libraries in the Embedded Coder documentation | rtwdemo_shrlib | ||||
Refine component and environment model designs by rapidly iterating between algorithm design and prototyping Verify whether a component can adequately control a physical system in non-real time Evaluate system performance before laying out hardware, coding production software, or committing to a fixed design Test hardware | Real-Time System Rapid Prototyping Model Architecture and Design in the Simulink Coder documentation Model Architecture and Design in the Embedded Coder documentation | rtwdemo_profile | ||||
Generate code for rapid prototyping | Model Architecture and Design in the Embedded Coder documentation |
| ||||
| Generate code for rapid prototyping in hard real time, using PCs | xPC Target documentation | doc xpcdemos | ||||
| Generate code for rapid prototyping in soft real time, using PCs | Real-Time Windows Target documentation | rtvdp (and others) |
Developing a Detailed Software Design
| Goals | Related Product Information | Demos | ||||||
|---|---|---|---|---|---|---|---|---|
| Refine a model design for representation and storage of data in generated code | ||||||||
Select a deployment code format | Model Architecture and Design and Code Generation for AUTOSAR Software Components in the Embedded Coder documentation |
| ||||||
| Specify target hardware settings | Target | rtwdemo_targetsettings | ||||||
| Design model variants | Modeling Variant Systems in the Simulink documentation | |||||||
| Specify fixed-point algorithms in Simulink, Stateflow, and the MATLAB language subset for code generation | Data Types and Scaling and Code Generation in the Simulink Fixed Point documentation |
| ||||||
| Convert a floating-point model or subsystem to a fixed-point representation | Fixed-Point Advisor in the Simulink Fixed Point documentation | fxpdemo_fpa | ||||||
| Iterate to obtain an optimal fixed-point design, using autoscaling | Automatic Data Typing in the Simulink Fixed Point documentation | fxpdemo_feedback | ||||||
| Create or rename data types specifically for your application | Code Generation with User-Defined Data Types in the Embedded Coder documentation | rtwdemo_udt | ||||||
| Control the format of identifiers in generated code | Configure Symbols in the Embedded Coder documentation | rtwdemo_symbols | ||||||
| Specify how signals, tunable parameters, block states, and data objects are declared, stored, and represented in generated code | Custom Storage Classes in the Embedded Coder documentation | rtwdemo_cscpredef | ||||||
| Create a data dictionary for a model | Data Definition and Declaration Management in the Embedded Coder documentation | rtwdemo_advsc | ||||||
| Relocate data segments for generated functions and data using #pragmas for calibration or safe data access | Memory Sections in the Embedded Coder documentation | rtwdemo_memsec | ||||||
| Assess and adjust model configuration parameters based on the application and an expected run-time environment | Code Generation in the Simulink Coder documentation Code Generation in the Embedded Coder documentation | rtwdemo_f14 | ||||||
| Check a model against basic modeling guidelines | Consulting the Model Advisor in the Simulink documentation | rtwdemo_advisor1 | ||||||
| Add custom checks to the Simulink Model Advisor | Simulink Verification and Validation Customizing the Model Advisor in the Simulink Verification and Validation documentation | slvnvdemo_mdladv | ||||||
| Check a model against custom standards or guidelines | Consulting the Model Advisor in the Simulink documentation | |||||||
| Check a model against industry standards and guidelines (MathWorks Automotive Advisory Board (MAAB), IEC 61508, and DO-178B) | Guidelines and Standards in the Embedded Coder documentation Simulink Verification and Validation Model Advisor Checks in the Simulink Verification and Validation documentation | rtwdemo_iec61508 | ||||||
| Obtain model coverage for structural coverage analysis such as MC/DC | Simulink Verification and Validation Model Coverage Analysis in the Simulink Verification and Validation documentation | cvbasic_operation | ||||||
| Prove properties and generate test vectors for models |
| |||||||
| Generate reports of models and software designs | MATLAB Report Generator documentation Simulink Report Generator System Design Description Report documentation | rtwdemo_codegenrpt | ||||||
| Conduct reviews of your model and software designs with coworkers, customers, and suppliers who do not have Simulink available | Export Simulink Models to Web Views and Comparing XML Files Exported from Simulink Models in the Simulink Report Generator documentation | slxml_sfcar | ||||||
Refine the concept model of your component or system Test and validate the model functionality in real time Test the hardware Obtain real-time profiles and code metrics for analysis and sizing based on your embedded processor Assess the feasibility of the algorithm based on integration with the environment or plant hardware | Real-Time System Rapid Prototyping in the Embedded Coder documentation Embedded IDEs and Embedded Targets topics in the Embedded Coder documentation Desktop IDEs and Desktop Targets topics in the Simulink Coder documentation | rtwdemos, select Desktop IDEsDesktop TargetsEmbedded IDEsEmbedded Targets folder | ||||||
| Generate source code for your models, integrate the code into your production build environment, and run it on existing hardware | Model Architecture and Design and Code Generation for AUTOSAR Software Components in the Embedded Coder documentation |
| ||||||
| Integrate existing externally written C or C++ code with your model for simulation and code generation | Integrating Existing C Functions into Simulink Models with the Legacy Code Tool in the Simulink documentation Insert S-Function Code in the Simulink Coder documentation External Code Integration in the Embedded Coder documentation | rtwdemos, select Integrating with C Code or Integrating with C++ Code folder | ||||||
| Generate code for on-target rapid prototyping on specific embedded microprocessors and IDEs | Real-Time System Rapid Prototyping in the Embedded Coder documentation Embedded IDEs and Embedded Targets topics in the Embedded Coder documentation Desktop IDEs and Desktop Targets topics in the Simulink Coder documentation | In rtwdemos, select one of the following folders: Desktop IDEs, Desktop Targets, Embedded IDEs, or Embedded Targets |
Generating the Application Code
| Goals | Related Product Information | Demos | ||
|---|---|---|---|---|
| Optimize generated ANSI® C code for production (for example, disable floating-point code, remove termination and error handling code, and combine code entry points into single functions) | Performance in the Embedded Coder documentation | rtwdemos, select Optimizations folder | ||
| Optimize code for a specific run-time environment, using specialized function libraries | Code Replacement in the Embedded Coder documentation | rtwdemo_crl_script | ||
| Control the format and style of generated code | Control Code Style in the Embedded Coder documentation | rtwdemo_parentheses | ||
| Control the comments inserted into generated code | Configure Code Comments in Embedded System Code in the Embedded Coder | rtwdemo_comments | ||
| Enter special instructions or tags for postprocessing by third-party tools or processes | Customize Post-Code-Generation Build Processing | rtwdemo_buildinfo | ||
| Include requirements tags in generated code | Simulink Verification and Validation Requirements Information in Generated Code in the Simulink Verification and Validation documentation | rtwdemo_requirements | ||
| Trace model blocks and subsystems to generated code and vice versa | Report Generation, Trace Code to Model Objects Using Hyperlinks,Trace Model Objects to Generated Code, and Guidelines and Standards in the Embedded Coder documentation |
| ||
| Integrate existing externally written code with code generated for a model | Integrating Existing C Functions into Simulink Models with the Legacy Code Tool in the Simulink documentation Insert S-Function Code in the Simulink Coder documentation External Code Integration in the Embedded Coder documentation | rtwdemos, select Integrating with C Code or Integrating with C++ Code folder | ||
| Verify generated code for MISRA C®[a] and other run-time violations | Develop Models and Code That Comply with MISRA C Guidelines in the Embedded Coder documentation | rtwdemo_polyspace | ||
Protect the intellectual property of component model design and generated code Generate a binary file (shared library) | Protecting Referenced Models in the Simulink documentation Shared Object Libraries in the Embedded Coder documentation | |||
| Generate a MEX-file S-function for a model or subsystem so that it can be shared with a third-party vendor | Generated S-Function Block | |||
| Generate a shared library for a model or subsystem so that it can be shared with a third-party vendor | Shared Object Libraries in the Embedded Coder documentation | |||
| Test generated production code with an environment or plant model to verify a successful conversion of the model to code | Numerical Equivalence Checking in the Embedded Coder documentation | rtwdemo_sil_pil_script | ||
| Write or generate an S-function wrapper for calling your generated source code from a model running in Simulink | Generate S-Function Wrappers in the Embedded Coder documentation | rtwdemo_sil_pil_script | ||
| Set up and run SIL tests on your host computer | Numerical Equivalence Checking in the Embedded Coder documentation | rtwdemo_sil_pil_script | ||
[a] MISRA® and MISRA C are registered trademarks of MISRA Ltd., held on behalf of the MISRA Consortium. | ||||
Integrating and Verifying Software
| Goals | Related Product Information | Demos | ||||
|---|---|---|---|---|---|---|
| Integrate existing externally written C or C++ code with a model for simulation and code generation | Integrating Existing C Functions into Simulink Models with the Legacy Code Tool in the Simulink documentation Insert S-Function Code in the Simulink Coder documentation External Code Integration in the Embedded Coder documentation | rtwdemos, select Integrating with C Code or Integrating with C++ Code folder | ||||
| Connect to data interfaces for generated C code data structures | Customization in the Simulink Coder documentation Deployment in the Embedded Coder documentation |
| ||||
| Control the generation of code interfaces so that external software can compile, build, and invoke the generated code | Function Prototype Control and C++ Encapsulation Interface Control in the Embedded Coder documentation |
| ||||
| Export virtual and function-call subsystems | Export Function-Call Subsystems in the Embedded Coder documentation | rtwdemo_export_functions | ||||
| Include target-specific code | Code Replacement in the Embedded Coder documentation | rtwdemo_crl_script | ||||
| Customize and control the build process | Program Building, Interaction, and Debugging | rtwdemo_buildinfo | ||||
Create a zip file that contains generated code files, static files, and dependent data to build the generated code in an environment other than your host computer | Relocate Code to Another Development Environment (PacknGo) | rtwdemo_buildinfo | ||||
| Integrate all software components as a complete system for testing in the target environment | Component Verification in the Embedded Coder documentation | |||||
| Generate source code for integration with specific production environments | Model Architecture and Design and Code Generation for AUTOSAR Software Components in the Embedded Coder documentation |
| ||||
| Integrate code for a specific run-time environment, using specialized function libraries | Code Replacement in the Embedded Coder documentation | rtwdemo_crl_script | ||||
| Enter special instructions or tags for postprocessing by third-party tools or processes | Customize Post-Code-Generation Build Processing | rtwdemo_buildinfo | ||||
| Integrate existing externally written code with code generated for a model | Integrating Existing C Functions into Simulink Models with the Legacy Code Tool in the Simulink documentation Insert S-Function Code in the Simulink Coder documentation External Code Integration in the Embedded Coder documentation | rtwdemos, select Integrating with C Code or Integrating with C++ Code folder | ||||
| Connect to data interfaces for the generated C code data structures | Customization in the Simulink Coder documentation Deployment in the Embedded Coder documentation |
| ||||
| Customize and control the build process | Program Building, Interaction, and Debugging | rtwdemo_buildinfo | ||||
Create a zip file that contains generated code files, static files, and dependent data needed to build the generated code in an environment other than your host computer | Relocate Code to Another Development Environment (PacknGo) | rtwdemo_buildinfo | ||||
Schedule the generated code | rtwdemos, select Multirate Support folder | |||||
Verify object code files in a target environment | Numerical Equivalence Checking in the Embedded Coder documentation | rtwdemo_sil_pil_script | ||||
| Set up and run PIL tests on your target system | Numerical Equivalence Checking in the Embedded Coder documentation Embedded IDEs and Embedded Targets topics in the Embedded Coder documentation |
|
Integrating, Verifying, and Calibrating System Components
| Goals | Related Product Information | Demos |
|---|---|---|
Integrate the software and its microprocessor with the hardware environment for the final embedded system product Add the complexity of the environment (or plant) under control to the test platform Test and verify the embedded system or control unit by using a real-time target environment | Hardware-In-the-Loop (HIL) Simulation | |
| Generate source code for HIL testing | Model Architecture and Design and Code Generation for AUTOSAR Software Components in the Embedded Coder documentation | rtwdemo_f14 |
| Conduct hard real-time HIL testing using PCs | xPC Target documentation | doc xpcdemos |
Tune ECU properly for its intended use | Customization in the Simulink Coder documentation Deployment in the Embedded Coder documentation | |
| Generate ASAP2 data files | ASAP2 Data Measurement and Calibration | rtwdemo_asap2 |
| Generate C API data interface files | Data Interchange Using the C API | rtwdemo_capi |
[a] MISRA® and MISRA C are registered trademarks of MISRA Ltd., held on behalf of the MISRA Consortium.
![]() | Algorithm Development Options | Getting Started Examples | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |