Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
HEV - High Energy Ventilator
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
HEV - High Energy Ventilator
Commits
1d20ed58
Commit
1d20ed58
authored
Feb 22, 2021
by
Emigdio Jimenez Dominguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test mass change
parent
ac8b5473
Pipeline
#950
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
BreathingLoop.cpp
arduino/hev_prototype_v1/src/BreathingLoop.cpp
+21
-5
BreathingLoop.h
arduino/hev_prototype_v1/src/BreathingLoop.h
+3
-0
No files found.
arduino/hev_prototype_v1/src/BreathingLoop.cpp
View file @
1d20ed58
...
...
@@ -51,6 +51,10 @@ BreathingLoop::BreathingLoop()
initCalib
();
resetReadingSums
();
_Pstartbuffer
=
0
;
_Pendbuffer
=
0
;
_Pstartbuffer
=
0
;
_flow
=
0
;
_volume
=
0
;
_airway_pressure
=
0
;
...
...
@@ -301,7 +305,8 @@ void BreathingLoop::updateCycleReadings()
_cycle_index
=
(
_cycle_index
==
CYCLE_AVG_READINGS
-
1
)
?
0
:
_cycle_index
+
1
;
_cycle_readings
.
timestamp
=
tnow
;
_cycle_readings
.
fiO2_percent
=
_cycle_readings
.
lung_compliance
;
//_readings_avgs.o2_percent;// FIXME
_cycle_readings
.
fiO2_percent
=
_cycle_readings
.
static_compliance
;
//_cycle_readings.fiO2_percent = _cycle_readings.lung_compliance; //_readings_avgs.o2_percent;// FIXME
_running_inhale_minute_volume
[
_cycle_index
]
=
_volume_inhale
;
_running_exhale_minute_volume
[
_cycle_index
]
=
_volume_exhale
;
//logMsg(" I, E "+String(_volume_inhale)+ " "+String(_volume_exhale));
...
...
@@ -334,7 +339,8 @@ void BreathingLoop::updateCycleReadings()
_cycle_readings
.
inhaled_tidal_volume
=
mvi_sum
/
CYCLE_AVG_READINGS
;
_cycle_readings
.
exhaled_tidal_volume
=
mve_sum
/
CYCLE_AVG_READINGS
;
_cycle_readings
.
lung_compliance
=
_cycle_readings
.
inhaled_tidal_volume
/
(
_cycle_readings
.
peak_inspiratory_pressure
-
_peep
);
_cycle_readings
.
static_compliance
=
_cycle_readings
.
tidal_volume
/
(
_cycle_readings
.
plateau_pressure
-
_peep
);
_cycle_readings
.
static_compliance
=
(
_volumeStandard
*
0.082
*
293
)
/
790
;
//_cycle_readings.static_compliance = _cycle_readings.tidal_volume / (_cycle_readings.plateau_pressure - _peep);
_cycle_readings
.
mean_airway_pressure
=
_airway_pressure
;
_cycle_readings
.
inhalation_pressure
=
_airway_pressure
;
_cycle_readings
.
apnea_index
+=
(
_apnea_event
==
true
)
?
1
:
0
;
...
...
@@ -640,7 +646,7 @@ void BreathingLoop::FSM_breathCycle()
_pid
.
istep
=
0
;
_peep
=
_running_avg_peep
;
break
;
case
BL_STATES
:
:
INHALE
:
//_valves_controller.setValves(VALVE_STATE::CLOSED, VALVE_STATE::CLOSED, VALVE_STATE::OPEN, VALVE_STATE::CLOSED, VALVE_STATE::CLOSED);//Comment this line for the PID control during inhale
...
...
@@ -654,6 +660,7 @@ void BreathingLoop::FSM_breathCycle()
// mand_vol = volumeTrigger(); // disable for now
_mandatory_exhale
=
mand_ex
;
// & mand_vol;
//logMsg("inhale "+String(_valley_flow_time)+" "+_measured_durations.inhale+ " "+_measured_durations.exhale+" " +_fsm_timeout);
break
;
case
BL_STATES
:
:
PAUSE
:
_valves_controller
.
setValves
(
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
);
...
...
@@ -1279,10 +1286,15 @@ void BreathingLoop::runningAvgs()
_flow_fitter
.
resetCalculation
(
tnow
);
}
if
(
_bl_state
==
BL_STATES
::
BUFF_PRE_INHALE
){
_Pstartbuffer
=
_readings_avgs
.
pressure_buffer
;
//P1
}
if
(
_bl_state
==
BL_STATES
::
PAUSE
){
// even if pause duration is 0, this should execute once
_cycle_readings
.
plateau_pressure
=
_readings_avgs
.
pressure_patient
;
//_running_avg_plateau_pressure;
_cycle_readings
.
plateau_pressure
=
_readings_avgs
.
pressure_patient
;
//_running_avg_plateau_pressure;
_cycle_readings
.
peak_inspiratory_pressure
=
_readings_avgs
.
pressure_inhale
;
_Pendbuffer
=
_readings_avgs
.
pressure_buffer
;
//P1'
}
if
((
_readings_avgs
.
pressure_patient
>
_cycle_readings
.
peak_inspiratory_pressure
)
&&
(
_bl_state
==
BL_STATES
::
INHALE
)){
...
...
@@ -1294,7 +1306,7 @@ void BreathingLoop::runningAvgs()
_volume_inhale
=
_volume
;
//getVolume();
//logMsg("INHALE "+String(_volume_inhale));
}
else
if
(
_bl_state
==
BL_STATES
::
EXHALE
){
_volume_exhale
=
_volume_inhale
-
_volume
;
//getVolume();
_volume_exhale
=
_volume_inhale
-
_volume
;
//getVolume();
//if(fabs(_flow) < 0.02){
// _peep = _readings_avgs.pressure_patient;
//}
...
...
@@ -1302,6 +1314,10 @@ void BreathingLoop::runningAvgs()
_flow_fitter
.
appendPoints
(
millis
(),
_flow
);
}
if
(
_bl_state
==
BL_STATES
::
EXHALE
){
_volumeStandard
=
((
_Pstartbuffer
-
_Pendbuffer
)
*
(
10
/
(
0.0082
*
293
))
+
(
_cycle_readings
.
plateau_pressure
*
(
1
+
(
0.1
*
(
_cycle_readings
.
plateau_pressure
-
_peep
)
-
(
_peep
*
1
))
/
(
0.0082
*
293
);
}
_sum_airway_pressure
+=
_readings_avgs
.
pressure_patient
;
_ap_readings_N
++
;
...
...
arduino/hev_prototype_v1/src/BreathingLoop.h
View file @
1d20ed58
...
...
@@ -185,6 +185,9 @@ private:
uint16_t
_inhale_cycle_duration
[
CYCLE_AVG_READINGS
];
uint16_t
_exhale_cycle_duration
[
CYCLE_AVG_READINGS
];
float
_Pstartbuffer
;
float
_Pendbuffer
;
float
_volumeStandard
;
float
_flow
;
float
_volume
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment