How to add model parameters programmatically into a Veristand System Definition file using .NET API?

Updated May 11, 2026

Reported In

Software

  • VeriStand

Issue Details

I am trying to programmatically add model parameters to a VeriStand System Definition using the Veristand .NET API. I can't find any examples or documentation that showcases this process.

Solution

There are a couple of approaches that can be followed in order to add a model parameters programmatically into a Veristand System Definition file using the Veristand .NET API. Either of these approaches can be followed using the Engine Demo as an example:

 

1. If the required model parameter names can be expressed with a regular expression, then instantiating Model as mentioned below will only import/add parameters that match with parameter name reg expression. Note: This regular expression is case insensitive. Below code imports parameters whose name contains the case insensitive substring "temperature":

 var model = new Model(
    "Model1",
    Description: string.Empty,
    ModelPath: @"C:\EngineDemo_windows.vsmodel",
    Processor: -2,
    Decimation: 1,
    InitialState: 0,
    SegmentVectors: false,
    ImportParameters: true,
    ParameterRegularExpression: @".*temperature.*",  // Regular expression to filter parameters to import.
    ImportSignals: false,
    SignalRegularExpression: string.Empty,
    ImportOnlyNamedSignals: false,
    NIVeriStandServerPort: 0);

 

2. Use Model.GetSectionWithAllParameters for getting all model parameters, then select only required ones from this list and then import selected parameters into the model by calling ImportParameters:

var model = new Model(
    "Model1",
    Description: string.Empty,
    ModelPath: @"C:\EngineDemo_windows.vsmodel",
    Processor: -2,
    Decimation: 1,
    InitialState: 0,
    SegmentVectors: false,
    ImportParameters: false,
    ImportSignals: false,
    NIVeriStandServerPort: 0);

// Get all parameter, whether they're already imported or not when instantiating model.
// Note: GetSectionWithAllParameters method does not import parameters into model.
var allParameters = model.GetSectionWithAllParameters().GetParameters();

var requiredParameters = new List<ModelParameter>();
foreach (var parameter in allParameters)
{
    if (parameter.Name.Contains("temperature"))
    {
        requiredParameters.Add(parameter);
    }
}

// Imports parameters present in requiredParameters list into model.
model.ImportParameters(requiredParameters);