BASIS 2 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
alicat_basis2::Basis2< Port > Class Template Reference

Driver for one instrument on a Bus. More...

#include <alicat_basis2.hpp>

Public Member Functions

 Basis2 (Bus< Port > &bus, const Config &config={}) noexcept
 Bind to a bus and store the configuration. No I/O, cannot fail.
 
 Basis2 (const Basis2 &)=delete
 One driver object per instrument.
 
Basis2 & operator= (const Basis2 &)=delete
 One driver object per instrument.
 
Lifecycle
Result< void > EnsureInitialized () noexcept
 Bring the port up and check the stored configuration; no instrument traffic.
 
Result< void > Begin () noexcept
 Learn the instrument: a poll, the firmware, serial number, full scale, gas, totalizer limit, averaging, reference temperature and, for a controller, setpoint source, ramp and autotare. Sends no write.
 
Result< void > Recover () noexcept
 Find the instrument again after a guarded command left StateUnknown or after a lost line: poll the configured ID, else (only when Bus::DeviceCount() is one) scan A to Z or the Modbus addresses, adopt the ID that answers and run Begin(). StateUnknown ends only when that Begin() succeeds and the serial number, firmware and kind equal those learned before; on any failure the driver stays in StateUnknown and keeps its old ID.
 
bool IsInitialized () const noexcept
 
bool IsReady () const noexcept
 
bool IsStateUnknown () const noexcept
 
const Config & GetConfig () const &noexcept
 
void GetConfig () const &&=delete
 Not on a temporary.
 
const Identity & GetIdentity () const &noexcept
 
void GetIdentity () const &&=delete
 Not on a temporary.
 
uint8_t LastException () const noexcept
 
Result< modbus::Response > ReadRegisterRaw (uint16_t first, uint16_t count) noexcept
 Single-shot raw read of count registers from first (Modbus function 3): one frame, no retry, no scaling. The reply is still accepted only after its CRC, address and length check.
 
Result< Reply > ReadRawLine (Command command) noexcept
 Single-shot raw read of one ASCII command that only reads (never one that writes): one request, no retry, no decoding; the reply line (without its CR) is returned as received.
 
const Reply & GetLastReply () const &noexcept
 
void GetLastReply () const &&=delete
 Not on a temporary.
 
Data
Result< Frame > ReadFrame () noexcept
 Poll: the full data frame (C01), or the Modbus block 2100 to 2109.
 
Result< Frame > ReadData (uint8_t items) noexcept
 Read selected fields (DV n, C02). In Modbus mode the block is read and the fields asked are filled.
 
Result< Decimal > ReadFlow () noexcept
 Flow in the configured unit.
 
Result< Decimal > ReadTemperature () noexcept
 Temperature in C.
 
Result< Decimal > ReadTotal () noexcept
 Totalizer.
 
Result< Decimal > ReadValveDrive () noexcept
 Valve drive in percent (controllers).
 
Result< Decimal > ReadSetpointValue () noexcept
 The current setpoint (controllers).
 
Result< Decimal > ReadBatchRemaining () noexcept
 Batch volume remaining (controllers).
 
Result< StatusFlags > ReadStatus () noexcept
 Status flags.
 
Result< Frame > ReadGas () noexcept
 The selected gas (C27).
 
Setpoint and valve (controllers)
Result< void > SetSetpoint (double flow) noexcept
 Set the setpoint (C03; Modbus registers 2053 to 2054).
 
Result< SetpointSource > ReadSetpointSource () noexcept
 Read the setpoint source (C04, register 516).
 
Result< void > SetSetpointSource (SetpointSource source) noexcept
 Set the setpoint source (C05, register 516). SavedDigital wears non-volatile memory: use UnsavedDigital for frequent changes.
 
Result< Ramp > ReadRamp () noexcept
 Read the ramp (C06, registers 524 to 525; Modbus: the raw register).
 
Result< void > SetRamp (double rate, TimeUnit unit) noexcept
 Set the maximum setpoint ramp rate (C07; Modbus 524 to 525 after conversion with the full scale, A9).
 
Result< void > DisableRamp () noexcept
 Disable ramp limiting (C08).
 
Result< uint32_t > ReadWatchdog () noexcept
 Read the watchdog in ms (C09, register 514).
 
Result< void > SetWatchdog (uint32_t ms) noexcept
 Set the communication watchdog (C10, register 514). It acts only for Modbus-set setpoints with the unsaved digital source (M p.12 to 13, A8): never rely on it with ASCII; see WatchdogProtects().
 
Result< void > HoldValve (double percent) noexcept
 Hold the valve at a percentage of full drive (C11). ASCII only; the Modbus map has no such register.
 
Result< void > ResumeControl () noexcept
 Resume closed-loop control after a hold (C12).
 
Result< void > OpenValve () noexcept
 Hold the valve fully open: HoldValve(100) (the FlowVision "open" button is not a command, A20).
 
Result< void > CloseValve () noexcept
 Hold the valve closed: HoldValve(0). Never refused for StateUnknown.
 
Control tuning (controllers)
Result< Gains > ReadGains () noexcept
 Read the loop gains (C13, registers 519 and 520).
 
Result< void > SetGains (uint32_t p, uint32_t i) noexcept
 Set the loop gains (C14).
 
Result< bool > ReadAutotare () noexcept
 Read autotare (C25, register 515).
 
Result< void > SetAutotare (bool on) noexcept
 Enable or disable autotare (C26): the zero is taken after 2 s at a zero setpoint.
 
Result< uint8_t > ReadMeasurementTrigger () noexcept
 Read the measurement trigger bits (C19, register 4200).
 
Result< void > SetMeasurementTrigger (uint8_t mask) noexcept
 Set the trigger bits (C20).
 
Measurement window and tare
Result< void > StartMeasurement (uint32_t duration_ms) noexcept
 Start a measurement window (C21; Modbus register 4201 in samples of about 2.5 ms).
 
Result< Averages > ReadAverages () noexcept
 Averages of the current or most recent window (C22).
 
Result< Ranges > ReadRanges () noexcept
 Minimum and maximum of the current or most recent window (C23).
 
Result< PreviousMeasurement > ReadPreviousMeasurement () noexcept
 The previous completed window (Modbus only; reading it may start a window, A17).
 
Result< void > Tare (uint32_t duration_ms) noexcept
 Tare the flow sensor (C24; Modbus 51 and 39). Only on the pure process gas at true zero flow (M p.14). The bus stays closed for the duration.
 
Result< void > TareDefault () noexcept
 Tare(1000), the manual's example duration.
 
Gas, totalizer, processing
Result< void > SetGas (GasId gas) noexcept
 Select the gas (C29, register 2100).
 
Result< GasList > ReadGasList () noexcept
 The gases the instrument offers (C28, firmware 3.0.5).
 
Result< GasTable > ReadGasTable () noexcept
 The twelve-entry gas table (Modbus only, firmware 3.0.5).
 
Result< void > ResetTotal () noexcept
 Reset the totalizer (C30, register 53).
 
Result< TotalizerLimit > ReadTotalizerLimit () noexcept
 Read the totalizer limit mode (C33, register 54).
 
Result< void > SetTotalizerLimit (TotalizerLimit mode) noexcept
 Set the totalizer limit mode (C34).
 
Result< void > SetBatch (double volume) noexcept
 Set a batch volume (C31; the valve closes after it has flowed).
 
Result< void > DisableBatch () noexcept
 Disable the batch (C32).
 
Result< uint32_t > ReadAveraging () noexcept
 Flow averaging time constant in ms (C17, register 55).
 
Result< void > SetAveraging (uint32_t ms) noexcept
 Set the averaging time constant (C18).
 
Result< Decimal > ReadReferenceTemperature () noexcept
 Reference temperature in C (C15, register 52).
 
Result< void > SetReferenceTemperature (double celsius) noexcept
 Set the reference temperature (C16): 0 to 30.00 C (A10).
 
Identity
Result< FullScale > ReadFullScale (FullScaleItem item) noexcept
 Read a full-scale value with its unit text (C35).
 
Result< Text > ReadSerialNumber () noexcept
 Serial number (C37, registers 26 to 31).
 
Result< Text > ReadFirmware () noexcept
 Firmware version (C38, register 25).
 
Result< uint32_t > ReadModbusAddress () noexcept
 Modbus address (C39, register 45).
 
Result< Baud > ReadBaud () noexcept
 Baud rate (C41, register 21).
 
Result< CommandProtocol > ReadProtocol () noexcept
 Command protocol (C43, register 56).
 
Result< FlowUnit > ReadFlowUnit () noexcept
 The flow unit code of register 49 (Modbus only).
 
Result< uint32_t > ReadFullScaleSccm () noexcept
 The full scale in SCCM (registers 35 to 36, Modbus only).
 
Result< uint16_t > ReadSensorOffset () noexcept
 The flow sensor offset (register 32, Modbus only).
 
Guarded commands
Result< void > ChangeUnitId (char new_id, ConfirmUnitIdChange) noexcept
 Change the unit ID (C36, register 46). Connect one instrument at a time (M p.16): refused when Bus::DeviceCount() is above one. The reply is accepted under either ID, then verified with a poll under the new ID; if that fails the state is StateUnknown until Recover().
 
Result< void > SetModbusAddress (uint8_t address, ConfirmAddressChange) noexcept
 Change the Modbus address (C40, register 45).
 
Result< void > ChangeBaud (Baud baud, ConfirmBaudChange) noexcept
 Change the baud rate (C42, register 21): the reply arrives at the new speed. Needs the port's SetBaud() hook. On failure the port is set back once and the state is StateUnknown.
 
Result< void > SwitchToProtocol1 (ConfirmAbandonProtocol2) noexcept
 Switch the instrument to BASIS Protocol 1 (C44, register 56). Only with the flow units SCCM, SLPM, NCCM or NLPM (M p.17). Afterwards the driver is abandoned: every call is Unsupported until SwitchToProtocol2() or Begin().
 
Result< void > SwitchToProtocol2 (ConfirmReturnToProtocol2) noexcept
 Switch back to BASIS Protocol 2 (C45).
 
Result< void > FactoryRestore (ConfirmFactoryRestore) noexcept
 Restore the factory configuration (C46, register 80). Unit ID, baud rate, Modbus address and protocol revert: the state is StateUnknown; power-cycle the instrument and call Recover().
 
Scans
Result< UnitIdScan > ScanUnitIds () noexcept
 Poll A to Z (26 reads at most) and report which answered.
 
Result< AddressScan > ScanModbusAddresses (uint8_t first, uint8_t last) noexcept
 Read register 25 at each address of a range (function 3 only).
 

Static Public Member Functions

static constexpr bool WatchdogProtects (Protocol protocol, SetpointSource source) noexcept
 Whether the instrument's watchdog protects a setpoint (A8): only for Modbus-written setpoints with the unsaved digital source.
 

Detailed Description

template<UartPort Port>
class alicat_basis2::Basis2< Port >

Driver for one instrument on a Bus.

Lifecycle: construct with the configuration (no I/O), then EnsureInitialized() (port up, configuration checked), then Begin() (a read-only sequence that learns the identity). Every call that touches the instrument returns NotInitialized before EnsureInitialized() has succeeded.

Template Parameters
PortYour class derived from UartInterface<Port>.

Constructor & Destructor Documentation

◆ Basis2()

template<UartPort Port>
alicat_basis2::Basis2< Port >::Basis2 ( Bus< Port > &  bus,
const Config &  config = {} 
)
inlineexplicitnoexcept

Bind to a bus and store the configuration. No I/O, cannot fail.

Parameters
busThe serial line; it must outlive the driver.
configChecked by EnsureInitialized() before any I/O.

Member Function Documentation

◆ Begin()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::Begin ( )
noexcept

Learn the instrument: a poll, the firmware, serial number, full scale, gas, totalizer limit, averaging, reference temperature and, for a controller, setpoint source, ramp and autotare. Sends no write.

The instrument needs about one minute after power-up to settle (S19 p.1). In Modbus mode Config::modbus_flow_decimals must be set (A11).

Returns
Ok, NotInitialized, InvalidArgument (Modbus decimals unset), or the error of the first failing transaction.

◆ ChangeBaud()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::ChangeBaud ( Baud  baud,
ConfirmBaudChange   
)
noexcept

Change the baud rate (C42, register 21): the reply arrives at the new speed. Needs the port's SetBaud() hook. On failure the port is set back once and the state is StateUnknown.

Parameters
baudThe new speed.
Returns
Ok, Unsupported (no hook), FirmwareTooOld, StateUnknown or an error.

◆ ChangeUnitId()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::ChangeUnitId ( char  new_id,
ConfirmUnitIdChange   
)
noexcept

Change the unit ID (C36, register 46). Connect one instrument at a time (M p.16): refused when Bus::DeviceCount() is above one. The reply is accepted under either ID, then verified with a poll under the new ID; if that fails the state is StateUnknown until Recover().

Parameters
new_idA to Z.
Returns
Ok, GuardNotConfirmed, InvalidArgument, Unsupported or StateUnknown.

◆ CloseValve()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::CloseValve ( )
noexcept

Hold the valve closed: HoldValve(0). Never refused for StateUnknown.

Returns
Ok or an error.

◆ DisableBatch()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::DisableBatch ( )
noexcept

Disable the batch (C32).

Returns
Ok/error.

◆ DisableRamp()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::DisableRamp ( )
noexcept

Disable ramp limiting (C08).

Returns
Ok or an error.

◆ EnsureInitialized()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::EnsureInitialized ( )
noexcept

Bring the port up and check the stored configuration; no instrument traffic.

Returns
Ok, InvalidArgument (bad Config), Bus (the port could not start).

◆ FactoryRestore()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::FactoryRestore ( ConfirmFactoryRestore  )
noexcept

Restore the factory configuration (C46, register 80). Unit ID, baud rate, Modbus address and protocol revert: the state is StateUnknown; power-cycle the instrument and call Recover().

Returns
Ok or an error.

◆ GetConfig()

template<UartPort Port>
const Config & alicat_basis2::Basis2< Port >::GetConfig ( ) const &
inlinenoexcept
Returns
The configuration in force.

◆ GetIdentity()

template<UartPort Port>
const Identity & alicat_basis2::Basis2< Port >::GetIdentity ( ) const &
inlinenoexcept
Returns
What Begin() learned.

◆ GetLastReply()

template<UartPort Port>
const Reply & alicat_basis2::Basis2< Port >::GetLastReply ( ) const &
inlinenoexcept
Returns
The last reply any call accepted from the bus (no I/O); empty before the first.

◆ HoldValve()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::HoldValve ( double  percent)
noexcept

Hold the valve at a percentage of full drive (C11). ASCII only; the Modbus map has no such register.

Parameters
percent0 to 100.
Returns
Ok, InvalidArgument, Unsupported (meter or Modbus) or a bus error.

◆ IsInitialized()

template<UartPort Port>
bool alicat_basis2::Basis2< Port >::IsInitialized ( ) const
inlinenoexcept
Returns
true after EnsureInitialized() succeeded. No I/O.

◆ IsReady()

template<UartPort Port>
bool alicat_basis2::Basis2< Port >::IsReady ( ) const
inlinenoexcept
Returns
true after Begin() succeeded and until a guarded command leaves the state unknown.

◆ IsStateUnknown()

template<UartPort Port>
bool alicat_basis2::Basis2< Port >::IsStateUnknown ( ) const
inlinenoexcept
Returns
true while the driver doubts the instrument's state (a guarded command's outcome was not seen); only a successful Recover() ends it. No I/O.

◆ LastException()

template<UartPort Port>
uint8_t alicat_basis2::Basis2< Port >::LastException ( ) const
inlinenoexcept
Returns
The Modbus exception code of the last Rejected Modbus reply, else 0.

◆ OpenValve()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::OpenValve ( )
noexcept

Hold the valve fully open: HoldValve(100) (the FlowVision "open" button is not a command, A20).

Returns
Ok or an error.

◆ ReadAutotare()

template<UartPort Port>
Result< bool > alicat_basis2::Basis2< Port >::ReadAutotare ( )
noexcept

Read autotare (C25, register 515).

Returns
true when enabled.

◆ ReadAverages()

template<UartPort Port>
Result< Averages > alicat_basis2::Basis2< Port >::ReadAverages ( )
noexcept

Averages of the current or most recent window (C22).

Returns
Time, temperature, flow.

◆ ReadAveraging()

template<UartPort Port>
Result< uint32_t > alicat_basis2::Basis2< Port >::ReadAveraging ( )
noexcept

Flow averaging time constant in ms (C17, register 55).

Returns
The time.

◆ ReadBatchRemaining()

template<UartPort Port>
Result< Decimal > alicat_basis2::Basis2< Port >::ReadBatchRemaining ( )
noexcept

Batch volume remaining (controllers).

Returns
The number.

◆ ReadBaud()

template<UartPort Port>
Result< Baud > alicat_basis2::Basis2< Port >::ReadBaud ( )
noexcept

Baud rate (C41, register 21).

Returns
The speed.

◆ ReadData()

template<UartPort Port>
Result< Frame > alicat_basis2::Basis2< Port >::ReadData ( uint8_t  items)
noexcept

Read selected fields (DV n, C02). In Modbus mode the block is read and the fields asked are filled.

Parameters
itemsDataItem bits, 1 to 255; controller-only items on a meter are Unsupported.
Returns
The frame with present == items.

◆ ReadFirmware()

template<UartPort Port>
Result< Text > alicat_basis2::Basis2< Port >::ReadFirmware ( )
noexcept

Firmware version (C38, register 25).

Returns
The text as printed (Modbus: V a.b.c).

◆ ReadFlow()

template<UartPort Port>
Result< Decimal > alicat_basis2::Basis2< Port >::ReadFlow ( )
noexcept

Flow in the configured unit.

Returns
The number.

◆ ReadFlowUnit()

template<UartPort Port>
Result< FlowUnit > alicat_basis2::Basis2< Port >::ReadFlowUnit ( )
noexcept

The flow unit code of register 49 (Modbus only).

Returns
The unit.

◆ ReadFrame()

template<UartPort Port>
Result< Frame > alicat_basis2::Basis2< Port >::ReadFrame ( )
noexcept

Poll: the full data frame (C01), or the Modbus block 2100 to 2109.

Returns
The frame.

◆ ReadFullScale()

template<UartPort Port>
Result< FullScale > alicat_basis2::Basis2< Port >::ReadFullScale ( FullScaleItem  item)
noexcept

Read a full-scale value with its unit text (C35).

Parameters
itemWhich.
Returns
The value.

◆ ReadFullScaleSccm()

template<UartPort Port>
Result< uint32_t > alicat_basis2::Basis2< Port >::ReadFullScaleSccm ( )
noexcept

The full scale in SCCM (registers 35 to 36, Modbus only).

Returns
The value.

◆ ReadGains()

template<UartPort Port>
Result< Gains > alicat_basis2::Basis2< Port >::ReadGains ( )
noexcept

Read the loop gains (C13, registers 519 and 520).

Returns
P and I.

◆ ReadGas()

template<UartPort Port>
Result< Frame > alicat_basis2::Basis2< Port >::ReadGas ( )
noexcept

The selected gas (C27).

Returns
The gas and its name.

◆ ReadGasList()

template<UartPort Port>
Result< GasList > alicat_basis2::Basis2< Port >::ReadGasList ( )
noexcept

The gases the instrument offers (C28, firmware 3.0.5).

Returns
The list or its raw text.

◆ ReadGasTable()

template<UartPort Port>
Result< GasTable > alicat_basis2::Basis2< Port >::ReadGasTable ( )
noexcept

The twelve-entry gas table (Modbus only, firmware 3.0.5).

Returns
The table.

◆ ReadMeasurementTrigger()

template<UartPort Port>
Result< uint8_t > alicat_basis2::Basis2< Port >::ReadMeasurementTrigger ( )
noexcept

Read the measurement trigger bits (C19, register 4200).

Returns
A mask of TriggerMode.

◆ ReadModbusAddress()

template<UartPort Port>
Result< uint32_t > alicat_basis2::Basis2< Port >::ReadModbusAddress ( )
noexcept

Modbus address (C39, register 45).

Returns
The address.

◆ ReadPreviousMeasurement()

template<UartPort Port>
Result< PreviousMeasurement > alicat_basis2::Basis2< Port >::ReadPreviousMeasurement ( )
noexcept

The previous completed window (Modbus only; reading it may start a window, A17).

Returns
The values.

◆ ReadProtocol()

template<UartPort Port>
Result< CommandProtocol > alicat_basis2::Basis2< Port >::ReadProtocol ( )
noexcept

Command protocol (C43, register 56).

Returns
The protocol.

◆ ReadRamp()

template<UartPort Port>
Result< Ramp > alicat_basis2::Basis2< Port >::ReadRamp ( )
noexcept

Read the ramp (C06, registers 524 to 525; Modbus: the raw register).

Returns
The ramp.

◆ ReadRanges()

template<UartPort Port>
Result< Ranges > alicat_basis2::Basis2< Port >::ReadRanges ( )
noexcept

Minimum and maximum of the current or most recent window (C23).

Returns
The ranges.

◆ ReadRawLine()

template<UartPort Port>
Result< Reply > alicat_basis2::Basis2< Port >::ReadRawLine ( Command  command)
noexcept

Single-shot raw read of one ASCII command that only reads (never one that writes): one request, no retry, no decoding; the reply line (without its CR) is returned as received.

Parameters
commandA read command of the grammar table, for example Command::ReadGas.
Returns
The reply line, or Unsupported over Modbus, InvalidArgument or a bus error.

◆ ReadReferenceTemperature()

template<UartPort Port>
Result< Decimal > alicat_basis2::Basis2< Port >::ReadReferenceTemperature ( )
noexcept

Reference temperature in C (C15, register 52).

Returns
The number.

◆ ReadRegisterRaw()

template<UartPort Port>
Result< modbus::Response > alicat_basis2::Basis2< Port >::ReadRegisterRaw ( uint16_t  first,
uint16_t  count 
)
noexcept

Single-shot raw read of count registers from first (Modbus function 3): one frame, no retry, no scaling. The reply is still accepted only after its CRC, address and length check.

Parameters
firstFirst register.
countNumber of registers, 1 to reg::kMaxRead.
Returns
The register words, or Unsupported over ASCII, InvalidArgument or a bus error.

◆ ReadSensorOffset()

template<UartPort Port>
Result< uint16_t > alicat_basis2::Basis2< Port >::ReadSensorOffset ( )
noexcept

The flow sensor offset (register 32, Modbus only).

Returns
The ADC integer defined as zero.

◆ ReadSerialNumber()

template<UartPort Port>
Result< Text > alicat_basis2::Basis2< Port >::ReadSerialNumber ( )
noexcept

Serial number (C37, registers 26 to 31).

Returns
The text.

◆ ReadSetpointSource()

template<UartPort Port>
Result< SetpointSource > alicat_basis2::Basis2< Port >::ReadSetpointSource ( )
noexcept

Read the setpoint source (C04, register 516).

Returns
The source.

◆ ReadSetpointValue()

template<UartPort Port>
Result< Decimal > alicat_basis2::Basis2< Port >::ReadSetpointValue ( )
noexcept

The current setpoint (controllers).

Returns
The number.

◆ ReadStatus()

template<UartPort Port>
Result< StatusFlags > alicat_basis2::Basis2< Port >::ReadStatus ( )
noexcept

Status flags.

Returns
The flags.

◆ ReadTemperature()

template<UartPort Port>
Result< Decimal > alicat_basis2::Basis2< Port >::ReadTemperature ( )
noexcept

Temperature in C.

Returns
The number.

◆ ReadTotal()

template<UartPort Port>
Result< Decimal > alicat_basis2::Basis2< Port >::ReadTotal ( )
noexcept

Totalizer.

Returns
The number.

◆ ReadTotalizerLimit()

template<UartPort Port>
Result< TotalizerLimit > alicat_basis2::Basis2< Port >::ReadTotalizerLimit ( )
noexcept

Read the totalizer limit mode (C33, register 54).

Returns
The mode.

◆ ReadValveDrive()

template<UartPort Port>
Result< Decimal > alicat_basis2::Basis2< Port >::ReadValveDrive ( )
noexcept

Valve drive in percent (controllers).

Returns
The number.

◆ ReadWatchdog()

template<UartPort Port>
Result< uint32_t > alicat_basis2::Basis2< Port >::ReadWatchdog ( )
noexcept

Read the watchdog in ms (C09, register 514).

Returns
The time, 0 when disabled.

◆ Recover()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::Recover ( )
noexcept

Find the instrument again after a guarded command left StateUnknown or after a lost line: poll the configured ID, else (only when Bus::DeviceCount() is one) scan A to Z or the Modbus addresses, adopt the ID that answers and run Begin(). StateUnknown ends only when that Begin() succeeds and the serial number, firmware and kind equal those learned before; on any failure the driver stays in StateUnknown and keeps its old ID.

Returns
Ok, NotInitialized, Timeout (nothing answered), VerifyMismatch (another instrument answered) or an error of Begin().

◆ ResetTotal()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::ResetTotal ( )
noexcept

Reset the totalizer (C30, register 53).

Returns
Ok/error.

◆ ResumeControl()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::ResumeControl ( )
noexcept

Resume closed-loop control after a hold (C12).

Returns
Ok or an error.

◆ ScanModbusAddresses()

template<UartPort Port>
Result< AddressScan > alicat_basis2::Basis2< Port >::ScanModbusAddresses ( uint8_t  first,
uint8_t  last 
)
noexcept

Read register 25 at each address of a range (function 3 only).

Parameters
firstFirst address, 1 to 247.
lastLast address, first to 247.
Returns
The addresses that answered.

◆ ScanUnitIds()

template<UartPort Port>
Result< UnitIdScan > alicat_basis2::Basis2< Port >::ScanUnitIds ( )
noexcept

Poll A to Z (26 reads at most) and report which answered.

Returns
The IDs.

◆ SetAutotare()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetAutotare ( bool  on)
noexcept

Enable or disable autotare (C26): the zero is taken after 2 s at a zero setpoint.

Parameters
onEnabled.
Returns
Ok or an error.

◆ SetAveraging()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetAveraging ( uint32_t  ms)
noexcept

Set the averaging time constant (C18).

Parameters
ms0 to 2500.
Returns
Ok/error.

◆ SetBatch()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetBatch ( double  volume)
noexcept

Set a batch volume (C31; the valve closes after it has flowed).

Parameters
volumeAbove 0.
Returns
Result.

◆ SetGains()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetGains ( uint32_t  p,
uint32_t  i 
)
noexcept

Set the loop gains (C14).

Parameters
pP gain 0 to 65535.
iI gain 0 to 65535.
Returns
Ok/error.

◆ SetGas()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetGas ( GasId  gas)
noexcept

Select the gas (C29, register 2100).

Parameters
gasThe gas.
Returns
Ok/error.

◆ SetMeasurementTrigger()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetMeasurementTrigger ( uint8_t  mask)
noexcept

Set the trigger bits (C20).

Parameters
mask0 to 7.
Returns
Ok/error.

◆ SetModbusAddress()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetModbusAddress ( uint8_t  address,
ConfirmAddressChange   
)
noexcept

Change the Modbus address (C40, register 45).

Parameters
address1 to 247.
Returns
Ok, InvalidArgument, StateUnknown or an error.

◆ SetRamp()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetRamp ( double  rate,
TimeUnit  unit 
)
noexcept

Set the maximum setpoint ramp rate (C07; Modbus 524 to 525 after conversion with the full scale, A9).

Parameters
rateFlow units per time unit, above 0.
unitThe time unit.
Returns
Ok, InvalidArgument, Unsupported or a bus error.

◆ SetReferenceTemperature()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetReferenceTemperature ( double  celsius)
noexcept

Set the reference temperature (C16): 0 to 30.00 C (A10).

Parameters
celsiusThe value.
Returns
Result.

◆ SetSetpoint()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetSetpoint ( double  flow)
noexcept

Set the setpoint (C03; Modbus registers 2053 to 2054).

Checked against 0 to full scale x 1.025 (M p.11). While the source is SavedDigital (or unknown) a change sooner than Config::saved_setpoint_min_interval_ms after the last one is RateLimited: the saved source wears non-volatile memory (M p.11). Read back per Config::verify_setpoint: one extra transaction.

Parameters
flowThe setpoint in the instrument's flow unit.
Note
A setpoint of 0 is a switch-off: it is never refused for StateUnknown or RateLimited.
Returns
Ok, InvalidArgument, Unsupported (meter), RateLimited, VerifyMismatch or a bus error.

◆ SetSetpointSource()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetSetpointSource ( SetpointSource  source)
noexcept

Set the setpoint source (C05, register 516). SavedDigital wears non-volatile memory: use UnsavedDigital for frequent changes.

Parameters
sourceThe source.
Returns
Ok, InvalidArgument, Unsupported or a bus error.

◆ SetTotalizerLimit()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetTotalizerLimit ( TotalizerLimit  mode)
noexcept

Set the totalizer limit mode (C34).

Parameters
modeThe mode.
Returns
Ok/error.

◆ SetWatchdog()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SetWatchdog ( uint32_t  ms)
noexcept

Set the communication watchdog (C10, register 514). It acts only for Modbus-set setpoints with the unsaved digital source (M p.12 to 13, A8): never rely on it with ASCII; see WatchdogProtects().

Parameters
ms0 to 5000; 0 disables.
Returns
Ok, InvalidArgument, Unsupported or a bus error.

◆ StartMeasurement()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::StartMeasurement ( uint32_t  duration_ms)
noexcept

Start a measurement window (C21; Modbus register 4201 in samples of about 2.5 ms).

Parameters
duration_msDuration in ms.
Returns
Ok, InvalidArgument or an error.

◆ SwitchToProtocol1()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SwitchToProtocol1 ( ConfirmAbandonProtocol2  )
noexcept

Switch the instrument to BASIS Protocol 1 (C44, register 56). Only with the flow units SCCM, SLPM, NCCM or NLPM (M p.17). Afterwards the driver is abandoned: every call is Unsupported until SwitchToProtocol2() or Begin().

Returns
Ok, Unsupported (unit not allowed) or an error.

◆ SwitchToProtocol2()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::SwitchToProtocol2 ( ConfirmReturnToProtocol2  )
noexcept

Switch back to BASIS Protocol 2 (C45).

Returns
Ok/error.

◆ Tare()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::Tare ( uint32_t  duration_ms)
noexcept

Tare the flow sensor (C24; Modbus 51 and 39). Only on the pure process gas at true zero flow (M p.14). The bus stays closed for the duration.

Parameters
duration_ms1 to 32767.
Returns
Ok, InvalidArgument or an error.

◆ TareDefault()

template<UartPort Port>
Result< void > alicat_basis2::Basis2< Port >::TareDefault ( )
noexcept

Tare(1000), the manual's example duration.

Returns
Ok/error.

◆ WatchdogProtects()

template<UartPort Port>
static constexpr bool alicat_basis2::Basis2< Port >::WatchdogProtects ( Protocol  protocol,
SetpointSource  source 
)
inlinestaticconstexprnoexcept

Whether the instrument's watchdog protects a setpoint (A8): only for Modbus-written setpoints with the unsaved digital source.

Parameters
protocolThe protocol the setpoint is written with.
sourceThe setpoint source.
Returns
true only for ModbusRtu with UnsavedDigital.

The documentation for this class was generated from the following file: