Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch/Vitals - ACE Advanced Fatigue Integration #709

Open
wants to merge 3 commits into
base: dev-Tomcat
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions addons/vitals/functions/fnc_handleCardiacFunction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if IN_CRDC_ARRST(_unit) then {
private _painLevel = GET_PAIN_PERCEIVED(_unit);

// Adjustments and Pain Levels are taken off of last cycle HR to prevent any spiraling vitials
private _lastCycleHeartRate = GET_HEART_RATE(_unit) - _hrTargetAdjustment - (10 * _painLevel);
private _lastCycleHeartRate = GET_HEART_RATE(_unit) - _hrTargetAdjustment - (10 * _painLevel) - (ACEGVAR(advanced_fatigue,anFatigue) * 50);
private _lastCycleCO2 = _lastCycleHeartRate * HEART_RATE_CO2_MULTIPLIER;
private _demandReturn = _lastCycleCO2 / CO2_TO_DEMAND_DIVISOR;
private _strokeVolume = (_bloodVolume / BLOOD_VOLUME_TO_STROKE_DIVISOR);
Expand All @@ -63,9 +63,9 @@ if IN_CRDC_ARRST(_unit) then {
};

// All additional adjustments are added back
_actualHeartRate = _actualHeartRate + _hrTargetAdjustment + (10 * _painLevel);
_actualHeartRate = _actualHeartRate + _hrTargetAdjustment + (10 * _painLevel) + (ACEGVAR(advanced_fatigue,anFatigue) * 50);
};

_unit setVariable [VAR_HEART_RATE, _actualHeartRate, _syncValue];

_actualHeartRate
_actualHeartRate
7 changes: 4 additions & 3 deletions addons/vitals/functions/fnc_handleOxygenFunction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ if (EGVAR(pharma,kidneyAction)) then {

// Adjust dissociation constant based on temperature
private _phConstant = ((-0.00006653 * (_temperature ^ 2)) - (0.03268 * _temperature) + 7.4);
private _fatigue = [0, (ACEGVAR(advanced_fatigue,anFatigue) / 2)] select (ACEGVAR(advanced_fatigue,enabled));

// pH is from the Henderson-Hasselbalch equation
_pH = (_phConstant + log(24 / ((0.03 * _paco2)))) - ((_externalPh max 1) / 2000);
_pH = (_phConstant + log(24 / ((0.03 * _paco2)))) - ((_externalPh max 1) / 2000) - (_fatigue / 3);
};

// Fractional Oxygen when breathing normal air is 0.21, 1 when breathing 100% Oxygen, and 0 when no air is being brought into the lungs
Expand All @@ -103,8 +104,8 @@ private _arrestPerfusion = [1, (1 * EGVAR(breathing,SpO2_PerfusionMultiplier))]
// PaO2 moves in controlled steps to prevent hard movements when Ventilation Demand spikes
_pao2 = if (_previousCyclePao2 != _pao2) then { ([ (_previousCyclePao2 - ((PAO2_MAX_CHANGE * EGVAR(breathing,SpO2_MultiplyNegative) * _arrestPerfusion) * _deltaT)) , (_previousCyclePao2 + ((PAO2_MAX_CHANGE * EGVAR(breathing,SpO2_MultiplyPositive)) * _deltaT))] select ((_previousCyclePao2 - _pao2) < 0)) } else { _pao2 };

// Oxy-Hemo Dissociation Curve, driven by PaO2 with shaping done by pH
private _o2Sat = ((_pao2 max 1)^2.7 / ((25 - (((_pH / DEFAULT_PH) - 1) * 150))^2.7 + _pao2^2.7)) min 0.999;
// Oxy-Hemo Dissociation Curve, driven by PaO2 with shaping done by pH.
private _o2Sat = (((_pao2 max 1)^2.7 / ((25 - (((_pH / DEFAULT_PH) - 1) * 150))^2.7 + _pao2^2.7))) min 0.999;

_unit setVariable [VAR_BREATHING_RATE, (_respiratoryRate max 0), _syncValues];
_unit setVariable [VAR_BLOOD_GAS, [_paco2, _pao2, _o2Sat, 24, _pH, _etco2], _syncValues];
Expand Down
9 changes: 9 additions & 0 deletions addons/watch/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,13 @@ ADDON = true;
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[[0, 1], [LLSTRING(SETTING_AltitudeForm_meters), LLSTRING(SETTING_AltitudeForm_feet)], 0],
true
] call CBA_Settings_fnc_init;

[
QGVAR(watchInaccuracy),
"CHECKBOX",
[LLSTRING(SETTING_WatchInaccuracy), LLSTRING(SETTING__WatchInaccuracy_Desc)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[false],
true
] call CBA_Settings_fnc_init;
2 changes: 1 addition & 1 deletion addons/watch/functions/fnc_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ _unit setVariable [QGVAR(rangerStart), false, true];
_unit setVariable [QGVAR(rangerTimer), 0, true];
_unit setVariable [QGVAR(rangerHands), true, true];

_unit setVariable [QGVAR(katminSeconds), false, true];
_unit setVariable [QGVAR(katminSeconds), false, true];
9 changes: 8 additions & 1 deletion addons/watch/functions/fnc_showCWatch.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ private _bearing = _display displayCtrl 20807;
_altitude ctrlSetText ([_altitudeValue, 1, 0] call CBA_fnc_formatNumber);
};

_hr ctrlSetText ([GET_HEART_RATE(_unit), 1, 0] call CBA_fnc_formatNumber);
if (GVAR(watchInaccuracy)) then {
private _fatigue = [0, (ACEGVAR(advanced_fatigue,anFatigue) * 2)] select (ACEGVAR(advanced_fatigue,enabled));
private _temperature = _unit getVariable [QEGVAR(hypothermia,unitTemperature), 37];

_hr ctrlSetText ([(GET_HEART_RATE(_unit) + ((2 * _fatigue) - (37 - _temperature))), 1, 0] call CBA_fnc_formatNumber);
} else {
_hr ctrlSetText ([GET_HEART_RATE(_unit), 1, 0] call CBA_fnc_formatNumber);
};

}, 1, [
_unit,
Expand Down
12 changes: 10 additions & 2 deletions addons/watch/functions/fnc_showKWatch.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,16 @@ private _timeSeconds = _display displayCtrl 22008;
_temp ctrlSetText (format ["%1C", ([(_altitudeValue call ACEFUNC(weather,calculateTemperatureAtHeight)), 1, 0] call CBA_fnc_formatNumber)]);
};

_hr ctrlSetText ([GET_HEART_RATE(_unit), 1, 0] call CBA_fnc_formatNumber);
_o2 ctrlSetText ([GET_KAT_SPO2(_unit), 1, 0] call CBA_fnc_formatNumber);
if (GVAR(watchInaccuracy)) then {
private _fatigue = [0, (ACEGVAR(advanced_fatigue,anFatigue) * 2)] select (ACEGVAR(advanced_fatigue,enabled));
private _temperature = _unit getVariable [QEGVAR(hypothermia,unitTemperature), 37];

_hr ctrlSetText ([(GET_HEART_RATE(_unit) + ((2 * _fatigue) - (37 - _temperature))), 1, 0] call CBA_fnc_formatNumber);
_o2 ctrlSetText ([(GET_KAT_SPO2(_unit) - (_fatigue - (37 - _temperature))), 1, 0] call CBA_fnc_formatNumber);
} else {
_hr ctrlSetText ([GET_HEART_RATE(_unit), 1, 0] call CBA_fnc_formatNumber);
_o2 ctrlSetText ([GET_KAT_SPO2(_unit), 1, 0] call CBA_fnc_formatNumber);
};

switch (true) do {
case(rain != 0): { _rain ctrlShow true; _overcast ctrlShow false; _sun ctrlShow false; };
Expand Down
12 changes: 10 additions & 2 deletions addons/watch/functions/fnc_showRWatch.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,16 @@ private _o2 = _display displayCtrl 22810;
_altitude ctrlSetText ([_altitudeValue, 1, 0] call CBA_fnc_formatNumber);
};

_hr ctrlSetText ([GET_HEART_RATE(_unit), 1, 0] call CBA_fnc_formatNumber);
_o2 ctrlSetText ([GET_KAT_SPO2(_unit), 1, 0] call CBA_fnc_formatNumber);
if (GVAR(watchInaccuracy)) then {
private _fatigue = [0, (ACEGVAR(advanced_fatigue,anFatigue) * 2)] select (ACEGVAR(advanced_fatigue,enabled));
private _temperature = _unit getVariable [QEGVAR(hypothermia,unitTemperature), 37];

_hr ctrlSetText ([(GET_HEART_RATE(_unit) + ((2 * _fatigue) - (37 - _temperature))), 1, 0] call CBA_fnc_formatNumber);
_o2 ctrlSetText ([(GET_KAT_SPO2(_unit) - (_fatigue - (37 - _temperature))), 1, 0] call CBA_fnc_formatNumber);
} else {
_hr ctrlSetText ([GET_HEART_RATE(_unit), 1, 0] call CBA_fnc_formatNumber);
_o2 ctrlSetText ([GET_KAT_SPO2(_unit), 1, 0] call CBA_fnc_formatNumber);
};

private _hours = floor dayTime;
private _minutes = floor ((dayTime - _hours) * 60);
Expand Down
12 changes: 10 additions & 2 deletions addons/watch/functions/fnc_showSWatch.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,16 @@ private _altitudeUnit = GVAR(altitudeUnit);

_time ctrlSetText (format ["%1:%2", [_hour, 2] call CBA_fnc_formatNumber, [_minute, 2] call CBA_fnc_formatNumber]);

_hr ctrlSetText ([GET_HEART_RATE(_unit), 1, 0] call CBA_fnc_formatNumber);
_o2 ctrlSetText ([GET_KAT_SPO2(_unit), 1, 0] call CBA_fnc_formatNumber);
if (GVAR(watchInaccuracy)) then {
private _fatigue = [0, (ACEGVAR(advanced_fatigue,anFatigue) * 2)] select (ACEGVAR(advanced_fatigue,enabled));
private _temperature = _unit getVariable [QEGVAR(hypothermia,unitTemperature), 37];

_hr ctrlSetText ([(GET_HEART_RATE(_unit) + ((2 * _fatigue) - (37 - _temperature))), 1, 0] call CBA_fnc_formatNumber);
_o2 ctrlSetText ([(GET_KAT_SPO2(_unit) - (_fatigue - (37 - _temperature))), 1, 0] call CBA_fnc_formatNumber);
} else {
_hr ctrlSetText ([GET_HEART_RATE(_unit), 1, 0] call CBA_fnc_formatNumber);
_o2 ctrlSetText ([GET_KAT_SPO2(_unit), 1, 0] call CBA_fnc_formatNumber);
};

private _curTime = CBA_missionTime;
private _timeDiff = _curTime - _prevTime;
Expand Down
6 changes: 6 additions & 0 deletions addons/watch/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@
<French>Pieds</French>
<Chinesesimp>英尺</Chinesesimp>
</Key>
<Key ID="STR_KAT_Watch_SETTING_WatchInaccuracy">
<English>Watch Vitals Inaccuracy</English>
</Key>
<Key ID="STR_KAT_Watch_SETTING__WatchInaccuracy_Desc">
<English>Enables watch inaccuracy when reading patient vitals</English>
</Key>
<Key ID="STR_KAT_Watch_KatminDescription">
<English>Watch with Vital Monitoring Capabilities</English>
<Dutch>Horloge met ingebouwde vitale waarden monitor</Dutch>
Expand Down
Loading