Class Driver Simulation

National Instruments IVI Driver

Class Driver Simulation

The IVI class drivers provide simulation tools. You can use these tools to create simulated output data. The class drivers provide simulation by using a simulation driver. Simulation drivers are components that plug into a class driver. The class driver uses the simulation driver to generate data.

For example, ICP includes five simulation drivers—oscilloscope, DMM, function generator, switch, and DC power supply. Each of these simulation drivers communicates with the corresponding class driver to perform more flexible data generation than in instrument specific drivers. The following diagram illustrates how a class driver uses a class simulation driver.

Class Simulation Driver

When your program calls a class driver, the class driver calls the corresponding function in the specific driver. When you enable simulation, the class driver opens an additional session that is assigned to its class simulation driver. Whenever you invoke a function in the class driver, the class driver first calls the corresponding function in the specific driver and then calls the same function in the class simulation driver. The specific driver performs range checking and coercion on all input parameters, and the class simulation driver generates the simulated output data and status codes.

Simulation drivers have two modes: interactive and non-interactive. You specify whether to use interactive or non-interactive simulation with MAX. In interactive mode, simulation drivers have pop-up user interface panels that allow you to configure the parameters for generating the simulated output data.

For example, when you initialize the IviDmm class driver in simulation mode, the simulation driver displays the panel shown in the following figure.

From the panel, you can select a base measurement value and an offset. For example, in the previous figure, the panel settings specify a value of 10.0 with a range of ±1.0. You can configure the driver to display the panel each time the program calls a function that returns measurement data, or you can configure the driver to generate the data automatically within the range you specify. In non-interactive mode, the simulation driver returns data to the program without requiring further user interaction.

In addition to generating simulated measurement data, you can use the class simulation features to generate simulated results for the Self-Test, Error Query, and Revision Query functions that all IVI drivers export. You can also use the class simulation tools to generate simulated completion codes for the instrument driver functions. Use this feature to verify that your program correctly handles error conditions that the instrument driver might return.

To configure all the features of the simulation driver, use attributes in the simulation driver. When you use non-interactive simulation, you configure the attributes of the simulation driver with MAX without modifying your test program code.

ICP includes C source code for the class simulation drivers. You can develop robust simulated data generation algorithms for your test systems and incorporate them into the simulation drivers. Whenever you swap to a different instrument, you can reuse your developed simulation code because the simulation drivers work with the class drivers.