hvl_ccb.dev.mbw973.mbw973

digraph inheritanceec72289ff6 { bgcolor=transparent; rankdir=TB; size=""; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "AsyncCommunicationProtocol" [URL="../hvl_ccb.comm.base.html#hvl_ccb.comm.base.AsyncCommunicationProtocol",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for asynchronous communication protocols"]; "CommunicationProtocol" -> "AsyncCommunicationProtocol" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AsyncCommunicationProtocolConfig" [URL="../hvl_ccb.comm.base.html#hvl_ccb.comm.base.AsyncCommunicationProtocolConfig",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base configuration data class for asynchronous communication protocols"]; "CCBError" [URL="../hvl_ccb.error.html#hvl_ccb.error.CCBError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "CommunicationProtocol" [URL="../hvl_ccb.comm.base.html#hvl_ccb.comm.base.CommunicationProtocol",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Communication protocol abstract base class."]; "ConfigurationMixin" -> "CommunicationProtocol" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "CommunicationProtocol" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ConfigurationMixin" [URL="../hvl_ccb.configuration.html#hvl_ccb.configuration.ConfigurationMixin",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin providing configuration to a class."]; "ABC" -> "ConfigurationMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Device" [URL="../hvl_ccb.dev.base.html#hvl_ccb.dev.base.Device",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for devices. Implement this class for a concrete device,"]; "ConfigurationMixin" -> "Device" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "Device" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DeviceError" [URL="../hvl_ccb.dev.base.html#hvl_ccb.dev.base.DeviceError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "CCBError" -> "DeviceError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MBW973" [URL="../hvl_ccb.dev.mbw973.mbw973.html#hvl_ccb.dev.mbw973.mbw973.MBW973",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="MBW 973 dew point mirror device class."]; "SingleCommDevice" -> "MBW973" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MBW973Config" [URL="../hvl_ccb.dev.mbw973.mbw973.html#hvl_ccb.dev.mbw973.mbw973.MBW973Config",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Device configuration dataclass for MBW973."]; "MBW973ControlRunningError" [URL="../hvl_ccb.dev.mbw973.mbw973.html#hvl_ccb.dev.mbw973.mbw973.MBW973ControlRunningError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Error indicating there is still a measurement running, and a new one cannot be"]; "MBW973Error" -> "MBW973ControlRunningError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MBW973Error" [URL="../hvl_ccb.dev.mbw973.mbw973.html#hvl_ccb.dev.mbw973.mbw973.MBW973Error",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="General error with the MBW973 dew point mirror device."]; "DeviceError" -> "MBW973Error" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MBW973PumpRunningError" [URL="../hvl_ccb.dev.mbw973.mbw973.html#hvl_ccb.dev.mbw973.mbw973.MBW973PumpRunningError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Error indicating the pump of the dew point mirror is still recovering gas,"]; "MBW973Error" -> "MBW973PumpRunningError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MBW973SerialCommunication" [URL="../hvl_ccb.dev.mbw973.mbw973.html#hvl_ccb.dev.mbw973.mbw973.MBW973SerialCommunication",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Specific communication protocol implementation for the MBW973 dew point mirror."]; "SerialCommunication" -> "MBW973SerialCommunication" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MBW973SerialCommunicationConfig" [URL="../hvl_ccb.dev.mbw973.mbw973.html#hvl_ccb.dev.mbw973.mbw973.MBW973SerialCommunicationConfig",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="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)"]; "SerialCommunicationConfig" -> "MBW973SerialCommunicationConfig" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SerialCommunication" [URL="../hvl_ccb.comm.serial.html#hvl_ccb.comm.serial.SerialCommunication",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Implements the Communication Protocol for serial ports."]; "AsyncCommunicationProtocol" -> "SerialCommunication" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SerialCommunicationConfig" [URL="../hvl_ccb.comm.serial.html#hvl_ccb.comm.serial.SerialCommunicationConfig",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Configuration dataclass for :class:`SerialCommunication`."]; "AsyncCommunicationProtocolConfig" -> "SerialCommunicationConfig" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SingleCommDevice" [URL="../hvl_ccb.dev.base.html#hvl_ccb.dev.base.SingleCommDevice",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for devices with a single communication protocol."]; "Device" -> "SingleCommDevice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "SingleCommDevice" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

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

stop() None[source]

Stop the device. Closes also the communication protocol.

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.

clean_values()[source]
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.

static config_cls()[source]

Return the default configdataclass class.

Returns:

a reference to the default configdataclass class

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