pyopticon.majumdar_lab_widgets.aalborg_dpc_widget module

class pyopticon.majumdar_lab_widgets.aalborg_dpc_widget.AalborgDPCWidget(parent_dashboard, name, nickname, default_serial_port, default_gas='Ar', **kwargs)

Bases: GenericWidget

Widget for an Aalborg DPC mass flow controller (MFC). This widget controls a single MFC via a serial port.

By default, the gas selection dropdown includes a few gases that the author happened to use. Aalborg has many, many gas options in its user manual. You can configure the gas options in the constructor.

In practice, the MFC’s sometimes bug out when serial commands are sent directly back-to-back, so we use a short delay between queries/commands that are sent.

One can add a manual calibration curve, though these devices tend to be pretty accurate. This is done by tabulating the commanded flow (i.e., the value sent to the MFC) and the actual flow (according to an external flow meter) at various flow conditions, then feeding the resulting tuples of flows to the constructor for this class.

Parameters:
  • parent_dashboard (richardview.dashboard.RichardViewDashboard) – The dashboard object to which this device will be added

  • name (str) – The name that the widget will be labeled with, and under which its data will be logged, e.g. “Methane Mass Flow Controller”

  • nickname (str) – A shortened nickname that can be used to identify the widget in automation scripts, e.g. “CH4 MFC”

  • default_serial_port (str) – The name of the default selected serial port, e.g. ‘COM9’

  • default_gas (str, optional) – The default gas that’s selected in the dropdown, defaults to ‘Ar’ for Argon

  • gas_options (list, optional) – The list of gas names (strings) that can be selected. Defaults to argon, hydrogen, and methane.

  • gas_numbers (list, optional) – The list of gas numbers (integers) corresponding to gas_options according to the Aalborg DPC handbook. Defaults to indices for Ar, H2, and CH4.

  • calibration (tuple, optional) – a tuple containing two tuples of ints or floats with the results of calibrating the MFC. The first should contain a range of flow commands sent to the MFC. The second should contain the result flows according to an external flow meter. (0,0) should be included, as should a value above the highest flow you expect to use. For example, ( (0,10,20,30), (0,11.5,20.7,33.4) ).

on_failed_serial_open()

If serial failed to open, set the readouts to ‘no reading’.

on_handshake()

Conduct a handshake and populate the default values.

on_update()

Send four queries to the serial device asking for the gas selection, mode, setpoint, and actual flow rate. Mode refers to open, closed, or setpoint. Read and process the responses.

on_serial_close()

When serial is closed, set all readouts to ‘None’.

on_confirm()

When ‘confirm’ is pressed, send the appropriate commands to the MFC. Prints warnings to console if the entered parameters are invalid.