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 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
PC_VSAI_Controller pcVsaiController
List of alarms (named by their code)