software:firmware
MakAir Firmware
pc_vsai_controller.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include "../includes/parameters.h"
11 #include "../includes/ventilation_controller.h"
12 
15  public:
18 
20  void setup() override;
21 
23  void initCycle() override;
24 
26  void inhale() override;
27 
29  void exhale() override;
30 
32  void endCycle() override;
33 
35  struct Alarms enabledAlarms() const override {
40  RCM_SW_22};
41  return a;
42  }
43 
44  private:
47 
49  uint16_t m_triggerWindow;
50 
53 
61  int32_t PCinspiratoryPID(int32_t targetPressure, int32_t currentPressure, int32_t dt);
62 
70  int32_t PCexpiratoryPID(int32_t targetPressure, int32_t currentPressure, int32_t dt);
71 
73  uint16_t m_blowerSpeed;
74 
78 
81 
84 
87 
90 
93 
96 
99 
102 
105 
108 
111 
114 
117 
120 
123 };
124 
#define RCM_SW_11
#define RCM_SW_20
#define RCM_SW_12
#define RCM_SW_15
#define RCM_SW_3
#define RCM_SW_5
#define RCM_SW_18
#define RCM_SW_19
#define RCM_SW_6
#define RCM_SW_16
#define RCM_SW_1
#define RCM_SW_9
#define RCM_SW_14
#define RCM_SW_8
#define RCM_SW_4
#define RCM_SW_21
#define RCM_SW_2
#define RCM_SW_22
#define RCM_SW_7
Controller for the VSAI mode.
int32_t m_expiratoryPidLastErrors[PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN]
Last errors in expiratory PID.
bool m_plateauPressureReached
True if plateau pressure has been reached (but not necessarily converged)
void setup() override
Initialize controller.
bool m_reOpenInspiratoryValve
True if we want to reopen the inspiratory valve to create a circulation flow able to detect inspirato...
int32_t m_maxInspiratoryFlow
Max flow during inspiration.
int32_t m_inspiratoryPidLastError
Error of the last computation of the blower PID.
int32_t PCexpiratoryPID(int32_t targetPressure, int32_t currentPressure, int32_t dt)
PID to control the patient valve during some specific steps of the cycle.
uint16_t m_blowerSpeed
Current blower speed.
PC_VSAI_Controller()
Default constructor.
void endCycle() override
End the current breathing cycle.
uint16_t m_triggerWindow
Number of ticks from which it is possible to trigger a new inspiration.
void inhale() override
Control the inhalation.
int32_t m_expiratoryPidIntegral
Integral gain of the patient PID.
int32_t m_expiratoryPidLastErrorsIndex
Last error index in expiratory PID.
int32_t m_blowerIncrement
Current blower speed increment (to apply at the beginning of the next cycle)
int32_t m_inspiratoryPidIntegral
Error of the last computation of the blower PID.
int32_t m_inspiratoryPidLastErrorsIndex
Last error index in inspiratory PID.
int32_t m_inspiratoryPidLastErrors[PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN]
Last errors in inspiratory PID.
void calculateBlowerIncrement()
Determine the blower speed to adopt for next cycle.
bool m_inspiratoryPidFastMode
Fast mode at start of inspiration.
bool m_expiratoryPidFastMode
Fast mode at start of expiration.
struct Alarms enabledAlarms() const override
List of alarms that must be enabled for this mode.
void initCycle() override
Begin a new breathing cycle.
int32_t m_inspiratorySlope
Slope of the inspiration open loop (in mmH2O/s)
int32_t m_inspiratoryValveLastAperture
Last aperture of the blower valve.
int32_t m_expiratoryValveLastAperture
Last aperture of the blower valve.
int32_t m_expiratoryPidLastError
Error of the last computation of the PID.
void exhale() override
Control the exhalation.
int32_t PCinspiratoryPID(int32_t targetPressure, int32_t currentPressure, int32_t dt)
PID to control the blower valve during some specific steps of the cycle.
Abstract class for ventilation controllers.
#define PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN
Definition: parameters.h:152
PC_VSAI_Controller pcVsaiController
List of alarms (named by their code)