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
146c1cfb
Commit
146c1cfb
authored
Jan 06, 2021
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the calculation of the voltage from adc according to measured Voltag/ADC factor
parent
73a67801
Pipeline
#763
failed
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
22 deletions
+15
-22
BreathingLoop.cpp
arduino/hev_prototype_v1/src/BreathingLoop.cpp
+2
-2
common.cpp
arduino/hev_prototype_v1/src/common.cpp
+7
-14
main.cpp
arduino/hev_prototype_v1/src/main.cpp
+6
-6
No files found.
arduino/hev_prototype_v1/src/BreathingLoop.cpp
View file @
146c1cfb
...
...
@@ -329,7 +329,7 @@ void BreathingLoop::updateCycleReadings()
_ap_readings_N
=
0
;
_volume_inhale
=
0
;
_volume_exhale
=
0
;
_volume
=
0
;
_volume
=
0
;
//reset
_cycle_done
=
true
;
...
...
@@ -353,8 +353,8 @@ void BreathingLoop::updateCalculations() {
_calculations
.
flow
=
getFlow
();
// TODO: can be run every 1 ms instead of every arduino cycle
//_calculations.flow_calc = calculateFlow(_readings_avgs.timestamp, _readings_avgs.pressure_patient, _readings_avgs.pressure_buffer);
_calculations
.
flow_calc
=
calculateFlow
(
_readings_avgs
.
timestamp
,
_readings_avgs
.
pressure_patient
,
_readings_avgs
.
pressure_buffer
);
_calculations_time
=
tnow
;
_calculations
.
volume
=
getVolume
();
_calculations_time
=
tnow
;
}
_calculations
.
pressure_airway
=
getAirwayPressure
();
// _calculations.flow_calc = calculateFlow(tnow, adcToMillibarFloat(_readings_raw.pressure_patient, _calib_avgs.pressure_patient), adcToMillibarFloat(_readings_raw.pressure_buffer, _calib_avgs.pressure_buffer));
...
...
arduino/hev_prototype_v1/src/common.cpp
View file @
146c1cfb
...
...
@@ -221,24 +221,17 @@ float adcToMillibarDPFloat(float adc, float offset)
// The calibration for the DP sensor is provided by the manufacturer
// https://docs.rs-online.com/7d77/0900766b81568899.pdf
float
PCB_Gain
=
2.
;
// real voltage is two times higher thant the measured in the PCB (there is a voltage divider)
float
ADC_to_mVoltage_Gain
=
3300.
/
4096.0
;
// maximum Voltage of 3.3V for 4096 ADC counts - (It might need recalibration?)
float
zeroDPmvoltageInADC
=
(
2500.
/
PCB_Gain
)
*
(
1.
/
ADC_to_mVoltage_Gain
);
float
_voltage
=
PCB_Gain
*
ADC_to_mVoltage_Gain
*
(
adc
);
// - offset + zeroDPmvoltageInADC);
float
PCB_Gain
=
2.
;
// real voltage is two times higher thant the measured in the PCB (there is a voltage divider)
float
ADC_to_mVoltage_Gain
=
0.788
;
// this is the measured gain
float
ADC_offset
=
162.
;
// this is the measured offset
float
Aout
=
PCB_Gain
*
(
ADC_to_mVoltage_Gain
*
adc
+
162
)
;
float
Vdd
=
5000
;
float
PaTombar
=
0.01
;
//float AoutVdd = _voltage/5000.; // The board provides 5000 mV to the input of the DP sensor
float
AoutVdd
=
_voltage
/
(
2
*
PCB_Gain
*
ADC_to_mVoltage_Gain
*
offset
);
// The board provides 5000 mV to the input of the DP sensor
float
sign
=
2
*
((
AoutVdd
-
0.5
>
0.
)
-
0.5
);
float
sign
=
2
*
((
Aout
/
Vdd
-
0.5
>
0.
)
-
0.5
);
float
dp_mbar
=
PaTombar
*
sign
*
pow
(((
Aout
Vdd
/
0.4
)
-
1.25
),
2
)
*
525
;
// same calculation as in the Labview Code
float
dp_mbar
=
PaTombar
*
sign
*
pow
(((
Aout
/
(
Vdd
*
0.4
)
)
-
1.25
),
2
)
*
525
;
// same calculation as in the Labview Code
//String s = " dp "+String(dp_mbar)+ " off "+String(offset)+" zero "+String(zeroDPmvoltageInADC) +" adc " + String(adc);
//logMsg(s);
return
static_cast
<
float
>
(
dp_mbar
);
}
...
...
arduino/hev_prototype_v1/src/main.cpp
View file @
146c1cfb
...
...
@@ -143,12 +143,12 @@ void loop()
alarm_loop
.
fireAlarms
();
ui_loop
.
reportFastReadings
();
//
ui_loop.reportReadbackValues();
//
ui_loop.reportCycleReadings();
//
ui_loop.reportAlarms();
//
ui_loop.reportIVTReadings();
//
ui_loop.reportDebugValues(); // data duplicated to fast and readback
//
ui_loop.reportTargets();
ui_loop
.
reportReadbackValues
();
ui_loop
.
reportCycleReadings
();
ui_loop
.
reportAlarms
();
ui_loop
.
reportIVTReadings
();
ui_loop
.
reportDebugValues
();
// data duplicated to fast and readback
ui_loop
.
reportTargets
();
// per cycle receiver
comms
.
receiver
();
...
...
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