From 2375fe4f2dae7a9a728aef9b68d50029c8af127c Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:46:23 -0800 Subject: [PATCH 1/4] Initial --- .../breathing/functions/fnc_checkBreathing.sqf | 8 +++++++- addons/breathing/stringtable.xml | 6 ++++++ addons/main/script_macros.hpp | 4 ++++ addons/vitals/functions/fnc_fullHealLocal.sqf | 1 + .../functions/fnc_handleOxygenFunction.sqf | 16 ++++++++++++---- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/addons/breathing/functions/fnc_checkBreathing.sqf b/addons/breathing/functions/fnc_checkBreathing.sqf index 8cc5e4de0..b7d24d297 100644 --- a/addons/breathing/functions/fnc_checkBreathing.sqf +++ b/addons/breathing/functions/fnc_checkBreathing.sqf @@ -28,11 +28,17 @@ private _breathing = LLSTRING(breathing_isNormal); private _breathing_log = localize ACELSTRING(medical_treatment,Check_Pulse_Normal); private _breath = ""; -if (_patient getVariable [QGVAR(pneumothorax), 0] > 0) then { +private _respiratoryDepth = _patient getVariable [QEGVAR(vitals,respiratoryDepth), 10]; +if ((10 > _respiratoryDepth) && (_respiratoryDepth >= 7)) then { _breathing = LLSTRING(breathing_isShallow); _breathing_log = LLSTRING(breathing_shallow); }; +if (_respiratoryDepth < 7) then { + _breathing = LLSTRING(breathing_isVeryShallow); + _breathing_log = LLSTRING(breathing_Veryshallow); +}; + if (_ph < 7.2) then { _breath = LLSTRING(breath_mild); diff --git a/addons/breathing/stringtable.xml b/addons/breathing/stringtable.xml index 6a37354bd..26929f50d 100644 --- a/addons/breathing/stringtable.xml +++ b/addons/breathing/stringtable.xml @@ -2323,6 +2323,12 @@ Дыхание поверхностное Oppervlakkig + + Patient's breathing is very shallow + + + Very Shallow + Patient is not breathing 患者は呼吸していない diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 7007174ec..376306636 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -280,6 +280,7 @@ #define DEFAULT_PH 7.4 #define DEFAULT_ETCO2 37 #define DEFAULT_BLOOD_GAS [DEFAULT_PACO2, DEFAULT_PAO2, DEFAULT_O2SAT, DEFAULT_HCO3, DEFAULT_PH, DEFAULT_ETCO2] +#define DEFAULT_RESPIRATORY_DEPTH 10 #define DEFAULT_ANEROBIC_EXCHANGE 0.8 #define DEFAULT_TEMPERATURE 37 @@ -302,6 +303,9 @@ #define VAR_SURFACE_AREA 400 #define GET_KAT_SURFACE_AREA(unit) (VAR_SURFACE_AREA - (((unit getVariable [QEGVAR(breathing,pneumothorax), 0]) * 75))) +#define VAR_RESPIRATORY_DEPTH QEGVAR(vitals,respiratoryDepth) +#define GET_KAT_RESPIRATORY_DEPTH(unit) (unit getVariable [QEGVAR(vitals,respiratoryDepth), 10]) + #define VAR_BLOOD_GAS QEGVAR(circulation,bloodGas) #define VAR_BREATHING_RATE QEGVAR(breathing,breathRate) diff --git a/addons/vitals/functions/fnc_fullHealLocal.sqf b/addons/vitals/functions/fnc_fullHealLocal.sqf index 8b4cd8329..a34b00a0d 100644 --- a/addons/vitals/functions/fnc_fullHealLocal.sqf +++ b/addons/vitals/functions/fnc_fullHealLocal.sqf @@ -18,6 +18,7 @@ params ["_patient"]; _patient setVariable [QGVAR(simpleMedical), false, true]; +_patient setVariable [QGVAR(respiratoryDepth), DEFAULT_RESPIRATORY_DEPTH, true]; if (GVAR(enableSimpleMedical)) then { _patient setVariable [QGVAR(simpleMedical), true, true]; diff --git a/addons/vitals/functions/fnc_handleOxygenFunction.sqf b/addons/vitals/functions/fnc_handleOxygenFunction.sqf index 23d8c5bdc..f4549133d 100644 --- a/addons/vitals/functions/fnc_handleOxygenFunction.sqf +++ b/addons/vitals/functions/fnc_handleOxygenFunction.sqf @@ -31,8 +31,11 @@ params ["_unit", "_actualHeartRate", "_anerobicPressure", "_bloodGas", "_tempera #define PACO2_MAX_CHANGE 0.05 #define PAO2_MAX_CHANGE 0.1 #define DEFAULT_FIO2 0.21 +#define MAXIMUM_DEPTH 2 +#define MINIMUM_DEPTH 0.2 private _respiratoryRate = 0; +private _respiratoryDepression = 0; private _demandVentilation = 0; private _actualVentilation = 0; private _previousCyclePaco2 = (_bloodGas select 0); @@ -42,19 +45,24 @@ if (IN_CRDC_ARRST(_unit)) then { // When in arrest, there should be no effecive breaths but still a minimum O2 demand. Zero O2 demand would mean a dead patient. Actual ventilation is 1 to prevent issues in the gas tension functions _demandVentilation = MINIMUM_VENTILATION; _respiratoryRate = 0; + _respiratoryDepression = 0; _actualVentilation = 1; } else { // Ventilatory Demand comes from Heart Rate with increase demand from PaCO2 levels _demandVentilation = ((((_actualHeartRate * HEART_RATE_CO2_MULTIPLIER) / _anerobicPressure) + ((_previousCyclePaco2 - DEFAULT_PACO2) * 200)) max MINIMUM_VENTILATION); private _tidalVolume = GET_KAT_SURFACE_AREA(_unit); - // Respiratory Rate is supressed by Opioids - _respiratoryRate = [((_demandVentilation / _tidalVolume) - (_opioidDepression * 5)) min MAXIMUM_RR, 20] select (_unit getVariable [QEGVAR(breathing,BVMInUse), false]); + // Respiratory Depth is supressed by Opioids and pneumothorax + private _respiratoryDepth = (DEFAULT_RESPIRATORY_DEPTH - ((_unit getVariable [QEGVAR(breathing,pneumothorax), 0]) * 0.75)); + _respiratoryDepression = [((_respiratoryDepth - (_opioidDepression * 5)) max MINIMUM_DEPTH), 10] select (_unit getVariable [QEGVAR(breathing,BVMInUse), false]); + + // Respiratory Rate Calculation + _respiratoryRate = [((_demandVentilation / _tidalVolume)) min MAXIMUM_RR, 20] select (_unit getVariable [QEGVAR(breathing,BVMInUse), false]); // If respiratory rate is low due to PaCO2, it starts increasing faster to compensate if (_previousCyclePaco2 > 50) then { _respiratoryRate = (_respiratoryRate + ((_previousCyclePaco2 - 50) * 0.2)) min MAXIMUM_RR}; - _actualVentilation = _tidalVolume * _respiratoryRate; + _actualVentilation = _tidalVolume * _respiratoryRate * (_respiratoryDepression / 10); }; private _paco2 = 40; @@ -102,5 +110,5 @@ private _o2Sat = ((_pao2 max 1)^2.7 / ((25 - (((_pH / DEFAULT_PH) - 1) * 150))^2 _unit setVariable [VAR_BREATHING_RATE, (_respiratoryRate max 0), _syncValues]; _unit setVariable [VAR_BLOOD_GAS, [_paco2, _pao2, _o2Sat, 24, _pH, _etco2], _syncValues]; - +_unit setVariable [QGVAR(respiratoryDepth), (_respiratoryDepression max 0), _syncValues]; _o2Sat * 100 From 0aafd9dae81b6f6684777c604878c203f3edaf89 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:52:31 -0800 Subject: [PATCH 2/4] fix for ETCO2 --- addons/vitals/functions/fnc_handleOxygenFunction.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/vitals/functions/fnc_handleOxygenFunction.sqf b/addons/vitals/functions/fnc_handleOxygenFunction.sqf index f4549133d..9a6f6cf04 100644 --- a/addons/vitals/functions/fnc_handleOxygenFunction.sqf +++ b/addons/vitals/functions/fnc_handleOxygenFunction.sqf @@ -73,7 +73,7 @@ if (EGVAR(breathing,paco2Active)) then { }; // Generated ETCO2 quadratic. Ensures ETCO2 moves with Respiratory Rate and is constantly below PaCO2 -private _etco2 = [((_paco2 - 3) - ((-0.0416667 * (_respiratoryRate^2)) + (3.09167 * (_respiratoryRate)) - DEFAULT_ETCO2) max 10), 0] select (IN_CRDC_ARRST(_unit)); +private _etco2 = [((((_paco2 - 3) - ((-0.0416667 * (_respiratoryRate^2)) + (3.09167 * (_respiratoryRate))) *(_respiratoryDepression / 10)) - DEFAULT_ETCO2) max 10), 0] select (IN_CRDC_ARRST(_unit)); private _externalPh = 0; private _pH = 7.4; From ef5381fab3853586de471f2dc8d6a4e1057a92df Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:57:36 -0800 Subject: [PATCH 3/4] small fix --- addons/vitals/functions/fnc_handleOxygenFunction.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/vitals/functions/fnc_handleOxygenFunction.sqf b/addons/vitals/functions/fnc_handleOxygenFunction.sqf index 9a6f6cf04..c45e0f531 100644 --- a/addons/vitals/functions/fnc_handleOxygenFunction.sqf +++ b/addons/vitals/functions/fnc_handleOxygenFunction.sqf @@ -53,7 +53,7 @@ if (IN_CRDC_ARRST(_unit)) then { private _tidalVolume = GET_KAT_SURFACE_AREA(_unit); // Respiratory Depth is supressed by Opioids and pneumothorax - private _respiratoryDepth = (DEFAULT_RESPIRATORY_DEPTH - ((_unit getVariable [QEGVAR(breathing,pneumothorax), 0]) * 0.75)); + private _respiratoryDepth = (DEFAULT_RESPIRATORY_DEPTH - ((_unit getVariable [QEGVAR(breathing,pneumothorax), 0]) / 2)); _respiratoryDepression = [((_respiratoryDepth - (_opioidDepression * 5)) max MINIMUM_DEPTH), 10] select (_unit getVariable [QEGVAR(breathing,BVMInUse), false]); // Respiratory Rate Calculation From 3a294c6e7eec0833395eb334cd150aee9a3b1eb2 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:00:39 -0800 Subject: [PATCH 4/4] Update fnc_handleOxygenFunction.sqf --- addons/vitals/functions/fnc_handleOxygenFunction.sqf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/vitals/functions/fnc_handleOxygenFunction.sqf b/addons/vitals/functions/fnc_handleOxygenFunction.sqf index c45e0f531..417f913b4 100644 --- a/addons/vitals/functions/fnc_handleOxygenFunction.sqf +++ b/addons/vitals/functions/fnc_handleOxygenFunction.sqf @@ -31,7 +31,6 @@ params ["_unit", "_actualHeartRate", "_anerobicPressure", "_bloodGas", "_tempera #define PACO2_MAX_CHANGE 0.05 #define PAO2_MAX_CHANGE 0.1 #define DEFAULT_FIO2 0.21 -#define MAXIMUM_DEPTH 2 #define MINIMUM_DEPTH 0.2 private _respiratoryRate = 0; @@ -45,7 +44,7 @@ if (IN_CRDC_ARRST(_unit)) then { // When in arrest, there should be no effecive breaths but still a minimum O2 demand. Zero O2 demand would mean a dead patient. Actual ventilation is 1 to prevent issues in the gas tension functions _demandVentilation = MINIMUM_VENTILATION; _respiratoryRate = 0; - _respiratoryDepression = 0; + _respiratoryDepression = 1; _actualVentilation = 1; } else { // Ventilatory Demand comes from Heart Rate with increase demand from PaCO2 levels