Using The Option String |
Top Previous Next |
An IVI driver can operate without the presence of an actual instrument by using simulation mode. When simulation is turned on, the driver performs no instrument communication, but attempts to generate results which allow client applications to reasonably execute. You can turn on simulation using either of the following two techniques: •Passing the "simulate=true" option string parameter to the Initialize method. •Setting the Simulate property to True. The IVI-COM driver contains a Simulate property in the IIviDriverOperation interface. The IVI-C driver contains a corresponding Simulate attribute. Note that you can turn simulation on, if you initialize a driver with it off. However, if you initialize an IVI-COM driver with simulation turned on, you will get an error if you attempt to later turn it off. This is because you cannot initiate a live I/O session with an instrument after you have called the Initialize function. The fourth and last parameter to the Initialize method is the option string. See the help on Initialize for more details. To turn simulation on with the option string, include the following in the option string:
simulate=true For example, the Initialize call in C# might look like this: instr.Initialize("USB::0x1BFE::0x5500::8728::BTN", true, true, "Simulate=True"); When the simulate option is set True, the value of the resource descriptor parameter (the first parameter above) is ignored. This is because no I/O connection will be made with the instrument, as is required by IVI-3.1: Driver Architecture Specification. The Driver Session Simulate PropertyA DriverSession in the IVI Configuration Store contains properties for the same items which can be set with the option string parameter. The name of a DriverSession, or the name of a LogicalName which points to a DriverSession, can be used as the first parameter to Initialize. If the Simulate property in the DriverSession is true, the driver is initialized in simulation mode. Changing the Instrument ModelMany drivers support more than one instrument model. These models are listed in the SupportedInstrumentModels property in the IIviDriverIdentify interface. Drivers will typically select one of these as the default model by creating a special type of entry in the IVI Configuration Store known as a Configurable Initial Settings. You can modify the Model value in the Configurable Initial Settings for the DriverSession of interest, or you can simply specify the model to simulate at runtime during the call to Initialize. To have the driver simulate a specific model of your choosing, simply add the desired model to the DriverSetup string using the following special syntax: Simulate=true, DriverSetup=Model=55006 The complete Initialize call becomes: instr.Initialize("USB::0x1BFE::0x5500::8728::BTN", True, True, "Simulate=True, DriverSetup= Model=55006") If you set the model to a value not supported by the driver, the driver reports an error. Limitations of SimulationSimulation is designed to allow the driver to be used without an instrument or any I/O software or hardware. However, simulation is not intended to fully emulate the instrument. There are some important differences you should be aware of: •Many instruments have status systems, and these are not live. For instance, you can set Enable and Transition registers but queries of Condition and Event registers will always return a fixed value, which is usually zero. •There often is no parameter range checking or coercion unless done in the driver. Most drivers depend on the instrument to perform range checking and coercion of parameter values. In simulation mode, this will not occur. For example setting a frequency parameter to 1E99 will be accepted without error in simulation where an instrument would return a "parameter out of range" error. •IIviDriverUtility::ErrorQuery() typically returns no error. •Measurement data is not live. Most data queries will return a fixed value or a small array of values. |