Solution
Model parameters are not like other channels in a VeriStand project and cannot be written to using the
ChannelReference.value method. Instead, you must open a ModelManager2 session and use the methods from the ModelManager2 API to set parameter values. Refer to the
ModelManager2 methods in the NIVeriStand Legacy Python API Refence.
For example, here is a Python script that could be used to set the Idle_Speed_RPM parameter of the Engine Demo model that is included with VeriStand. Before running this code, open the Engine Demo example project in VeriStand and deploy it.
from niveristand.legacy import NIVeriStand
def set_parameter_value():
# Open a ModelManager2 reference using "localhost" as the gateway address.
modelRef = NIVeriStand.ModelManager2("localhost")
#Here we use the the SetSingleParameterValue(target, name, value) method from the ModelManager2 API. Target is the name of the controller where the model is running. Name is the name or expression of the model parameter you wish to set.
modelRef.SetSingleParameterValue("Controller","Idle_Speed_RPM", 1500)
if __name__ == '__main__':
set_parameter_value()
ModelManager2 includes many different methods for reading and writing single or multiple parameters.