10 #include "../includes/parameters.h"
11 #include "../includes/ventilation_controller.h"
20 void setup()
override;
61 int32_t
PCinspiratoryPID(int32_t targetPressure, int32_t currentPressure, int32_t dt);
70 int32_t
PCexpiratoryPID(int32_t targetPressure, int32_t currentPressure, int32_t dt);
Controller for the CMV mode.
int32_t m_expiratoryPidLastError
Error of the last computation of the expiratory PID.
int32_t m_inspiratoryPidLastError
Error of the last computation of the expiratory PID.
uint16_t m_blowerSpeed
Current blower speed.
bool m_expiratoryPidFastMode
Fast mode at start of expiration.
int32_t m_inspiratoryPidIntegral
Error of the last computation of the blower PID.
PC_CMV_Controller()
Default constructor.
int32_t m_expiratoryValveLastAperture
Last aperture of the blower valve.
void initCycle() override
Begin a new breathing cycle.
int32_t m_expiratoryPidIntegral
Integral gain of the patient PID.
int32_t m_inspiratoryPidLastErrorsIndex
Last error index in inspiratory PID.
void inhale() override
Control the inhalation.
int32_t m_inspiratoryPidLastErrors[PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN]
Last errors in inspiratory PID.
bool m_inspiratoryPidFastMode
Fast mode at start of inspiration.
void setup() override
Initialize controller.
int32_t m_expiratoryPidLastErrors[PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN]
Last errors in expiratory PID.
struct Alarms enabledAlarms() const override
List of alarms that must be enabled for this mode.
uint16_t m_plateauStartTime
Number of ticks when plateau is reached for the first time.
void exhale() override
Control the exhalation.
int32_t m_blowerIncrement
Current blower speed increment (to apply at the beginning of the next cycle)
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.
int32_t m_expiratoryPidLastErrorsIndex
Last error index in inspiratory PID.
bool m_plateauPressureReached
True if plateau pressure has been reached (but not necessarily converged)
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.
void endCycle() override
End the current breathing cycle.
void calculateBlowerIncrement()
Determine the blower speed to adopt for next cycle.
int32_t m_inspiratoryValveLastAperture
Last aperture of the blower valve.
Abstract class for ventilation controllers.
#define PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN
PC_CMV_Controller pcCmvController
List of alarms (named by their code)