From 9a8203ebfa55d919ba024899ea4d3a2161aacad0 Mon Sep 17 00:00:00 2001 From: mazinskihenry <33608576+mazinskihenry@users.noreply.github.com> Date: Mon, 20 Jan 2025 23:10:07 -0800 Subject: [PATCH] Update fnc_handleOxygenFunction.sqf --- addons/vitals/functions/fnc_handleOxygenFunction.sqf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/vitals/functions/fnc_handleOxygenFunction.sqf b/addons/vitals/functions/fnc_handleOxygenFunction.sqf index 4e0461dba..57952fcd2 100644 --- a/addons/vitals/functions/fnc_handleOxygenFunction.sqf +++ b/addons/vitals/functions/fnc_handleOxygenFunction.sqf @@ -96,8 +96,11 @@ private _fio2 = switch (true) do { // Alveolar Gas equation. PALVO2 is largely impacted by Barometric Pressure and FiO2 private _pALVo2 = ((_fio2 * (_baroPressure - 47)) - (_paco2 / _anerobicPressure)) max 1; -// PaO2 cannot be higher than PALVO2 and comes from ventilation shortage multipled by RBC volume -private _pao2 = (DEFAULT_PAO2 - ((DEFAULT_ECB / ((GET_BODY_FLUID(_unit) select 0) max 500)) * ((_demandVentilation - _actualVentilation) / 120))) min _pALVo2; +// PaO2 comes from ventilation shortage multipled by RBC volume +private _pao2 = (DEFAULT_PAO2 - ((DEFAULT_ECB / ((GET_BODY_FLUID(_unit) select 0) max 500)) * ((_demandVentilation - _actualVentilation) / 120))); + +// PaO2 is shifted by the difference between PALVO2 and PaO2, capped by PALVO2 +_pao2 = (((linearConversion[-50, 50, (_pALVo2 - _pao2), -20, 20, true]) + _pao2) min _pALVo2) max 0; private _arrestPerfusion = [1, (1 * EGVAR(breathing,SpO2_PerfusionMultiplier))] select ((IN_CRDC_ARRST(_unit)) && (EGVAR(breathing,SpO2_perfusion))); // PaO2 moves in controlled steps to prevent hard movements when Ventilation Demand spikes