|Download Help (Windows Only)|
When you add a model to a system definition file, the Add Simulation Model dialog box allows you to configure the parts of the model and how it executes.
|Note You also can configure some of these settings in the System Explorer window after you add a model to the system definition file.|
A model is set to run at a certain rate, or step size, as defined in the build options when the model is compiled. However, depending on configuration settings for the system definition, the rate at which the VeriStand Engine actually executes models might differ from the compiled rate. The following equation describes how the VeriStand Engine executes models:
actual model rate = Primary Control Loop (PCL) rate / model decimation
You set these variables at the following locations:
You can adjust the PCL rate and model decimation to run the model faster or slower than the rate for which it was compiled. For example, if the model was compiled to run at 100 Hz, you can set the Primary Control Loop to run at 1 kHz, or 10 times faster than real time, assuming the model decimation is 1. This means the model does not run in real time and is potentially unstable.
If both the controller and plant are simulated, such as in model-in-the-loop testing, running your model at a faster rate than the rate for which it was compiled can be desirable. Running faster than real time allows you to accomplish more simulation in a shorter amount of time. However, when you test with real hardware, as in hardware-in-the-loop testing, run your model at the rate for which it was compiled to accurately simulate the system.
Choose if the model runs as soon as you deploy the system definition or if its initial state at run time is paused. If you want to change the values of model parameters before the first time step, set the initial state to be paused.
Import only parameters and signals that your system requires. Importing many parameters and signals can have a negative impact on the performance of the system even if the model is not running.
By default, the initial values of parameters are the values that were compiled into the model. However, NI VeriStand can automatically apply parameter values from a text file when you deploy the system definition file. This feature is useful because it allows you to quickly switch initial parameter values between tests without recompiling models. Alternatively, you can change the parameter values in the model, and then recompile the model.
Compiled models can contain global parameters that by default apply to any other models on the same target that contain global parameters with the same name. Global parameters are similar to workspace variables in The MathWorks, Inc. MATLAB® software. You can configure whether updates to a global parameter affect other models by configuring one of two scopes for all global parameters in a model:
Configure the scope for global parameters in a model on the Parameters and Signals page of the Add Simulation Model dialog box or, after you add a model, on the Parameters configuration page in the System Explorer configuration tree. All global parameters in a particular model share the same scope.
If your model contains a vector inport or outport, choose between maintaining the vector representation or separating each vector element into a separate scalar channel. You must choose this setting in the Add Simulation Model dialog box when you add the model.
Scalar channels provide greater flexibility than vector channels when you connect them to other parts of the system for the following reasons:
When you choose to separate a vector inport or outport into scalar channels, a virtual folder of the scalar channels appears in your system definition.
The default value of all inports is 0. You can change the default value for an inport by expanding Inports in the System Explorer configuration tree and selecting the inport you want to modify. Setting the default values can help to prevent your models from ever using invalid values. For example, if the model divides by an inport value, changing the default from 0 avoids an invalid operation.
|Note Your system configuration might cause the initial, default value to go unused. For example, if the PCL execution mode is Low Latency, the model is assigned to the first execution group, and an inport is mapped to hardware, the inport will always receive its value from hardware.|