NI-9477 digital output module
Flowchem supports the National Instruments NI-9477 C Series module when it is installed in a CompactDAQ chassis such as
the cDAQ-9171. The NI-9477 is exposed as a 32-channel relay-style component named relay.
Note
The NI-9477 is a sinking digital output module. In Flowchem, power-on means that the output line is active/sinking
current. It does not mean the module sources voltage to the connected load.
Installation
Install the NI-DAQmx driver from NI and confirm the chassis and module are visible in NI MAX. Then install Flowchem with the NI extra:
python -m pip install "flowchem[ni]"
For local development from this repository:
python -m pip install -e ".[ni]"
Configuration
If there is exactly one NI-9477 visible to NI-DAQmx, module may be omitted. Otherwise, set it to the NI MAX module
name, for example cDAQ1Mod1 or Dev1.
[device.ni_outputs]
type = "NI9477"
module = "cDAQ1Mod1"
reset_outputs_on_initialize = true
By default, Flowchem writes all 32 outputs OFF during initialization so the cached output state is known. Set
reset_outputs_on_initialize = false if startup must not modify the hardware state.
Relay API
The component is available as device_name/relay, for example ni_outputs/relay.
PUT /power-on?channel=1activates one output.PUT /power-off?channel=1deactivates one output.GET /is-on?channel=1returns whether one output is active.PUT /multiple_channel?values=101sets outputs from a compact state string; missing channels are padded OFF.GET /channel_set_point?channel=1returns1or0for one output.GET /channels_set_pointreturns all 32 cached output states.
Flowchem channels are numbered 1 to 32, mapped to NI physical lines line0 to line31.
Controlling a solenoid valve
The NI relay component can be used as a support_platform for a BioChem solenoid valve:
[device.ni_outputs]
type = "NI9477"
module = "cDAQ1Mod1"
[device.valve_1]
type = "BioChemSolenoidValve"
support_platform = "ni_outputs/relay"
channel = 1
normally_open = false
The channel value selects which NI-9477 output line drives the valve.