Simulation is a process in which you validate and verify a model by comparing simulation results with:
Data collected from a real system.
Functionality described in the model requirements.
Perform the simulation workflow after you've finished building your model and a simulation completes without errors. The steps in a typical simulation workflow include:
Prepare for simulation.
Run and evaluate simulation.
Define the external input and output interfaces.
Before simulating a model, you need to understand your goals and requirements. Ask yourself these questions to help plan your simulations:
What questions do you want the simulation to answer?
How accurately does the model need to represent the system?
Some possible simulation goals:
Understand input to output causality — For a given input set and nominal parameter values, look at how the inputs flow through the system to the outputs.
Verify model — Compare simulation results with collected data from the modeled system. Iteratively debug and improve the design.
Optimize parameters — Change parameters and compare simulation runs.
Visualize results — Send simulation results to a plot or print in a report.
Collect input and output data from an actual system.
Use the measured input data to drive the simulation.
Compare measured output data with the model simulation results to verify the accuracy of your model.
Preparing a model for simulation includes defining the external interfaces for input data and control signals, and output signals for viewing and recording simulation results.
For the first simulation, use model parameters from the validated model. After comparing the simulation results with measured output data, change model parameters to more accurately represent the modeled system.
Simulate your model and verify that the simulation results match the measured data from the modeled system.
Simulink® enables you to import data into your model.
Use the Signal Builder block to import input signals from a Microsoft® Excel® file (XLSX, XLS) or a comma-separated value file (CSV). Simulink saves data imported from an Excel file using a Signal Builder block with the model and loads the data into memory when you open the model.
For large data sets, use a MATLAB MAT-file with an Inport block.
Using measured input data, run a simulation and save results.
Evaluate the differences between simulated output and measured output data. Use the evaluation to verify the accuracy of your model and how well it represents the system behavior. Decide if the accuracy of your model adequately represents the dynamic system you are modeling.
Determine the changes to improve your model. Model changes include:
Parameters — Some parameters were initially estimated and approximated. Optimize and update parameters.
Adding structure — Some parts or details of the system were not modeled. Add missing details.