hvl_ccb.dev.mbw973.mbw973
Device class for controlling a MBW 973 SF6 Analyzer over a serial connection.
The MBW 973 is a gas analyzer designed for gas insulated switchgear and measures humidity, SF6 purity and SO2 contamination in one go. Manufacturer homepage: https://www.mbw.ch/products/sf6-gas-analysis/973-sf6-analyzer/
- class MBW973(com, dev_config=None)[source]
Bases:
SingleCommDevice
MBW 973 dew point mirror device class.
- static config_cls()[source]
Return the default configdataclass class.
- Returns:
a reference to the default configdataclass class
- static default_com_cls()[source]
Get the class for the default communication protocol used with this device.
- Returns:
the type of the standard communication protocol for this device
- is_done() bool [source]
Poll status of the dew point mirror and return True, if all measurements are done.
- Returns:
True, if all measurements are done; False otherwise.
- Raises:
SerialCommunicationIOError – when communication port is not opened
- read(cast_type: type = <class 'str'>)[source]
Read value from self.com and cast to cast_type. Raises ValueError if read text (str) is not convertible to cast_type, e.g. to float or to int.
- Returns:
Read value of cast_type type.
- read_float() float [source]
Convenience wrapper for self.read(), with typing hint for return value.
- Returns:
Read float value.
- read_int() int [source]
Convenience wrapper for self.read(), with typing hint for return value.
- Returns:
Read int value.
- read_measurements() dict[str, float] [source]
Read out measurement values and return them as a dictionary.
- Returns:
Dictionary with values.
- Raises:
SerialCommunicationIOError – when communication port is not opened
- set_measuring_options(humidity: bool = True, sf6_purity: bool = False) None [source]
Send measuring options to the dew point mirror.
- Parameters:
humidity – Perform humidity test or not?
sf6_purity – Perform SF6 purity test or not?
- Raises:
SerialCommunicationIOError – when communication port is not opened
- start() None [source]
Start this device. Opens the communication protocol and retrieves the set measurement options from the device.
- Raises:
SerialCommunicationIOError – when communication port cannot be opened.
- start_control() None [source]
Start dew point control to acquire a new value set.
- Raises:
SerialCommunicationIOError – when communication port is not opened
- write(value) None [source]
Send value to self.com.
- Parameters:
value – Value to send, converted to str.
- Raises:
SerialCommunicationIOError – when communication port is not opened
- class MBW973Config(polling_interval: int | float = 2)[source]
Bases:
object
Device configuration dataclass for MBW973.
- force_value(fieldname, value)
Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
- Parameters:
fieldname – name of the field
value – value to assign
- is_configdataclass = True
- classmethod keys() Sequence[str]
Returns a list of all configdataclass fields key-names.
- Returns:
a list of strings containing all keys.
- classmethod optional_defaults() dict[str, object]
Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
- Returns:
a list of strings containing all optional keys.
- polling_interval: int | float = 2
Polling period for is_done status queries [in seconds].
- classmethod required_keys() Sequence[str]
Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
- Returns:
a list of strings containing all required keys.
- exception MBW973ControlRunningError[source]
Bases:
MBW973Error
Error indicating there is still a measurement running, and a new one cannot be started.
- exception MBW973Error[source]
Bases:
DeviceError
General error with the MBW973 dew point mirror device.
- exception MBW973PumpRunningError[source]
Bases:
MBW973Error
Error indicating the pump of the dew point mirror is still recovering gas, unable to start a new measurement.
- class MBW973SerialCommunication(configuration)[source]
Bases:
SerialCommunication
Specific communication protocol implementation for the MBW973 dew point mirror. Already predefines device-specific protocol parameters in config.
- class MBW973SerialCommunicationConfig(terminator: bytes = b'\r', encoding: str = 'utf-8', encoding_error_handling: str = 'strict', wait_sec_read_text_nonempty: Union[int, float] = 0.5, default_n_attempts_read_text_nonempty: int = 10, port: Optional[str] = None, baudrate: int = 9600, parity: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = <SerialCommunicationParity.NONE: 'N'>, stopbits: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = <SerialCommunicationStopbits.ONE: 1>, bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = <SerialCommunicationBytesize.EIGHTBITS: 8>, timeout: Union[int, float] = 3)[source]
Bases:
SerialCommunicationConfig
- baudrate: int = 9600
Baudrate for MBW973 is 9600 baud
- bytesize: int | SerialCommunicationBytesize = 8
One byte is eight bits long
- force_value(fieldname, value)
Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
- Parameters:
fieldname – name of the field
value – value to assign
- classmethod keys() Sequence[str]
Returns a list of all configdataclass fields key-names.
- Returns:
a list of strings containing all keys.
- classmethod optional_defaults() dict[str, object]
Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
- Returns:
a list of strings containing all optional keys.
- parity: str | SerialCommunicationParity = 'N'
MBW973 does not use parity
- classmethod required_keys() Sequence[str]
Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
- Returns:
a list of strings containing all required keys.
- stopbits: int | SerialCommunicationStopbits = 1
MBW973 does use one stop bit
- terminator: bytes = b'\r'
The terminator is only CR
- timeout: int | float = 3
use 3 seconds timeout as default