Using Python to Control VeriStand to Set Parameter Values of Models.

Updated Nov 14, 2025

Environment

Software

  • VeriStand

Programming Language

  • Python

A model is a math function that represents how the outputs of a system are affected by the inputs to the system. A model has many interfaces, such as Inports, Outputs, Parameters, and Signals.  Parameter is a variable used inside the model. To set parameters value via Python, you can not use SetSingleChannelValue() or SetChannelValues() APIs. 

To set parameter values, you should use SetSignalParameterValue(target, name, value) or SetMultipleParameterValues(target, names, values) from the ModelManager2 session. target is the target name in VeriStand project. "VDC_HIL" is the target name of this VeriStand project.

name is the parameter name. As there are 2 types of parameters: global parameter and local parameter, it is not so easy to get the parameter names based on the parameter's hierarchical structure in VeriStand project. To get the parameter names, you can use the method GetParametersList(target).

Here is a Python script that can be used to get the parameters list of above model.

from niveristand.legacy import NIVeriStand

def Control_VeriStand_debug():
    workspace = NIVeriStand.Workspace2("localhost")
    modelM2 = NIVeriStand.ModelManager2("localhost")
    project_path = os.path.abspath("D:\Work\VeriStand\VeriStand Projects\Default Project\Default Project.nivssdf")
    print (project_path)
    print("Deploying system definition...")
    workspace.ConnectToSystem(project_path, True, 60000)
    print("System definition deployed...")

    time.sleep(4)
    parameters = modelM2.GetParametersList("VDC_HIL")
    print(parameters)

    time.sleep(5) 
    print("Undeploying system definition...")
    workspace.DisconnectFromSystem('', True)
    print("System definition undeployed...")

if __name__ == '__main__':
    Control_VeriStand_debug()

From the Output window, you can get the parameters list.

Then you can update the Python script to set parameter values with SetSignalParameterValue(target, name, value) one by one.

from niveristand.legacy import NIVeriStand

def Control_VeriStand_debug():
    workspace = NIVeriStand.Workspace2("localhost")
    modelM2 = NIVeriStand.ModelManager2("localhost")
    project_path = os.path.abspath("D:\Work\VeriStand\VeriStand Projects\Default Project\Default Project.nivssdf")
    print (project_path)
    print("Deploying system definition...")
    workspace.ConnectToSystem(project_path, True, 60000)
    print("System definition deployed...")

    time.sleep(1)
    print("Set Base Parameter Value")
    modelM2.SetSingleParameterValue("VDC_HIL","Base_Para",3.0)
    time.sleep(1)
    print("Set Model Parameter Value")
    modelM2.SetSingleParameterValue("VDC_HIL","test_para/test_para/Model_Para",2.0)

    time.sleep(2) 
    print("Undeploying system definition...")
    workspace.DisconnectFromSystem('', True)
    print("System definition undeployed...")

if __name__ == '__main__':
    Control_VeriStand_debug()

you can also set all parameter values with SetMultipleParameterValues(target, names, values).

modelM2.SetMultipleParameterValues("VDC_HIL",["Base_Para","test_para/test_para/Model_Para"],[3.0,2.0])