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
ffbf1e36
Commit
ffbf1e36
authored
Oct 16, 2020
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial work on o2 mixing
parent
09022cb3
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
7 deletions
+36
-7
BreathingLoop.cpp
arduino/hev_prototype_v1/src/BreathingLoop.cpp
+30
-5
BreathingLoop.h
arduino/hev_prototype_v1/src/BreathingLoop.h
+3
-0
ValvesController.cpp
arduino/hev_prototype_v1/src/ValvesController.cpp
+1
-1
CommsDebug.py
raspberry-dataserver/CommsDebug.py
+2
-1
No files found.
arduino/hev_prototype_v1/src/BreathingLoop.cpp
View file @
ffbf1e36
...
@@ -79,9 +79,10 @@ BreathingLoop::BreathingLoop()
...
@@ -79,9 +79,10 @@ BreathingLoop::BreathingLoop()
_cycle_index
=
0
;
_cycle_index
=
0
;
_min_inhale_time
=
150
;
_min_inhale_time
=
150
;
_min_exhale_time
=
3
00
;
_min_exhale_time
=
8
00
;
_max_exhale_time
=
10000
;
// for mandatory cycle - changed to 30s for the sponteneous breath testing
_max_exhale_time
=
10000
;
// for mandatory cycle - changed to 30s for the sponteneous breath testing
initTargets
();
initTargets
();
setVentilationMode
(
_ventilation_mode
);
setVentilationMode
(
_ventilation_mode
);
...
@@ -99,7 +100,7 @@ void BreathingLoop::initTargets()
...
@@ -99,7 +100,7 @@ void BreathingLoop::initTargets()
_targets_pcac
.
peep
=
5
;
_targets_pcac
.
peep
=
5
;
_targets_pcac
.
fiO2_percent
=
21
;
_targets_pcac
.
fiO2_percent
=
21
;
_targets_pcac
.
inhale_trigger_threshold
=
1
;
// abs flow ? unit /
_targets_pcac
.
inhale_trigger_threshold
=
5
;
// abs flow ? unit /
_targets_pcac
.
exhale_trigger_threshold
=
0.25
;
// 25% of the peak flow
_targets_pcac
.
exhale_trigger_threshold
=
0.25
;
// 25% of the peak flow
_targets_pcac
.
buffer_lower_pressure
=
285.0
;
_targets_pcac
.
buffer_lower_pressure
=
285.0
;
...
@@ -610,9 +611,11 @@ void BreathingLoop::FSM_breathCycle()
...
@@ -610,9 +611,11 @@ void BreathingLoop::FSM_breathCycle()
_peak_flow
=
-
100000
;
// reset peak after inhale
_peak_flow
=
-
100000
;
// reset peak after inhale
_peak_flow_time
=
millis
();
_peak_flow_time
=
millis
();
_fsm_timeout
=
_states_durations
.
exhale
;
_fsm_timeout
=
_states_durations
.
exhale
;
// uint32_t tnow = millis();
if
(
doExhalePurge
()){
_valves_controller
.
setValves
(
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
OPEN
,
VALVE_STATE
::
OPEN
);
// fill buffer to required pressure or timeout ; close valves 10ms before timeout.
// fill buffer to required pressure or timeout ; close valves 10ms before timeout.
if
((
_readings_avgs
.
pressure_buffer
>=
_targets_current
->
buffer_upper_pressure
)
||
(
millis
()
-
_fsm_time
>=
(
_fsm_timeout
-
10
))){
}
else
if
((
_readings_avgs
.
pressure_buffer
>=
_targets_current
->
buffer_upper_pressure
)
||
(
millis
()
-
_fsm_time
>=
(
_fsm_timeout
-
10
))){
_valves_controller
.
setValves
(
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
OPEN
,
VALVE_STATE
::
CLOSED
);
_valves_controller
.
setValves
(
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
OPEN
,
VALVE_STATE
::
CLOSED
);
}
else
if
(
_readings_avgs
.
pressure_buffer
<
_targets_current
->
buffer_lower_pressure
){
}
else
if
(
_readings_avgs
.
pressure_buffer
<
_targets_current
->
buffer_lower_pressure
){
_valves_controller
.
setValves
(
VALVE_STATE
::
OPEN
,
VALVE_STATE
::
OPEN
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
OPEN
,
VALVE_STATE
::
CLOSED
);
_valves_controller
.
setValves
(
VALVE_STATE
::
OPEN
,
VALVE_STATE
::
OPEN
,
VALVE_STATE
::
CLOSED
,
VALVE_STATE
::
OPEN
,
VALVE_STATE
::
CLOSED
);
...
@@ -1259,3 +1262,25 @@ void BreathingLoop::tsigReset()
...
@@ -1259,3 +1262,25 @@ void BreathingLoop::tsigReset()
}
}
}
}
float
BreathingLoop
::
o2ValveFrac
(
float
desired_fiO2
)
{
// airValveFrac = 1.0 - O2ValveFrac
return
(
desired_fiO2
-
0.21
)
/
0.79
;
}
bool
BreathingLoop
::
doExhalePurge
()
{
// do nothing for now
return
false
;
uint32_t
tnow
=
millis
();
// purge-to-fill ratio = 0.66 => spend 66% time purging 33% filling buffer
if
(
tnow
-
_fsm_time
>=
static_cast
<
uint32_t
>
(
0.66
*
_min_exhale_time
)
)
{
if
(
fabs
(
_targets_current
->
fiO2_percent
-
_readings_avgs
.
o2_percent
)
<
1
){
return
true
;
}
}
return
false
;
}
arduino/hev_prototype_v1/src/BreathingLoop.h
View file @
ffbf1e36
...
@@ -120,6 +120,9 @@ private:
...
@@ -120,6 +120,9 @@ private:
states_durations
_measured_durations
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
states_durations
_measured_durations
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
void
measureDurations
();
void
measureDurations
();
void
measurePEEP
();
void
measurePEEP
();
float
o2ValveFrac
(
float
desired_fiO2
);
bool
doExhalePurge
();
// targets
// targets
void
initTargets
();
void
initTargets
();
target_variables
_targets_pcac
;
target_variables
_targets_pcac
;
...
...
arduino/hev_prototype_v1/src/ValvesController.cpp
View file @
ffbf1e36
...
@@ -49,7 +49,7 @@ ValvesController::ValvesController()
...
@@ -49,7 +49,7 @@ ValvesController::ValvesController()
_valve_params
.
inhale_duty_cycle
=
0
;
_valve_params
.
inhale_duty_cycle
=
0
;
_valve_params
.
inhale_open_max
=
MAX_VALVE_FRAC_OPEN
;
_valve_params
.
inhale_open_max
=
MAX_VALVE_FRAC_OPEN
;
_valve_params
.
inhale_open_min
=
0.5
3
;
_valve_params
.
inhale_open_min
=
0.5
1
;
_valve_params
.
valve_air_in_enable
=
1
;
_valve_params
.
valve_air_in_enable
=
1
;
_valve_params
.
valve_o2_in_enable
=
1
;
_valve_params
.
valve_o2_in_enable
=
1
;
_valve_params
.
valve_purge_enable
=
1
;
_valve_params
.
valve_purge_enable
=
1
;
...
...
raspberry-dataserver/CommsDebug.py
View file @
ffbf1e36
...
@@ -41,7 +41,8 @@ class Dependant(object):
...
@@ -41,7 +41,8 @@ class Dependant(object):
# logging.info(f"Alarm: {payload.alarm_code} of priority: {payload.alarm_type}")
# logging.info(f"Alarm: {payload.alarm_code} of priority: {payload.alarm_type}")
if
payload
.
getType
()
==
PAYLOAD_TYPE
.
DATA
.
value
:
if
payload
.
getType
()
==
PAYLOAD_TYPE
.
DATA
.
value
:
logging
.
info
(
f
"payload received: {payload}"
)
#logging.info(f"payload received: {payload}")
logging
.
info
(
f
"payload received: {payload.timestamp} pc {payload.flow:3.6f} dc {payload.flow_calc:3.6f} fsm {payload.fsm_state}"
)
# #logging.info(f"payload received: {payload.timestamp} pc {payload.flow:3.6f} dc {payload.volume:3.6f} fsm {payload.fsm_state}")
# #logging.info(f"payload received: {payload.timestamp} pc {payload.flow:3.6f} dc {payload.volume:3.6f} fsm {payload.fsm_state}")
# #logging.info(f"payload received: {payload.pressure_buffer:3.6f} fsm {payload.fsm_state}")
# #logging.info(f"payload received: {payload.pressure_buffer:3.6f} fsm {payload.fsm_state}")
# #logging.info(f"Fsm state: {payload.fsm_state}")
# #logging.info(f"Fsm state: {payload.fsm_state}")
...
...
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