Creating or Modifying IVI Class Simulation Drivers

Updated Nov 16, 2023



  • IVI Compliance Package

The IVI class drivers implement simulation features by using simulation drivers. The IVI Compliance Package (ICP) installs a simulation driver for each IVI class driver. Each simulation driver plugs in to the corresponding class driver and performs flexible output data simulation.

 Using IVI Class Simulation Drivers

The NI IVI Driver Help contains information about using and configuring the IVI Class simulation drivers. If you installed the IVI Compliance Package (ICP), you can access the help document from the following location in Windows: Start>>Program Files>>National Instruments>>IVI>>IVI Driver Help

You can also use IVI Drivers to Simulate Your Instrumentation Hardware in LabVIEW and LabWindows/CVI

 Creating Custom IVI Class Simulation Drivers

The IVI Compliance Package (ICP) distributes the simulation drivers as .dll files so that you can use them immediately. It also includes C source files for the simulation drivers, so you can modify the drivers to meet your specific simulation requirements. The ICP installation program places the simulation driver .dll files in the <IVI Standard Root Dir>\bin directory. The installation program places the .c, .h, and .uir files in the Program Files\National Instruments\IVI\Sim directory. You must use LabWindows/CVI to modify or build the class simulation drivers.

To modify or create a new class simulation driver, you will need to go through the following steps:

  1. Review the IVI Class Driver Simulation Overview topic and its subtopics in the NI IVI Driver Help to acquaint yourself with the design and features of a class simulation driver.
  2. In the Program Files\National Instruments\IVI\Sim directory, copy and rename the source and project files for the driver that most closely resembles the IVI class for which you are trying to develop a class simulation driver.
  3. Search and replace all instances of prefix and PREFIX with your class simulation driver prefix.
  4. Modify the data generation algorithms and status codes to meet your simulation requirements.
  5. Build the simulation driver DLL.
  6. Review the next section, Using Custom IVI Class Simulation Drivers, to learn how to configure your system to use the simulation driver you just created.


Using Custom IVI Class Simulation Drivers

To use an IVI class simulation driver that you develop, you need to create simulation driver-related items in the IVI Configuration Store using NI Measurement & Automation Explorer (MAX). A class simulation driver registers itself with the IVI Configuration Store like any other software module, except that it creates an additional IviPublishedAPI item with the name NISimulationDriver. The additional IviPublishedAPI item allows NI MAX to recognize the software module as a class simulation driver and display it under the Advanced>>Simulation Driver Software Modules node, as shown below:

Figure 1. The Simulation Driver Software Module Tree in NI MAX

​​​​​​Figure 2. An Example Simulation Driver Software Module

Currently, NI MAX does not allow you to directly create and configure simulation driver software modules. You can use the following workaround to create simulation driver software modules:

  1. Launch NI MAX and browse to the IVI Drivers>>Advanced>>Instrument Driver Software Modules node.
  2. Right-click on the node and select Create New from the context menu.
  3. Rename the new item to the name of your software module (e.g. simscope).
  4. Fill in the Prefix and Module Path properties on the General tab.
  5. (Optional) If you want to define configurable initial settings for the simulation driver, you can add them on the Configurable Settings tab. Specify only the following properties for a simulation driver configurable setting: NameDescriptionTypeSoftwareModuleKey, and DefaultValue. Refer to the IVI Class Driver Help>>IviDCPwr>>Simulation Driver Attributes topic in NI IVI Driver Help for a list of attributes that apply only to class simulation.

    For example, you can specify the following values for INTERACTIVE_SIMULATION:
    Description = Specifies whether the simulation driver uses interactive simulation
    Type = Boolean
    DefaultValue = True
  6. Now add the following entries to the list of Published APIs (case-sensitive):

    IviDriver, 2.0, IVI-C
    NISimulationDriver, 2.0, IVI-C
    <yourclassname>,<yourclassversion>, IVI-C
  7. Click the Save IVI Configuration button to save the configuration and press <F5> to refresh the view. The software module item appears under the Simulation Driver Software Modules node.
  8. Create a Simulation Driver Session. Browse to the Simulation Driver Sessions node. Right-click and select Create New from the context menu. Rename the driver session (e.g. simscope).
  9. On the General tab, select simscope for the value of the Simulation Driver Software Module drop-down list.
  10. To use the class simulation driver, create a Driver Session item and select simscope as the class simulation session to use with the Driver Session (specified on the General tab).

When you initialize an IVI class driver with a Logical Name (or Driver Session) that uses a class simulation driver, the class driver automatically loads and initializes the specified simulation driver. Any function calls made to the class driver are dispatched to the simulation driver (in addition to the specific driver) if the simulation driver implements that particular function call.