v0.6.7: fix: Smooth HR transitions
This commit is contained in:
parent
f98fc7412f
commit
2c0dc760d9
8 changed files with 311 additions and 38 deletions
189
patient-monitor-simulation-v0.6.6-to-v0.6.7.patch
Normal file
189
patient-monitor-simulation-v0.6.6-to-v0.6.7.patch
Normal file
|
|
@ -0,0 +1,189 @@
|
||||||
|
diff --git a/Cargo.toml b/Cargo.toml
|
||||||
|
index f3abff3..eda3ddf 100644
|
||||||
|
--- a/Cargo.toml
|
||||||
|
+++ b/Cargo.toml
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
[package]
|
||||||
|
name = "patient-monitor-simulation"
|
||||||
|
-version = "0.6.6"
|
||||||
|
+version = "0.6.7"
|
||||||
|
edition = "2021"
|
||||||
|
license = "MIT"
|
||||||
|
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
||||||
|
diff --git a/README.de.md b/README.de.md
|
||||||
|
index 605a34f..17890f5 100644
|
||||||
|
--- a/README.de.md
|
||||||
|
+++ b/README.de.md
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-# Patient Monitor Simulation (PaMSim) — v0.6.6
|
||||||
|
+# Patient Monitor Simulation (PaMSim) — v0.6.7
|
||||||
|
|
||||||
|
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
|
||||||
|
|
||||||
|
@@ -6,6 +6,17 @@ Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenst
|
||||||
|
> EKG, invasive arterielle Druckkurve, Plethysmogramm und Kapnogramm sind schematische mathematische Annäherungen.
|
||||||
|
> Die Simulation wurde nicht klinisch validiert und ist kein Medizinprodukt.
|
||||||
|
|
||||||
|
+## Stufenlose Herzfrequenzänderung (v0.6.7)
|
||||||
|
+
|
||||||
|
+Bei Änderungen der Herzfrequenz bleibt die Historie der zuletzt *mechanisch
|
||||||
|
+wirksamen* Herzschläge erhalten. Die angezeigte Pulsfrequenz passt sich über
|
||||||
|
+den gleitenden Mittelwert der letzten drei Pulsintervalle an, ohne
|
||||||
|
+zwischenzeitlich zu verschwinden. SpO₂-Wert, Plethysmogramm und
|
||||||
|
+sättigungsabhängiger Pulston bleiben bei gewöhnlichen Änderungen der
|
||||||
|
+Herzfrequenz erhalten. Ein tatsächlicher Verlust der mechanischen
|
||||||
|
+Pulsüberleitung, ein abgesteckter Sensor und wirkliche Signalausfälle lösen
|
||||||
|
+weiterhin unmittelbar die vorgesehenen Alarme aus.
|
||||||
|
+
|
||||||
|
## Monitoraufteilung (v0.5.7)
|
||||||
|
|
||||||
|
Der nutzbare Monitorbereich wird in einem festen Verhältnis von **75 % für die
|
||||||
|
@@ -175,7 +186,7 @@ Mit **F11** wird der Vollbildmodus aktiviert bzw. umgeschaltet, mit **Esc** wird
|
||||||
|
Unter Wayland sollte das Fenster vor dem Wechsel in den Vollbildmodus auf den gewünschten Präsentationsbildschirm verschoben werden.
|
||||||
|
Der Vollbildmodus sperrt den Computer nicht gegen andere Eingaben.
|
||||||
|
|
||||||
|
-## Akustische Alarme und QRS-Ton (aktualisiert v0.6.6)
|
||||||
|
+## Akustische Alarme und QRS-Ton (aktualisiert v0.6.7)
|
||||||
|
|
||||||
|
Die akustische Alarmierung ist **standardmäßig eingeschaltet**. Im
|
||||||
|
Admin-Fenster lässt sie sich mit **Audible alarms** aktivieren bzw. stummschalten.
|
||||||
|
diff --git a/README.md b/README.md
|
||||||
|
index 250b938..793a3d4 100644
|
||||||
|
--- a/README.md
|
||||||
|
+++ b/README.md
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-# Patient Monitor Simulation (PaMSim) — v0.6.6
|
||||||
|
+# Patient Monitor Simulation (PaMSim) — v0.6.7
|
||||||
|
|
||||||
|
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
|
||||||
|
|
||||||
|
@@ -6,6 +6,16 @@ A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedo
|
||||||
|
> plethysmography and capnography are schematic mathematical approximations. The
|
||||||
|
> simulation has no clinical validation and is not a medical device.
|
||||||
|
|
||||||
|
+## Smooth HR transitions (v0.6.7)
|
||||||
|
+
|
||||||
|
+Changing the HR slider now preserves the recent history of *mechanically
|
||||||
|
+captured* beats. PR converges to the new rate using the existing rolling
|
||||||
|
+three-interval average instead of temporarily disappearing. The SpO₂ value,
|
||||||
|
+plethysmography and saturation-dependent QRS tone remain available during
|
||||||
|
+ordinary HR adjustments. Actual loss of mechanical capture, disconnected
|
||||||
|
+sensors, deliberate signal dropout and low-quality/absent signals still
|
||||||
|
+produce their intended alarms immediately.
|
||||||
|
+
|
||||||
|
## Monitor layout (v0.5.7)
|
||||||
|
|
||||||
|
The monitor uses a fixed **3:1 column ratio** over the drawable area:
|
||||||
|
@@ -166,7 +176,7 @@ The monitor can be resized and toggled fullscreen with **F11**; **Esc** exits
|
||||||
|
fullscreen. On Wayland, move the monitor to the presentation screen before
|
||||||
|
activating fullscreen. Fullscreen does not lock down the computer.
|
||||||
|
|
||||||
|
-## Audible alarms and QRS tone (updated v0.6.6)
|
||||||
|
+## Audible alarms and QRS tone (updated v0.6.7)
|
||||||
|
|
||||||
|
Sound is **enabled by default**. The Admin window has an **Audible alarms**
|
||||||
|
checkbox for muting and a **Test tone** button (works even while muted).
|
||||||
|
diff --git a/src/simulation.rs b/src/simulation.rs
|
||||||
|
index ec88a5a..800293f 100644
|
||||||
|
--- a/src/simulation.rs
|
||||||
|
+++ b/src/simulation.rs
|
||||||
|
@@ -197,12 +197,11 @@ pub struct Simulator {
|
||||||
|
respiratory_phase: f64,
|
||||||
|
ecg_beat_number: u64,
|
||||||
|
conducted_qrs: VecDeque<ConductedBeat>, // captured QRS with respiratory beat amplitude
|
||||||
|
- rate_qrs: VecDeque<f64>, // captured beats for measured PR; reset after rate changes
|
||||||
|
+ rate_qrs: VecDeque<f64>, // captured beats for measured PR; rolling history smooths HR changes
|
||||||
|
audio_events: VecDeque<BeatEvent>, // consumed by the 100-ms UI audio timer
|
||||||
|
filtered_pleth: f64,
|
||||||
|
previous_rhythm: EcgRhythm,
|
||||||
|
previous_conduction: PulseConduction,
|
||||||
|
- previous_heart_rate: i32,
|
||||||
|
poor_signal_outages: PoorSignalOutages,
|
||||||
|
compressions: ChestCompressions,
|
||||||
|
nibp: NibpMachine,
|
||||||
|
@@ -224,7 +223,6 @@ impl Simulator {
|
||||||
|
filtered_pleth: 0.0,
|
||||||
|
previous_rhythm: params.ecg_rhythm,
|
||||||
|
previous_conduction: params.pulse_conduction,
|
||||||
|
- previous_heart_rate: params.heart_rate,
|
||||||
|
poor_signal_outages: PoorSignalOutages::new(),
|
||||||
|
compressions: ChestCompressions::new(),
|
||||||
|
nibp: NibpMachine::new(),
|
||||||
|
@@ -427,12 +425,12 @@ impl Simulator {
|
||||||
|
self.previous_rhythm = params.ecg_rhythm;
|
||||||
|
self.previous_conduction = params.pulse_conduction;
|
||||||
|
}
|
||||||
|
- if params.heart_rate != self.previous_heart_rate {
|
||||||
|
- // Old captured events remain in the *waveforms* until they pass.
|
||||||
|
- // They must not bias the pulse rate after an HR slider change.
|
||||||
|
- self.rate_qrs.clear();
|
||||||
|
- self.previous_heart_rate = params.heart_rate;
|
||||||
|
- }
|
||||||
|
+ // Keep recent mechanically captured beats when only HR changes.
|
||||||
|
+ // The rolling three-interval PR calculation then converges naturally
|
||||||
|
+ // to the new rate as new pulses arrive. Clearing this history on every
|
||||||
|
+ // slider update would briefly make PR unavailable and falsely trigger
|
||||||
|
+ // SpO2 NO READING, even though perfusion and the sensor are intact.
|
||||||
|
+ // Actual loss of capture is still handled above, immediately.
|
||||||
|
|
||||||
|
// Respiratory phase drives both the capnogram and arterial PPV.
|
||||||
|
let respiratory_rate = params.respiratory_rate.max(0) as f64 / 60.0;
|
||||||
|
@@ -1181,12 +1179,55 @@ mod tests {
|
||||||
|
assert_eq!(sim.pulse_rate(), Some(75));
|
||||||
|
p.heart_rate = 189;
|
||||||
|
sim.step(&p);
|
||||||
|
- // No old 75 bpm PR is displayed while the new beat interval is measured.
|
||||||
|
- assert_eq!(sim.pulse_rate(), None);
|
||||||
|
- for _ in 0..200 { sim.step(&p); }
|
||||||
|
+ // A new HR must not invalidate existing mechanical pulse history.
|
||||||
|
+ // The displayed PR is smoothed from actual conducted QRS intervals.
|
||||||
|
+ assert_eq!(sim.pulse_rate(), Some(75));
|
||||||
|
+ assert_eq!(sim.spo2_status(&p), Spo2Status::Available);
|
||||||
|
+ for _ in 0..800 {
|
||||||
|
+ sim.step(&p);
|
||||||
|
+ assert!(sim.pulse_rate().is_some(), "PR must remain available");
|
||||||
|
+ assert_eq!(sim.spo2_status(&p), Spo2Status::Available);
|
||||||
|
+ assert!(sim.samples.back().unwrap().pleth_valid,
|
||||||
|
+ "no artificial gap in the pleth trace during HR adjustment");
|
||||||
|
+ }
|
||||||
|
assert_eq!(sim.pulse_rate(), Some(189));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ #[test]
|
||||||
|
+ fn repeated_heart_rate_slider_moves_do_not_trigger_spo2_no_reading() {
|
||||||
|
+ let mut p = Parameters::default();
|
||||||
|
+ let mut sim = Simulator::new(&p);
|
||||||
|
+ for rate in [90, 105, 120, 140, 110, 80, 75] {
|
||||||
|
+ p.heart_rate = rate;
|
||||||
|
+ for _ in 0..40 { // only 160 ms between successive slider updates
|
||||||
|
+ sim.step(&p);
|
||||||
|
+ assert!(sim.pulse_rate().is_some());
|
||||||
|
+ assert_eq!(sim.spo2_status(&p), Spo2Status::Available);
|
||||||
|
+ assert!(sim.samples.back().unwrap().pleth_valid);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ #[test]
|
||||||
|
+ fn conducted_two_to_one_pulses_remain_available_during_hr_change() {
|
||||||
|
+ let mut p = Parameters { pulse_conduction: PulseConduction::TwoToOne,
|
||||||
|
+ ..Parameters::default() };
|
||||||
|
+ let mut sim = Simulator::new(&p);
|
||||||
|
+ assert_eq!(sim.pulse_rate(), Some(38));
|
||||||
|
+ p.heart_rate = 150;
|
||||||
|
+ for _ in 0..1200 {
|
||||||
|
+ sim.step(&p);
|
||||||
|
+ assert!(sim.pulse_rate().is_some());
|
||||||
|
+ assert_eq!(sim.spo2_status(&p), Spo2Status::Available);
|
||||||
|
+ }
|
||||||
|
+ assert_eq!(sim.pulse_rate(), Some(75));
|
||||||
|
+ // Genuine mechanical capture loss still produces NO READING immediately.
|
||||||
|
+ p.pulse_conduction = PulseConduction::None;
|
||||||
|
+ sim.step(&p);
|
||||||
|
+ assert_eq!(sim.pulse_rate(), None);
|
||||||
|
+ assert_eq!(sim.spo2_status(&p), Spo2Status::NoReading);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
#[test]
|
||||||
|
fn new_rate_respects_two_to_one_mechanical_capture() {
|
||||||
|
let mut p = Parameters::default();
|
||||||
2
patient-monitor-simulation/Cargo.lock
generated
2
patient-monitor-simulation/Cargo.lock
generated
|
|
@ -438,7 +438,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "patient-monitor-simulation"
|
name = "patient-monitor-simulation"
|
||||||
version = "0.6.6"
|
version = "0.6.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gtk4",
|
"gtk4",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "patient-monitor-simulation"
|
name = "patient-monitor-simulation"
|
||||||
version = "0.6.6"
|
version = "0.6.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
description = "Synthetic patient-monitor simulation for teaching (not for clinical use)"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,17 @@ Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenst
|
||||||
> EKG, invasive arterielle Druckkurve, Plethysmogramm und Kapnogramm sind schematische mathematische Annäherungen.
|
> EKG, invasive arterielle Druckkurve, Plethysmogramm und Kapnogramm sind schematische mathematische Annäherungen.
|
||||||
> Die Simulation wurde nicht klinisch validiert und ist kein Medizinprodukt.
|
> Die Simulation wurde nicht klinisch validiert und ist kein Medizinprodukt.
|
||||||
|
|
||||||
|
## Stufenlose Herzfrequenzänderung (v0.6.7)
|
||||||
|
|
||||||
|
Bei Änderungen der Herzfrequenz bleibt die Historie der zuletzt *mechanisch
|
||||||
|
wirksamen* Herzschläge erhalten. Die angezeigte Pulsfrequenz passt sich über
|
||||||
|
den gleitenden Mittelwert der letzten drei Pulsintervalle an, ohne
|
||||||
|
zwischenzeitlich zu verschwinden. SpO₂-Wert, Plethysmogramm und
|
||||||
|
sättigungsabhängiger Pulston bleiben bei gewöhnlichen Änderungen der
|
||||||
|
Herzfrequenz erhalten. Ein tatsächlicher Verlust der mechanischen
|
||||||
|
Pulsüberleitung, ein abgesteckter Sensor und wirkliche Signalausfälle lösen
|
||||||
|
weiterhin unmittelbar die vorgesehenen Alarme aus.
|
||||||
|
|
||||||
## Monitoraufteilung (v0.5.7)
|
## Monitoraufteilung (v0.5.7)
|
||||||
|
|
||||||
Der nutzbare Monitorbereich wird in einem festen Verhältnis von **75 % für die
|
Der nutzbare Monitorbereich wird in einem festen Verhältnis von **75 % für die
|
||||||
|
|
@ -172,7 +183,7 @@ Mit **F11** wird der Vollbildmodus aktiviert bzw. umgeschaltet, mit **Esc** wird
|
||||||
Unter Wayland sollte das Fenster vor dem Wechsel in den Vollbildmodus auf den gewünschten Präsentationsbildschirm verschoben werden.
|
Unter Wayland sollte das Fenster vor dem Wechsel in den Vollbildmodus auf den gewünschten Präsentationsbildschirm verschoben werden.
|
||||||
Der Vollbildmodus sperrt den Computer nicht gegen andere Eingaben.
|
Der Vollbildmodus sperrt den Computer nicht gegen andere Eingaben.
|
||||||
|
|
||||||
## Akustische Alarme und QRS-Ton (aktualisiert v0.6.6)
|
## Akustische Alarme und QRS-Ton (aktualisiert v0.6.7)
|
||||||
|
|
||||||
Die akustische Alarmierung ist **standardmäßig eingeschaltet**. Im
|
Die akustische Alarmierung ist **standardmäßig eingeschaltet**. Im
|
||||||
Admin-Fenster lässt sie sich mit **Audible alarms** aktivieren bzw. stummschalten.
|
Admin-Fenster lässt sie sich mit **Audible alarms** aktivieren bzw. stummschalten.
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ Mit **F11** wird der Vollbildmodus aktiviert bzw. umgeschaltet, mit **Esc** wird
|
||||||
Unter Wayland sollte das Fenster vor dem Wechsel in den Vollbildmodus auf den gewünschten Präsentationsbildschirm verschoben werden.
|
Unter Wayland sollte das Fenster vor dem Wechsel in den Vollbildmodus auf den gewünschten Präsentationsbildschirm verschoben werden.
|
||||||
Der Vollbildmodus sperrt den Computer nicht gegen andere Eingaben.
|
Der Vollbildmodus sperrt den Computer nicht gegen andere Eingaben.
|
||||||
|
|
||||||
## Akustische Alarme (aktualisiert v0.6.5)
|
## Akustische Alarme und QRS-Ton (aktualisiert v0.6.6)
|
||||||
|
|
||||||
Die akustische Alarmierung ist **standardmäßig eingeschaltet**. Im
|
Die akustische Alarmierung ist **standardmäßig eingeschaltet**. Im
|
||||||
Admin-Fenster lässt sie sich mit **Audible alarms** aktivieren bzw. stummschalten.
|
Admin-Fenster lässt sie sich mit **Audible alarms** aktivieren bzw. stummschalten.
|
||||||
|
|
@ -185,9 +185,10 @@ werden. Die optischen Alarme blinken bei stummgeschalteter Tonausgabe weiterhin.
|
||||||
- **Numerische und technische Alarme:** Grenzwertüberschreitungen sowie
|
- **Numerische und technische Alarme:** Grenzwertüberschreitungen sowie
|
||||||
**NO SENSOR** und **NO READING** lösen ebenfalls einen **Zweitonalarm** aus
|
**NO SENSOR** und **NO READING** lösen ebenfalls einen **Zweitonalarm** aus
|
||||||
(700 Hz gefolgt von 950 Hz), der ungefähr alle 2,5 Sekunden wiederholt wird.
|
(700 Hz gefolgt von 950 Hz), der ungefähr alle 2,5 Sekunden wiederholt wird.
|
||||||
- Zwischen beiden Tönen liegt jeweils eine kurze Pause. Ein einzelner
|
- Zwischen beiden Tönen liegt jeweils eine kurze Pause. Zusätzlich gibt es
|
||||||
**QRS-Piepton** ist für eine spätere Version vorgesehen und wird derzeit
|
einen separaten, kurzen **QRS-/Pulston**, der im Admin-Fenster über
|
||||||
noch nicht ausgegeben.
|
**QRS tone** unabhängig von **Audible alarms** ein- und ausgeschaltet wird
|
||||||
|
(standardmäßig eingeschaltet).
|
||||||
- Kritische Alarme haben Vorrang. Auch bei mehreren gleichzeitig aktiven
|
- Kritische Alarme haben Vorrang. Auch bei mehreren gleichzeitig aktiven
|
||||||
Alarmen wird nur eine Tonfolge ausgegeben. Bei behobenem Alarm oder
|
Alarmen wird nur eine Tonfolge ausgegeben. Bei behobenem Alarm oder
|
||||||
Stummschaltung verstummt die Ausgabe. Ausgeblendete Monitorbereiche
|
Stummschaltung verstummt die Ausgabe. Ausgeblendete Monitorbereiche
|
||||||
|
|
@ -197,6 +198,42 @@ werden. Die optischen Alarme blinken bei stummgeschalteter Tonausgabe weiterhin.
|
||||||
selbst ist kein Alarm. Die Audioausgabe wird unabhängig von der Darstellung
|
selbst ist kein Alarm. Die Audioausgabe wird unabhängig von der Darstellung
|
||||||
der Kurven verarbeitet.
|
der Kurven verarbeitet.
|
||||||
|
|
||||||
|
### Synchroner QRS-/Pulston
|
||||||
|
|
||||||
|
**QRS tone** ist unabhängig von **Audible alarms** schaltbar. Jeder kurze
|
||||||
|
Piepton (85 ms) wird durch ein tatsächliches simuliertes elektrisches oder
|
||||||
|
mechanisches Ereignis ausgelöst, nicht durch einen eigenen Taktgeber:
|
||||||
|
|
||||||
|
- **SpO₂-Messwert vorhanden:** Auslösung beim verzögerten Pleth-Puls.
|
||||||
|
Die Frequenz richtet sich nach der angezeigten Sauerstoffsättigung.
|
||||||
|
Nicht übergeleitete mechanische Pulse erzeugen keinen Pleth-Piepton.
|
||||||
|
- **Kein SpO₂-Messwert:** fester Ton mit **500 Hz** bei einem sichtbaren,
|
||||||
|
organisierten EKG-QRS; andernfalls bei einem dargestellten arteriellen
|
||||||
|
Pulsschlag. Bei gleichzeitig sichtbarem EKG und ART wird ein Herzschlag
|
||||||
|
nicht doppelt vertont.
|
||||||
|
- **Kammerflimmern/Asystolie ohne wirksame Herzdruckmassage:** kein
|
||||||
|
Pulston. Bei Herzdruckmassage können ART-Pulse einen 500-Hz-Ton auslösen;
|
||||||
|
bei guter Kompressionsqualität und gültigem SpO₂-Messwert wird die
|
||||||
|
sättigungsabhängige Tonhöhe verwendet.
|
||||||
|
|
||||||
|
| SpO₂ (%) | Frequenz (Hz) |
|
||||||
|
| --- | ---: |
|
||||||
|
| 97–100 | 740 |
|
||||||
|
| 94–96 | 675 |
|
||||||
|
| 90–93 | 609 |
|
||||||
|
| 80–89 | 544 |
|
||||||
|
| 70–79 | 479 |
|
||||||
|
| 60–69 | 413 |
|
||||||
|
| 50–59 | 348 |
|
||||||
|
| 40–49 | 283 |
|
||||||
|
| 30–39 | 218 |
|
||||||
|
| 20–29 | 152 |
|
||||||
|
| 0–19 | 87 |
|
||||||
|
|
||||||
|
Die Frequenzen sind ausschließlich didaktische Simulationen, keine
|
||||||
|
kalibrierten Töne eines klinischen Pulsoxymeters. QRS-/Pulston und
|
||||||
|
Zweitonalarm können unabhängig voneinander erklingen.
|
||||||
|
|
||||||
Unter Fedora wird **`pw-play`** aus dem Paket `pipewire-utils` verwendet,
|
Unter Fedora wird **`pw-play`** aus dem Paket `pipewire-utils` verwendet,
|
||||||
alternativ **`paplay`**. Es sind weder zusätzliche Rust-Bibliotheken noch
|
alternativ **`paplay`**. Es sind weder zusätzliche Rust-Bibliotheken noch
|
||||||
mitzuliefernde Audiodateien notwendig: Das Programm erzeugt seine WAV-Töne
|
mitzuliefernde Audiodateien notwendig: Das Programm erzeugt seine WAV-Töne
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,8 @@
|
||||||
--- README.de.md
|
--- README.de.md
|
||||||
+++ README.de.md
|
+++ README.de.md
|
||||||
@@ -1,4 +1,4 @@
|
@@ -1,4 +1,4 @@
|
||||||
-# Patient Monitor Simulation (PaMSim) — v0.6.5
|
-# Patient Monitor Simulation (PaMSim) — v0.6.6
|
||||||
+# Patient Monitor Simulation (PaMSim) — v0.6.6
|
+# Patient Monitor Simulation (PaMSim) — v0.6.7
|
||||||
|
|
||||||
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
|
Ein mit Rust und GTK4 entwickelter Patient*innenmonitor-Simulator mit zwei Fenstern für die Lehre unter Fedora Linux.
|
||||||
|
|
||||||
@@ -669,3 +706,14 @@ Die Priorisierung und die Wiederholungsintervalle bleiben unverändert.
|
|
||||||
**Test tone** spielt den Standard-Zweitonalarm. Ein einzelner QRS-Piepton
|
|
||||||
ist für eine spätere Erweiterung reserviert. Optische Alarme und
|
|
||||||
Simulationsverhalten wurden nicht verändert.
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+### v0.6.6 – Schaltbarer QRS-/Pulston
|
|
||||||
+
|
|
||||||
+Ein neuer Admin-Schalter **QRS tone** aktiviert oder deaktiviert den
|
|
||||||
+kurzen, beat-synchronen Einzelton unabhängig von den Zweitonalarmen.
|
|
||||||
+Bei vorhandenem SpO₂-Messwert richtet sich die Tonhöhe in elf Stufen
|
|
||||||
+zwischen 740 und 87 Hz nach der Sauerstoffsättigung; ohne SpO₂-Messwert
|
|
||||||
+erfolgt bei EKG-QRS oder arteriellem Puls ein 500-Hz-Ton. Die bisherigen
|
|
||||||
+Zweitonalarme bleiben unverändert. Zusätzliche Tests prüfen die
|
|
||||||
+Frequenzbereiche, Ereigniszuordnung und WAV-Ausgabe.
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Patient Monitor Simulation (PaMSim) — v0.6.6
|
# Patient Monitor Simulation (PaMSim) — v0.6.7
|
||||||
|
|
||||||
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
|
A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.
|
||||||
|
|
||||||
|
|
@ -6,6 +6,16 @@ A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedo
|
||||||
> plethysmography and capnography are schematic mathematical approximations. The
|
> plethysmography and capnography are schematic mathematical approximations. The
|
||||||
> simulation has no clinical validation and is not a medical device.
|
> simulation has no clinical validation and is not a medical device.
|
||||||
|
|
||||||
|
## Smooth HR transitions (v0.6.7)
|
||||||
|
|
||||||
|
Changing the HR slider now preserves the recent history of *mechanically
|
||||||
|
captured* beats. PR converges to the new rate using the existing rolling
|
||||||
|
three-interval average instead of temporarily disappearing. The SpO₂ value,
|
||||||
|
plethysmography and saturation-dependent QRS tone remain available during
|
||||||
|
ordinary HR adjustments. Actual loss of mechanical capture, disconnected
|
||||||
|
sensors, deliberate signal dropout and low-quality/absent signals still
|
||||||
|
produce their intended alarms immediately.
|
||||||
|
|
||||||
## Monitor layout (v0.5.7)
|
## Monitor layout (v0.5.7)
|
||||||
|
|
||||||
The monitor uses a fixed **3:1 column ratio** over the drawable area:
|
The monitor uses a fixed **3:1 column ratio** over the drawable area:
|
||||||
|
|
@ -166,7 +176,7 @@ The monitor can be resized and toggled fullscreen with **F11**; **Esc** exits
|
||||||
fullscreen. On Wayland, move the monitor to the presentation screen before
|
fullscreen. On Wayland, move the monitor to the presentation screen before
|
||||||
activating fullscreen. Fullscreen does not lock down the computer.
|
activating fullscreen. Fullscreen does not lock down the computer.
|
||||||
|
|
||||||
## Audible alarms and QRS tone (updated v0.6.6)
|
## Audible alarms and QRS tone (updated v0.6.7)
|
||||||
|
|
||||||
Sound is **enabled by default**. The Admin window has an **Audible alarms**
|
Sound is **enabled by default**. The Admin window has an **Audible alarms**
|
||||||
checkbox for muting and a **Test tone** button (works even while muted).
|
checkbox for muting and a **Test tone** button (works even while muted).
|
||||||
|
|
|
||||||
|
|
@ -197,12 +197,11 @@ pub struct Simulator {
|
||||||
respiratory_phase: f64,
|
respiratory_phase: f64,
|
||||||
ecg_beat_number: u64,
|
ecg_beat_number: u64,
|
||||||
conducted_qrs: VecDeque<ConductedBeat>, // captured QRS with respiratory beat amplitude
|
conducted_qrs: VecDeque<ConductedBeat>, // captured QRS with respiratory beat amplitude
|
||||||
rate_qrs: VecDeque<f64>, // captured beats for measured PR; reset after rate changes
|
rate_qrs: VecDeque<f64>, // captured beats for measured PR; rolling history smooths HR changes
|
||||||
audio_events: VecDeque<BeatEvent>, // consumed by the 100-ms UI audio timer
|
audio_events: VecDeque<BeatEvent>, // consumed by the 100-ms UI audio timer
|
||||||
filtered_pleth: f64,
|
filtered_pleth: f64,
|
||||||
previous_rhythm: EcgRhythm,
|
previous_rhythm: EcgRhythm,
|
||||||
previous_conduction: PulseConduction,
|
previous_conduction: PulseConduction,
|
||||||
previous_heart_rate: i32,
|
|
||||||
poor_signal_outages: PoorSignalOutages,
|
poor_signal_outages: PoorSignalOutages,
|
||||||
compressions: ChestCompressions,
|
compressions: ChestCompressions,
|
||||||
nibp: NibpMachine,
|
nibp: NibpMachine,
|
||||||
|
|
@ -224,7 +223,6 @@ impl Simulator {
|
||||||
filtered_pleth: 0.0,
|
filtered_pleth: 0.0,
|
||||||
previous_rhythm: params.ecg_rhythm,
|
previous_rhythm: params.ecg_rhythm,
|
||||||
previous_conduction: params.pulse_conduction,
|
previous_conduction: params.pulse_conduction,
|
||||||
previous_heart_rate: params.heart_rate,
|
|
||||||
poor_signal_outages: PoorSignalOutages::new(),
|
poor_signal_outages: PoorSignalOutages::new(),
|
||||||
compressions: ChestCompressions::new(),
|
compressions: ChestCompressions::new(),
|
||||||
nibp: NibpMachine::new(),
|
nibp: NibpMachine::new(),
|
||||||
|
|
@ -427,12 +425,12 @@ impl Simulator {
|
||||||
self.previous_rhythm = params.ecg_rhythm;
|
self.previous_rhythm = params.ecg_rhythm;
|
||||||
self.previous_conduction = params.pulse_conduction;
|
self.previous_conduction = params.pulse_conduction;
|
||||||
}
|
}
|
||||||
if params.heart_rate != self.previous_heart_rate {
|
// Keep recent mechanically captured beats when only HR changes.
|
||||||
// Old captured events remain in the *waveforms* until they pass.
|
// The rolling three-interval PR calculation then converges naturally
|
||||||
// They must not bias the pulse rate after an HR slider change.
|
// to the new rate as new pulses arrive. Clearing this history on every
|
||||||
self.rate_qrs.clear();
|
// slider update would briefly make PR unavailable and falsely trigger
|
||||||
self.previous_heart_rate = params.heart_rate;
|
// SpO2 NO READING, even though perfusion and the sensor are intact.
|
||||||
}
|
// Actual loss of capture is still handled above, immediately.
|
||||||
|
|
||||||
// Respiratory phase drives both the capnogram and arterial PPV.
|
// Respiratory phase drives both the capnogram and arterial PPV.
|
||||||
let respiratory_rate = params.respiratory_rate.max(0) as f64 / 60.0;
|
let respiratory_rate = params.respiratory_rate.max(0) as f64 / 60.0;
|
||||||
|
|
@ -1181,12 +1179,55 @@ mod tests {
|
||||||
assert_eq!(sim.pulse_rate(), Some(75));
|
assert_eq!(sim.pulse_rate(), Some(75));
|
||||||
p.heart_rate = 189;
|
p.heart_rate = 189;
|
||||||
sim.step(&p);
|
sim.step(&p);
|
||||||
// No old 75 bpm PR is displayed while the new beat interval is measured.
|
// A new HR must not invalidate existing mechanical pulse history.
|
||||||
assert_eq!(sim.pulse_rate(), None);
|
// The displayed PR is smoothed from actual conducted QRS intervals.
|
||||||
for _ in 0..200 { sim.step(&p); }
|
assert_eq!(sim.pulse_rate(), Some(75));
|
||||||
|
assert_eq!(sim.spo2_status(&p), Spo2Status::Available);
|
||||||
|
for _ in 0..800 {
|
||||||
|
sim.step(&p);
|
||||||
|
assert!(sim.pulse_rate().is_some(), "PR must remain available");
|
||||||
|
assert_eq!(sim.spo2_status(&p), Spo2Status::Available);
|
||||||
|
assert!(sim.samples.back().unwrap().pleth_valid,
|
||||||
|
"no artificial gap in the pleth trace during HR adjustment");
|
||||||
|
}
|
||||||
assert_eq!(sim.pulse_rate(), Some(189));
|
assert_eq!(sim.pulse_rate(), Some(189));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn repeated_heart_rate_slider_moves_do_not_trigger_spo2_no_reading() {
|
||||||
|
let mut p = Parameters::default();
|
||||||
|
let mut sim = Simulator::new(&p);
|
||||||
|
for rate in [90, 105, 120, 140, 110, 80, 75] {
|
||||||
|
p.heart_rate = rate;
|
||||||
|
for _ in 0..40 { // only 160 ms between successive slider updates
|
||||||
|
sim.step(&p);
|
||||||
|
assert!(sim.pulse_rate().is_some());
|
||||||
|
assert_eq!(sim.spo2_status(&p), Spo2Status::Available);
|
||||||
|
assert!(sim.samples.back().unwrap().pleth_valid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn conducted_two_to_one_pulses_remain_available_during_hr_change() {
|
||||||
|
let mut p = Parameters { pulse_conduction: PulseConduction::TwoToOne,
|
||||||
|
..Parameters::default() };
|
||||||
|
let mut sim = Simulator::new(&p);
|
||||||
|
assert_eq!(sim.pulse_rate(), Some(38));
|
||||||
|
p.heart_rate = 150;
|
||||||
|
for _ in 0..1200 {
|
||||||
|
sim.step(&p);
|
||||||
|
assert!(sim.pulse_rate().is_some());
|
||||||
|
assert_eq!(sim.spo2_status(&p), Spo2Status::Available);
|
||||||
|
}
|
||||||
|
assert_eq!(sim.pulse_rate(), Some(75));
|
||||||
|
// Genuine mechanical capture loss still produces NO READING immediately.
|
||||||
|
p.pulse_conduction = PulseConduction::None;
|
||||||
|
sim.step(&p);
|
||||||
|
assert_eq!(sim.pulse_rate(), None);
|
||||||
|
assert_eq!(sim.spo2_status(&p), Spo2Status::NoReading);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn new_rate_respects_two_to_one_mechanical_capture() {
|
fn new_rate_respects_two_to_one_mechanical_capture() {
|
||||||
let mut p = Parameters::default();
|
let mut p = Parameters::default();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue