Message

Message objects that define the API between modules in the system.

  • SensorValues are used to communicate sensor readings between the controller, GUI, and alarm manager

  • ControlSetting is used to set ventilation controls from the GUI to the controller.

Classes:

SensorValues([timestamp, loop_counter, ...])

Structured class for communicating sensor readings throughout PVP.

ControlSetting(name[, value, min_value, ...])

Message containing ventilation control parameters.

ControlValues(control_signal_in, ...)

Class to save control values, analogous to SensorValues.

DerivedValues(timestamp, breath_count, ...)

Class to save derived values, analogous to SensorValues.

class pvp.common.message.SensorValues(timestamp=None, loop_counter=None, breath_count=None, vals=typing.Union[NoneType, typing.Dict[ForwardRef('ValueName'), float]], **kwargs)[source]

Bases: object

Structured class for communicating sensor readings throughout PVP.

Should be instantiated with each of the SensorValues.additional_values, and values for all ValueName s in values.SENSOR by passing them in the vals kwarg.

An AssertionError if an incomplete set of values is given.

Values can be accessed either via attribute name (SensorValues.PIP) or like a dictionary (SensorValues['PIP'])

Parameters
  • timestamp (float) – from time.time(). must be passed explicitly or as an entry in vals

  • loop_counter (int) – number of control_module loops. must be passed explicitly or as an entry in vals

  • breath_count (int) – number of breaths taken. must be passed explicitly or as an entry in vals

  • vals (None, dict) – Dict of {ValueName: float} that contains current sensor readings. Can also be equivalently given as kwargs . if None, assumed values are being passed as kwargs, but an exception will be raised if they aren’t.

  • **kwargs – sensor readings, must be in pvp.values.SENSOR.keys

Attributes:

additional_values

Additional attributes that are not ValueName s that are expected in each SensorValues message

Methods:

__init__([timestamp, loop_counter, ...])

param timestamp

from time.time(). must be passed explicitly or as an entry in vals

to_dict()

Return a dictionary of all sensor values and additional values

additional_values = ('timestamp', 'loop_counter', 'breath_count')

Additional attributes that are not ValueName s that are expected in each SensorValues message

__init__(timestamp=None, loop_counter=None, breath_count=None, vals=typing.Union[NoneType, typing.Dict[ForwardRef('ValueName'), float]], **kwargs)[source]
Parameters
  • timestamp (float) – from time.time(). must be passed explicitly or as an entry in vals

  • loop_counter (int) – number of control_module loops. must be passed explicitly or as an entry in vals

  • breath_count (int) – number of breaths taken. must be passed explicitly or as an entry in vals

  • vals (None, dict) – Dict of {ValueName: float} that contains current sensor readings. Can also be equivalently given as kwargs . if None, assumed values are being passed as kwargs, but an exception will be raised if they aren’t.

  • **kwargs – sensor readings, must be in pvp.values.SENSOR.keys

to_dict() dict[source]

Return a dictionary of all sensor values and additional values

Returns

dict

class pvp.common.message.ControlSetting(name: pvp.common.values.ValueName, value: float = None, min_value: float = None, max_value: float = None, timestamp: float = None, range_severity: AlarmSeverity = None)[source]

Bases: object

Message containing ventilation control parameters.

At least one of value, min_value, or max_value must be given (unlike SensorValues which requires all fields to be present) – eg. in the case where one is setting alarm thresholds without changing the actual set value

When a parameter has multiple alarm limits for different alarm severities, the severity should be passed to range_severity

Parameters
  • name (ValueName) – Name of value being set

  • value (float) – Value to set control

  • min_value (float) – Value to set control minimum (typically used for alarm thresholds)

  • max_value (float) – Value to set control maximum (typically used for alarm thresholds)

  • timestamp (float) – time.time() control message was generated

  • range_severity (AlarmSeverity) – Some control settings have multiple limits for different alarm severities, this attr, when present, specifies which is being set.

Methods:

__init__(name[, value, min_value, ...])

Message containing ventilation control parameters.

__init__(name: pvp.common.values.ValueName, value: float = None, min_value: float = None, max_value: float = None, timestamp: float = None, range_severity: AlarmSeverity = None)[source]

Message containing ventilation control parameters.

At least one of value, min_value, or max_value must be given (unlike SensorValues which requires all fields to be present) – eg. in the case where one is setting alarm thresholds without changing the actual set value

When a parameter has multiple alarm limits for different alarm severities, the severity should be passed to range_severity

Parameters
  • name (ValueName) – Name of value being set

  • value (float) – Value to set control

  • min_value (float) – Value to set control minimum (typically used for alarm thresholds)

  • max_value (float) – Value to set control maximum (typically used for alarm thresholds)

  • timestamp (float) – time.time() control message was generated

  • range_severity (AlarmSeverity) – Some control settings have multiple limits for different alarm severities, this attr, when present, specifies which is being set.

class pvp.common.message.ControlValues(control_signal_in, control_signal_out)[source]

Bases: object

Class to save control values, analogous to SensorValues.

Used by the controller to save waveform data in DataLogger.store_waveform_data() and ControlModuleBase.__save_values`()

Key difference: SensorValues come exclusively from the sensors, ControlValues contains controller variables, i.e. control signals and controlled signals (the flows). :param control_signal_in: :param control_signal_out:

class pvp.common.message.DerivedValues(timestamp, breath_count, I_phase_duration, pip_time, peep_time, pip, pip_plateau, peep, vte)[source]

Bases: object

Class to save derived values, analogous to SensorValues.

Used by controller to store derived values (like PIP from Pressure) in DataLogger.store_derived_data() and in ControlModuleBase.__analyze_last_waveform`()

Key difference: SensorValues come exclusively from the sensors, DerivedValues contain estimates of I_PHASE_DURATION, PIP_TIME, PEEP_time, PIP, PIP_PLATEAU, PEEP, and VTE. :param timestamp: :param breath_count: :param I_phase_duration: :param pip_time: :param peep_time: :param pip: :param pip_plateau: :param peep: :param vte: