Click or drag to resize

IVI-COM Property Range Checking Editor

Nimbus offers three different styles of automatic range checking -- validation against a continous range of values, checking against a list of discrete values, or executing custom logic in a special range-checking function. In all cases, Nimbus generates code that returns the IVI-defined error E_IVI_INVALID_VALUE if the range check condition fails.

Important note Important

The range-checking logic for any option is only executed when range-checking is enabled by the end user. This can be done by passing RangeCheck=True as part of the OptionString parameter to the driver's Initialize method, or it can be done after driver initialization via the IIviDriverOperation.RangeCheck property.

None

Specifies that no automatic range checking should be performed on the property.

Continuous range

Enables range checking for the selected property against a continuous range of values between the specified Minimum and Maximum. The two Inclusive check boxes are used to specify if the Minimum and Maximum values are included in the list of valid values for the property.

Discrete values

Enables range checking for the selected property against a discrete set of values specifed as a comma-separated list.

Using this option also enables coercion of the property value. If the property value falls between two values in the list of Allowed values, then the Coercion combo box indicates whether the property value should rounded to the next higher value in the list (coerce Up), to the next lower value in the list (coerce Down), or should generate an error (coercion set to None).

Custom

Custom range checking allows custom code to be executed for performing the range checking and coercion logic. The specified Range check function is invoked at the proper time when range checking is enabled and the specified Coercion function is used to coerce property values. These two functions should be used instead of explicit code in the property implementation because Nimbus ensures that the logic in these two functions executes at the proper time relative to other Nimbus-generated code, such as simulation and state caching logic.

Use the Create button to create a new range check or coercion function that has the signature Nimbus requires.

Use the Select button to select an existing range check or coercion function that has the signature Nimbus requires. This option is useful if several properties need to share range checking logic.

Model-Specific Programming with the Models Window

The Property Range Checking Editor contains a collapsible Models Window in the right portion of the editor. This window is used to customize range-checking settings on a per-model or per-family basis.

Note Note

The Models Window cannot be used to define new models for the driver. The list of models supported by the driver is specified on the Models Page of the Driver Settings Editor.

The root node of the Models Window is labeled "All Models". This node can be thought of as the "default behavior" for the property. By default, all instrument models share the same range-checking settings. Thus, the editor controls are initially only enabled when "All Models" is selected in the Models Window. This changes when model-specific behavior is specified, as explained below.

When customizing range-checking behavior on a per-model or per-family basis, Nimbus generates code that will use different allowed values based upon the actual model detected at runtime. See the discussion of the InitializeIdentification function to understand how Nimbus determines the connected model at runtime.

The only range checking settings that can be customized on a per-model basis are the Minimum and Maximum values for continuous range checking and the Allowed values list for discrete range checking. The range checking style (none, continuous, discrete, custom) must be the same for all models. Additionally, only a single range-checking and coercion function can be specified, so any per-model behavior with custom range checking must be implemented explicitly in the Range check function and the Coercion function.

To customize the range checking settings for a model

  1. From the Models Window, right-click on the desired model or family.

  2. Choose Customize settings

  3. The Minimum and Maximum text boxes or the Allowed values text box are enabled for the selected model, allowing model-specific values to be set. The model appears in bold font for the customized model.

    Note that if a family was selected, all models in the family appear in bold font, indicating that they will all the same custom range checking values.

  4. To have a property return to using the default range checking settings, right-click the model and choose Remove custom settings. The model appears in normal font and the editor controls are once again disabled when the model is selected, indicating that the model is controlled via the default settings specified when the "All Models" node is selected.

See Also

Download a complete CHM version of this documentation here.