The pfeiffer module

The pfeiffer module contains drivers for equipment from Pfeiffer Vacuum. At present the module contains drivers for the TPG 261 and TPG 262 pressure measurement and control units.

TPG 26x

The TPG 261 and TPG 262 has the same communications protocol and therefore the driver has been implemented as a common driver in the TPG26x class, which the TPG261 and TPG262 classes inherit from, as illustrated below.

digraph inheritance917ab441ed { rankdir=LR; size="8.0, 12.0"; "PyExpLabSys.drivers.pfeiffer.TPG261" [URL="#PyExpLabSys.drivers.pfeiffer.TPG261",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Driver for the TPG 261 dual channel measurement and control unit"]; "PyExpLabSys.drivers.pfeiffer.TPG26x" -> "PyExpLabSys.drivers.pfeiffer.TPG261" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PyExpLabSys.drivers.pfeiffer.TPG262" [URL="#PyExpLabSys.drivers.pfeiffer.TPG262",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Driver for the TPG 262 dual channel measurement and control unit"]; "PyExpLabSys.drivers.pfeiffer.TPG26x" -> "PyExpLabSys.drivers.pfeiffer.TPG262" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PyExpLabSys.drivers.pfeiffer.TPG26x" [URL="#PyExpLabSys.drivers.pfeiffer.TPG26x",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Abstract class that implements the common driver for the TPG 261 and"]; }

The driver implements only a sub set of the specification, but given that the ground work has already been done, it should be simple to implement more methods as they are needed.

Usage Example

The driver classes can be instantiated by specifying just the address of the serial communications port the unit is connected to:

from PyExpLabSys.drivers.pfeiffer import TPG262
tpg = TPG262(port='/dev/ttyUSB0')
value, (status_code, status_string) = tpg.pressure_gauge(1)
# or
value, _ = tpg.pressure_gauge(1)
unit = tpg.pressure_unit()
print 'pressure is {} {}'.format(value, unit)

If the baud rate on the TPG 26x unit has been changed away from the default setting of 9600, then the correct baud rate will need to be given as a parameter.

pfeiffer module

This module contains drivers for the following equipment from Pfeiffer Vacuum:

  • TPG 262 and TPG 261 Dual Gauge. Dual-Channel Measurement and Control
    Unit for Compact Gauges
class PyExpLabSys.drivers.pfeiffer.TPG26x(port='/dev/ttyUSB0', baudrate=9600)[source]

Bases: object

Abstract class that implements the common driver for the TPG 261 and TPG 262 dual channel measurement and control unit. The driver implements the following 6 commands out the 39 in the specification:

  • PNR: Program number (firmware version)
  • PR[1,2]: Pressure measurement (measurement data) gauge [1, 2]
  • PRX: Pressure measurement (measurement data) gauge 1 and 2
  • TID: Transmitter identification (gauge identification)
  • UNI: Pressure unit
  • RST: RS232 test

This class also contains the following class variables, for the specific characters that are used in the communication:

Variables:
  • ETX – End text (Ctrl-c), chr(3), \x15
  • CR – Carriage return, chr(13), \r
  • LF – Line feed, chr(10), \n
  • ENQ – Enquiry, chr(5), \x05
  • ACK – Acknowledge, chr(6), \x06
  • NAK – Negative acknowledge, chr(21), \x15
__init__(port='/dev/ttyUSB0', baudrate=9600)[source]

Initialize internal variables and serial connection

Parameters:
  • port (str or int) – The COM port to open. See the documentation for pyserial for an explanation of the possible value. The default value is ‘/dev/ttyUSB0’.
  • baudrate (int) – 9600, 19200, 38400 where 9600 is the default
program_number()[source]

Return the firmware version

Returns:the firmware version
Return type:str
pressure_gauge(gauge=1)[source]

Return the pressure measured by gauge X

Parameters:gauge (int) – The gauge number, 1 or 2
Raises:ValueError – if gauge is not 1 or 2
Returns:(value, (status_code, status_message))
Return type:tuple
pressure_gauges()[source]

Return the pressures measured by the gauges

Returns:(value1, (status_code1, status_message1), value2, (status_code2, status_message2))
Return type:tuple
gauge_identification()[source]

Return the gauge identication

Returns:(id_code_1, id_1, id_code_2, id_2)
Return type:tuple
pressure_unit()[source]

Return the pressure unit

Returns:the pressure unit
Return type:str
rs232_communication_test()[source]

RS232 communication test

Returns:the status of the communication test
Return type:bool
class PyExpLabSys.drivers.pfeiffer.TPG262(port='/dev/ttyUSB0', baudrate=9600)[source]

Bases: PyExpLabSys.drivers.pfeiffer.TPG26x

Driver for the TPG 262 dual channel measurement and control unit

__init__(port='/dev/ttyUSB0', baudrate=9600)[source]

Initialize internal variables and serial connection

Parameters:
  • port (str or int) –

    The COM port to open. See the documentation for pyserial for an explanation of the possible value. The default value is ‘/dev/ttyUSB0’.

  • baudrate (int) – 9600, 19200, 38400 where 9600 is the default
class PyExpLabSys.drivers.pfeiffer.TPG261(port='/dev/ttyUSB0', baudrate=9600)[source]

Bases: PyExpLabSys.drivers.pfeiffer.TPG26x

Driver for the TPG 261 dual channel measurement and control unit

__init__(port='/dev/ttyUSB0', baudrate=9600)[source]

Initialize internal variables and serial connection

Parameters:
  • port (str or int) –

    The COM port to open. See the documentation for pyserial for an explanation of the possible value. The default value is ‘/dev/ttyUSB0’.

  • baudrate (int) – 9600, 19200, 38400 where 9600 is the default