Session

class nimodinst.Session(self, driver)

Creates a handle to a list of installed devices supported by the specified driver. Call this method and pass in the name of an NI instrument driver, such as “NI-SCOPE”. This method searches the system and constructs a list of all the installed devices that are supported by that driver, and then returns both a handle to this list and the number of devices found. The handle is used with other methods to query for properties such as device name and model, and to safely discard the list when finished. Note This handle reflects the system state when the handle is created (that is, when you call this method. If you remove devices from the system or rename them in Measurement & Automation Explorer (MAX), this handle may not refer to an accurate list of devices. You should destroy the handle using nimodinst.Session._close_installed_devices_session() and create a new handle using this method.

Parameters:driver (str) – A string specifying the driver whose supported devices you want to find. This string is not case-sensitive. Some examples are: NI-SCOPE niScope NI-FGEN niFgen NI-HSDIO niHSDIO NI-DMM niDMM NI-SWITCH niSwitch Note If you use the empty string for this parameter, NI-ModInst creates a list of all Modular Instruments devices installed in the system.

Methods

close

nimodinst.Session.close()

Cleans up the NI-ModInst session created by a call to nimodinst.Session._open_installed_devices_session(). Call this method when you are finished using the session handle and do not use this handle again.

Note

This method is not needed when using the session context manager

Properties

bus_number

nimodinst.Session.bus_number

The bus on which the device has been enumerated.

The following table lists the characteristics of this property.

Characteristic Value
Datatype int
Permissions read only

Tip

This property corresponds to the following LabVIEW Property or C Attribute:

  • C Attribute: NIMODINST_ATTR_BUS_NUMBER

chassis_number

nimodinst.Session.chassis_number

The number of the chassis in which the device is installed. This property can only be queried for PXI devices installed in a chassis that has been properly identified in MAX.

The following table lists the characteristics of this property.

Characteristic Value
Datatype int
Permissions read only

Tip

This property corresponds to the following LabVIEW Property or C Attribute:

  • C Attribute: NIMODINST_ATTR_CHASSIS_NUMBER

device_model

nimodinst.Session.device_model

The model of the device (for example, NI PXI-5122)

The following table lists the characteristics of this property.

Characteristic Value
Datatype str
Permissions read only

Tip

This property corresponds to the following LabVIEW Property or C Attribute:

  • C Attribute: NIMODINST_ATTR_DEVICE_MODEL

device_name

nimodinst.Session.device_name

The name of the device, which can be used to open an instrument driver session for that device

The following table lists the characteristics of this property.

Characteristic Value
Datatype str
Permissions read only

Tip

This property corresponds to the following LabVIEW Property or C Attribute:

  • C Attribute: NIMODINST_ATTR_DEVICE_NAME

serial_number

nimodinst.Session.serial_number

The serial number of the device

The following table lists the characteristics of this property.

Characteristic Value
Datatype str
Permissions read only

Tip

This property corresponds to the following LabVIEW Property or C Attribute:

  • C Attribute: NIMODINST_ATTR_SERIAL_NUMBER

slot_number

nimodinst.Session.slot_number

The slot (for example, in a PXI chassis) in which the device is installed. This property can only be queried for PXI devices installed in a chassis that has been properly identified in MAX.

The following table lists the characteristics of this property.

Characteristic Value
Datatype int
Permissions read only

Tip

This property corresponds to the following LabVIEW Property or C Attribute:

  • C Attribute: NIMODINST_ATTR_SLOT_NUMBER

socket_number

nimodinst.Session.socket_number

The socket number on which the device has been enumerated

The following table lists the characteristics of this property.

Characteristic Value
Datatype int
Permissions read only

Tip

This property corresponds to the following LabVIEW Property or C Attribute:

  • C Attribute: NIMODINST_ATTR_SOCKET_NUMBER