Modeling is a process in which you describe a dynamic system with mathematical equations and then create a simplified representation of the system with a model. The equations define the science of the system and the model uses the equations to define the time-varying behavior.
The steps in a typical modeling workflow include:
Defining a system
Modeling the system
Integrating the system
Identify the components of a system, determine physical characteristics, and define dynamic behavior with equations. You perform these steps outside of the Simulink® software environment and before you begin building your model.
Before designing a model, you need to understand your goals and requirements. Ask yourself these questions to help plan your model design:
What problem does the model help you solve?
What questions can it answer?
How accurately must it represent the system?
Some possible modeling goals:
Understand how system components interact with each other.
Explore controller and fault-tolerance strategies.
Decide between alternative designs.
Observe the response of systems that you cannot solve analytically.
Determine how various inputs and changing model parameters affect the output.
Once you understand your modeling requirements, you can begin to identify the components of the system.
Identify the components that correspond to structural parts of the system. Creating a model that reflects the physical structure of a system, for example, motor controller or brake system, is helpful when you have to build part of the system in software and hardware.
Identify functional parts that you can independently model and test.
Describe the relationships between components, for example, data, energy, and force transfer.
Draw a picture showing the connections between components. Include major parameters in your diagram. Creating a picture of the system can help you identify and model the parts that are essential to the behaviors you want to observe.
After you identify the components in a system, you can describe the system mathematically with equations. Derive the equations using scientific principles or from the input-output response of measured data. Many of the system equations fall into three categories:
For continuous systems, differential equations describe the rate of change for variables with the equations defined for all values of time. For example, the velocity of a car is given by the second order differential equation
For discrete systems, difference equations describe the rate of change for variables, but the equations are defined only at specific times. For example, the control signal from a discrete propositional-derivative controller is given by the difference equation
Equations without derivatives are algebraic equations. For example, the total current in a parallel circuit with two components is given by the algebraic equation
Create a list of equation variables and constant coefficients, and then determine the coefficient values from published sources or by performing experiments on the system.
Use measured data from a system to define equation coefficients and parameters in your model.
Identify the parts that are measurable in a system.
Measure physical characteristics or use published property values. Manufacturer data sheets are a good source for hardware values.
Perform experiments to measure the system response to various inputs. You will later use this data to verify your model design with simulations.
Build individual model components that implement the system equations, and define the interfaces for passing data between components.
A model in Simulink is a graphical representation of a system using blocks and connections between blocks. After you finish describing your system, its components, and equations, you can begin to build your model.
Use the system equations to build a graphical model of the system with the Simulink Editor.
If you place all of the model blocks in one level of a diagram, your diagram can become difficult to read and understand. One way to organize your model is to use subsystems. Examples of blocks you can use to create a subsystem include Subsystem, Atomic Subsystem, and Model.
Identify input and output connections (for example, signal lines) between subsystems. Input and output values change dynamically during a simulation.
Some questions to ask before you begin to model a component:
What are the constants for each component and the values that do not change unless you change them?
What are the variables for each component and the values that change over time?
How many state variables does a component have?
After you create the top-level structure for your model, you can begin to model the individual components.
Use the system equations to create a Simulink model.
Add Simulink blocks in the Simulink Editor. Blocks represent coefficients and variables from the equations. Connect blocks to other blocks. Lines connecting blocks represent data transfer.
Build the model for each component separately. The most effective way to build a model of a system is to consider components independently.
Start by building simple models using approximations of the system. Identify assumptions that can affect the accuracy of your model. Iteratively add detail until the level of complexity satisfies the modeling and accuracy requirements.
After you build a model component, you can simulate to validate the design.
Predict the expected output of the integrated model components.
Add blocks to approximate actual input and control values. Add sink blocks to record and visualize results.
Validate the model design by comparing the simulation output to your expected output.
If the result does not match your prediction, change your model to improve the accuracy of your prediction. Changes include model structure and parameters.
Connect component models and simulate the model response over time to validate the design.
After you build and validate each model component, you can connect them into a complete model, simulate the model, and analyze the results.
Some guidelines for connecting model components:
Integrate model components by first connecting two of them (for example, connect a plant to a controller). After validating the pair by simulation, continue connecting components until your model is complete.
Think about how each component you add affects the other parts of the model.
Validating your model determines if it accurately represents the physical characteristics of the modeled dynamic system. Some guidelines for validating subsystems:
Predict the expected simulation results and outputs of the subsystems.
Add realistic inputs using source blocks.
Add sink blocks to record and visualize results.
Simulate the subsystems and compare the simulated result with your expected result.
Add blocks for connecting external signals into and out of your model.