Model dynamic start up and shut down behavior by adding custom routines to the default model initialize and terminate methods. During simulation, control when the methods execute with events. Create functions to reinitialize blocks with initial values.
|Initialize Function||Execute subsystem on model initialize event|
|Reinitalize Function||Execute subsystem on model or subsystem reinitialize event|
|Reset Function||Execute subsystem on model reset event|
|Terminate Function||Execute subsystem on model terminate event|
Readers and Writers
|State Reader||Read a block state|
|State Writer||Write to a block state|
|Parameter Writer||Write to block parameter or model workspace variable|
|Data Store Read||Read data from data store|
|Data Store Write||Write data to data store|
|Parameter Writer block validation||Globally or locally enable parameter validation|
- Using Initialize, Reinitialize, Reset, and Terminate Functions
Set the state of a block with an initialize function-call event. Reset block states with a reinitialize or reset function-call event. Save the state of a block with a terminate function-call event.
- Create Test Harness to Generate Function Calls
Schedule initialize, reset, and terminate function-call events.
- Initialize and Reset Parameter Values
Use the Parameter Writer block to change block parameter values during model simulation.
- Working with the Reinitialize Function Block
This example shows how to use a Reinitialize Function block to reset the initial condition of a Discrete-Time Integrator block for every function-call event received by a subsystem.
- Initialize, Reinitialize, Reset, and Terminate Function Limitations
Determine whether Initialize Function, Reinitialize Function, Reset Function, or Terminate Function blocks support a block, feature, or modeling pattern.
- Prepare Sensor and Controller Models in a Distributed Monitoring System for Code Generation
Prepare models to generate code for deployment on target hardware platforms.
- Use Parameter Writer Block to Change Block Parameters
This example shows how to use the Parameter Writer block to change the values of block parameters.