By providing a way to configure the relationship between drivers and I/O references, an IVI® configuration store greatly enhances instrument interchangeability.
Suppose your code uses only a specified driver to communicate with one type of instrument at a fixed location. If you change the instrument model, instrument location, or driver, you would have to modify the code to accommodate that change.
An IVI configuration store offers the ability to accommodate different instrument models, drivers, or ports, without having to modify your code. This interchangeability is especially useful when you use code that cannot be easily modified.
The components of an IVI configuration store identify:
Locations of the instruments to communicate with
Software modules used to control the instruments
Associations of software modules used with instruments at specific locations
Component | Description |
---|---|
Software module | A software module is instrument-specific, and contains the commands and functions necessary to communicate with the instrument. The instrument vendor commonly provides software modules, which you cannot edit from the MATLAB® Command Window. |
Hardware asset | A hardware asset identifies a communication port connected
the instrument. Configure this component with an |
Driver session | A driver session makes the association between a software module and a hardware asset. Generally, you have a driver session for each instrument at each of its possible locations. Identical instruments connected at different locations can use the same software module, but because they have different hardware assets, they require different driver sessions. Different kinds of instruments connected to the same location (at different times) use the same hardware asset, but can have different software modules. Therefore, they require different driver sessions. |
Logical name | A logical name is a configuration store component that provides access to a driver session. You can interpret a logical name as a configurable pointer to a driver session. In a typical setup, the code communicates with an instrument via a logical name. If the code must communicate with a different instrument (for example, a similar scope at a different location), update only the logical name within the IVI configuration store to point to the new driver session. You need not rewrite any code because it uses the same logical name. |
You can use the Test & Measurement Tool to examine or configure your IVI configuration store. Open the tool by typing:
tmtool
Expand the Instrument Drivers node and click IVI.
You see a tab for each type of IVI configuration store
element. This figure shows the available driver sessions in the current IVI configuration
store. For the selected driver session, you can use any available
software module or hardware asset. This figure shows the configuration
for the driver session TekScope.DriverSession
,
which uses the software module TekScope.Software
and
the hardware asset TekScope.Hardware
.
Alternatively, you can use command-line functions to examine
and configure your IVI configuration store. To see what IVI configuration
store elements are available, use instrhwinfo
to
identify the existing logical names.
instrhwinfo('ivi') ans = LogicalNames: {'MainScope', 'FuncGen'} ProgramIDs: {'TekScope.TekScope','Agilent33250'} Modules: {'ag3325b', 'hpe363xa'} ConfigurationServerVersion: '1.6.0.10124' MasterConfigurationStore: 'C:\Program Files\IVI\Data\ IviConfigurationStore.xml' IVIRootPath: 'C:\Program Files\IVI\'
Use instrhwinfo
with a logical name as an
argument to see the details of the configuration.
instrhwinfo('ivi','MainScope') ans = DriverSession: 'TekScope.DriverSession' HardwareAsset: 'TekScope.Hardware' SoftwareModule: 'TekScope.Software' IOResourceDescriptor: 'GPIB0::13::INSTR' SupportedInstrumentModels: 'TekScope 5000, 6000 and 7000 series' ModuleDescription: 'TekScope software module desc' ModuleLocation: ''
You can use the command line to change the configuration store. Here is an example of changing it programmatically.
% Construct a configStore. configStore = iviconfigurationstore; % Set up the hardware asset with name myScopeHWAsset, and resource descriptor % TCPIP0::a-m6104a-004598::INSTR. add(configStore, 'HardwareAsset', 'myScopeHWAsset', 'TCPIP0::a-m6104a-004598::INSTR'); % Add a driver session with name myScopeSession, and use the asset created in the step above. % Ag546XX is the Agilent driver. add(configStore, 'DriverSession', 'myScopeSession', 'Ag546XX', 'myScopeHWAsset'); % Add a logical name to the configStore, with name myScope and driver session % named myScopeSession. add(configStore, 'LogicalName', 'myScope', 'myScopeSession'); % Save the changes to the IVI configuration store data file. commit(configStore); % You can verify that the steps you just performed worked. logicalNameInfo = instrhwinfo('ivi', 'myscope')
Following is an example of configuration used by data_analyzer.m
.
Create and configure elements in the IVI configuration
store using the IVI configuration store object methods add
, commit
, remove
, and update
. For further details, see the
reference pages for these methods.
The following figure shows an example of an IVI configuration
store with several interchangeable components. Code
1 requires access to the oscilloscopes at two different
locations (hardware asset X
and hardware asset Y
). The scopes are similar, so they
use the same software module S
. Here, the scopes
are at different locations (or the same scope connected to two different
locations at different times). Therefore, each configuration requires
its own driver session, in this example, driver session A
and
driver session B
.
Write Code 1 to access logical
name 1
. You configure the name in the IVI configuration
store to access driver session A
or driver session B
(but
not both at the same time). Because you select the driver session
in the IVI configuration store, you need not alter the code to
change access from one scope to the other.