Model-Based Design is a process that enables faster, more cost-effective development of dynamic systems, including control systems, signal processing, and communications systems. In Model-Based Design, a system model is at the center of the development process, from requirements development, through design, implementation, and testing. The model is an executable specification that is continually refined throughout the development process. After model development, simulation shows whether the model works correctly.
When software and hardware implementation requirements are included, such as fixed-point and timing behavior, you can automatically generate code for embedded deployment and create test benches for system verification, saving time and avoiding the introduction of manually coded errors.
Model-Based Design allows you to improve efficiency by:
- Using a common design environment across project teams
- Linking designs directly to requirements
- Integrating testing with design to continuously identify and correct errors
- Refining algorithms through multidomain simulation
- Automatically generating embedded software code
- Developing and reusing test suites
- Automatically generating documentation
- Reusing designs to deploy systems across multiple processors and hardware targets
There are six steps to modeling any system:
- Defining the System
- Identifying System Components
- Modeling the System with Equations
- Building the Simulink Block Diagram
- Running the Simulation
- Validating the Simulation Results
You perform the first three steps of this process outside of the Simulink software before you begin building your model.
Defining the System
The first step in modeling a dynamic system is to fully define the system. If you are modeling a large system that can be broken into parts, you should model each subcomponent on its own. Then, after building each component, you can integrate them into a complete model of the system.
For example, the demo model used later in this guide models the heating system of a house. This system can be broken down into three main parts:
- Heater subsystem
- Thermostat subsystem
- Thermodynamic model subsystem
The most effective way to build a model of this system is to consider each of these subsystems independently.
Identifying System Components
The second step in the modeling process is to identify the system components. Three types of components define a system:
- Parameters — System values that remain constant unless you change them
- States — Variables in the system that change over time
- Signals — Input and output values that change dynamically during the simulation
In Simulink, parameters and states are represented by blocks, while signals are represented by the lines that connect blocks.
For each subsystem that you identified, ask yourself the following questions:
- How many input signals does the subsystem have?
- How many output signals does the subsystem have?
- How many states (variables) does the subsystem have?
- What are the parameters (constants) in the subsystem?
- Are there any intermediate (internal) signals in the subsystem?
Once you have answered these questions, you should have a comprehensive list of the system components, and are ready to begin modeling the system.
Modeling the System with Equations
The third step in modeling a system is to formulate the mathematical equations that describe the system.
For each subsystem, use the list of system components you identified to describe the system mathematically. Your model may include:
- Algebraic equations
- Logical equations
- Differential equations, for continuous systems
- Difference equations, for discrete systems
You use these equations to create the block diagram in Simulink.
Building the Simulink Block Diagram
After you have defined the mathematical equations that describe each subsystem, you can begin building a block diagram of your model in Simulink.
Build the block diagram for each of your subcomponents separately. After you have modeled each subcomponent, you can then integrate them into a complete model of the system.
[important]See Creating a Simple Model for more information on building the block diagram.[/important]
Running the Simulation
After you build the Simulink block diagram, you can simulate the model and analyze the results.
Simulink allows you to interactively define system inputs, simulate the model, and observe changes in behavior. This allows you to quickly evaluate your model.
[important]See Simulating the Model for more information on running a simulation.[/important]
Validating the Simulation Results
Finally, you must validate that the model accurately represents the physical characteristics of the system.
You can use the linearization and trimming tools available from the MATLAB command line, plus the many tools in MATLAB and its application toolboxes to analyze and validate your model.