tanjera / infirmary-integrated

Medical device simulator for training healthcare professionals.
http://www.infirmary-integrated.com/
Other
40 stars 5 forks source link

Tracing Realism: A-Fib & A-Flutter #189

Open tanjera opened 1 year ago

tanjera commented 1 year ago

Needs realistic update to tracing algorithms for atrial fibrillation and atrial flutter. Current tracings have unrealistic outcomes.

tanjera commented 1 year ago

Atrial fibrillation isoelectric drawing updated to:

public static List<PointD> ECG_Isoelectric__Atrial_Fibrillation (Physiology? _P, Lead? _L) {
            if (_P is null || _L is null)
                return new ();

            int Fibrillations = (int)System.Math.Ceiling (_P.GetHR_Seconds / 0.08);
            List<PointD> thisBeat = new ();
            for (int i = 1; i < Fibrillations; i++)
                thisBeat = Plotting.Concatenate (thisBeat, ECG_P (_P, _L,
                    Math.RandomDbl (0.04d, 0.12d),                                                                          // fibrillatory wave interval
                    (Math.RandomInt (0, 3) == 0 ? Math.RandomDbl (-0.04d, -0.02d) : Math.RandomDbl (0.02d, 0.06d)),         // fibrillation amplitude
                    0d, Plotting.Last (thisBeat)));

            return thisBeat;
        }

Overall, a huge improvement in clinical realism for atrial fibrillation's isoelectric drawing!