Skip to content

Commit

Permalink
Update fnc_handleOxygenFunction.sqf
Browse files Browse the repository at this point in the history
  • Loading branch information
mazinskihenry committed Jan 21, 2025
1 parent 71a65bb commit 9a8203e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions addons/vitals/functions/fnc_handleOxygenFunction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a8203e

Please sign in to comment.