main.cpp 19.6 KB
Newer Older
Bernhard PETERMEIER's avatar
Bernhard PETERMEIER committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include <Arduino.h>
#include "pins.h"
#include "states.h"
#include "display.h"
#include "motor.h"
#include "modes.h"
#include "globalFlags.h"
#include "../lib/Encoder_ID129/Encoder.h"
#include "alarms.h"

//for Arduino MEGA with compatibility to UNO for essential functions

bool PRESSURE_FLAG;
bool CHANGES_FLAG;
bool MOTOR_FLAG;
bool START_UP_FLAG;
bool SILENCE_FLAG;
bool MOTOR_ACTIVE_FLAG;
bool VOLUME_FLAG;


const int diffBagPosition = 60;     //ticks between homePosition and fingers touching the bag (HARDCODED)
const int timeHold = 200;           //The amount of time (in milliseconds) to hold the compression at the end of the inhale for plateau pressure
const int velocityHoming = 70;      //slow speed for homing
const int controlPeriod = 50;       //ms
const int closePosition = 190;      //Ticks between home and full close

//state machine variables
int lastMode;
int mode;                 //switch state variable for outer switch
int nextMode;             //mode to be executed after homing
int state;                //switch state variable for inner switch

//Encoder variables
int homePosition;         //Encoder value at the position of the limit switch
int currentPosition;
int bagPosition;          //absolute positions where fingers touching the bag
int inhaleEndPosition;    //calculated absolute position at the end of the inspiratory phase
int prePeriodPosition;    //ticks before the current velocity control period
int preInhalePosition;

//In/Exhale times
int targetTimeInhale;     //The length of time (in ms) of the inspiratory phase.
int targetTimeExhale;     //The length of time (in ms) of the expiratory phase.

//volume parameters
int volumeTidal;          //The total volume of air to be delivered to the patient
int volumeTicks;          //The number of Encoder ticks required for the given volumeTidal
int realVolume;
int realVolumeTicks;

//rate and ratio
int breathsPerMinute;     // Breaths per minute, also called respiratory rate (RR). Typically varies between 8-30 BPM.
float I2E_ratio;          // The ratio of the duration of the inhale to the duration of the exhale.

//velocity control
float targetInhaleVelocity; //target input of controller
float targetExhaleVelocity; //target input of controller
int currentVelocity;        //Measure Input of controller.
int dutyCycleOutput;       //Output of controller. The inhale velocity scaled from 0-255 for PWM Output
int integral;
float iTerm;   //integral term of PI controller
float pTerm;

//flow
int currentFlow;        //ml/s
int targetFlow;
int meanFlow;
int maxFlow;

//pressures
int pressurePlateau;      //Last measured plateauPressure in mbar
int limitPressure;        //maximum presssure for pressure limited mode

//variables for setpoint potentiometers
int volumeTidalSet;       //Current potentiometer value for volumeTidal, not confirmed
int breathsPerMinuteSet;  //Current potentiometer value for breathsPerMinute, not confirmed
float I2E_ratioSet;       //Current potentiometer value for I2E_ratio, not confirmed
int limitPressureSet;     //Current potentiometer value for limitPressure, not confirmed
int lastVolumeTidalSet;       //last potentiometer value for volumeTidal, not confirmed
int lastBreathsPerMinuteSet;  //last potentiometer value for breathsPerMinute, not confirmed
float lastI2E_ratioSet;       //last potentiometer value for I2E_ratio, not confirmed
int lastLimitPressureSet;//last potentiometer value for limitPressure, not confirmed



//timers in ms
unsigned long timerSetPoint;
unsigned long timerPotentiometer;
unsigned long timerDebounce;
unsigned long timerDisplay;
unsigned long timerControlPeriod;
unsigned long timerInhale;
unsigned long timerExhale;
unsigned long timerDelay;
unsigned long timerRealInhale;
unsigned long timerRealExhale;
unsigned long timerSilence;
unsigned long timerAlarmsInterrupt;

int currentMeanFlow;

int controlCounter;
long plottingCounter;

//encoder instance
Encoder encoder(ENC_A,ENC_B);

void calculateVolumeParameters(){
  int singleBreathTime =60000/breathsPerMinute - timeHold;
111
  targetTimeInhale = singleBreathTime*I2E_ratio;
Bernhard PETERMEIER's avatar
Bernhard PETERMEIER committed
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
  targetTimeExhale = singleBreathTime -targetTimeInhale;
  volumeTicks = (volumeTidal+420)/12; //linear model y=12*x-420
  inhaleEndPosition = bagPosition - volumeTicks;
  meanFlow = (volumeTicks/(targetTimeInhale/1000.0))*12;
  targetExhaleVelocity = volumeTicks/(targetTimeExhale/1000.0);
}

int getPressure(){

  int readingA = analogRead(PRESSURE);
  delay(5);
  int readingB = analogRead(PRESSURE);
  delay(5);
  int readingC = analogRead(PRESSURE);
  return map((readingA+readingB+readingC)/3, 40, 963, 0, 100); // from 0.2V (41) to 3.7V (963) to a range of 0 to 100mbar
}


void controlInhaleVelocity(){

  //calculate ticks in last period
  int ticksInLastPeriod = prePeriodPosition-currentPosition;
  //calculate current velocity in Ticks/s
  currentVelocity =  ticksInLastPeriod * (1000/controlPeriod); //current velocity in Ticks/s

  //flow calculation
  //two seperate linear apprxomiations are used <60 or >60
  //calculate current flow in ml/s
  if((bagPosition-prePeriodPosition) < 60){
    currentFlow = currentVelocity*8;
  }
  else{
    currentFlow = currentVelocity*12;
  }
  currentMeanFlow = (currentMeanFlow*0.6+currentFlow*0.4);

  if(mode == MODE_VOLUME){
    //calculate target flow
    int inhaleControlCycles = targetTimeInhale/controlPeriod;
    if(controlCounter < inhaleControlCycles/2){
      targetFlow = meanFlow * ((1.1*controlCounter)/(inhaleControlCycles/2.0)+0.2);      //1.1 -> 110% difference between 20% at begin and 130% at the end
    }
    else{
      targetFlow = 1.3*meanFlow;            //130% flow in second half to reach mean flow
    }

  }

if((bagPosition-currentPosition) < 60){
  targetInhaleVelocity = targetFlow/8;
}
else{
  targetInhaleVelocity = targetFlow/12;
}
  //controller
  int controlDifference = targetInhaleVelocity - currentVelocity;
  //define P term of controller
  if(controlDifference < 0){
    pTerm = 0.001;
  }
  else{
    pTerm = 0.07;
  }
  iTerm = 0.001;
  integral += controlDifference;

  //new inhalleVelocity
  dutyCycleOutput = dutyCycleOutput + controlDifference*pTerm + integral*iTerm;
  //limit for inhale velocity
  if(dutyCycleOutput > 255){
    dutyCycleOutput=255;
  }
  //set parameters for next control cycle
  controlCounter++;
  prePeriodPosition = currentPosition;
}

void controlExhaleVelocity(){

  //calculate ticks in last period
  int ticksInLastPeriod = currentPosition - prePeriodPosition;
  //calculate current velocity in Ticks/s
  currentVelocity =  ticksInLastPeriod * (1000/controlPeriod); //current velocity in Ticks/s

  //controller
  int controlDifference = targetExhaleVelocity -currentVelocity;

  if(controlDifference < 0){
    pTerm = 0.001;
  }
  else{
    pTerm = 0.08;
  }
  iTerm = 0.0001;
  integral += controlDifference;

  dutyCycleOutput = dutyCycleOutput + controlDifference*pTerm + integral*iTerm;

  if(dutyCycleOutput < 35){
    dutyCycleOutput = 35;
  }
  //limit for inhale velocity
  if(dutyCycleOutput > 40){
    dutyCycleOutput=40;
  }
}

void controlPressure(){

  int currentPressure = getPressure();
  int controlDifference = limitPressure - currentPressure;
  integral += controlDifference;
  pTerm = 2;
  if(controlCounter < 4){
    integral = 0;
  }
  iTerm = 0.1;

  //new inhalleVelocity
  dutyCycleOutput = dutyCycleOutput + controlDifference*pTerm + integral*iTerm;
  //limit for inhale velocity
  if(dutyCycleOutput > 255){
    dutyCycleOutput=255;
  }
  if(currentPosition < (homePosition - closePosition)){
    timerInhale = millis()-1; //stops
  }

  //set parameters for next control cycle
  controlCounter++;
  prePeriodPosition = currentPosition;
}

void timer1_setup(long time_in_ms) {
   // initialize timer1
  noInterrupts();           // disable all interrupts
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1  = 0;
  unsigned long long match_register_value = 62500*(time_in_ms/1000.0); // compare match register 16MHz/256/xHz
  OCR1A = match_register_value;            // compare match register 16MHz/256/x Hz
  //OCR1A = 31250;
  TCCR1B |= (1 << WGM12);   // CTC mode
  TCCR1B |= (1 << CS12);    // 256 prescaler
  TIMSK1 |= (1 << OCIE1A);  // enable timer compare interrupt
  interrupts();             // enable all interrupts
}

ISR(TIMER1_COMPA_vect)          // timer1 interrupt service routine
{
  handleAlarms(mode, pressurePlateau, getPressure(), encoder.read(), (realVolume/1000.0*breathsPerMinute));
}

void setup() {
  pinMode(RESET_PIN, OUTPUT);
  digitalWrite(RESET_PIN, HIGH);
  pinMode(PRESSURE, INPUT);
  pinMode(LIMIT_SWITCH, INPUT);
  pinMode(VOL_POT, INPUT);
  pinMode(RATE_POT, INPUT);
  pinMode(I2E_POT, INPUT);
  pinMode(PRS_POT, INPUT);
  pinMode(MODE_SWITCH, INPUT_PULLUP);
  pinMode(SILENCE_BUTTON, INPUT_PULLUP);
  pinMode(CONFIRM_BUTTON, INPUT_PULLUP);
  pinMode(BUZZER, OUTPUT);
  pinMode(MOTOR_DIR, OUTPUT);
  pinMode(MOTOR_PWM, OUTPUT);
  pinMode(MOTOR_BRAKE, OUTPUT);
  pinMode(MOTOR_SENSE, INPUT);
  pinMode(LCD_BACKLIGHT, OUTPUT);
  pinMode(ENC_A, INPUT_PULLUP);
  pinMode(ENC_B, INPUT_PULLUP);
  pinMode(ENC_I, INPUT_PULLUP);
  pinMode(LED_POWER, OUTPUT);
  pinMode(LED_GREEN, OUTPUT);
  pinMode(LED_RED, OUTPUT);

  START_UP_FLAG = true;

  //debugging serial
  Serial1.begin(9600);
  //lcd
  initLCD();
  homeScreen();
  digitalWrite(LCD_BACKLIGHT, HIGH);

  //test outputs
  digitalWrite(LED_POWER, HIGH);
  digitalWrite(LED_GREEN, HIGH);
  digitalWrite(LED_RED, HIGH);
  tone(BUZZER, 10000);
  delay(1500);
  digitalWrite(LED_POWER, LOW);
  digitalWrite(LED_GREEN, LOW);
  digitalWrite(LED_RED, LOW);
  noTone(BUZZER);

  //inital states
  lastMode = MODE_IDLE;
  mode = MODE_IDLE;
  nextMode = MODE_IDLE;
  state = 0;
  realVolume = 500;
  pressurePlateau = 5;

  timer1_setup(250); // perform safety and alarn function every 250ms
  digitalWrite(LED_POWER, HIGH);    //LED to show that arduino is running
}

void loop() {
  switch (mode) {
    case MODE_IDLE:{
      digitalWrite(LED_GREEN, LOW);
      break;
    }

    case MODE_HOMING:{
      digitalWrite(LED_GREEN, HIGH);
      switch (state) {
        //prehome
        case 0:{
          //move outward slowly
          moveMotor(DIRECTION_OPEN, velocityHoming, MOTOR_FLAG);

          if(digitalRead(LIMIT_SWITCH) == LIMIT_REACHED){
            stopMotor();
            timerDebounce = millis() + 100;
            state++;
          }
          break;
        }
        //homing
        case 1:{
          //move forward slowly, zero encoder
          moveMotor(DIRECTION_CLOSE, velocityHoming, MOTOR_FLAG);

          if((digitalRead(LIMIT_SWITCH)!=LIMIT_REACHED) && (millis()>timerDebounce)){
            stopMotor();
            tone(BUZZER, 20000, 500);
            delay(1000);
            homePosition = encoder.read();
            bagPosition = homePosition - diffBagPosition;
            state++;
          }
          break;
        }
        //posthome
        case 2:
          moveMotor(DIRECTION_CLOSE, velocityHoming, MOTOR_FLAG);
          currentPosition = encoder.read();
          if(currentPosition <= bagPosition){
            stopMotor();
            calculateVolumeParameters();
            state = 0;
            mode = nextMode;
          }
        break;
      }
      break;
    }

    case MODE_VOLUME:{
        digitalWrite(LED_GREEN, HIGH);
        switch (state) {
          //start homing
          case 0:{
            if(nextMode != MODE_VOLUME){
              nextMode = MODE_VOLUME;
              mode = MODE_HOMING;
            }
            else{
              state++;
              prePeriodPosition = encoder.read();
              timerRealInhale = millis();
              timerControlPeriod = millis() + controlPeriod;
              controlCounter = 0;
              integral=0;
              dutyCycleOutput = 60;
            }
            break;
          }
          //inhale
          case 1:{
            moveMotor(DIRECTION_CLOSE, dutyCycleOutput, MOTOR_FLAG);
            currentPosition = encoder.read();
            if(millis() > timerControlPeriod){
              controlInhaleVelocity();
              timerControlPeriod = millis() + controlPeriod;
            }
            if(currentPosition <= inhaleEndPosition){
              stopMotor();
              timerRealInhale = millis()-timerRealInhale;
              timerSetPoint = millis() + timeHold;
              delay(10);
              pressurePlateau = getPressure();
              state++;
            }
            break;
          }
          //pause
          case 2:{
            if(millis() >= timerSetPoint){
              state++;
              prePeriodPosition = encoder.read();
              timerRealExhale = millis();
              timerControlPeriod = millis() + controlPeriod;
              controlCounter = 0;
              integral = 0;
              dutyCycleOutput = 18;
            }
            break;
          }
          //exhale
          case 3:{
            moveMotor(DIRECTION_OPEN, dutyCycleOutput,MOTOR_FLAG);
            currentPosition = encoder.read();
            if(millis() > timerControlPeriod){
              controlExhaleVelocity();
              prePeriodPosition = currentPosition;
              timerControlPeriod = millis() + controlPeriod;
            }
            if(currentPosition >= bagPosition){
              stopMotor();
              timerRealExhale = millis()-timerRealExhale;
              int totalTime = timerRealInhale + timerRealExhale + timeHold;
              if(totalTime < 60000/breathsPerMinute){
                int delay =  60000/breathsPerMinute - totalTime;
                timerDelay = millis() + delay;
              }
              state++;
            }
          break;
          }
          case 4: {
            if(millis() > timerDelay){
              nextMode = MODE_VOLUME;
              state = 0;
            }
            break;
          }
        }
      break;
    }

    case MODE_PRESSURE:{
      digitalWrite(LED_GREEN, HIGH);
      switch (state) {
        //homing
        case 0: {
          if(nextMode != MODE_PRESSURE){
            nextMode = MODE_PRESSURE;
            mode = MODE_HOMING;
          }
          else{
            prePeriodPosition = encoder.read();
            timerInhale = millis() + targetTimeInhale;
            timerControlPeriod = millis() + controlPeriod;
            timerRealInhale = millis();
            controlCounter = 0;
            integral=0;
            dutyCycleOutput = 80;
            state++;
          }
          break;
        }
        //inhale
        case 1: {
          moveMotor(DIRECTION_CLOSE, dutyCycleOutput, MOTOR_FLAG);
          currentPosition = encoder.read();
          if(millis() > timerControlPeriod){
            controlPressure();
            timerControlPeriod = millis() + controlPeriod;
          }
          if(millis() > timerInhale){
            stopMotor();
            timerRealInhale = millis()-timerRealInhale;
            timerSetPoint = millis() + timeHold;
            //calculate applied volume
            realVolumeTicks = bagPosition - currentPosition;

            if(realVolumeTicks < 60){

              realVolume = realVolumeTicks*8 -190;
            }
            else{
              realVolume = realVolumeTicks*12 -420;
            }
            state++;
          }
          break;
        }
        //hold
        case 2: {
          if(millis() >= timerSetPoint){
            state++;
            prePeriodPosition = encoder.read();
            timerRealExhale = millis();
            timerControlPeriod = millis() + controlPeriod;
            controlCounter = 0;
            integral = 0;
            dutyCycleOutput = 18;
          }
          break;
        }
        //exhale
        case 3: {
          moveMotor(DIRECTION_OPEN, dutyCycleOutput,MOTOR_FLAG);
          currentPosition = encoder.read();
          if(millis() > timerControlPeriod){
            controlExhaleVelocity();
            prePeriodPosition = currentPosition;
            timerControlPeriod = millis() + controlPeriod;
          }
          if(currentPosition >= bagPosition){
            stopMotor();
            timerRealExhale = millis()-timerRealExhale;
            int totalTime = timerRealInhale + timerRealExhale + timeHold;
            if(totalTime < 60000/breathsPerMinute){
              int delay =  60000/breathsPerMinute - totalTime;
              timerDelay = millis() + delay;
            }
            state++;
          }
          break;
        }
        //delay
        case 4: {
          if(millis() > timerDelay){
            nextMode = MODE_PRESSURE;
            state = 0;
          }
          break;
        }
      }
      break;
    }

  }

  //input handling --------------------------------------------------------------
  if(millis() >= timerPotentiometer){
  //potentiometer reads
    volumeTidalSet = map(analogRead(VOL_POT),0,1020,900,300);
    breathsPerMinuteSet = map(analogRead(RATE_POT),0,1020,40,8);
    limitPressureSet = map(analogRead(PRS_POT),0,1020,30,10);
    int I2E_ratioMeasure = analogRead(I2E_POT);

    if(I2E_ratioMeasure < 256){
      I2E_ratioSet = 0.2;
    }
    else if(I2E_ratioMeasure < 512){
      I2E_ratioSet = 0.25;
    }
    else if(I2E_ratioMeasure < 768){
      I2E_ratioSet = 0.34;
    }
    else{
      I2E_ratioSet = 0.5;
    }

//have parameters been changed?
    if( (volumeTidalSet < (lastVolumeTidalSet-5)||
        volumeTidalSet > (lastVolumeTidalSet+5)||
        breathsPerMinuteSet < (lastBreathsPerMinuteSet-1) ||
        breathsPerMinuteSet > (lastBreathsPerMinuteSet+1) ||
        limitPressureSet < (lastLimitPressureSet-2) ||
        limitPressureSet > (lastLimitPressureSet+2) ||
        I2E_ratioSet != lastI2E_ratioSet ) && !START_UP_FLAG) {
          CHANGES_FLAG = true;
            digitalWrite(LCD_BACKLIGHT, HIGH);
        }

        int modeMeasure = analogRead(MODE_SWITCH);
        if(modeMeasure < 250 && mode != MODE_HOMING){
          mode = MODE_VOLUME;
        }
        else if(modeMeasure < 750 && mode != MODE_HOMING){
          mode = MODE_PRESSURE;
        }
        else if(modeMeasure > 800){
          stopMotor();
          mode = MODE_IDLE;
          nextMode = MODE_IDLE;
        }
        if(mode != lastMode){
          lastMode = mode;
          state = 0;
        }

        if((volumeTidalSet <= (lastVolumeTidalSet-5)) ||
          (volumeTidalSet >= (lastVolumeTidalSet+5))){
            lastVolumeTidalSet = volumeTidalSet;
          }
          else{
            volumeTidalSet = lastVolumeTidalSet;
          }

    lastBreathsPerMinuteSet = breathsPerMinuteSet;
    lastLimitPressureSet = limitPressureSet;
    lastI2E_ratioSet = I2E_ratioSet;

    timerPotentiometer = millis() + 100;
  }

  if(digitalRead(CONFIRM_BUTTON) == BUTTON_PRESSED && millis()>timerDebounce){
      timerDebounce = millis() + 500;

      //confirm changes and start mode if not started
      volumeTidal = volumeTidalSet;
      breathsPerMinute = breathsPerMinuteSet;
      limitPressure = limitPressureSet;
      I2E_ratio = I2E_ratioSet;


      CHANGES_FLAG = false;
      digitalWrite(LCD_BACKLIGHT, HIGH);
      calculateVolumeParameters();

      //Confirm error
      MOTOR_FLAG = PRESSURE_FLAG = false;
      state=0;
    }

  if(digitalRead(SILENCE_BUTTON) == BUTTON_PRESSED && millis()>timerDebounce){
    SILENCE_FLAG = true;
    timerSilence = millis() + 10000;
  }
  else if( SILENCE_FLAG && millis() > timerSilence){
    SILENCE_FLAG = false;
  }

  //LCD outputs ----------------------------------------------------------------
  if(millis() > timerDisplay){
    updateValues(volumeTidalSet, breathsPerMinuteSet, I2E_ratioSet, limitPressureSet, pressurePlateau, realVolume, mode);
    updateErrors();
    timerDisplay = millis()+ 100;
  }

  if(!MOTOR_ACTIVE_FLAG){
    stopMotor(); //to avoid random movement of motor due to noise
  }
  if(START_UP_FLAG){
    //confirm changes and start mode if not started
    volumeTidal = volumeTidalSet;
    breathsPerMinute = breathsPerMinuteSet;
    limitPressure = limitPressureSet;
    I2E_ratio = I2E_ratioSet;
    START_UP_FLAG = false;
  }

}