software:firmware
MakAir Firmware
PC_VSAI_Controller Class Referencefinal

Controller for the VSAI mode. More...

#include <pc_vsai_controller.h>

+ Inheritance diagram for PC_VSAI_Controller:

Public Member Functions

 PC_VSAI_Controller ()
 Default constructor. More...
 
void setup () override
 Initialize controller. More...
 
void initCycle () override
 Begin a new breathing cycle. More...
 
void inhale () override
 Control the inhalation. More...
 
void exhale () override
 Control the exhalation. More...
 
void endCycle () override
 End the current breathing cycle. More...
 
struct Alarms enabledAlarms () const override
 List of alarms that must be enabled for this mode. More...
 

Private Member Functions

void calculateBlowerIncrement ()
 Determine the blower speed to adopt for next cycle. More...
 
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. More...
 
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. More...
 

Private Attributes

uint16_t m_triggerWindow
 Number of ticks from which it is possible to trigger a new inspiration. More...
 
bool m_plateauPressureReached
 True if plateau pressure has been reached (but not necessarily converged) More...
 
uint16_t m_blowerSpeed
 Current blower speed. More...
 
bool m_reOpenInspiratoryValve
 True if we want to reopen the inspiratory valve to create a circulation flow able to detect inspiratory flow trigger. More...
 
int32_t m_inspiratorySlope
 Slope of the inspiration open loop (in mmH2O/s) More...
 
int32_t m_blowerIncrement
 Current blower speed increment (to apply at the beginning of the next cycle) More...
 
int32_t m_inspiratoryPidIntegral
 Error of the last computation of the blower PID. More...
 
int32_t m_inspiratoryPidLastError
 Error of the last computation of the blower PID. More...
 
bool m_expiratoryPidFastMode
 Fast mode at start of expiration. More...
 
bool m_inspiratoryPidFastMode
 Fast mode at start of inspiration. More...
 
int32_t m_expiratoryPidIntegral
 Integral gain of the patient PID. More...
 
int32_t m_inspiratoryValveLastAperture
 Last aperture of the blower valve. More...
 
int32_t m_expiratoryValveLastAperture
 Last aperture of the blower valve. More...
 
int32_t m_expiratoryPidLastError
 Error of the last computation of the PID. More...
 
int32_t m_inspiratoryPidLastErrors [PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN]
 Last errors in inspiratory PID. More...
 
int32_t m_inspiratoryPidLastErrorsIndex
 Last error index in inspiratory PID. More...
 
int32_t m_expiratoryPidLastErrors [PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN]
 Last errors in expiratory PID. More...
 
int32_t m_expiratoryPidLastErrorsIndex
 Last error index in expiratory PID. More...
 
int32_t m_maxInspiratoryFlow
 Max flow during inspiration. More...
 

Detailed Description

Controller for the VSAI mode.

Definition at line 14 of file pc_vsai_controller.h.

Constructor & Destructor Documentation

◆ PC_VSAI_Controller()

PC_VSAI_Controller::PC_VSAI_Controller ( )

Default constructor.

Definition at line 28 of file pc_vsai_controller.cpp.

28  {
34  + (1000u / MAIN_CONTROLLER_COMPUTE_PERIOD_MS); // Possible to trigger 1s before end
35 
38 
39  for (uint8_t i = 0u; i < PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN; i++) {
42  }
43 
55 }
uint32_t ticksPerInhalation() const
Get the duration of an inhalation in ticks.
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)
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.
uint16_t m_blowerSpeed
Current blower speed.
uint16_t m_triggerWindow
Number of ticks from which it is possible to trigger a new inspiration.
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.
bool m_inspiratoryPidFastMode
Fast mode at start of inspiration.
bool m_expiratoryPidFastMode
Fast mode at start of expiration.
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.
uint16_t maxAperture() const
Maximum valve aperture angle in degrees.
MainController mainController
uint16_t i
#define PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN
Definition: parameters.h:152
#define DEFAULT_BLOWER_SPEED
Definition: parameters.h:194
#define MAIN_CONTROLLER_COMPUTE_PERIOD_MS
Definition: parameters.h:28
PressureValve inspiratoryValve
PressureValve expiratoryValve

Member Function Documentation

◆ calculateBlowerIncrement()

void PC_VSAI_Controller::calculateBlowerIncrement ( )
private

Determine the blower speed to adopt for next cycle.

Definition at line 172 of file pc_vsai_controller.cpp.

172  {
173  int16_t peakDelta =
175  int16_t rebouncePeakDelta =
177  DBG_DO(Serial.print("peakPressure:");)
178  DBG_DO(Serial.println(mainController.peakPressureMeasure());)
179  DBG_DO(Serial.print("plateauPressureCommand:");)
180  DBG_DO(Serial.println(mainController.plateauPressureCommand());)
181 
182  // Check that pressure didn't rebounced
183  // High rebounces will decrease the blower
184  // Low rebounce will prevent increase (but not decrease)
185  bool veryHighRebounce = (peakDelta > 60) || ((rebouncePeakDelta < -60) && (peakDelta >= 0));
186  bool highRebounce = (peakDelta > 40) || ((rebouncePeakDelta < -40) && (peakDelta >= 0));
187  bool lowRebounce = (peakDelta > 20) || ((rebouncePeakDelta < -15) && (peakDelta >= 0));
188  bool veryLowRebounce = (peakDelta > 10) || ((rebouncePeakDelta < -10) && (peakDelta >= 0));
189 
190  // Update blower only if patient is plugged on the machine
191  if (mainController.peakPressureMeasure() > 20) {
192  // Safety condition: a too high peak (4 cmH2O) should decrease the blower
193  if (veryHighRebounce) {
194  m_blowerIncrement = -100;
195  } else if (highRebounce) {
196  m_blowerIncrement = -10;
197  } else if (m_inspiratorySlope > 650) { // We want the m_inspiratorySlope = 600 mmH2O/s
198  // Only case for decreasing the blower: ramping is too fast or overshooting is too high
199  if ((m_inspiratorySlope > 1000)
200  || ((lowRebounce && (m_inspiratorySlope > 800)) || (peakDelta > 25))) {
201  m_blowerIncrement = -100;
202  } else {
203  m_blowerIncrement = 0;
204  }
205  } else if (m_inspiratorySlope > 550) {
206  m_blowerIncrement = 0;
207  } else if ((m_inspiratorySlope > 450) && !veryLowRebounce) {
208  m_blowerIncrement = +25;
209  } else if ((m_inspiratorySlope > 350) && !veryLowRebounce) {
210  m_blowerIncrement = +50;
211  } else if ((m_inspiratorySlope > 250) && !veryLowRebounce) {
212  m_blowerIncrement = +75;
213  } else if (!lowRebounce) {
214  m_blowerIncrement = +100;
215  } else {
216  // Do nothing
217  }
218  }
219 
220  DBG_DO(Serial.print("BLOWER"));
221  DBG_DO(Serial.println(m_blowerIncrement));
222  DBG_DO(Serial.print("m_inspiratorySlope:");)
223  DBG_DO(Serial.println(m_inspiratorySlope);)
224 }
int16_t rebouncePeakPressureMeasure() const
Get the measured rebounce peak pressure.
int16_t peakPressureMeasure() const
Get the measured peak pressure.
int16_t plateauPressureCommand() const
Get the desired plateau pressure.
#define DBG_DO(statement)
Expand arbitrary code only when in debug mode.
Definition: debug.h:24

◆ enabledAlarms()

struct Alarms PC_VSAI_Controller::enabledAlarms ( ) const
inlineoverridevirtual

List of alarms that must be enabled for this mode.

Implements VentilationController.

Definition at line 32 of file pc_vsai_controller.h.

35  {
40  RCM_SW_22};
41  return a;
42  }
#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
List of alarms (named by their code)

◆ endCycle()

void PC_VSAI_Controller::endCycle ( )
overridevirtual

End the current breathing cycle.

Implements VentilationController.

Definition at line 170 of file pc_vsai_controller.cpp.

void calculateBlowerIncrement()
Determine the blower speed to adopt for next cycle.

◆ exhale()

void PC_VSAI_Controller::exhale ( )
overridevirtual

Control the exhalation.

Implements VentilationController.

Definition at line 139 of file pc_vsai_controller.cpp.

139  {
140  // Open the expiration valve so the patient can exhale outside
141  int32_t expiratoryValveOpenningValue = PCexpiratoryPID(
143 
144  (void)expiratoryValve.openLinear(expiratoryValveOpenningValue);
145 
147 
148  // Calculate max pressure for the last samples
150  for (uint8_t i = 0; i < MAX_PRESSURE_SAMPLES; i++) {
153  }
154  }
155 
156  // In case the pressure trigger mode is enabled, check if inspiratory trigger is raised
157  if ((mainController.tick()
159  // m_peakPressure > CONST_MIN_PEAK_PRESSURE ensures that the patient is plugged on the
160  // machine
161  if (((mainController.pressure())
166  }
167  }
168 }
int32_t dt() const
Get the delta of time since the last cycle (in ms)
int16_t * lastPressureValues()
Get last pressure values.
uint32_t tick() const
Get the tick number of the current cycle.
int16_t pressure() const
Get the current measured pressure.
const int16_t pressureTriggerOffsetCommand() const
Get the value of the inspiratory trigger pressure command.
int32_t pressureCommand() const
Get the pressure command.
const void setTrigger(bool triggerValue)
Reset the trigger to false.
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.
void close()
Request closing of the Pressure Valve.
uint16_t openLinear(uint16_t p_command)
Request opening of the Pressure Valve with a given angle with linearization.
int32_t maxPressureValue
#define MAX_PRESSURE_SAMPLES
Number of values to aggregate when computing plateau pressure.
#define CONST_MIN_PEAK_PRESSURE
Definition: parameters.h:34

◆ inhale()

void PC_VSAI_Controller::inhale ( )
overridevirtual

Control the inhalation.

Implements VentilationController.

Definition at line 102 of file pc_vsai_controller.cpp.

102  {
103  m_expiratoryPidFastMode = false;
104 
105  // Keep the inspiratory valve open using a PID
106  int32_t inspiratoryValveOpenningValue = PCinspiratoryPID(
108 
109  // Normally inspiratory valve is open, but at the end of the cycle it could be closed and
110  // expiratory valve will open
111  (void)inspiratoryValve.openLinear(inspiratoryValveOpenningValue);
113 
115 
116  // m_inspiratorySlope is used for blower regulations, -20 corresponds to open loop openning
120  / static_cast<int32_t>(mainController.tick()); // in mmH2O/s
122  }
123 
124  int32_t tiMinInTick =
126 
129  } else if ((mainController.inspiratoryFlow()
131  && (static_cast<int64_t>(mainController.tick())
132  > static_cast<int64_t>(tiMinInTick))) {
134  } else {
135  // Do nothing
136  }
137 }
const int16_t tiMinCommand() const
Get the value of the minimum duration of inspiration in ms.
const int16_t expiratoryTriggerFlowCommand() const
Get the value of the expiratory trigger flow command.
int16_t peepMeasure() const
Get the measured PEEP.
int32_t inspiratoryFlow() const
Get the current inspiratoryFlow.
void ticksPerInhalationSet(uint32_t p_ticksPerInhalation)
Get the duration of an inhalation in ticks.
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.

◆ initCycle()

void PC_VSAI_Controller::initCycle ( )
overridevirtual

Begin a new breathing cycle.

Implements VentilationController.

Definition at line 59 of file pc_vsai_controller.cpp.

59  {
63  + (1400u / MAIN_CONTROLLER_COMPUTE_PERIOD_MS); // Possible to trigger 1.4s before end
66  // Reset PID values
75  for (uint8_t i = 0; i < PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN; i++) {
79  }
80 
81  // Apply blower ramp-up
82  if (m_blowerIncrement >= 0) {
83  blower.runSpeedWithRampUp(m_blowerSpeed + static_cast<uint16_t>(abs(m_blowerIncrement)));
84  } else {
85  // When blower increment is negative, we need to check that it is less than current speed
86  // If not, it would result in an overflow
87  if (static_cast<uint16_t>(abs(m_blowerIncrement)) < blower.getSpeed()) {
89  - static_cast<uint16_t>(abs(m_blowerIncrement)));
90  } else {
92  }
93  }
96 
98 
100 }
Blower blower
Definition: blower.cpp:20
uint16_t getSpeed() const
Get speed value.
Definition: blower.cpp:101
uint16_t getTargetSpeed() const
Get target speed value.
Definition: blower.cpp:103
void runSpeedWithRampUp(uint16_t p_targetSpeed)
Run the blower to a given speed applying a ramp-up to prevent high current drain.
Definition: blower.cpp:44
int16_t peepCommand() const
Get the desired PEEP.
#define MIN_BLOWER_SPEED
Definition: parameters.h:192

◆ PCexpiratoryPID()

int32_t PC_VSAI_Controller::PCexpiratoryPID ( int32_t  targetPressure,
int32_t  currentPressure,
int32_t  dt 
)
private

PID to control the patient valve during some specific steps of the cycle.

Parameters
targetPressureThe pressure we want (in mmH2O)
currentPressureThe pressure measured by the sensor (in mmH2O)
dtTime since the last computation (in microsecond)

Definition at line 328 of file pc_vsai_controller.cpp.

328  {
329  int32_t minAperture = expiratoryValve.minAperture();
330  int32_t maxAperture = expiratoryValve.maxAperture();
331  int32_t expiratoryValveAperture;
332  int32_t derivative = 0;
333  int32_t smoothError = 0;
334  int32_t totalValues = 0;
335  int32_t temporarym_expiratoryPidIntegral = 0;
336  int32_t proportionnalWeight;
337  int32_t derivativeWeight;
338 
339  int32_t coefficientP;
340  int32_t coefficientI;
341  int32_t coefficientD;
342 
343  // Compute error
344  int32_t error = targetPressure + PID_PATIENT_SAFETY_PEEP_OFFSET - currentPressure;
345 
346  // Calculate derivative part
347  // Include a moving average on error for smoothing purpose
351  >= static_cast<int32_t>(PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN)) {
353  }
354  for (uint8_t i = 0u; i < PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN; i++) {
355  totalValues += m_expiratoryPidLastErrors[i];
356  }
357  smoothError = totalValues / static_cast<int32_t>(PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN);
358  derivative = (dt == 0) ? 0 : (1000000 * (smoothError - m_expiratoryPidLastError)) / dt;
359 
360  // Windowing (it overrides the parameter.h coefficients)
361  if (error < 0) {
362  coefficientI = 50;
363  coefficientP = 2500;
364  coefficientD = 0;
365  } else {
366  // For a high PEEP, a lower KI is required
367  // For PEEP = 100 mmH2O, KI = 120
368  // For PEEP = 50 mmH2O, KI = 250
369  if (mainController.peepCommand() > 100) {
370  coefficientI = 120;
371  } else {
372  coefficientI = ((-130 * ((int32_t)mainController.peepCommand())) / 50) + 380;
373  }
374  coefficientP = 2500;
375  coefficientD = 0;
376  }
377 
378  // Fast mode ends at 30 mmH20 from target
379  // When changing from fast mode to PID, set the integral to the previous value
380  if (error > -30) {
382  proportionnalWeight = (coefficientP * error) / 1000;
383  derivativeWeight = (coefficientD * derivative / 1000);
384  m_expiratoryPidIntegral = 1000 * ((int32_t)m_expiratoryValveLastAperture - maxAperture)
385  / (maxAperture - minAperture)
386  - (proportionnalWeight + derivativeWeight);
387  }
388  m_expiratoryPidFastMode = false;
389  }
390 
391  // Fast mode: open loop with ramp
393  expiratoryValveAperture = 0;
394  } else { // If not in fast mode, the PID is used
395  temporarym_expiratoryPidIntegral =
396  m_expiratoryPidIntegral + ((coefficientI * error * dt) / 1000000);
397  temporarym_expiratoryPidIntegral =
399  min(PID_PATIENT_INTEGRAL_MAX, temporarym_expiratoryPidIntegral));
400 
401  proportionnalWeight = ((coefficientP * error) / 1000);
402  int32_t integralWeight = temporarym_expiratoryPidIntegral;
403  derivativeWeight = coefficientD * derivative / 1000;
404 
405  int32_t patientCommand = proportionnalWeight + integralWeight + derivativeWeight;
406 
407  expiratoryValveAperture = max(
408  minAperture,
409  min(maxAperture, maxAperture + (maxAperture - minAperture) * patientCommand / 1000));
410  }
411 
412  // If the valve is completely open or completely closed, don't update integral part
413  if ((expiratoryValveAperture != minAperture) && (expiratoryValveAperture != maxAperture)) {
414  m_expiratoryPidIntegral = temporarym_expiratoryPidIntegral;
415  }
416 
417  m_expiratoryPidLastError = smoothError;
418  m_expiratoryValveLastAperture = expiratoryValveAperture;
419 
420  return expiratoryValveAperture;
421 }
uint16_t minAperture() const
Minimum valve aperture angle in degrees.
static const int32_t PID_PATIENT_INTEGRAL_MIN
Definition: parameters.h:146
static const int32_t PID_PATIENT_INTEGRAL_MAX
Definition: parameters.h:145
static const int32_t PID_PATIENT_SAFETY_PEEP_OFFSET
Increase target pressure by an offset (in mmH2O) for safety, to avoid going below the target pressure...
Definition: parameters.h:150

◆ PCinspiratoryPID()

int32_t PC_VSAI_Controller::PCinspiratoryPID ( int32_t  targetPressure,
int32_t  currentPressure,
int32_t  dt 
)
private

PID to control the blower valve during some specific steps of the cycle.

Parameters
targetPressureThe pressure we want (in mmH2O)
currentPressureThe pressure measured by the sensor (in mmH2O)
dtTime since the last computation (in microsecond)

Definition at line 227 of file pc_vsai_controller.cpp.

227  {
228  int32_t minAperture = inspiratoryValve.minAperture();
229  int32_t maxAperture = inspiratoryValve.maxAperture();
230  int32_t inspiratoryValveAperture;
231  int32_t derivative = 0;
232  int32_t smoothError = 0;
233  int32_t totalValues = 0;
234  int32_t proportionnalWeight;
235  int32_t derivativeWeight;
236 
237  int32_t coefficientP;
238  int32_t coefficientI;
239  int32_t coefficientD;
240 
241  int32_t temporarym_inspiratoryPidIntegral = 0;
242 
243  // Compute error
244  int32_t error = targetPressure - currentPressure;
245 
246  // Windowing (it overrides the parameter.h coefficients)
247  coefficientP = 2500;
248 
249  coefficientD = 0;
250  if (error < 0) {
251  coefficientI = 200;
252 
253  } else {
254  coefficientI = 50;
255  }
256 
257  // Calculate derivative part
258  // Include a moving average on error for smoothing purpose
262  >= static_cast<int32_t>(PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN)) {
264  }
265  for (uint8_t i = 0u; i < PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN; i++) {
266  totalValues += m_inspiratoryPidLastErrors[i];
267  }
268  smoothError = totalValues / static_cast<int32_t>(PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN);
269 
270  // Fast mode ends at 20 mmH20 from target
271  // When changing from fast mode to PID, set the integral to the previous value
272  if (error < 20) {
274  proportionnalWeight = (coefficientP * error) / 1000;
275  derivativeWeight = (coefficientD * derivative / 1000);
277  * ((int32_t)m_inspiratoryValveLastAperture - maxAperture)
278  / (minAperture - maxAperture)
279  - (proportionnalWeight + derivativeWeight);
280  }
281  m_inspiratoryPidFastMode = false;
282  }
283 
284  // In fast mode: everything is openned (open loop)
286  // Ramp from 125 to 0 angle during 250 ms
287  int32_t increment =
288  (5 * static_cast<int32_t>(MAIN_CONTROLLER_COMPUTE_PERIOD_MICROSECONDS)) / 10000;
289  if (m_inspiratoryValveLastAperture >= abs(increment)) {
290  inspiratoryValveAperture =
291  max(minAperture,
292  min(maxAperture,
293  (static_cast<int32_t>(m_inspiratoryValveLastAperture) - increment)));
294  } else {
295  inspiratoryValveAperture = 0;
296  }
297  } else { // If not in fast mode, the PID is used
298  derivative = ((dt == 0)) ? 0 : ((1000000 * (m_inspiratoryPidLastError - smoothError)) / dt);
299 
300  temporarym_inspiratoryPidIntegral =
301  m_inspiratoryPidIntegral + ((coefficientI * error * dt) / 1000000);
302  temporarym_inspiratoryPidIntegral =
304  min(PID_BLOWER_INTEGRAL_MAX, temporarym_inspiratoryPidIntegral));
305 
306  proportionnalWeight = ((coefficientP * error) / 1000);
307  int32_t integralWeight = temporarym_inspiratoryPidIntegral;
308  derivativeWeight = coefficientD * derivative / 1000;
309 
310  int32_t blowerCommand = proportionnalWeight + integralWeight + derivativeWeight;
311  inspiratoryValveAperture =
312  max(minAperture,
313  min(maxAperture, maxAperture + (minAperture - maxAperture) * blowerCommand / 1000));
314  }
315 
316  // If the valve is completely open or completely closed, don't update integral part
317  if ((inspiratoryValveAperture != minAperture) && (inspiratoryValveAperture != maxAperture)) {
318  m_inspiratoryPidIntegral = temporarym_inspiratoryPidIntegral;
319  }
320 
321  m_inspiratoryValveLastAperture = inspiratoryValveAperture;
322  m_inspiratoryPidLastError = smoothError;
323 
324  return inspiratoryValveAperture;
325 }
static const int32_t PID_BLOWER_INTEGRAL_MAX
Definition: parameters.h:139
#define MAIN_CONTROLLER_COMPUTE_PERIOD_MICROSECONDS
Definition: parameters.h:30
static const int32_t PID_BLOWER_INTEGRAL_MIN
Definition: parameters.h:140

◆ setup()

void PC_VSAI_Controller::setup ( )
overridevirtual

Initialize controller.

Implements VentilationController.

Definition at line 57 of file pc_vsai_controller.cpp.

Member Data Documentation

◆ m_blowerIncrement

int32_t PC_VSAI_Controller::m_blowerIncrement
private

Current blower speed increment (to apply at the beginning of the next cycle)

Definition at line 83 of file pc_vsai_controller.h.

◆ m_blowerSpeed

uint16_t PC_VSAI_Controller::m_blowerSpeed
private

Current blower speed.

Definition at line 73 of file pc_vsai_controller.h.

◆ m_expiratoryPidFastMode

bool PC_VSAI_Controller::m_expiratoryPidFastMode
private

Fast mode at start of expiration.

Definition at line 92 of file pc_vsai_controller.h.

◆ m_expiratoryPidIntegral

int32_t PC_VSAI_Controller::m_expiratoryPidIntegral
private

Integral gain of the patient PID.

Definition at line 98 of file pc_vsai_controller.h.

◆ m_expiratoryPidLastError

int32_t PC_VSAI_Controller::m_expiratoryPidLastError
private

Error of the last computation of the PID.

Definition at line 107 of file pc_vsai_controller.h.

◆ m_expiratoryPidLastErrors

int32_t PC_VSAI_Controller::m_expiratoryPidLastErrors[PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN]
private

Last errors in expiratory PID.

Definition at line 116 of file pc_vsai_controller.h.

◆ m_expiratoryPidLastErrorsIndex

int32_t PC_VSAI_Controller::m_expiratoryPidLastErrorsIndex
private

Last error index in expiratory PID.

Definition at line 119 of file pc_vsai_controller.h.

◆ m_expiratoryValveLastAperture

int32_t PC_VSAI_Controller::m_expiratoryValveLastAperture
private

Last aperture of the blower valve.

Definition at line 104 of file pc_vsai_controller.h.

◆ m_inspiratoryPidFastMode

bool PC_VSAI_Controller::m_inspiratoryPidFastMode
private

Fast mode at start of inspiration.

Definition at line 95 of file pc_vsai_controller.h.

◆ m_inspiratoryPidIntegral

int32_t PC_VSAI_Controller::m_inspiratoryPidIntegral
private

Error of the last computation of the blower PID.

Definition at line 86 of file pc_vsai_controller.h.

◆ m_inspiratoryPidLastError

int32_t PC_VSAI_Controller::m_inspiratoryPidLastError
private

Error of the last computation of the blower PID.

Definition at line 89 of file pc_vsai_controller.h.

◆ m_inspiratoryPidLastErrors

int32_t PC_VSAI_Controller::m_inspiratoryPidLastErrors[PC_NUMBER_OF_SAMPLE_DERIVATIVE_MOVING_MEAN]
private

Last errors in inspiratory PID.

Definition at line 110 of file pc_vsai_controller.h.

◆ m_inspiratoryPidLastErrorsIndex

int32_t PC_VSAI_Controller::m_inspiratoryPidLastErrorsIndex
private

Last error index in inspiratory PID.

Definition at line 113 of file pc_vsai_controller.h.

◆ m_inspiratorySlope

int32_t PC_VSAI_Controller::m_inspiratorySlope
private

Slope of the inspiration open loop (in mmH2O/s)

Definition at line 80 of file pc_vsai_controller.h.

◆ m_inspiratoryValveLastAperture

int32_t PC_VSAI_Controller::m_inspiratoryValveLastAperture
private

Last aperture of the blower valve.

Definition at line 101 of file pc_vsai_controller.h.

◆ m_maxInspiratoryFlow

int32_t PC_VSAI_Controller::m_maxInspiratoryFlow
private

Max flow during inspiration.

Definition at line 122 of file pc_vsai_controller.h.

◆ m_plateauPressureReached

bool PC_VSAI_Controller::m_plateauPressureReached
private

True if plateau pressure has been reached (but not necessarily converged)

Definition at line 52 of file pc_vsai_controller.h.

◆ m_reOpenInspiratoryValve

bool PC_VSAI_Controller::m_reOpenInspiratoryValve
private

True if we want to reopen the inspiratory valve to create a circulation flow able to detect inspiratory flow trigger.

Definition at line 77 of file pc_vsai_controller.h.

◆ m_triggerWindow

uint16_t PC_VSAI_Controller::m_triggerWindow
private

Number of ticks from which it is possible to trigger a new inspiration.

Definition at line 49 of file pc_vsai_controller.h.


The documentation for this class was generated from the following files: