Initializing Parameter Values
- Updated2026-05-07
- 2 minute(s) read
Set and initialize parameter values in models using the Model Interface API or modeling environment software.
Many models have parameters, which act as variables in the model. The default values of parameters are compiled into the model. However, you can perform the following tasks to set new initial values:
- In the appropriate modeling environment software, manually change the parameter values in the model, and then recompile the model.
- In your LabVIEW code, use the Model Interface API to programmatically change parameter values at run time. After your code loads a model, you can set an initial value for a parameter.
To initialize a parameter value with the Model Interface API, complete the following steps:
- Set the new values.
- Commit the new values.
The following block diagram shows how to initialize a parameter in the initialization portion of your code:
The initialization portion of the code performs the following steps:
- Loads the model from disk.
- Creates a model reference. Pass the model reference to set parameters for other VIs in the application and to run the model in a control loop.
- Creates a Parameter Interface reference. Pass the reference to get and set parameters for other VIs.
- Sets the value of the scalar parameter whose index is 1 among all the model
parameters.Tip
- You can use the Set Parameter VI to update one element of a vector parameter or an entire vector parameter.
- You can use the Get Information by Path VI to programmatically return the index of a specific parameter rather than hard-coding it on the block diagram. However, hard-coding values provides better performance than using this VI.
After the initialization portion of your code runs, your model will use the new parameter value when the control loop of your application steps the model for the first time.
For an example code that demonstrates the initialization process, see the MIT Multiple Models VI in the labview\examples\Control and Simulation\Model Interface directory.
Related Information
- Updating Parameters While the Model Runs
Use the Model Interface API to update model parameters programmatically during runtime.