Initializing Parameter Values (Model Interface Toolkit)

LabVIEW 2017 Model Interface Toolkit Help

Edition Date: May 2017

Part Number: 374160C-01

»View Product Info
Download Help (Windows Only)

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, as shown below.

In the latter case, initializing a parameter value with the Model Interface API is a two-step process: setting the new values, and then committing the new values. The following block diagram shows how to initialize a specific parameter in the initialization portion of your code:

Loads the model from disk and creates a model reference that you pass to other VIs throughout the application to set its parameters, and later, to run the model in a control loop.

Creates a Parameter Interface reference that you pass to other VIs to get and set model parameters.

Sets the value of the scalar parameter whose index is 1 among all the model parameters.
  • You also 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, note that hard-coding values provides better performance than using this VI.

Commits the new value to the model. The Model Interface API only applies values you set after the Commit Parameters VI runs.

After this 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.

Refer to the MIT Multiple Models VI in the labview\examples\Control and Simulation\Model Interface directory for example code that demonstrates these concepts.

Related Links

Parameters VIs

Updating Parameters While a Model Runs

Basic Architecture for Executing Models


Not Helpful