Methods

Setup

Setup virtual device including mappings to physical device entities.

This method is used to setup the list of device entities on the virtual device and to setup the configurations for the linked source device entities.

In each configuration, the source device entity for each virtual device entity must be selected and the setup for each source device entity must also be selected.

It is possible to only use a single configuration or to use multiple configurations. Using multiple configurations allows having several configurations to choose between, but only one configuration can be used at a time.

Using a single configuration

The setup method of the Virtual Device Tool supports any number of configurations. For simple usage the “Single Configuration” option can be selected (default).

Figure 1; Single Configuration chosen

Using multiple configurations

If more than one configuration should be created, the “Multiple Configurations” option can be selected.

When using multiple configurations, a Configuration Property (CP) of an enumeration type must be selected. The selected CP will be used to select which configuration to use for the virtual device. The virtual device will then have one configuration for each value in the enum type of the used CP. Each configuration in the virtual device will have the same name as the associated enum value.

Create a CP for configuration selection by right clicking the project header line and selecting ‘Add Configuration Property - Setup’.

Choose Integer type (will be changed later) and type the name for the CP and press ‘Create’.

Create a ‘Script Enum’ in the file to enumerate each configuration. Right click the empty line below the workbench and select ‘New Enum’.

Select a name for the enum and add a value for each configuration.

Select the previously created CP in the file view and change the data type to the new enum. Select also the default configuration by setting the ‘Default Value’ of the CP to one of the values.

The CP can now be selected in the ‘Configuration Selector’ on the virtual device setup page:

Creating the configurations

Both when using a single configuration or multiple configurations, the right configurations must be created in the setup data, and any non-used configurations must be removed before the configurations can be edited.

On the setup page there are two buttons for that.

The ‘Create Missing Configurations’ is used to ensure either the single configuration or all configurations in the Multiple Configurations are created.
When switching between ‘Single Configuration’ and ‘Multiple Configurations’ it is necessary to create the configurations that was not created before.
When using multiple configurations it is also necessary to create the missing configurations when adding values to the enum type used by the configuration selector CP.

Likewise the ‘Delete Unused Configurations’ is used when switching between ‘Single Configuration’ and ‘Multiple Configurations’ or when removing values from the enum type used by the configuration selector CP.

Configuration Setup

In each configuration, the source entity for each virtual device entity must be chosen and the setup for the source entity must be selected. The setup of the source entity is thereby controlled by the selected configuration of the virtual device.

Press the ‘Open Setup (Device and Configuration)’ button on the setup page to open the ‘Virtual Device Entity Configuration’ dialog.

GetAnalogInput

Please see the documentation in the Analog IO Tool manual.

SetAnalogOutput

Please see the documentation in the Analog IO Tool manual.

Get Entity Value

Please see the documentation in the Data Tool manual.

Set Entity Value

Please see the documentation in the Data Tool manual.

SetChannelDirection

Please see the documentation in the Digital IO Tool manual.

GetChannel

Please see the documentation in the Digital IO Tool manual.

SetChannel

Please see the documentation in the Digital IO Tool manual.

SetPortDirection

Please see the documentation in the Digital IO Tool manual.

GetPort

Please see the documentation in the Digital IO Tool manual.

SetPort

Please see the documentation in the Digital IO Tool manual.