Table Of Contents

Adding and Configuring Models

Last Modified: December 13, 2019

Add a model to a system definition to connect it to other parts of the system and run the model on a hardware target.

Before you begin, you should understand the components of a model and how the Primary Control Loop (PCL) steps execute in models. VeriStand executes each model in its own loop. If a system definition contains multiple models that reference the same compiled model, VeriStand makes a temporary copy of the model so each loop has its own compiled model to execute. Adding more than one instance of the same compiled model can cause errors if the model accesses a shared resource, such as a dependant file. Contact your model provider for information about whether the model accesses such resources.

If you are using an uncompiled model from The MathWorks, Inc. Simulink® software, you can only run it on a computer that runs the Windows operating system. You must convert a Simulink model into a compiled model to run it on a real-time target.

  1. Launch the VeriStand Editor.
  2. In the Project Files pane, double-click a system definition file (.nivssdf). System Explorer opens .
  3. Click Targets»Controller in the configuration tree.
  4. Click Simulation Models and click Add a Simulation Model.
  5. Use the Add Simulation Model dialog box to configure the model.
    1. On the General tab, select the Path to the model you want to add.
    2. On the Settings tab, configure whether the initial state of the model is running or paused, and configure the rate the model runs.

      To change the values of model parameters before the first time step, set the initial state to paused.

    3. On the Parameters and Signals tab, specify whether to import parameters and signals.

      Importing many parameters and signals can have a negative impact on the performance of the system even if the model is not running, so avoid importing unnecessary items.

    4. If your model contains a vector inport or outport, use the Inports and Outports tab to choose a Vector port specification as segment into scalar channels or maintain as vector channel.

      Scalar channels provide greater flexibility than vector channels. You can only map vector channels to another model that contains a vector channel of the same size. You cannot map a vector channel to controls or indicators on your Workspace or use it with calculated channels, alarms, procedures, and others.

    5. Click OK.
  6. Depending on your goal, complete the following task to configure the model further.
    Goal Task
    Set model timing Set a model to run at a certain rate, or step size.
    Set model parameters Use the VeriStand Editor, Workspace, Model Parameter Manager, and Stimulus Profile Editor to set the values of model parameters.
    Scope global parameters Update the scope of a global parameter to the target-level or model-level for all global parameters in a model.
    Set the default values for inports Change the default value for an inport to prevent your models from using invalid values.
    Configure the execution order of multiple models Define the order that the Primary Control Loop (PCL) executes models relative to each other.
  7. Save the system definition file.

Recently Viewed Topics