Table Of Contents

Declaring Temporary Variables in a Model Parameter File

Last Modified: June 10, 2021

Declare temporary variables within a .txt file and use those temporary variables as new parameter values or as parts of expressions that define new parameter values.

Before you begin, learn about the supported syntax for .txt files.
  1. Open a formatted .txt file.
  2. Create a new line for the temporary variable.
  3. Enter the temporary variable name in the parameter column and the variable value in the value column.
    spd-note-note
    Note  

    The variable name must start with a letter and contain only alphanumeric characters or underscores.

  4. Save the text file.
  5. Configure VeriStand to allow temporary variables based on where you call the text file.
    Location How to configure
    Stimulus Profile Editor
    1. Open a stimulus profile.
    2. On the Edit tab, select Update Model Parameters from File.
    3. Set the Allow Temporary Variables property to true.
    Initializing parameters
    1. Use System Explorer to apply initial values for model parameters from a .txt file.
    2. On the Simulation Models page, click Allow temporary variables.
    Model Parameter Manager tab
    1. Use the VeriStand Editor to import model parameters.
    2. In the Configure Parameter Import dialog box, click Allow local variables.
    Model Parameter Manager Workspace tool
    1. Use the Workspace to import model parameters.
    2. In the Select Model Calibration File dialog box, click Allow temporary variables.
    spd-note-note
    Note  

    Allowing temporary variables causes VeriStand to assume that any parameter column entries that do not exactly match model parameter names are temporary variables. For example, if Allow Temporary Variables is TRUE and you enter a model parameter name incorrectly, VeriStand creates a temporary variable with the new name and uses that variable instead of the model parameter. You do not receive an error notification about the name mismatch.

The following excerpt from the ParameterUpdate2.txt example file shows how you can declare a temporary variable, tempConversionFactor. The variable is used in an expression that defines the value of the environment temperature (C) model parameter.
spd-note-note
Note  

This file uses a tab delimiter.

tempConversionFactor     0.5
{environment temperature (C)}     50 * tempConversionFactor

This file is part of the Update Model Parameters example, available in the <Common Data>\Examples\Stimulus Profile\Engine Demo\Stimulus Profiles\ directory.


Recently Viewed Topics