KAT-Advanced-Medical / KAM

The ACE Advanced Medical System is nice, but we can do it better, even on a more realistic way and bring it on another level with these addons.
https://katalam.github.io/KAM
GNU General Public License v3.0
69 stars 100 forks source link

SpO2 loss in cardiac arrest is negligible at ~1%/minute, multiplier settings have no effect #632

Closed mrschick closed 4 hours ago

mrschick commented 1 month ago

CBA Settings

CBA Settings All default ACE Medical and KAM settings, except for: `ace_medical_statemachine_fatalInjuriesAI = 2;` for repro purposes

Description: Since the last update or so, SpO2 loss due to conditions and especially cardiac arrest is only negligible. Units in CA will start from 97% and only lose at most 1%/minute, making any airway treatment redundant as they will still have enough SpO2 to wake up if recovered from CA within the usual 5-10 minute timeout.

Steps to reproduce:

  1. Place an AI civilian
  2. Shoot it in the chest to immediately trigger cardiac arrest (and possibly a pneumothorax)
  3. Monitor SpO2 with pulse-oximeter or vitals monitor for 5 minutes

Where did the issue occur?

Additional information: Increasing the positive/negative SpO2 multiplier settings appears to have no effect at all. On a related note, the Airway Zeus Module appears to be broken, on healthy AI it will show 90% SpO2 and modifying the slider won't affect an AI's actual SpO2. Explained by the slider actually modifying PaO2, but I think it would be more intuitive for it to still modify SpO2 via some reversed function.

RPT log file:

Cplhardcore commented 1 month ago

The airway module shows PaO2, not SpO2 In addition, with the vitals update spo2 is calculated with a lot more factors then just ptx/airways, blood volume/heart rate/breathing is all taken into effect

YetheSamartaka commented 1 month ago

Hi. I confirm the issue. SpO2 loss is completely broken. Even with occluded/obstructed airways and full pneumothorax, the SpO2 is negligible and multiplier settings have no effect.

mrschick commented 1 month ago

The airway module shows PaO2, not SpO2

What do you mean? I don't see any oxygenation settings in the Airways category. Those in the Breathing category all reference SpO2. Is that documented somewhere?

In addition, with the vitals update spo2 is calculated with a lot more factors then just ptx/airways, blood volume/heart rate/breathing is all taken into effect

What conditions will still cause a drop of oxygenation SpO2 comparable to past versions then? Shouldn't untreated cardiac arrest for multiple minutes have a more pronounced negative effect that will take extra "stable" time to compensate?

Cplhardcore commented 1 month ago

On a related note, the Airway Zeus Module appears to be broken, on healthy AI it will show 90% SpO2 and modifying the slider won't affect an AI's actual SpO2.

Yes, as that module doesn't show SpO2 anymore, it shows PaO2

What conditions will still cause a drop of oxygenation SpO2 comparable to past versions then? Shouldn't untreated cardiac arrest for multiple minutes have a more pronounced negative effect that will take extra "stable" time to compensate?"

https://docs.google.com/document/d/1lpVcD5B0SfGvYc5hnz35jNVvX28lvdHVpacUs7RIXkA/edit?tab=t.0 Take a look through this, this mini guide shows what effects spO2 loss, and how it works in the new vitals simulation

mrschick commented 1 month ago

Yes, as that module doesn't show SpO2 anymore, it shows PaO2

Ah, good to know. IIRC though I tried changing the slider's value and after reopening it it was still showing the previous state.

Take a look through this, this mini guide shows what effects spO2 loss, and how it works in the new vitals simulation

Neat, I read through it and it answers a lot of questions, especially about the new hypothermia 👍🏻

However, it's still unclear to me how SpO2 could appear entirely unaffected by cardiac arrest for several minutes.

In that condition FiO2 should be 0, leading to a drop of PAO2 and consequently SpO2. Given that "small shifts in PaO2 can result in large shifts in SpO2", one would expect a delayed but significant drop of SpO2 over a few minutes, no? Otherwise, it renders carrying any airway items or BVMs completely redundant.

Cplhardcore commented 1 month ago

Yes, but by significant you're thinking 40 points, in reality it will be 15-20 Testing showed a pt with a ptx, in CA, and no airways dropped about 20 points over 8 minutes, which is realistic In return, its not as fast to get back up to stable, which be default is 85, but realistically it should be higher

mrschick commented 1 month ago

Yeah, when testing it on a patient in CA and no airways, it takes 8 minutes to only drop from 97 to 80. Isn't CA IRL likely to cause permanent brain damage after 8 minutes? Would that not coincide with a much larger loss down to 70% in the same timeframe?

Either way, another issue is that we can't customize SpO2 loss back to pre-v3.0 levels because neither kat_breathing_SpO2_MultiplyNegative nor kat_breathing_SpO2_PerfusionMultiplier at high values like 8 appear to affect the 97->80% / 8 minutes observation at all.

I also observed a different behaviour, after ~4m the patient got into VFib at SpO2 91, and it ended up fluctuating between 91 and 92 until it progressed to PEA/Asystole at ~7m, after which it only got down to 90% at ~14 minutes after CA (and imminent death).

YetheSamartaka commented 1 month ago

No multiplier settings are used in the function handling oxygenation... There is no way to customize it right now. And default values are set in a way that it is unrealistically slow. Please fix it @mazinskihenry

mrschick commented 1 month ago

For extra context, Cplhardcore wrote this on the ACE Discord:

IRL its closer to 4 minutes. and that's at a SPo2 value of 80%, with full death happening at 12 mins In KAM that value is about doubled, because this is a game and there is no brain damage yet

I would argue that this should match default ACE Medical settings more, to optimize it towards the default 5m CA timeout that most people will use. Just because "brain damage" is not a simulate-able symptom (yet) doesn't mean that that IRL timeout isn't appropriate for the death timeout in-game.

Cplhardcore commented 1 month ago

5 minutes is way too fast of a timer, and the defaults are just that, defaults, everyone has the option to change the settings based on the units need,

mrschick commented 1 month ago

Sure, unless the values are unaffected by settings. In which case IMO it's better to have the hard-coded behaviour match what most people are going to use, which is about 5 minutes in my experience.

But that doesn't matter now as the linked PR works to solve the issue 👍🏻

mrschick commented 1 month ago

I also observed a different behaviour, after ~4m the patient got into VFib at SpO2 91, and it ended up fluctuating between 91 and 92 until it progressed to PEA/Asystole at ~7m, after which it only got down to 90% at ~14 minutes after CA (and imminent death).

@Cplhardcore I managed to repro this issue quite reliably. In short, it's because breathing rate is not considered by the FIO2 determination.

With the patient in any form of CA (from VTac to Asys), the following appears to happen: Even with no respiration and a simple PTX (but clear airways), _fio2 is set to its default of 0.21 by the switch at L82. https://github.com/KAT-Advanced-Medical/KAM/blob/4bc4bcb09b80dde6b814faef7f39626294a8d775/addons/vitals/functions/fnc_handleOxygenFunction.sqf#L84

Which then sets _pALVo2 to a high value of >99 in L92.

That causes the min _pALVo2 command in L95 to not affect the function, which only drops PaO2 to ~70% (given small blood loss) https://github.com/KAT-Advanced-Medical/KAM/blob/4bc4bcb09b80dde6b814faef7f39626294a8d775/addons/vitals/functions/fnc_handleOxygenFunction.sqf#L95 Which then always corresponds to an SpO2 of >90 as per the function at: https://github.com/KAT-Advanced-Medical/KAM/blob/4bc4bcb09b80dde6b814faef7f39626294a8d775/addons/vitals/functions/fnc_handleOxygenFunction.sqf#L101

As soon as the airways are obstructed/occluded, _fio2 is reduced, which sets the minimum allowed PaO2 to 1, which allows SpO2 to actually plummet along the sigmoidal function.