Skip to main content
This Instrument category is new and is currently available only in the Unstable package

InstroFlowController

InstroFlowController is a hardware abstraction layer (HAL) that provides a unified interface for InstroFlowMeter. The category class defines the vendor-independent API (set_voltage, get_voltage, output_enable, …). A vendor-specific driver (e.g. BK9115, KeysightE36100, TDKLambdaGenesys, RigolDP800) owns its connection details and translates those calls into vendor commands.

Supported Vendors

  • AlicatMC: Alicat MC-series serial-controlled flow meters
If your vendor or model is not listed, see Custom Driver Development below.

Key Concepts

Driver Composition

An InstroFlowController is built from a concrete driver:
  • The vendor driver (e.g. AlicatMC) owns the connection setup and vendor-specific command mapping.
  • InstroFlowController owns the category-level workflow: measurements, commands, publishers, the background daemon.

Lifecycle

The typical InstroFlowController workflow:
  1. Construct: instantiate the vendor driver and pass it to InstroFlowController.
  2. open(): establishes the VISA connection.
  3. Configure and measure: select gas, set flow setpoint, tare flow (optional), and read flow data.
  4. start(): begins a periodic background daemon. (Optional) By default this calls get_flow_data periodically.
  5. stop(): ends the background daemon (if started).
  6. close(): disconnects from hardware.

Creating an InstroFlowController Instance

Parameters

  • name: A name for this flow controller instance. Used as a prefix for channel names when publishing.
  • driver: A concrete FlowControllerDriverBase instance (e.g. AlicatMC) configured with the connection details for that model.
  • publishers: Optional list of publishers to attach.
  • **kwargs: Additional keyword arguments become default tags when using a publisher that supports tags (like NominalCorePublisher).

Choosing a Driver

Choose the concrete driver that matches the flow controller model, then pass the instrument connection settings to that driver. For example, use AlicatMC for the Alicat MC-series.

Examples

All measurement methods return Measurement objects. This is common amongst all Instrument objects.

Basic Usage

Background Daemon for Continuous Monitoring

In this mode:
  • start() begins a background daemon, executing a function or list of functions periodically.
  • stop() ends the background daemon.
Default Flow Controller Background DaemonFor each meter, using get_flow_data():
  • temperature
  • pressure
  • mass flow (mass_flow)
  • volumetric flow (vol_flow)
  • setpoint (as read back from the meter)
    • setpoint.cmd represents the last command to the controller from this client)
The default polling interval is 1 second, the default within the base Instrument class, but is configurable via the background_interval property.
Custom Background Daemon
  • To define your own background daemon, call define_background_daemon(method, *args, **kwargs), which replaces the registered daemon functions.
  • To add a method to the background daemon stack, call add_background_daemon_function().
See Two ways to get data for more information regarding background fetching of measurements.
Important Note about PublishersData is published as a direct result of an instrument method being called.For example, when you call get_flow_data(), this not only queries the instrument for the voltage but also causes all attached Publishers to publish the measurement response automatically.Therefore the background daemon, when calling these instrument methods, is publishing data in the background as well!

Published channels

Every measurement/command call produces a channel keyed under {name}.{descriptor}, where {name} is the name argument passed to the constructor.

Method Reference


Custom Driver Development

This section is for developers implementing InstroFlowController support for flow controllers that aren’t shipped in the library.

Overview

Driver developers subclass FlowControllerDriverBase and own whatever transport their instrument needs. The caller chooses a concrete driver and passes it to InstroFlowController:
The driver translates InstroFlowController’s vendor-independent API (get_flow_data, set_setpoint, select_gas, tare_flow) into vendor-specific commands.

Driver Responsibilities

A flow controller driver must:
  1. Expose a protocol-native constructor: accept inputs like visa_resource, host, port, or device_id, depending on the instrument.
  2. Own transport setup: create and store the transport internally. Do not require users to pass a VisaDriver or other transport object.
  3. Own lifecycle: implement open() and close() by opening and closing the underlying transport.
  4. Map commands: translate each abstract method into vendor-specific commands.
  5. Parse responses: convert instrument responses into FlowData or the expected return type.

FlowControllerDriverBase Interface

All flow controller drivers subclass FlowControllerDriverBase and implement these abstract methods:
All six methods are @abc.abstractmethod. FlowData (from instro.flowcontroller.types) carries pressure, temperature, vol_flow, mass_flow, setpoint, gas, and status_flags.

Talking to the Instrument

Concrete drivers should hide transport details behind private attributes. For VISA-backed drivers (including RS-232/serial), create a VisaDriver internally and use it for all I/O:
  • self._visa.write(command): Send a command (no response expected).
  • self._visa.query(command): Send a command and receive the response string.
  • self._visa.read(): Read one line from the device buffer.
VisaDriver owns the resource lock. Use with self._visa.lock(): when a sequence of writes and reads must execute atomically. See the VisaDriver guide for the full transport reference, covering configuration, terminators, timeouts, and serial settings.

Implementation Example: Alicat MC-Series

AlicatMC is the reference driver. It communicates over RS-232 using Alicat’s proprietary ASCII polling protocol — not SCPI — so commands are terse single-character identifiers rather than IEEE 488.2-style mnemonics.
Alicat ASCII protocol, not SCPIAlicat MC-series devices use a proprietary ASCII polling protocol. Commands are single-character identifiers (e.g. {id} to poll, {id}s{setpt} to set a setpoint, {id}v to tare, {id}g{n} to select a gas) rather than SCPI mnemonics. An unrecognized command returns ?. Consult the Alicat Gas Flow Controller Manual for the full command reference.

Using a Custom Driver

Construct InstroFlowController with your own driver instance:

Summary

Driver development requires careful mapping of vendor-specific behavior to the unified InstroFlowController interface. Focus on:
  • Subclassing FlowControllerDriverBase
  • Designing a constructor around natural connection parameters for the instrument
  • Hiding transport construction inside the driver
  • Implementing all six abstract methods on FlowControllerDriverBase
  • Returning correctly typed FlowData from measurement methods
  • Parsing and raising instrument errors appropriately
  • Testing with actual hardware to ensure commands work as expected