software:firmware
MakAir Firmware
|
Controls breathing cycle. More...
#include <main_controller.h>
Public Member Functions | |
MainController () | |
Default constructor. More... | |
void | setup () |
Initialize actuators. More... | |
void | initRespiratoryCycle () |
Begin a respiratory cycle. More... | |
void | endRespiratoryCycle (uint32_t p_currentMillis) |
End a respiratory cycle. More... | |
void | updateTick (uint32_t p_tick) |
Input a tick number. More... | |
void | updatePressure (int16_t p_currentPressure) |
Input a pressure reading. More... | |
void | updateInspiratoryFlow (int32_t p_currentInspiratoryFlow) |
Input an inspiratory flow reading. More... | |
void | updateExpiratoryFlow (int32_t p_currentExpiratoryFlow) |
Input an expiratory flow reading. More... | |
void | updateFakeExpiratoryFlow () |
Calculate expiratory flow from pressure and valve angle. More... | |
void | compute () |
Perform the pressure control. More... | |
void | onVentilationModeSet (uint16_t p_ventilationControllerMode) |
Set ventilation mode. More... | |
void | onInspiratoryTriggerFlowSet (uint16_t p_inspiratoryTriggerFlow) |
Set inspiratory trigger flow. More... | |
void | onExpiratoryTriggerFlowSet (uint16_t p_expiratoryTriggerFlow) |
Set expiratory trigger flow. More... | |
void | onTiMinSet (uint16_t p_tiMin) |
Set min inspiratory time. More... | |
void | onTiMaxSet (uint16_t p_tiMax) |
Set max inspiratory time. More... | |
void | onLowInspiratoryMinuteVolumeAlarmThresholdSet (uint16_t p_lowInspiratoryMinuteVolumeAlarmThreshold) |
Set alarm threshold for low inspiratory minute volume. More... | |
void | onHighInspiratoryMinuteVolumeAlarmThresholdSet (uint16_t p_highInspiratoryMinuteVolumeAlarmThreshold) |
Set alarm threshold for high inspiratory minute volume. More... | |
void | onLowExpiratoryMinuteVolumeAlarmThresholdSet (uint16_t p_lowExpiratoryMinuteVolumeAlarmThreshold) |
Set alarm threshold for low expiratory minute volume. More... | |
void | onHighExpiratoryMinuteVolumeAlarmThresholdSet (uint16_t p_highExpiratoryMinuteVolumeAlarmThreshold) |
Set alarm threshold for high expiratory minute volume. More... | |
void | onlowRespiratoryRateAlarmThresholdSet (uint16_t p_lowRespiratoryRateAlarmThreshold) |
Set alarm threshold for low respiratory rate. More... | |
void | onhighRespiratoryRateAlarmThresholdSet (uint16_t p_highRespiratoryRateAlarmThreshold) |
Set alarm threshold for high respiratory rate. More... | |
void | onTargetTidalVolumeSet (uint16_t p_targetTidalVolume) |
Set target tidal volume (used in VC modes) More... | |
void | onLowTidalVolumeAlarmThresholdSet (uint16_t p_lowTidalVolumeAlarmThreshold) |
Set threshold on tidal volume below which an alarm is raised. More... | |
void | onHighTidalVolumeAlarmThresholdSet (uint16_t p_highTidalVolumeAlarmThreshold) |
Set threshold on tidal volume for which an alarm is raised. More... | |
void | onPlateauDurationSet (uint16_t p_plateauDuration) |
Set the duration of Pause at the end of expiration in VC modes. More... | |
void | onLeakAlarmThresholdSet (uint16_t p_leakAlarmThreshold) |
Set the threshold for leak that raise the alarm. More... | |
void | onTargetInspiratoryFlow (uint16_t p_targetInspiratoryFlow) |
Set the inspiratory flow target. More... | |
void | onInspiratoryDuration (uint16_t p_inspiratoryDuration) |
Set the inspiration duration. More... | |
void | onCycleDecrease () |
Decrease the desired number of cycles per minute. More... | |
void | onCycleIncrease () |
Increase the desired number of cycles per minute. More... | |
void | onCycleSet (uint16_t p_cpm) |
Set the desired number of cycles per minute. More... | |
void | onPeepPressureDecrease () |
Decrease the minimal PEEP desired. More... | |
void | onPeepPressureIncrease () |
Increase the minimal PEEP desired. More... | |
void | onPeepSet (int16_t p_peep) |
Set the desired PEEP. More... | |
void | onPlateauPressureDecrease () |
Decrease the desired plateau pressure. More... | |
void | onPlateauPressureIncrease () |
Increase the desired plateau pressure. More... | |
void | onPlateauPressureSet (int16_t p_plateauPressure) |
Set the desired plateau pressure. More... | |
void | onPeakPressureDecrease () |
Decrease the desired peak pressure. More... | |
void | onPeakPressureIncrease () |
Increase the desired peak pressure. More... | |
void | onExpiratoryTermSet (uint16_t p_expiratoryTerm) |
Set the desired expiratory term. More... | |
void | onTriggerModeEnabledSet (uint16_t p_triggerEnabled) |
Enable or disable expiratory trigger mode. More... | |
void | onTriggerOffsetSet (uint16_t p_triggerOffset) |
Set the desired offset for expiratory trigger. More... | |
void | onPatientHeight (int16_t p_patientHeight) |
Set the desired patient height. More... | |
void | onPeakPressureAlarmThreshold (int16_t p_peakPressureAlarmThreshold) |
Set the desired threshold for max peak pressure. More... | |
void | onPatientGender (int16_t p_patientGender) |
Set the desired patient gender. More... | |
void | onPatientComputePreset () |
Updates patient computed params. More... | |
int32_t | patientHeight () const |
int16_t | tidalVolumeCommand () const |
int16_t | plateauDurationCommand () const |
int16_t | peakPressureCommand () const |
Get the desired max peak. More... | |
int16_t | plateauPressureCommand () const |
Get the desired plateau pressure. More... | |
int16_t | peepCommand () const |
Get the desired PEEP. More... | |
uint16_t | cyclesPerMinuteCommand () const |
Get the desired number of cycles per minute. More... | |
const int16_t | pressureTriggerOffsetCommand () const |
Get the value of the inspiratory trigger pressure command. More... | |
const bool | triggerModeEnabledCommand () |
Get the enabling state of trigger mode. More... | |
const int16_t | inspiratoryTriggerFlowCommand () const |
Get the value of the inspiratory trigger flow command. More... | |
const int16_t | expiratoryTriggerFlowCommand () const |
Get the value of the expiratory trigger flow command. More... | |
const int16_t | tiMinCommand () const |
Get the value of the minimum duration of inspiration in ms. More... | |
const int16_t | tiMaxCommand () const |
Get the value of the max duration of inspiration in ms. More... | |
const int32_t | targetInspiratoryFlowCommand () const |
get target inspiratory flow in mL/min (used in VC modes) More... | |
const int16_t | inspiratoryDurationCommand () const |
Get duration of inspiration command. More... | |
int16_t | tidalVolumeNextCommand () const |
Get the desired tidal Volume for the next cycle (used in VC modes) More... | |
int16_t | plateauDurationNextCommand () const |
int16_t | peakPressureNextCommand () const |
Get the desired max peak for the next cycle. More... | |
int16_t | plateauPressureNextCommand () const |
Get the desired plateau pressure for the next cycle. More... | |
int16_t | peepNextCommand () const |
Get the desired PEEP for the next cycle. More... | |
uint16_t | cyclesPerMinuteNextCommand () const |
Get the desired number of cycles per minute for the next cycle. More... | |
const int16_t | pressureTriggerOffsetNextCommand () const |
Get the value of the inspiratory trigger pressure command for the next cycle. More... | |
const bool | triggerModeEnabledNextCommand () |
Get the enabling state of trigger mode for the next cycle. More... | |
const int16_t | inspiratoryTriggerFlowNextCommand () const |
Get the value of the inspiratory trigger flow command for the next cycle. More... | |
const int16_t | expiratoryTriggerFlowNextCommand () const |
Get the value of the expiratory trigger flow command for the next cycle. More... | |
const int16_t | tiMinNextCommand () const |
Get the value of the minimum duration of inspiration in ms for the next cycle. More... | |
const int16_t | tiMaxNextCommand () const |
Get the value of the max duration of inspiration in ms for the next cycle. More... | |
const int32_t | targetInspiratoryFlowNextCommand () const |
get target inspiratory flow in mL/min (used in VC modes) for next cycle More... | |
const int16_t | inspiratoryDurationNextCommand () const |
Get duration of inspiration command fo next cycle. More... | |
const VentilationController * | ventilationControllerNextCommand () const |
Ventilation controller pointer for the next cycle. More... | |
int16_t | peakPressureMeasure () const |
Get the measured peak pressure. More... | |
int16_t | rebouncePeakPressureMeasure () const |
Get the measured rebounce peak pressure. More... | |
int16_t | plateauPressureMeasure () const |
Get the measured plateau pressure. More... | |
int16_t | peepMeasure () const |
Get the measured PEEP. More... | |
uint16_t | cyclesPerMinuteMeasure () const |
Get the desired number of cycles per minute. More... | |
uint16_t | tidalVolumeMeasure () const |
Get the measured Tidal Volume. Updated only at the end of inspiration. More... | |
int32_t | currentDeliveredVolume () const |
Get the measured Tidal Volume. Updated in real time. More... | |
uint32_t | cycleNumber () const |
Get the number of past cycles since the beginning. More... | |
uint16_t | ticksPerCycle () const |
Get the duration of a cycle in ticks. More... | |
uint32_t | ticksPerInhalation () const |
Get the duration of an inhalation in ticks. More... | |
void | ticksPerInhalationSet (uint32_t p_ticksPerInhalation) |
Get the duration of an inhalation in ticks. More... | |
int16_t | pressure () const |
Get the current measured pressure. More... | |
int32_t | inspiratoryFlow () const |
Get the current inspiratoryFlow. More... | |
int32_t | expiratoryFlow () const |
Get the current expiratoryFlow. More... | |
int32_t | dt () const |
Get the delta of time since the last cycle (in ms) More... | |
uint32_t | tick () const |
Get the tick number of the current cycle. More... | |
int32_t | pressureCommand () const |
Get the pressure command. More... | |
CyclePhases | phase () const |
Get the current cycle phase. More... | |
const bool | triggered () const |
Get the state of the inspiratory trigger. More... | |
const void | setTrigger (bool triggerValue) |
Reset the trigger to false. More... | |
const bool | isPeepDetected () |
Get if the PEEP has been detected during this cycle. More... | |
int16_t * | lastPressureValues () |
Get last pressure values. More... | |
uint16_t | lastPressureValuesIndex () |
Get last pressure values index. More... | |
void | updateDt (int32_t p_dt) |
Input the real duration since the last pressure controller computation. More... | |
void | updateCurrentDeliveredVolume (int32_t p_currentDeliveredVolume) |
Input the current delivered volume in inspiratory branch since beginning of the respiratory cycle. More... | |
void | updateCurrentExpiratoryVolume (int32_t p_expiratoryVolume) |
void | reachSafetyPosition () |
Put actuators in safety position. More... | |
void | stop (uint32_t p_currentMillis) |
Stop the breathing. More... | |
void | sendStopMessageToUi () |
Send a "stopped" telemetry message. More... | |
void | sendMachineState () |
Send a "machine state snapshot" telemetry message. More... | |
Private Member Functions | |
void | updatePhase () |
Update the cycle phase. More... | |
void | inhale () |
Perform the pressure control and compute the actuators commands during the inhalation phase. More... | |
void | exhale () |
Perform the pressure control and compute the actuators commands during the exhalation phase. More... | |
void | computeTickParameters () |
Compute various cycle durations given the desired number of cycles per minute. More... | |
void | executeCommands () |
Send the computed commands to actuators. More... | |
void | checkCycleAlarm () |
At the end of a respiratory cycle, check if some alarms are triggered. More... | |
void | calculateBlowerIncrement () |
void | printDebugValues () |
Print debug values, used to tweak PID, and triggers. More... | |
Private Attributes | |
uint32_t | m_tick |
Actual tick number (given by the main state machine) More... | |
uint16_t | m_cyclesPerMinuteCommand |
Actual desired number of cycles per minute. More... | |
uint16_t | m_cyclesPerMinuteNextCommand |
Number of cycles per minute desired by the operator for the next cycle. More... | |
uint32_t | m_cyclesPerMinuteMeasure |
Measured number of cycles per minute. More... | |
uint32_t | m_lastBreathPeriodsMs [NUMBER_OF_BREATH_PERIOD] |
Period durations of last beathings. More... | |
uint32_t | m_lastBreathPeriodsMsIndex |
Index for the m_lastBreathPeriodsMs array. More... | |
uint32_t | m_lastEndOfRespirationDateMs |
Date of the last ending of a respiration. More... | |
int16_t | m_peakPressureCommand |
Actual desired peak pressure. More... | |
int16_t | m_peakPressureMeasure |
Measured value of peak pressure. More... | |
int16_t | m_rebouncePeakPressureMeasure |
Measured value of rebounce peak pressure. More... | |
int16_t | m_peakPressureNextCommand |
Peak pressure desired by the operator for the next cycle. More... | |
int16_t | m_plateauPressureCommand |
Actual desired plateau pressure. More... | |
int16_t | m_plateauPressureNextCommand |
Plateau pressure desired by the operator for the next cycle. More... | |
int16_t | m_plateauPressureMeasure |
Measured value of the plateau pressure. More... | |
int16_t | m_plateauPressureToDisplay |
Measured value of the plateau pressure for display. More... | |
int64_t | m_PlateauMeasureSum |
Sum for calulating plateau value. More... | |
uint16_t | m_PlateauMeasureCount |
Count for calulating plateau value. More... | |
uint32_t | m_plateauDurationMs |
Duration of the plateau. More... | |
int16_t | m_peepCommand |
Actual desired PEEP. More... | |
int16_t | m_peepNextCommand |
Desired PEEP for the next cycle. More... | |
int16_t | m_peepMeasure |
Measured value of the PEEP. More... | |
bool | m_isPeepDetected |
Is PEEP pressure detected in the cycle? More... | |
int16_t | m_pressureTriggerOffsetCommand |
Actual pressure trigger offset. More... | |
int16_t | m_pressureTriggerOffsetNextCommand |
Desired pressure trigger offset for the next cycle. More... | |
bool | m_triggered |
Is inspiratory triggered or not? More... | |
bool | m_triggerModeEnabledCommand |
Actual state of enabling of trigger mode. More... | |
bool | m_triggerModeEnabledNextCommand |
Desired state of enabling of trigger mode for the next cycle. More... | |
bool | m_tidalVolumeAlreadyRead |
True if Tidal volume has already been read during cycle. More... | |
uint16_t | m_expiratoryTermCommand |
Actual expiratory term. More... | |
uint16_t | m_expiratoryTermNextCommand |
Desired expiratory term for the next cycle. More... | |
int16_t | m_inspiratoryTriggerFlowCommand |
Desired inspiratory trigger flow. More... | |
int16_t | m_inspiratoryTriggerFlowNextCommand |
Desired inspiratory trigger flow for next cycle. More... | |
int16_t | m_expiratoryTriggerFlowCommand |
Desired expiratory trigger flow (in percent of max flow) More... | |
int16_t | m_expiratoryTriggerFlowNextCommand |
Desired expiratory trigger flow for next cycle (in percent of max flow) More... | |
int16_t | m_tiMinCommand |
Minimum duration of inspiration in ms. More... | |
int16_t | m_tiMaxCommand |
Max duration of inspiration in ms. More... | |
int16_t | m_tiMinNextCommand |
Minimum duration of inspiration in ms for next cycle. More... | |
int16_t | m_tiMaxNextCommand |
Max duration of inspiration in ms for next cycle. More... | |
VentilationController * | m_ventilationController |
Ventilation controller in use (for everything related to breathing control) More... | |
VentilationController * | m_ventilationControllerNextCommand |
Ventilation controller for the next cycle. More... | |
VentilationController * | m_ventilationControllersTable [NUMBER_OF_VENTILATION_MODES+1u] |
Array containing pointers to different ventilation controllers. More... | |
VentilationModes | m_ventilationControllerMode |
int16_t | m_tidalVolumeMeasure |
Measured value of the Tidal volume (volume of air pushed in patient lungs in last inspiration) More... | |
int16_t | m_tidalVolumeCommand |
Tidal volume command (used in VC modes) More... | |
int16_t | m_tidalVolumeNextCommand |
Tidal volume command for next cycle. More... | |
int16_t | m_plateauDurationCommand |
Plateau duration command (used in VC modes) More... | |
int16_t | m_plateauDurationNextCommand |
Plateau duration command for next cycle. More... | |
int32_t | m_targetInspiratoryFlowCommand |
inspiratory flow required (used in VC modes) More... | |
int32_t | m_targetInspiratoryFlowNextCommand |
inspiratory flow required (used in VC modes) for next cycle More... | |
int16_t | m_inspiratoryDurationCommand |
Duration of inspiration. More... | |
int16_t | m_inspiratoryDurationNextCommand |
Duration of inspiration. More... | |
int32_t | m_lowInspiratoryMinuteVolumeAlarmThresholdCommand |
Threshold for low inspiratory minute volume alarm. More... | |
int32_t | m_lowInspiratoryMinuteVolumeAlarmThresholdNextCommand |
Threshold for low inspiratory minute volume alarm for next cycle. More... | |
int32_t | m_highInspiratoryMinuteVolumeAlarmThresholdCommand |
Threshold for high inspiratory minute volume alarm. More... | |
int32_t | m_highInspiratoryMinuteVolumeAlarmThresholdNextCommand |
Threshold for high inspiratory minute volume alarm for next cycle. More... | |
int32_t | m_lowExpiratoryMinuteVolumeAlarmThresholdCommand |
Threshold for low inspiratory minute volume alarm. More... | |
int32_t | m_lowExpiratoryMinuteVolumeAlarmThresholdNextCommand |
Threshold for low inspiratory minute volume alarm for next cycle. More... | |
int32_t | m_highExpiratoryMinuteVolumeAlarmThresholdCommand |
Threshold for high inspiratory minute volume alarm. More... | |
int32_t | m_highExpiratoryMinuteVolumeAlarmThresholdNextCommand |
Threshold for high inspiratory minute volume alarm for next cycle. More... | |
int32_t | m_lowRespiratoryRateAlarmThresholdCommand |
Threshold for low respiratory rate. More... | |
int32_t | m_lowRespiratoryRateAlarmThresholdNextCommand |
Threshold for low respiratory rate for next cycle. More... | |
int32_t | m_highRespiratoryRateAlarmThresholdCommand |
Threshold for low respiratory rate. More... | |
int32_t | m_highRespiratoryRateAlarmThresholdNextCommand |
Threshold for low respiratory rate for next cycle. More... | |
int32_t | m_lowTidalVolumeAlarmThresholdCommand |
Threshold for low tidal Volume Alarm. More... | |
int32_t | m_lowTidalVolumeAlarmThresholdNextCommand |
Threshold for low tidal Volume Alarm next cycle. More... | |
int32_t | m_highTidalVolumeAlarmThresholdCommand |
Threshold for high tidal Volume Alarm. More... | |
int32_t | m_highTidalVolumeAlarmThresholdNextCommand |
Threshold for high tidal Volume Alarm next cycle. More... | |
int32_t | m_leakAlarmThresholdCommand |
Threshold for leak alarm. More... | |
int32_t | m_leakAlarmThresholdNextCommand |
Threshold for leak alarm for next cycle. More... | |
int16_t | m_peakPressureAlarmThresholdCommand |
Threshold for peak pressure alarm. More... | |
int16_t | m_peakPressureAlarmThresholdNextCommand |
Threshold for peak pressure alarmfor next cycle. More... | |
int32_t | m_expiratoryVolume |
Volume expired by the patient during the exhalation phase. More... | |
uint16_t | m_ticksPerCycle |
Number of hundredth of second per cycle. More... | |
uint32_t | m_ticksPerInhalation |
Number of hundredth of second per inhalation. More... | |
int16_t | m_pressure |
Measured pressure. More... | |
int32_t | m_inspiratoryFlow |
Measured inspiratory flow. More... | |
int32_t | m_maxInspiratoryFlow |
Measured max inspiratory flow. More... | |
int32_t | m_expiratoryFlow |
Measured inspiratory flow. More... | |
int32_t | m_maxExpiratoryFlow |
Measured max inspiratory flow. More... | |
int32_t | m_lastMaxExpiratoryFlow |
Measured max inspiratory flow. More... | |
int32_t | m_currentDeliveredVolume |
Current delivered volume by the blower. More... | |
int16_t | m_inhalationLastPressure |
Last pressure of inhalation. More... | |
uint32_t | m_inspiratoryValveAngle |
Blower valve angle at peak. More... | |
CyclePhases | m_phase |
Current respiratory cycle phase. More... | |
uint32_t | m_cycleNb |
Number of elapsed cycles since beginning. More... | |
int32_t | m_dt |
Time since the last computation (in microsecond) More... | |
int32_t | m_pressureCommand |
Requested pressure at a given point in time. More... | |
int16_t | m_lastPressureValues [MAX_PRESSURE_SAMPLES] |
Last pressure values. More... | |
uint16_t | m_lastPressureValuesIndex |
Last pressure index. More... | |
uint32_t | m_sumOfPressures |
Sum of the current cycle's pressures. More... | |
uint16_t | m_numberOfPressures |
Number of the current cycle's pressures. More... | |
int32_t | m_patientHeight |
int32_t | m_patientGender |
Controls breathing cycle.
Definition at line 36 of file main_controller.h.
MainController::MainController | ( | ) |
Default constructor.
Definition at line 26 of file main_controller.cpp.
|
private |
|
private |
At the end of a respiratory cycle, check if some alarms are triggered.
Definition at line 528 of file main_controller.cpp.
void MainController::compute | ( | ) |
Perform the pressure control.
p_tick | Duration in hundredth of second from the begining of the cycle |
Definition at line 248 of file main_controller.cpp.
|
private |
Compute various cycle durations given the desired number of cycles per minute.
duration of the inhalation phase in hundredth of second
Definition at line 501 of file main_controller.cpp.
|
inline |
Get the measured Tidal Volume. Updated in real time.
Definition at line 343 of file main_controller.h.
|
inline |
Get the number of past cycles since the beginning.
Definition at line 346 of file main_controller.h.
|
inline |
|
inline |
|
inline |
Get the desired number of cycles per minute for the next cycle.
Definition at line 298 of file main_controller.h.
|
inline |
Get the delta of time since the last cycle (in ms)
Definition at line 369 of file main_controller.h.
void MainController::endRespiratoryCycle | ( | uint32_t | p_currentMillis | ) |
End a respiratory cycle.
Definition at line 372 of file main_controller.cpp.
|
private |
Send the computed commands to actuators.
Definition at line 510 of file main_controller.cpp.
|
private |
Perform the pressure control and compute the actuators commands during the exhalation phase.
Definition at line 346 of file main_controller.cpp.
|
inline |
|
inline |
Get the value of the expiratory trigger flow command.
Definition at line 273 of file main_controller.h.
|
inline |
Get the value of the expiratory trigger flow command for the next cycle.
Definition at line 310 of file main_controller.h.
|
private |
Perform the pressure control and compute the actuators commands during the inhalation phase.
Definition at line 325 of file main_controller.cpp.
void MainController::initRespiratoryCycle | ( | ) |
Begin a respiratory cycle.
Definition at line 175 of file main_controller.cpp.
|
inline |
|
inline |
Get duration of inspiration command fo next cycle.
Definition at line 322 of file main_controller.h.
|
inline |
|
inline |
Get the value of the inspiratory trigger flow command.
Definition at line 269 of file main_controller.h.
|
inline |
Get the value of the inspiratory trigger flow command for the next cycle.
Definition at line 306 of file main_controller.h.
|
inline |
Get if the PEEP has been detected during this cycle.
Definition at line 387 of file main_controller.h.
|
inline |
|
inline |
void MainController::onCycleDecrease | ( | ) |
Decrease the desired number of cycles per minute.
Definition at line 754 of file main_controller.cpp.
void MainController::onCycleIncrease | ( | ) |
Increase the desired number of cycles per minute.
Definition at line 766 of file main_controller.cpp.
void MainController::onCycleSet | ( | uint16_t | p_cpm | ) |
Set the desired number of cycles per minute.
p_cpm | Desired number of cycles per minute |
Definition at line 780 of file main_controller.cpp.
void MainController::onExpiratoryTermSet | ( | uint16_t | p_expiratoryTerm | ) |
Set the desired expiratory term.
p_expiratoryTerm | Expiration term in the "Inspiration/Expiration" ratio given that Inspiration = 10 |
Definition at line 936 of file main_controller.cpp.
void MainController::onExpiratoryTriggerFlowSet | ( | uint16_t | p_expiratoryTriggerFlow | ) |
Set expiratory trigger flow.
Definition at line 987 of file main_controller.cpp.
void MainController::onHighExpiratoryMinuteVolumeAlarmThresholdSet | ( | uint16_t | p_highExpiratoryMinuteVolumeAlarmThreshold | ) |
Set alarm threshold for high expiratory minute volume.
Definition at line 1073 of file main_controller.cpp.
void MainController::onHighInspiratoryMinuteVolumeAlarmThresholdSet | ( | uint16_t | p_highInspiratoryMinuteVolumeAlarmThreshold | ) |
Set alarm threshold for high inspiratory minute volume.
Definition at line 1040 of file main_controller.cpp.
void MainController::onhighRespiratoryRateAlarmThresholdSet | ( | uint16_t | p_highRespiratoryRateAlarmThreshold | ) |
Set alarm threshold for high respiratory rate.
Definition at line 1100 of file main_controller.cpp.
void MainController::onHighTidalVolumeAlarmThresholdSet | ( | uint16_t | p_highTidalVolumeAlarmThreshold | ) |
Set threshold on tidal volume for which an alarm is raised.
Definition at line 1136 of file main_controller.cpp.
void MainController::onInspiratoryDuration | ( | uint16_t | p_inspiratoryDuration | ) |
void MainController::onInspiratoryTriggerFlowSet | ( | uint16_t | p_inspiratoryTriggerFlow | ) |
Set inspiratory trigger flow.
Definition at line 974 of file main_controller.cpp.
void MainController::onLeakAlarmThresholdSet | ( | uint16_t | p_leakAlarmThreshold | ) |
Set the threshold for leak that raise the alarm.
Definition at line 1160 of file main_controller.cpp.
void MainController::onLowExpiratoryMinuteVolumeAlarmThresholdSet | ( | uint16_t | p_lowExpiratoryMinuteVolumeAlarmThreshold | ) |
Set alarm threshold for low expiratory minute volume.
Definition at line 1055 of file main_controller.cpp.
void MainController::onLowInspiratoryMinuteVolumeAlarmThresholdSet | ( | uint16_t | p_lowInspiratoryMinuteVolumeAlarmThreshold | ) |
Set alarm threshold for low inspiratory minute volume.
Definition at line 1022 of file main_controller.cpp.
void MainController::onlowRespiratoryRateAlarmThresholdSet | ( | uint16_t | p_lowRespiratoryRateAlarmThreshold | ) |
Set alarm threshold for low respiratory rate.
Definition at line 1088 of file main_controller.cpp.
void MainController::onLowTidalVolumeAlarmThresholdSet | ( | uint16_t | p_lowTidalVolumeAlarmThreshold | ) |
Set threshold on tidal volume below which an alarm is raised.
Definition at line 1123 of file main_controller.cpp.
void MainController::onPatientComputePreset | ( | ) |
Updates patient computed params.
Definition at line 1235 of file main_controller.cpp.
void MainController::onPatientGender | ( | int16_t | p_patientGender | ) |
Set the desired patient gender.
p_patientGender | patient gender 0 = male, 1 = female |
Definition at line 1220 of file main_controller.cpp.
void MainController::onPatientHeight | ( | int16_t | p_patientHeight | ) |
Set the desired patient height.
p_patientHeight | Desired patient height in cm |
Definition at line 1205 of file main_controller.cpp.
void MainController::onPeakPressureAlarmThreshold | ( | int16_t | p_peakPressureAlarmThreshold | ) |
Set the desired threshold for max peak pressure.
p_peakPressureAlarmThreshold | Desired threshold in mmH2O |
Definition at line 1194 of file main_controller.cpp.
void MainController::onPeakPressureDecrease | ( | ) |
Decrease the desired peak pressure.
Definition at line 885 of file main_controller.cpp.
void MainController::onPeakPressureIncrease | ( | ) |
Increase the desired peak pressure.
Definition at line 910 of file main_controller.cpp.
void MainController::onPeepPressureDecrease | ( | ) |
void MainController::onPeepPressureIncrease | ( | ) |
void MainController::onPeepSet | ( | int16_t | p_peep | ) |
Set the desired PEEP.
p_peep | Desired PEEP in mmH2O |
Definition at line 823 of file main_controller.cpp.
void MainController::onPlateauDurationSet | ( | uint16_t | p_plateauDuration | ) |
Set the duration of Pause at the end of expiration in VC modes.
Definition at line 1147 of file main_controller.cpp.
void MainController::onPlateauPressureDecrease | ( | ) |
void MainController::onPlateauPressureIncrease | ( | ) |
void MainController::onPlateauPressureSet | ( | int16_t | p_plateauPressure | ) |
Set the desired plateau pressure.
p_plateauPressure | Desired plateau pressure in mmH2O |
Definition at line 870 of file main_controller.cpp.
void MainController::onTargetInspiratoryFlow | ( | uint16_t | p_targetInspiratoryFlow | ) |
void MainController::onTargetTidalVolumeSet | ( | uint16_t | p_targetTidalVolume | ) |
void MainController::onTiMaxSet | ( | uint16_t | p_tiMax | ) |
Set max inspiratory time.
Definition at line 1011 of file main_controller.cpp.
void MainController::onTiMinSet | ( | uint16_t | p_tiMin | ) |
Set min inspiratory time.
Definition at line 1000 of file main_controller.cpp.
void MainController::onTriggerModeEnabledSet | ( | uint16_t | p_triggerEnabled | ) |
Enable or disable expiratory trigger mode.
p_triggerEnabled | 0: disable trigger mode, 1: enable trigger mode |
Definition at line 950 of file main_controller.cpp.
void MainController::onTriggerOffsetSet | ( | uint16_t | p_triggerOffset | ) |
Set the desired offset for expiratory trigger.
p_triggerOffset | Desired trigger offset in mmH2O |
Definition at line 959 of file main_controller.cpp.
void MainController::onVentilationModeSet | ( | uint16_t | p_ventilationControllerMode | ) |
|
inline |
Definition at line 249 of file main_controller.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 253 of file main_controller.h.
|
inline |
Definition at line 290 of file main_controller.h.
|
inline |
|
inline |
|
inline |
Get the desired plateau pressure for the next cycle.
Definition at line 294 of file main_controller.h.
|
inline |
|
inline |
|
inline |
Get the value of the inspiratory trigger pressure command.
Definition at line 263 of file main_controller.h.
|
inline |
Get the value of the inspiratory trigger pressure command for the next cycle.
Definition at line 300 of file main_controller.h.
|
private |
Print debug values, used to tweak PID, and triggers.
Definition at line 403 of file main_controller.cpp.
void MainController::reachSafetyPosition | ( | ) |
Put actuators in safety position.
Definition at line 660 of file main_controller.cpp.
|
inline |
void MainController::sendMachineState | ( | ) |
Send a "machine state snapshot" telemetry message.
Definition at line 715 of file main_controller.cpp.
void MainController::sendStopMessageToUi | ( | ) |
Send a "stopped" telemetry message.
Definition at line 666 of file main_controller.cpp.
|
inline |
void MainController::setup | ( | ) |
Initialize actuators.
Definition at line 164 of file main_controller.cpp.
void MainController::stop | ( | uint32_t | p_currentMillis | ) |
Stop the breathing.
Definition at line 686 of file main_controller.cpp.
|
inline |
get target inspiratory flow in mL/min (used in VC modes)
Definition at line 281 of file main_controller.h.
|
inline |
get target inspiratory flow in mL/min (used in VC modes) for next cycle
Definition at line 318 of file main_controller.h.
|
inline |
|
inline |
|
inline |
|
inline |
Get the duration of an inhalation in ticks.
Definition at line 355 of file main_controller.h.
|
inline |
Definition at line 251 of file main_controller.h.
|
inline |
Get the measured Tidal Volume. Updated only at the end of inspiration.
Definition at line 341 of file main_controller.h.
|
inline |
Get the desired tidal Volume for the next cycle (used in VC modes)
Definition at line 288 of file main_controller.h.
|
inline |
Get the value of the max duration of inspiration in ms.
Definition at line 279 of file main_controller.h.
|
inline |
Get the value of the max duration of inspiration in ms for the next cycle.
Definition at line 316 of file main_controller.h.
|
inline |
Get the value of the minimum duration of inspiration in ms.
Definition at line 277 of file main_controller.h.
|
inline |
Get the value of the minimum duration of inspiration in ms for the next cycle.
Definition at line 314 of file main_controller.h.
|
inline |
|
inline |
|
inline |
Get the enabling state of trigger mode for the next cycle.
Definition at line 304 of file main_controller.h.
void MainController::updateCurrentDeliveredVolume | ( | int32_t | p_currentDeliveredVolume | ) |
Input the current delivered volume in inspiratory branch since beginning of the respiratory cycle.
p_currentDeliveredVolume | Delivered Volume in mL/s |
Definition at line 489 of file main_controller.cpp.
void MainController::updateCurrentExpiratoryVolume | ( | int32_t | p_expiratoryVolume | ) |
Definition at line 495 of file main_controller.cpp.
void MainController::updateDt | ( | int32_t | p_dt | ) |
Input the real duration since the last pressure controller computation.
p_dt | Duration in microsecond |
Definition at line 424 of file main_controller.cpp.
void MainController::updateExpiratoryFlow | ( | int32_t | p_currentExpiratoryFlow | ) |
Input an expiratory flow reading.
p_currentExpiratoryFlow | Measured expiratory flow |
Definition at line 439 of file main_controller.cpp.
void MainController::updateFakeExpiratoryFlow | ( | ) |
Calculate expiratory flow from pressure and valve angle.
Definition at line 450 of file main_controller.cpp.
void MainController::updateInspiratoryFlow | ( | int32_t | p_currentInspiratoryFlow | ) |
Input an inspiratory flow reading.
p_currentInspiratoryFlow | Measured inspiratory flow |
Definition at line 428 of file main_controller.cpp.
|
private |
Update the cycle phase.
p_tick | Duration from the begining of the cycle in hundredth of second |
Definition at line 314 of file main_controller.cpp.
void MainController::updatePressure | ( | int16_t | p_currentPressure | ) |
Input a pressure reading.
p_currentPressure | Measured pressure |
Definition at line 422 of file main_controller.cpp.
void MainController::updateTick | ( | uint32_t | p_tick | ) |
Input a tick number.
p_tick | Tick number |
Definition at line 426 of file main_controller.cpp.
|
inline |
Ventilation controller pointer for the next cycle.
Definition at line 326 of file main_controller.h.
|
private |
Current delivered volume by the blower.
Definition at line 692 of file main_controller.h.
|
private |
Number of elapsed cycles since beginning.
Definition at line 704 of file main_controller.h.
|
private |
Actual desired number of cycles per minute.
Definition at line 467 of file main_controller.h.
|
private |
Measured number of cycles per minute.
Definition at line 471 of file main_controller.h.
|
private |
Number of cycles per minute desired by the operator for the next cycle.
Definition at line 469 of file main_controller.h.
|
private |
Time since the last computation (in microsecond)
Definition at line 707 of file main_controller.h.
|
private |
Measured inspiratory flow.
Definition at line 679 of file main_controller.h.
|
private |
Actual expiratory term.
E term of the I:E ratio. I = 10, and E is in [10;60]
Definition at line 547 of file main_controller.h.
|
private |
Desired expiratory term for the next cycle.
Definition at line 549 of file main_controller.h.
|
private |
Desired expiratory trigger flow (in percent of max flow)
Definition at line 557 of file main_controller.h.
|
private |
Desired expiratory trigger flow for next cycle (in percent of max flow)
Definition at line 559 of file main_controller.h.
|
private |
Volume expired by the patient during the exhalation phase.
Definition at line 661 of file main_controller.h.
|
private |
Threshold for high inspiratory minute volume alarm.
Definition at line 622 of file main_controller.h.
|
private |
Threshold for high inspiratory minute volume alarm for next cycle.
Definition at line 625 of file main_controller.h.
|
private |
Threshold for high inspiratory minute volume alarm.
Definition at line 610 of file main_controller.h.
|
private |
Threshold for high inspiratory minute volume alarm for next cycle.
Definition at line 613 of file main_controller.h.
|
private |
Threshold for low respiratory rate.
Definition at line 634 of file main_controller.h.
|
private |
Threshold for low respiratory rate for next cycle.
Definition at line 637 of file main_controller.h.
|
private |
Threshold for high tidal Volume Alarm.
Definition at line 645 of file main_controller.h.
|
private |
Threshold for high tidal Volume Alarm next cycle.
Definition at line 648 of file main_controller.h.
|
private |
Last pressure of inhalation.
Definition at line 695 of file main_controller.h.
|
private |
Duration of inspiration.
Definition at line 599 of file main_controller.h.
|
private |
Duration of inspiration.
Definition at line 601 of file main_controller.h.
|
private |
Measured inspiratory flow.
Definition at line 673 of file main_controller.h.
|
private |
Desired inspiratory trigger flow.
Definition at line 552 of file main_controller.h.
|
private |
Desired inspiratory trigger flow for next cycle.
Definition at line 554 of file main_controller.h.
|
private |
Blower valve angle at peak.
Definition at line 698 of file main_controller.h.
|
private |
Is PEEP pressure detected in the cycle?
Definition at line 526 of file main_controller.h.
|
private |
Period durations of last beathings.
Definition at line 477 of file main_controller.h.
|
private |
Index for the m_lastBreathPeriodsMs array.
Definition at line 479 of file main_controller.h.
|
private |
Date of the last ending of a respiration.
Definition at line 481 of file main_controller.h.
|
private |
Measured max inspiratory flow.
Definition at line 685 of file main_controller.h.
|
private |
Last pressure values.
Definition at line 713 of file main_controller.h.
|
private |
Last pressure index.
Definition at line 716 of file main_controller.h.
|
private |
Threshold for leak alarm.
Definition at line 651 of file main_controller.h.
|
private |
Threshold for leak alarm for next cycle.
Definition at line 653 of file main_controller.h.
|
private |
Threshold for low inspiratory minute volume alarm.
Definition at line 616 of file main_controller.h.
|
private |
Threshold for low inspiratory minute volume alarm for next cycle.
Definition at line 619 of file main_controller.h.
|
private |
Threshold for low inspiratory minute volume alarm.
Definition at line 604 of file main_controller.h.
|
private |
Threshold for low inspiratory minute volume alarm for next cycle.
Definition at line 607 of file main_controller.h.
|
private |
Threshold for low respiratory rate.
Definition at line 628 of file main_controller.h.
|
private |
Threshold for low respiratory rate for next cycle.
Definition at line 631 of file main_controller.h.
|
private |
Threshold for low tidal Volume Alarm.
Definition at line 640 of file main_controller.h.
|
private |
Threshold for low tidal Volume Alarm next cycle.
Definition at line 642 of file main_controller.h.
|
private |
Measured max inspiratory flow.
Definition at line 682 of file main_controller.h.
|
private |
Measured max inspiratory flow.
Definition at line 676 of file main_controller.h.
|
private |
Number of the current cycle's pressures.
Definition at line 722 of file main_controller.h.
|
private |
Definition at line 728 of file main_controller.h.
|
private |
Definition at line 725 of file main_controller.h.
|
private |
Threshold for peak pressure alarm.
Definition at line 656 of file main_controller.h.
|
private |
Threshold for peak pressure alarmfor next cycle.
Definition at line 658 of file main_controller.h.
|
private |
Actual desired peak pressure.
Definition at line 484 of file main_controller.h.
|
private |
Measured value of peak pressure.
Definition at line 486 of file main_controller.h.
|
private |
Peak pressure desired by the operator for the next cycle.
Definition at line 490 of file main_controller.h.
|
private |
Actual desired PEEP.
Definition at line 520 of file main_controller.h.
|
private |
Measured value of the PEEP.
Definition at line 524 of file main_controller.h.
|
private |
Desired PEEP for the next cycle.
Definition at line 522 of file main_controller.h.
|
private |
Current respiratory cycle phase.
Definition at line 701 of file main_controller.h.
|
private |
Plateau duration command (used in VC modes)
Definition at line 590 of file main_controller.h.
|
private |
Duration of the plateau.
Definition at line 517 of file main_controller.h.
|
private |
Plateau duration command for next cycle.
Definition at line 592 of file main_controller.h.
|
private |
Count for calulating plateau value.
Definition at line 511 of file main_controller.h.
|
private |
Sum for calulating plateau value.
Definition at line 509 of file main_controller.h.
|
private |
Actual desired plateau pressure.
Definition at line 493 of file main_controller.h.
|
private |
Measured value of the plateau pressure.
Definition at line 501 of file main_controller.h.
|
private |
Plateau pressure desired by the operator for the next cycle.
Definition at line 495 of file main_controller.h.
|
private |
Measured value of the plateau pressure for display.
Definition at line 507 of file main_controller.h.
|
private |
Measured pressure.
Definition at line 670 of file main_controller.h.
|
private |
Requested pressure at a given point in time.
Definition at line 710 of file main_controller.h.
|
private |
Actual pressure trigger offset.
Definition at line 529 of file main_controller.h.
|
private |
Desired pressure trigger offset for the next cycle.
Definition at line 531 of file main_controller.h.
|
private |
Measured value of rebounce peak pressure.
Definition at line 488 of file main_controller.h.
|
private |
Sum of the current cycle's pressures.
Definition at line 719 of file main_controller.h.
|
private |
inspiratory flow required (used in VC modes)
Definition at line 595 of file main_controller.h.
|
private |
inspiratory flow required (used in VC modes) for next cycle
Definition at line 597 of file main_controller.h.
|
private |
Actual tick number (given by the main state machine)
Definition at line 464 of file main_controller.h.
|
private |
Number of hundredth of second per cycle.
Definition at line 664 of file main_controller.h.
|
private |
Number of hundredth of second per inhalation.
Definition at line 667 of file main_controller.h.
|
private |
True if Tidal volume has already been read during cycle.
Definition at line 541 of file main_controller.h.
|
private |
Tidal volume command (used in VC modes)
Definition at line 585 of file main_controller.h.
|
private |
Measured value of the Tidal volume (volume of air pushed in patient lungs in last inspiration)
Definition at line 582 of file main_controller.h.
|
private |
Tidal volume command for next cycle.
Definition at line 587 of file main_controller.h.
|
private |
Max duration of inspiration in ms.
Definition at line 564 of file main_controller.h.
|
private |
Max duration of inspiration in ms for next cycle.
Definition at line 568 of file main_controller.h.
|
private |
Minimum duration of inspiration in ms.
Definition at line 562 of file main_controller.h.
|
private |
Minimum duration of inspiration in ms for next cycle.
Definition at line 566 of file main_controller.h.
|
private |
Is inspiratory triggered or not?
Definition at line 533 of file main_controller.h.
|
private |
Actual state of enabling of trigger mode.
Definition at line 536 of file main_controller.h.
|
private |
Desired state of enabling of trigger mode for the next cycle.
Definition at line 538 of file main_controller.h.
|
private |
Ventilation controller in use (for everything related to breathing control)
Definition at line 571 of file main_controller.h.
|
private |
Definition at line 578 of file main_controller.h.
|
private |
Ventilation controller for the next cycle.
Definition at line 573 of file main_controller.h.
|
private |
Array containing pointers to different ventilation controllers.
Definition at line 576 of file main_controller.h.