Model Context
Define the initialization and finalization scripts, and properties for a model.
Initialization Script
An initialization script provides a means for you to define OML variables and functions for a simulation.
On top of the main diagram context, the software applies an initialization script, which is yet another OML script that is executed at the beginning of the simulation process. The main purpose of this script is to define the variables or functions that are required throughout the model during a simulation.
Define Initialization Variables and Functions
Create a script with the OML variables and functions, such as the simulation final time, that you want to be available for a simulation .
Finalization Script
A finalization script provides a means for you to define OML commands that are to be executed at the end of a simulation.
The finalization script lets you define OML commands that are to be automatically executed when a simulation ends, such as plotting results or saving your data to a specified location.
Note that the Finalization Script is executed when the simulation ends (reaches the final time), or is stopped. It is not executed if the simulation is paused.
Define a Finalization Script
Enter the OML commands that you want to be automatically executed at the end of a simulation.