Architectural Overview
An overview of this package’s architecture.
The Device Manager
The DeviceManager class is the backbone of this package. It is what
facilitates connections to different devices and is responsible for correctly
selecting the driver for the device being connected to. The
DeviceManager
keeps a mapping of all devices in use and provides access to the driver for each
active device. The device driver is what is responsible for communication with
the physical device and also contains useful attributes, which contain
information about the device, and methods, which provide various functionality.
The DeviceManager uses a configuration parser
(DMConfigParser) to read in
connection information from an optional config file or
environment variable as well as to store
connection information that is provided directly via python code.
This information contains the device type (e.g., SCOPE, AFG, SMU) as well as the address
(e.g., hostname, IP address, or model and serial number for USBTMC). The config parser also reads in
optional configuration settings that apply globally, such as turning on verbose VISA logging. The
DeviceManager then connects to all the devices that the config parser
has listed and provides access to the Python driver for each device. The
Python device driver is the class responsible for actual communication with the physical
(or virtual) device.
Block Diagram
classDiagram
direction LR
DeviceManager --> "0..n" Device : contains
DeviceManager --> "1" DMConfigParser : uses
Device Types
These are the currently supported device types:
- Arbitrary Function Generators (AFGs)
- Arbitrary Waveform Generators (AWGs)
- Data Acquisition Systems (DAQs)
- Digital Multimeters (DMMs)
- Margin Testers
- Power Supplies (PSUs)
- Scopes (Oscilloscopes)
- Source Measure Units (SMUs)
- Systems Switches
Block Diagram
classDiagram
direction LR
Device <|-- AFG
Device <|-- AWG
Device <|-- DataAcquisitionSystem
Device <|-- DigitalMultimeter
Device <|-- Mainframe
Device <|-- MarginTester
Device <|-- PowerSupplyUnit
Device <|-- Scope
Device <|-- SourceMeasureUnit
Device <|-- SystemsSwitch
Device Drivers
Object-Oriented Design Principles
The drivers are the biggest part of this package; each unique series of instrument gets a uniquely
named Python driver class (see tm_devices.drivers for the list of
available driver classes). These classes are implemented using object-oriented programming
principles and make extensive use of inheritance. This allows common attributes and methods to be
defined in higher-level, abstract classes that are then inherited by the individual driver classes.
Mixin classes are also used to provide shared implementations and abstract method signatures for the
drivers. This allows multiple device types to all inherit from the same abstract class (mixin class)
without sharing the exact same inheritance tree (since they might not share much else). The mixin
classes define attributes and methods, some of which the driver will overwrite or implement for itself.
Family Base Classes
One other technique for enabling code reuse in the drivers is by using a “family base class”. Each
family base class is an abstract class that defines the signature for all child classes that
inherit from it. Occasionally a child class will need to overwrite an implementation due to the
differences that can occur between different models of the same device type, but the class signature
will not change. This means that all drivers that inherit from a common family base class are
guaranteed to have the same class signature (attributes, methods, etc.), and this rule is enforced by unit tests.
Object-Oriented Design Benefits
These object-oriented principles result in individual driver classes that are quite simple to
read, as they have very few actual lines of code. Code duplication is extremely low, which makes
drivers easy to create and update.
Block Diagram
This package supports many devices, zoom in to see them all!
Note
- Family Base Classes are outlined in orange red.
- Device Drivers are highlighted in lawn green.
classDiagram
direction LR
AFG <|-- AFG31K
AFG <|-- AFG3K
AFG3K <|-- AFG3KB
AFG3KB <|-- AFG3KC
AWG <|-- AWG5200
AWG <|-- AWG5K
AWG <|-- AWG70KA
AWG <|-- AWG7K
AWG5K <|-- AWG5KB
AWG5KB <|-- AWG5KC
AWG70KA <|-- AWG70KB
AWG7K <|-- AWG7KB
AWG7KB <|-- AWG7KC
AbstractTekScope <|-- TekScope
AbstractTekScope <|-- TekScopePC
DMM75xx <|-- DMM7510
DMM75xx <|-- DMM7512
DPO2K <|-- DPO2KB
DPO4K <|-- DPO4KB
DPO5K <|-- DPO5KB
DPO7 <|-- DPO7AX
DPO70K <|-- DPO70KC
DPO70K <|-- DPO70KDX
DPO70K <|-- DPO70KSX
DPO70KC <|-- DPO70KD
DPO7K <|-- DPO7KC
DSA70K <|-- DSA70KC
DSA70K <|-- DSA70KD
DataAcquisitionSystem <|-- DAQ6510
Device <|-- AFG
Device <|-- AWG
Device <|-- DataAcquisitionSystem
Device <|-- DigitalMultimeter
Device <|-- Mainframe
Device <|-- MarginTester
Device <|-- PowerSupplyUnit
Device <|-- Scope
Device <|-- SourceMeasureUnit
Device <|-- SystemsSwitch
DigitalMultimeter <|-- DMM6500
DigitalMultimeter <|-- DMM75xx
MDO4K <|-- MDO4KB
MDO4KB <|-- MDO4KC
MP5xxx <|-- MP5103
MSO2K <|-- MSO2KB
MSO4 <|-- MSO4B
MSO4K <|-- MSO4KB
MSO5 <|-- MSO5B
MSO5 <|-- MSO5LP
MSO5K <|-- MSO5KB
MSO6 <|-- LPD6
MSO6 <|-- MSO6B
MSO70K <|-- MSO70KC
MSO70K <|-- MSO70KDX
Mainframe <|-- MP5xxx
MarginTester <|-- TMT4
PSU2200 <|-- PSU2220
PSU2200 <|-- PSU2230
PSU2200 <|-- PSU2231
PSU2200 <|-- PSU2280
PSU2200 <|-- PSU2281
PSU2231 <|-- PSU2231A
PowerSupplyUnit <|-- PSU2200
SMU24xxInteractive <|-- SMU2450
SMU24xxInteractive <|-- SMU2460
SMU24xxInteractive <|-- SMU2461
SMU24xxInteractive <|-- SMU2470
SMU24xxStandard <|-- SMU2400
SMU24xxStandard <|-- SMU2401
SMU24xxStandard <|-- SMU2410
SMU2601B <|-- SMU2601BPulse
SMU265xA <|-- SMU2651A
SMU265xA <|-- SMU2657A
SMU26xx <|-- SMU265xA
SMU26xx <|-- SMU26xxA
SMU26xx <|-- SMU26xxB
SMU26xxA <|-- SMU2601A
SMU26xxA <|-- SMU2602A
SMU26xxA <|-- SMU2604A
SMU26xxA <|-- SMU2611A
SMU26xxA <|-- SMU2612A
SMU26xxA <|-- SMU2614A
SMU26xxA <|-- SMU2634A
SMU26xxA <|-- SMU2635A
SMU26xxA <|-- SMU2636A
SMU26xxB <|-- SMU2601B
SMU26xxB <|-- SMU2602B
SMU26xxB <|-- SMU2604B
SMU26xxB <|-- SMU2606B
SMU26xxB <|-- SMU2611B
SMU26xxB <|-- SMU2612B
SMU26xxB <|-- SMU2614B
SMU26xxB <|-- SMU2634B
SMU26xxB <|-- SMU2635B
SMU26xxB <|-- SMU2636B
SMU6xxx <|-- SMU6430
SMU6xxx <|-- SMU6514
SMU6xxx <|-- SMU6517B
Scope <|-- AbstractTekScope
Scope <|-- TSOVu
Scope <|-- TekScope2k
Scope <|-- TekScope3k4k
Scope <|-- TekScope5k7k70k
SourceMeasureUnit <|-- SMU24xxInteractive
SourceMeasureUnit <|-- SMU24xxStandard
SourceMeasureUnit <|-- SMU26xx
SourceMeasureUnit <|-- SMU6xxx
SystemsSwitch <|-- SS3706A
TekScope <|-- DPO7
TekScope <|-- MSO2
TekScope <|-- MSO4
TekScope <|-- MSO5
TekScope <|-- MSO6
TekScope2k <|-- DPO2K
TekScope2k <|-- MSO2K
TekScope3k4k <|-- DPO4K
TekScope3k4k <|-- MDO3
TekScope3k4k <|-- MDO3K
TekScope3k4k <|-- MDO4K
TekScope3k4k <|-- MSO4K
TekScope5k7k70k <|-- DPO5K
TekScope5k7k70k <|-- DPO70K
TekScope5k7k70k <|-- DPO7K
TekScope5k7k70k <|-- DSA70K
TekScope5k7k70k <|-- MSO5K
TekScope5k7k70k <|-- MSO70K
style AFG stroke:orangered,stroke-width:4px
style AWG5200 stroke:orangered,stroke-width:4px
style AWG5K stroke:orangered,stroke-width:4px
style AWG70KA stroke:orangered,stroke-width:4px
style AWG7K stroke:orangered,stroke-width:4px
style DAQ6510 stroke:orangered,stroke-width:4px
style DMM6500 stroke:orangered,stroke-width:4px
style DMM75xx stroke:orangered,stroke-width:4px
style MP5xxx stroke:orangered,stroke-width:4px
style MarginTester stroke:orangered,stroke-width:4px
style PSU2200 stroke:orangered,stroke-width:4px
style SMU24xxInteractive stroke:orangered,stroke-width:4px
style SMU24xxStandard stroke:orangered,stroke-width:4px
style SMU26xx stroke:orangered,stroke-width:4px
style SMU6xxx stroke:orangered,stroke-width:4px
style SS3706A stroke:orangered,stroke-width:4px
style TSOVu stroke:orangered,stroke-width:4px
style TekScope stroke:orangered,stroke-width:4px
style TekScope2k stroke:orangered,stroke-width:4px
style TekScope3k4k stroke:orangered,stroke-width:4px
style TekScope5k7k70k stroke:orangered,stroke-width:4px
style TekScopePC stroke:orangered,stroke-width:4px
style AFG31K fill:lawngreen
style AFG3K fill:lawngreen
style AFG3KB fill:lawngreen
style AFG3KC fill:lawngreen
style AWG5200 fill:lawngreen
style AWG5K fill:lawngreen
style AWG5KB fill:lawngreen
style AWG5KC fill:lawngreen
style AWG70KA fill:lawngreen
style AWG70KB fill:lawngreen
style AWG7K fill:lawngreen
style AWG7KB fill:lawngreen
style AWG7KC fill:lawngreen
style DAQ6510 fill:lawngreen
style DMM6500 fill:lawngreen
style DMM7510 fill:lawngreen
style DMM7512 fill:lawngreen
style DPO2K fill:lawngreen
style DPO2KB fill:lawngreen
style DPO4K fill:lawngreen
style DPO4KB fill:lawngreen
style DPO5K fill:lawngreen
style DPO5KB fill:lawngreen
style DPO70K fill:lawngreen
style DPO70KC fill:lawngreen
style DPO70KD fill:lawngreen
style DPO70KDX fill:lawngreen
style DPO70KSX fill:lawngreen
style DPO7AX fill:lawngreen
style DPO7K fill:lawngreen
style DPO7KC fill:lawngreen
style DSA70K fill:lawngreen
style DSA70KC fill:lawngreen
style DSA70KD fill:lawngreen
style LPD6 fill:lawngreen
style MDO3 fill:lawngreen
style MDO3K fill:lawngreen
style MDO4K fill:lawngreen
style MDO4KB fill:lawngreen
style MDO4KC fill:lawngreen
style MP5103 fill:lawngreen
style MSO2 fill:lawngreen
style MSO2K fill:lawngreen
style MSO2KB fill:lawngreen
style MSO4 fill:lawngreen
style MSO4B fill:lawngreen
style MSO4K fill:lawngreen
style MSO4KB fill:lawngreen
style MSO5 fill:lawngreen
style MSO5B fill:lawngreen
style MSO5K fill:lawngreen
style MSO5KB fill:lawngreen
style MSO5LP fill:lawngreen
style MSO6 fill:lawngreen
style MSO6B fill:lawngreen
style MSO70K fill:lawngreen
style MSO70KC fill:lawngreen
style MSO70KDX fill:lawngreen
style PSU2200 fill:lawngreen
style PSU2220 fill:lawngreen
style PSU2230 fill:lawngreen
style PSU2231 fill:lawngreen
style PSU2231A fill:lawngreen
style PSU2280 fill:lawngreen
style PSU2281 fill:lawngreen
style SMU2400 fill:lawngreen
style SMU2401 fill:lawngreen
style SMU2410 fill:lawngreen
style SMU2450 fill:lawngreen
style SMU2460 fill:lawngreen
style SMU2461 fill:lawngreen
style SMU2470 fill:lawngreen
style SMU2601A fill:lawngreen
style SMU2601B fill:lawngreen
style SMU2601BPulse fill:lawngreen
style SMU2602A fill:lawngreen
style SMU2602B fill:lawngreen
style SMU2604A fill:lawngreen
style SMU2604B fill:lawngreen
style SMU2606B fill:lawngreen
style SMU2611A fill:lawngreen
style SMU2611B fill:lawngreen
style SMU2612A fill:lawngreen
style SMU2612B fill:lawngreen
style SMU2614A fill:lawngreen
style SMU2614B fill:lawngreen
style SMU2634A fill:lawngreen
style SMU2634B fill:lawngreen
style SMU2635A fill:lawngreen
style SMU2635B fill:lawngreen
style SMU2636A fill:lawngreen
style SMU2636B fill:lawngreen
style SMU2651A fill:lawngreen
style SMU2657A fill:lawngreen
style SMU6430 fill:lawngreen
style SMU6514 fill:lawngreen
style SMU6517B fill:lawngreen
style SS3706A fill:lawngreen
style SupportedModels fill:lawngreen
style TMT4 fill:lawngreen
style TSOVu fill:lawngreen
style TekScopePC fill:lawngreen