SimPaM/patient-monitor-simulation
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-13 20:48:22 +01:00
..
data/icons/hicolor/scalable/apps Logo 2026-11-13 20:48:22 +01:00
src v0.6.11 — Native PulseAudio / PipeWire audio output 2026-11-13 20:09:25 +01:00
.gitignore Initial commit 2026-11-12 09:36:13 +01:00
at.criticalcare.SimPaM.desktop v0.6.11 — Native PulseAudio / PipeWire audio output 2026-11-13 20:09:25 +01:00
at.criticalcare.SimPaM.yml v0.6.11 — Native PulseAudio / PipeWire audio output 2026-11-13 20:09:25 +01:00
cargo-sources.json cargo-sources 2026-11-13 20:37:13 +01:00
Cargo.lock v0.6.11 — Native PulseAudio / PipeWire audio output 2026-11-13 20:09:25 +01:00
Cargo.toml v0.6.11 — Native PulseAudio / PipeWire audio output 2026-11-13 20:09:25 +01:00
README.de.md v0.6.11 — Native PulseAudio / PipeWire audio output 2026-11-13 20:09:25 +01:00
README.md v0.6.11 — Native PulseAudio / PipeWire audio output 2026-11-13 20:09:25 +01:00

SimPaM — Patient Monitor Simulation v0.6.11

A Rust/GTK4 patient-monitor simulator with two main windows for teaching on Fedora Linux.

Synthetic training signals only — not for clinical use. ECG, arterial pressure, plethysmography and capnography are schematic mathematical approximations. The simulation has no clinical validation and is not a medical device.

Overview

SimPaM is a touchscreen-capable patient-monitor simulation for teaching anesthesia, intensive care and emergency medicine. An instructor changes the patient's physiology in the Admin window, while learners see a simulated bedside monitor that can be resized or shown fullscreen. The application uses synthetic signals and is intended for demonstrations and scenarios—not patient monitoring.

Area What you can do
Direct Mode Set ECG rhythm and HR, mechanical capture, oxygen saturation and signal quality, invasive blood pressure, capnography, NIBP and visibility.
Actions & Occurrences Trigger time-based deterioration, defibrillation artifacts, simulated interventions and chest compressions; pause, resume or stop scripted changes.
Monitor Display ECG, SpO₂/plethysmography, ART, capnography, alarms and numerical measurements. Touch a parameter to adjust its alarm limits.
NIBP Start a cuff measurement manually or turn on automatic measurements; at startup there is no NIBP reading and Auto is off.
Sound Hear two-tone alarms and the optional saturation-dependent QRS/pulse beep; selectively pause already-active audible alarms for 120 s.

Guide contents

Getting started

Build and run on Fedora

sudo dnf install rust cargo gcc pkgconf-pkg-config gtk4-devel pulseaudio-libs-devel
cargo test
cargo run --release

Run these commands from the extracted patient-monitor-simulation folder. Window titles show the application version. GTK4 requires a functional graphical session (e.g., Fedora KDE/Wayland).

First session

  1. Open the Admin and Monitor windows. In Direct Mode, choose a rhythm and set the initial values. The monitor updates continuously.
  2. If needed, enter a patient name and adjust alarm thresholds or choose Adult under Alert presets.
  3. For a blood-pressure cuff reading, use Measure now in Admin or the NIBP touch menu. Automatic measurement is initially OFF.
  4. Switch to Actions & Occurrences to trigger an event, use the yellow Defibrillation shortcut or control chest compressions. To present the monitor fullscreen, press F11; use Esc to exit.

The following sections provide the complete controls, simulation behavior and technical details. The Changelog is kept at the end.

Windows, monitor layout and touch operation

Windows

Admin sections have a narrow colored stripe on their left edge to match the monitor: ECG green, SpO₂ yellow, invasive arterial pressure red, capnography light grey, NIBP red. The Patient section remains neutral. These accents are drawn by GTK and remain visible independently of light/dark themes. This is a visual-only change; control behavior is unchanged.

Admin: Controls patient name; ECG rhythm and rate; mechanical capture; SpO₂, signal quality and sensor connection; invasive arterial pressure, waveform shape and pulse-pressure variation; NIBP; and capnography. Numeric inputs have bidirectionally linked sliders and text fields. Each of the five monitor parameters (ECG, SpO₂/pleth, ART, CO₂, NIBP) has its own Show on monitor checkbox.

Monitor: Black background; ECG green, pleth yellow, ART red and capnogram light grey. The patient name entered in Admin replaces PATIENT MONITOR in the header immediately; leaving the name blank restores the generic title. Long names are automatically resized or clipped to fit the header. Waveforms and vital signs disappear together when their respective visibility checkbox is cleared. Remaining waveform rows expand to use the space. Hiding a display channel does not stop signal generation or physiological coupling: for example, hiding ECG does not stop ART or pleth pulses. The final row is split into four equal-width measurement groups, with NIBP in the fourth group, aligned beneath the regular numeric column. The first three groups are reserved for future measurements. Hiding NIBP only clears its own fourth group, without removing the final row.

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.

Monitor layout (v0.5.7)

The monitor uses a fixed 3:1 column ratio over the drawable area: 75% waveform column / 25% numeric column, regardless of window size. The last row is reserved for four equal-width numerical measurement groups:

Group 1 (25%) Group 2 (25%) Group 3 (25%) Group 4 (25%)
CO / CI SVRI · GEDI · ELWI (empty) NIBP

The first two groups currently display only their headings, with no numerical values or simulation logic. The third group is completely empty. The fourth retains the existing red NIBP readings, cuff gauge, progress bar and alarms. The NIBP visibility toggle hides only the fourth group's content; the bottom measurement row and other three groups remain present. Disabling one of the four waveform channels still reflows the remaining rows above it.

Display options (new in v0.3)

The five Show on monitor checkboxes affect the presentation only:

Checkbox Hidden monitor content
ECG ECG waveform, HR and rhythm alarm (when present)
Pulse oximetry Pleth waveform, SpO₂ and PR
Invasive arterial blood pressure ART waveform, pressure values, MAP and PPV label
Capnography CO₂ waveform, EtCO₂ and RR
NIBP Timed cuff-measurement values and red right-column value box

Remaining visible waveform rows and the bottom measurements row share an equal portion of the available height and remain aligned across both columns; zero waveform channels is supported. Hiding NIBP leaves the three future measurement placeholders visible.

Header controls: selective alarm pause and settings (v0.6.8)

Two touch/mouse controls are drawn at the far right of the monitor header:

  • Yellow bell (rightmost): pauses only the currently active audible alarm conditions for 120 seconds. The caption paused for x s counts down the remaining seconds. Pressing the bell again replaces the suppressed set with the conditions active at that moment and restarts the 120-second timer. A newly triggered alarm condition sounds normally, even if another alarm of the same priority is paused. When a condition clears, it loses its paused status so a later recurrence can sound. Pauses never change visual alarms or the separate beat-synchronous QRS sound. Pressing the bell when no alarms are active does not start a countdown.
  • Gear (left of bell): opens a black/light-grey monitor-side settings panel with QRS beep, Audible alarms, Alert presets (Custom, Adult), an editable Patient name field and the attribution PaMSim by Critical Care Club Austria, (c) 2026. It does not create an on-screen keyboard. Apply synchronizes settings with Admin; Cancel/Esc discards changes. The Adult preset affects alarm limits only.

Other channel touch menus are unchanged. NIBP retains its explicitly requested manual measurement, automatic measurement and interval controls.

Monitor touchscreen: alarm limits and NIBP controls (v0.6.4)

Tap or click the waveform or numerical readout of ECG, SpO₂, ART or CO₂ to open that channel's alarm-limit panel. For NIBP, tap the rightmost quarter of the bottom measurement row. The other three bottom-row groups are reserved for future measurements and remain non-interactive. The panels are available in fullscreen and retain a black background, very light-grey text, and 0.8-pixel borders and dividers, in the style of the main monitor.

Alarm thresholds can be modified from every monitor-side menu. No keyboard is required: every lower/upper limit has large − / + controls with a parameter-specific increment and an independent ON/OFF control. Unset limits remain disabled. The lower limit cannot exceed the upper limit.

Touch area Available alarm limits Increment
ECG HR 5 bpm
SpO₂ SpO₂; pulse rate (PR) 1% SpO₂; 5 bpm PR
ART SYS; MAP; DIA; PPV 5 mmHg pressure; 1% PPV
CO₂ EtCO₂; respiratory rate (RR) 1 mmHg EtCO₂; 1 breath/min RR
NIBP SYS; MAP; DIA 5 mmHg

Apply commits the threshold changes and synchronizes the Admin window. Changing a threshold sets the alarm preset to Custom. Cancel or Esc discards the draft changes.

NIBP is the exception: its monitor-side menu additionally provides Measure now, Automatic measurement ON/OFF, and the 1/3/5/10/20/30/60-minute interval. Interval and Auto changes take effect with Apply (or are discarded with Cancel/Esc); Measure now starts immediately, even with Auto OFF and before Apply. The touch controls synchronize with Admin. A measurement already in progress is not restarted. The simulated failure option and cuff placement remain Admin-only, as do ECG lead, SpO₂ sensor/quality and waveform choices.

NIBP startup and automatic measurements

Auto measurement is OFF by default. On startup the monitor shows ---/--- (MAP ---) and no measurement is initiated. To obtain a reading, select Measure now in the NIBP monitor menu (or in Admin), or enable Automatic NIBP measurement via the menu (or Admin). The first automatic cycle begins immediately after enabling Auto; subsequent measurement intervals count from completion of the prior cycle. Disabling Auto stops further scheduled measurements without interrupting a cycle already in progress. Manual measurement remains possible while Auto is off. The interval bar is empty and the monitor displays AUTO OFF whenever automatic measurements are disabled.

Horizontal touchscreen alarm matrix (v0.6.3)

All five monitor touch menus now share a compact horizontal alarm-limit matrix. Each parameter occupies its own row (for ART: SYS, MAP, DIA, PPV), with ↓ Lower and ↑ Upper displayed in adjacent columns. Within each limit cell, the touch controls are ordered + · value · − · OFF/ON (the OFF/ON button is immediately right of minus). The original large button styling, per-parameter increments, last-value restoration, optional bounds and Apply/Cancel semantics are unchanged. The matrix scrolls if necessary while Apply and Cancel remain accessible below it. Other physiological controls remain Admin-only, except for the three explicitly requested NIBP measurement controls.

Instructor controls and scenarios

Actions & Occurrences (v0.6.9)

The Admin window now has two tabs: Direct Mode (all original controls) and Actions & Occurrences (time-based instructor scripts). Select an action and Trigger action. Each running script appears in the action history with Pause / Resume / Stop and elapsed percentage. Stop freezes the physiological values at their current level and cancels any pending rhythm changes; it does not restore baseline. Restore pre-action baseline is an explicit reset that also stops all running scripts. Different actions can run concurrently; the latest action takes ownership of overlapping parameters. Manually adjusting any parameter in Direct Mode releases that parameter from script control, without stopping unrelated parameters. NIBP remains its own manual/automatic cuff measurement: its subsequent readings derive from ART.

Action Scripted behavior
Defibrillation Immediate high-amplitude ECG shock artifact; no rhythm change.
Defibrillation + rhythm change Immediate selected rhythm and ECG artifact; instructor-selected ART SYS/DIA reached in 60 s, EtCO₂ target in 30 s only if effective perfusion exists.
Deterioration: Hypoxia SpO₂ reaches randomized 40–50% (45 ±5) over 300 s. Below 60% saturation, HR gradually declines toward 50/min (or stays lower if initially under 50).
Deterioration: Shock Over 600 s, ART MAP trends toward 45 mmHg via proportional SYS/DIA reduction. HR trends to 140 ±5% at 300 s; rhythm becomes AF and HR reaches 160 ±5% at 600 s. SpO₂ quality becomes Poor at MAP ≤59 and None / NO READING at MAP ≤50.
Chest compressions Start/Stop and quality (Good/Adequate/Poor/Bad), using the existing Direct Mode CPR model.
Norepinephrine bolus At 30 s, ART SYS 200 mmHg / HR 160; at 60 s, SYS 260 / HR 180; original SYS and HR recovered over the next 300 s.
Too much propofol Over 60 s, ART reaches 60/45 mmHg and HR ~130 (±5%).
Lethal propofol Over 60 s, ART reaches 40/20 mmHg and HR ~150 (±5%), followed by VF.

Scope and assumptions: Scripts modify the invasive arterial-pressure model, not the NIBP settings or initial cuff reading. The ART numeric display may exceed the fixed 0–200 mmHg waveform axis during norepinephrine simulation; the trace clips at the top as before. Hypoxia bradycardia targets 50/min because only the onset threshold (60% saturation) was specified. The shock quality state “Bad” is mapped to the existing None / NO READING sensor-quality state. All actions are illustrative teaching scenarios, not pharmacokinetic or validated clinical models. Audible/visual alarms, the selective 120-second alarm pause, QRS sounds and monitor-side touchscreen menus are unchanged.

Instructor shortcuts on the Actions tab (v0.6.10)

The Actions & Occurrences tab keeps Chest compressions (Start/Stop button and quality selector: Good, Adequate, Poor, Bad) permanently visible above the scripted action selector. These are the same controls as on Direct Mode, backed by the same state; changes in either tab are reflected in the other. Chest compressions therefore no longer needs a redundant entry in the action dropdown. Its clinical simulation behavior is unchanged.

A wide yellow Defibrillation shortcut with a red lightning-bolt icon is also always available above the scripted actions. One press produces the existing transient ECG defibrillation artifact only. It does not change rhythm, ART, EtCO₂ or other physiological parameters, and it does not add a long-running scripted action. For rhythm conversion and hemodynamic targets, continue to select Defibrillation + rhythm change from the dropdown.

Chest compressions (v0.5.4)

The Chest compressions Admin group provides a large Start Chest Compressions button (green background). While active it changes to Stop Chest Compressions (red background). Compression quality can be changed at any time: Good, Adequate (default), Poor, or Bad.

  • Compressions are generated independently of the ECG at 90–110/min, with a new reproducible pseudo-random compression rate and pressure each stroke. The ECG rhythm and electrical HR setting are not changed.

  • Every compression adds movement artifact to the ECG. In a patient with existing intrinsic arterial perfusion, the native arterial waveform is preserved but distorted by compression-synchronous pressure artifact.

  • With no intrinsic arterial pulse (e.g., VF, PVT, asystole or PEA), each effective compression generates a broad, blunt arterial pressure wave:

    Compression quality Compression-generated ART systolic peak
    Good 90 mmHg ±10% (81–99 mmHg)
    Adequate (default) 70 mmHg ±10% (63–77 mmHg)
    Poor 50 mmHg, +10% / −50% (25–55 mmHg)
    Bad No compression-generated arterial pressure; 0–5 mmHg baseline drift

    During pulseless CPR, ART SYS shows the current compression peak, while DIA/MAP remain -- (not estimable from this synthetic pressure).

  • SpO₂ numeric saturation and the pleth waveform remain visible only when compression quality is Good, provided the sensor is connected and not occluded by an NIBP cuff. Their effective signal quality is forced to Poor (★), irrespective of the normal Admin quality setting. The displayed pleth-derived PR follows the compression rate (90–110/min), not the ECG. Adequate, Poor and Bad CPR display NO READING; detached sensors display NO SENSOR. Compression-induced Poor quality does not schedule the usual intermittent dropout; that resumes when ordinary Poor signal mode returns.

  • Existing numerical alarms and rhythm alarms remain active. ART SYS limits apply to compression-generated systolic peaks; NIBP scheduling remains unchanged; its cycle duration still depends on effective SpO₂ quality at the start of a measurement.

These pressure targets are didactic assumptions, not validated CPR hemodynamic criteria. The exercise must not be used to judge real compression quality or clinical perfusion.

Measurements and signal behavior

ECG and mechanical coupling

  • ECG rhythms: sinus, atrial fibrillation, monomorphic ventricular tachycardia (potentially perfusing), pulseless ventricular tachycardia (PVT), ventricular fibrillation and asystole.
  • Mechanical capture: 1:1, 2:1, 3:1, None (PEA), or deterministic pseudo-random capture (~65%). PR is derived from conducted QRS events, never controlled by a pulse-rate slider.
  • A captured QRS leads to an ART upstroke after a schematic 120 ms, and a peripheral pleth pulse after 300 ms. Pleth is strongly damped/filtered.
  • VT and PVT selections start with a heart rate of 160 bpm, and update both the HR slider and numeric entry. The instructor may modify this afterward.
  • PVT, VF, asystole and PEA suppress mechanical pulses; the ART trace then drifts smoothly at 0–5 mmHg rather than representing a pulsatile pressure. The ART SYS number shows the rounded low transducer pressure (0–5 mmHg), while DIA and MAP show -- because they cannot be reliably estimated. Previous pressure samples scroll out of view. NIBP follows a separate, time-based simulated cuff-measurement cycle.

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.

Patient name and pulse oximeter signal state (new in v0.3.2)

The new Patient name text field at the top of Admin immediately replaces the monitor headline. It is optional; an empty or whitespace-only name displays PATIENT MONITOR. This is a local teaching label, not a patient record.

Admin → Pulse oximetry has two additional controls:

  • Sensor not attached (checkbox): immediately removes the pleth waveform, suppresses SpO₂ and pulse-rate readings, and displays NO SENSOR instead of the numeric saturation. This takes precedence over signal quality.
  • Signal quality (dropdown), which changes the visible pleth waveform and quality indicator, independently of the instructor-set SpO₂ percentage:
Setting Pleth waveform Monitor display
0 — None No waveform Flashing NO READING, PR --; no stars
1 — Poor Small, irregularly distorted pulse, with temporary losses of signal 1 star (★) when available; blinking NO READING during loss
2 — Adequate Medium, smoothly damped pulse 2 stars (★★)
3 — Good Full nominal, smoothly damped pulse 3 stars (★★★)

Default: sensor attached; signal quality 3 — Good. At levels 1–3, the instructor-set SpO₂ number is shown only when mechanical pulses are detected. In Poor quality, the signal also has intermittent complete dropouts: 30–180 seconds of signal between interruptions, with each interruption lasting 5–20 seconds. During an interruption the pleth trace disappears, SpO₂ and PR are unavailable, and NO READING flashes. Following recovery, the Poor waveform and numerical readings return automatically. These intervals are pseudo-random and driven by simulation time, independent of frame rate; they reset when Poor quality is selected again. The dropout does not affect the actual saturation setting, ECG, derived mechanical pulse generation, or ART. The simulated pulse rate remains derived from captured QRS complexes.

The degraded waveform uses deterministic, smoothly interpolated pseudo-noise that scales only existing pleth pulses: it cannot manufacture pulses during PEA, PVT, ventricular fibrillation or asystole. Unplugging a sensor or selecting quality 0 hides even previously buffered pleth samples immediately. ECG and ART continue unaffected. The Show on monitor checkbox still hides the entire SpO₂ row; sensor/quality controls leave the row visible so the status can be taught.

Invasive arterial pressure and PPV (new in v0.3)

The arterial waveform has a fixed 0–200 mmHg display axis, with tick marks at 0, 50, 100, 150 and 200 mmHg. Nominal ART systolic and diastolic inputs are limited to 0–200 mmHg.

Pulse pressure variation (PPV) is adjustable from 0% to 60%, in 1% increments, via synchronized slider and text field (Admin → Invasive arterial blood pressure). Its default is 0% (no respiratory modulation). The respiratory cycle comes from the same respiratory-rate parameter as the capnogram. RR = 0 disables the respiratory modulation (apnea).

The synthetic PPV definition is:

PPV (%) = 100 × (PPmax − PPmin) / ((PPmax + PPmin) / 2)

The model applies a sinusoidal variation to pulse pressure, sampled for each mechanically conducted beat. The diastolic baseline remains nominally fixed, so this is primarily a beat-to-beat systolic swing, not an arbitrary vertical translation of the entire arterial trace. It does not affect ECG, mechanical capture or pleth amplitude. This is a visual teaching model, not a validated predictor of fluid responsiveness.

Example: ART 120/75 mmHg has nominal pulse pressure 45 mmHg. At PPV 20%, the ideal pulse-pressure extrema are 40.5 and 49.5 mmHg, corresponding to systolic peaks of approximately 115.5 and 124.5 mmHg (assuming the diastolic baseline stays at 75 mmHg). The rendered waveform shape and finite number of beats per respiratory cycle mean the visible maxima may not reach the ideal extrema exactly.

The ART sidebar displays the nominal systolic/diastolic pressures and MAP, plus the configured PPV percentage when PPV is greater than 0. It does not measure PPV from sampled arterial data. At very high nominal systolic pressure, the highest modulated pulses can exceed the 200 mmHg scale; the displayed curve is then clipped at the top, without rescaling the axis.

NIBP measurement cycle (v0.5.0)

NIBP is red, with a dedicated value box in the right-hand numeric column. The bottom measurement row has three placeholder groups to its left, keeping NIBP aligned with the standard right-hand numeric column. The previous static NIBP footer has been removed. In Admin, choose an interval of 1, 3, 5, 10, 20, 30, or 60 minutes (default 5). Auto measurement is disabled at startup, so no reading is shown and no measurement starts until the instructor activates Auto or selects Measure now. When enabled, the first automatic measurement starts immediately; subsequent intervals run from the end of the last measurement, not from its beginning. Measure now starts a cycle even when Auto is OFF, if none is in progress. The small horizontal progress bar shows the fraction of the waiting interval elapsed; a vertical 0–200 mmHg gauge shows the current cuff pressure during measurement.

The duration and success are determined by the signal quality at the start of the cycle (including an absent sensor or an ongoing Poor-signal dropout). Changing quality while a cycle is running does not retroactively change its planned duration:

Starting SpO₂ quality Cycle duration Result
Good (★★★) 20 s Measured
Adequate (★★) 40 s Measured
Poor (★) Randomly 60–120 s Simulated 65% chance of a reading
None / no sensor 120 s No reading
No reading checkbox 120 s No reading, regardless of quality

The cuff inflates to 200 mmHg then deflates. When the starting signal is Poor or None, it deflates to about 67 mmHg, reinflates to about 133 mmHg, and finally deflates to zero. At the end, the completed value becomes visible and blinks five times by appearing/disappearing (without the inverted-color alarm effect). If the cycle fails, the displayed reading is ---/---, with MAP ---. Previous NIBP values remain visible while the next cuff cycle is in progress, until the new reading is available.

The first successful measurement uses the initial NIBP SYS/DIA values from Admin. Subsequent successful values derive from the current invasive arterial SYS/DIA settings using independently sampled percentage deviations:

Starting quality Deviation relative to IBP
Good −5% to +5%
Adequate −10% to +5%
Poor −15% to −5%, if a reading succeeds
None No reading

Optional Cuff on SpO₂ extremity changes the effective pulse-oximeter quality while the cuff is inflated: above invasive systolic pressure = None; between invasive systolic and diastolic pressure = Poor; below invasive diastolic pressure = the configured quality. The quality never becomes better than the instructor's setting. NO READING, missing pleth waveform and restoration of the waveform are handled as before.

Optional Cuff on ART extremity modifies the simulated arterial transducer trace during cuff inflation: above invasive SYS it freezes at the last measured pressure; between invasive SYS and DIA it pulsates between the cuff pressure and the currently available NIBP SYS reference; below invasive DIA it returns to the normal arterial waveform. The ART numerical SYS/DIA/MAP values also reflect this altered trace. With absent mechanical cardiac capture, the previous pulseless 0–5 mmHg simulation is retained and no artificial pulses are introduced. Both cuff-interference options are off by default.

These cuff and SpO₂ interactions are deliberately simplified training artifacts; they should not be interpreted as validated cuff oscillometry.

Alarm limits and sounds

Numerical alarm limits (v0.4.0; layout and presets updated in v0.4.1)

Each displayed numeric measurement has an independent optional lower (↓) and upper (↑) alarm threshold in the corresponding Admin section. The lower and upper entries are placed in the same row as the corresponding slider. Derived values with no separate slider (PR, ART MAP, NIBP MAP) have their own compact alarm rows. The Admin window opens wider to accommodate these controls. Alarm fields are text inputs; leave a field blank (displayed as off) to disable just that threshold. With both fields blank, the whole numeric alarm is disabled. The value may equal either limit without triggering an alarm; only readings strictly below/above the respective threshold are out of range. If both limits are present, the lower limit must not exceed the upper limit. Invalid input is highlighted and the last valid configuration stays active.

Monitor section Independently configurable alarms
ECG HR
SpO₂ Oxygen saturation (SpO₂), derived pulse rate (PR)
Invasive arterial pressure (ART) Systolic (SYS), mean (MAP), diastolic (DIA), PPV
NIBP Systolic (SYS), mean (MAP), diastolic (DIA)
Capnography End-tidal CO₂ (EtCO₂), respiratory rate (RR)

The current limits are displayed in small type at the upper-right corner of each channel, with an arrow for the corresponding direction. A disabled boundary is displayed as ---. For instance:

⚠ SYS ↓80 ↑180
  MAP ↓60 ↑---
  DIA ↓--- ↑---

Alert presets

The Alert presets dropdown at the top of Admin offers Custom (manual) and Adult. Choosing Adult immediately sets all alarm limits and updates the lower/upper text fields alongside the sliders. It changes only alarm limits: it does not change heart rate, blood pressure, channel visibility or any other simulated physiological setting. Editing any alarm field after applying Adult switches the selector to Custom without changing other alarm limits. Select Adult again to reapply the complete preset.

Parameter Lower Upper
HR (bpm) 60 100
SpO₂ (%) 90 ---
PR (bpm) --- ---
ART SYS (mmHg) 80 180
ART MAP (mmHg) 60 100
ART DIA (mmHg) --- ---
PPV (%) --- 10
NIBP SYS (mmHg) 80 180
NIBP MAP (mmHg) 60 100
NIBP DIA (mmHg) --- ---
EtCO₂ (mmHg) 30 50
RR (/min) 10 20

--- denotes a disabled threshold. Adult is a teaching convenience preset, not a clinically validated set of alarm limits. Initially the selector is Custom, with all limits disabled (as in v0.4.0).

When a number violates a configured limit, that number flashes by inverting its foreground and background colors (500 ms inverted / 500 ms normal). Each pressure component (SYS, DIA, MAP) and the PPV reading flash independently. The waveform itself remains unchanged. All alarms are disabled by default so old scenarios do not unexpectedly flash.

Numerical threshold alarms only evaluate actual displayed measurements: --, NO SENSOR, and other unavailable readings do not trigger low-value alarms. ECG-derived PR and signal visibility continue to work as in v0.3.2. Audible alarms with two priorities are supported, but there is no alarm latching or clinical alarm validation. Instructor settings are held in memory and reset on restart.

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). Visual alarms keep blinking normally when sound is off.

  • Critical rhythm alarm: VT, PVT, VF and asystole produce a higher-pitched two-tone alert (880 Hz followed by 1160 Hz), repeated approximately every 1.5 seconds.
  • Numerical and SpO₂ technical alarms: out-of-range values, NO SENSOR and NO READING produce a lower-pitched two-tone alert (700 Hz followed by 950 Hz), repeated approximately every 2.5 seconds.
  • Both alarm signals use two different successive pitches, separated by a brief silence. The single QRS/pulse beep is independent and configurable using the new QRS tone checkbox in Admin (ON by default).
  • Critical alarms have priority: only one tone pattern is played even if multiple alarms are active. The sound stops when all alarms clear or when the checkbox is unchecked. Alarms on hidden monitor channels are excluded.
  • Values not yet available (e.g. NIBP before a completed measurement) do not trigger numerical limit alarms. The cuff measurement cycle by itself is not an alarm. Audio playback is separate from waveform rendering and simulation.

Beat-synchronous QRS/pulse tone

The QRS tone checkbox is independent of Audible alarms; turning off one does not mute the other. Each brief (85 ms), single-frequency beep follows an actual simulated beat event, not a separate rate timer:

  • SpO₂ reading available: beep on the delayed peripheral pleth pulse; the pitch follows the displayed saturation (including during effective good-quality chest compressions). Missed mechanical captures produce no peripheral beep.
  • SpO₂ reading unavailable: a fixed 500 Hz beep follows an organized ECG QRS if ECG is displayed; otherwise it follows an arterial pulse if ART is displayed. ECG and ART together do not cause duplicate beeps.
  • VF/asystole without effective CPR: no beat beep is generated. ART pulses created by CPR can generate the fallback tone, while good CPR with a valid SpO₂ reading uses the saturation-dependent tone.
SpO₂ (%) Tone (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

Saturation tone pitches are deliberately simplified teaching tones, not calibrated clinical pulse-oximeter sounds. The QRS beep and two-tone alarm can sound independently; no alarm priority or visual alarm logic was changed.

As of v0.6.11, audio uses the Rust libpulse-simple-binding backend directly, rather than launching pw-play or paplay. SimPaM synthesizes the same 44.1 kHz mono PCM16 tones in memory and sends them to two independent PulseAudio streams (alarm and QRS). Each stream has a dedicated playback thread so synchronous audio I/O never blocks GTK. PipeWire supports this through its PulseAudio compatibility server. The system mixer controls output volume. If connecting or writing to the audio server fails, the worker logs an error and can retry on the next sound. Test tone verifies playback independently of the mute checkbox. No temporary WAV files or external player programs are used.

Important: These simple teaching tones do not comply with medical-device alarm standards (including IEC 60601-1-8) and must never be relied on for clinical monitoring.

Technical reference

ECG morphology correction (v0.3.1)

At high heart rates, the previous ECG generator expressed QRS width as a fixed fraction of the R–R interval and sampled at 100 Hz. Narrow R waves could fall between samples, making successive QRS complexes appear to vary dramatically in amplitude despite a regular sinus rhythm.

  • Synthetic P/QRS/T components now have widths specified in milliseconds, not fixed fractions of the cardiac cycle. P/T positioning and widths adapt to the R–R interval, while the QRS width remains essentially constant.
  • Sampling increased to 250 Hz (4 ms intervals) to capture QRS peaks more consistently, including at 189–240 bpm.
  • The ECG morphology remains independent of the respiratory arterial PPV setting. The arterial and pleth delays and mechanical capture options are unchanged.
  • Regression tests compare peak heights at 60, 75, 120, 189 and 240 bpm, and verify that changing PPV does not affect the ECG signal.

The ECG remains a schematic educational signal; no voltage calibration, lead placement model, diagnostic criteria, or patient-specific physiology are simulated.

Signal implementation

  • 250 Hz synthetic signal samples, 10 s retained history, 8 s scrolling trace.
  • Cairo draws into the GTK4 DrawingArea and scales with the window.
  • A conducted QRS records its own respiratory PPV multiplier at event time. The arterial pulse thus retains the same amplitude throughout the beat.
  • Varying PPV does not alter the peripheral pleth pulse or the number of mechanical pulses.
  • Clinical accuracy, calibration, artifact realism and patient-specific physiology are outside this prototype; its NIBP cycle and alarms are synthetic.

Project layout

src/
  main.rs        GTK application entry point
  audio_backend.rs  Native PulseAudio playback workers
  alarm.rs       Alarm/QRS tone synthesis, scheduling and pause
  model.rs       Parameters, rhythm/capture settings, display flags
  simulation.rs  QRS-timed mechanical signals, PPV and respiratory synthesis
  render.rs      Cairo monitor layout, dynamic visibility, fixed ART axis
  nibp.rs        Scheduled cuff measurements and measurement results
  ui.rs          Admin controls and monitor window

Building audio in Flatpak

For Flatpak, keep --socket=pulseaudio in finish-args and verify the target SDK provides the libpulse-simple development library:

flatpak run --command=sh org.gnome.Sdk//51 \
    -c 'pkg-config --modversion libpulse-simple'

The Flatpak runtime must also ship the corresponding shared libraries. The host's pipewire-utils package is no longer required. Update Cargo.lock with Cargo after changing dependencies, then regenerate cargo-sources.json using flatpak-cargo-generator before building offline. The project archive contains application sources; an existing Flatpak manifest is maintained separately and was not modified by this update.

Changelog

Changes since v0.2.2

  1. Respiratory PPV with a 0–60% instructor setting, coupled to the simulated respiratory cycle and applied per arterial beat.
  2. Five independent display visibility toggles, dynamic waveform row layout, and independent NIBP value-box hiding.
  3. ART axis reduced from 0–250 to 0–200 mmHg, with inputs adjusted to the new range.
  4. Added regression tests for PPV arithmetic and its effects on ART, for hiding ECG while retaining mechanical pulses, for active channel selection, and for arterial-axis normalization.

Verification: The archive is generated from these sources. Run cargo test locally to verify the Rust/GTK build; Rust and GTK4 development components were not available in the environment where this ZIP was prepared.

Changes in v0.3.2

  1. Added live patient-name header in Admin/Monitor with blank-name fallback.
  2. Added four levels of SpO₂ signal quality, quality stars and an irregular, low-amplitude pleth waveform for Poor quality.
  3. Added Sensor not attached with NO SENSOR status and suppression of saturation, pulse rate and pleth waveform.
  4. Added tests for signal-quality scaling, displayed readings and disconnected sensor behavior.

Build verification: ZIP integrity and patch application were checked. The GTK4 application and Rust tests were not compiled in the packaging environment; run cargo test and cargo run --release on Fedora.

v0.4.2 — Rhythm, sensor and missing-reading alarms

  • VT remains potentially perfusing. The new PVT (pulseless ventricular tachycardia) rhythm retains organized broad QRS complexes but produces no arterial/pleth pulses. VF and asystole are also pulseless regardless of capture selection.
  • ECG: a flashing ARRHYTHMIA message for VT, PVT and VF; a flashing ASYSTOLE message for asystole. These event alarms do not depend on numerical HR limits.
  • SpO₂: when the probe is disconnected, a flashing NO SENSOR replaces the saturation reading. Quality 0, loss of mechanical capture or a pulseless rhythm results in flashing NO READING (no numerical SpO₂/PR). Sensor disconnection takes precedence. No pleth waveform is displayed in these conditions.
  • ART: without mechanical pulses (including PVT/VF/asystole/PEA), the simulated invasive pressure line has slow non-pulsatile drift between 0 and 5 mmHg. In v0.4.2, the numeric display showed --/--; v0.4.3 changes this to a rounded measured SYS of 0–5 mmHg, with -- for DIA and MAP.
  • ECG rhythm name has been removed from the monitor; only HR and the associated alarm message, when present, are visible. The instructor continues to select the rhythm in Admin.
  • Numerical alarm thresholds and the Adult preset from v0.4.1 are unchanged. Synthetic demonstration behavior only; not suitable for clinical decisions.

v0.4.3 — Low arterial pressure, VT rate preset and intermittent Poor SpO₂

  • Pulseless rhythms, PEA or otherwise absent mechanical capture: invasive SYS reports the current measured 0–5 mmHg pressure, e.g. 3/-- with MAP -- mmHg. Only SYS is tested against configured ART SYS limits; no spurious MAP/DIA threshold alarms are generated from missing readings.
  • Selecting VT or PVT in Admin sets HR to 160 bpm and updates the associated slider and text field. Subsequent manual rate changes are allowed. Perfusing VT still produces QRS-linked pulses subject to capture settings; PVT remains pulseless.
  • Poor (★) SpO₂ signal periodically changes to NO READING for a pseudo-random 5–20 seconds, after a pseudo-random 30–180 seconds of usable low-quality signal. The technical alarm blinks, SpO₂/PR readings are suppressed, and the pleth waveform is absent. On recovery it resumes at Poor quality. The simulated signal history retains visible gaps for outages. Choosing another signal quality immediately clears the intermittent outage.
  • No changes to Adult alarm presets, alarm limit ordering, or the 0–200 mmHg arterial scale. All behavior is synthetic and intended for teaching only.

v0.5.1 — Aligned monitor columns

The left waveform column and right numeric column now share the same row grid. NIBP reserves an empty cell in the left waveform column instead of shortening the other numeric rows. Hiding any channel reflows both columns together. No NIBP measurement logic or alarm behavior was changed.

v0.5.3 — Audible alarm output

  • Alarm-tone playback through Fedora PipeWire (pw-play) or PulseAudio compatibility (paplay), without any new Rust library dependencies.
  • Admin controls to mute/unmute alarms or play a test tone.
  • Distinct critical-rhythm and standard/technical patterns; critical priority.
  • Audio keeps running independently of the monitor's drawing callback.
  • Visual alarms and existing physiological simulation remain unchanged.

v0.5.5 — CPR plethysmography correction

The delayed CPR pleth waveform no longer wraps its trailing portion into the next compression. The regression test now reports the maximum valid waveform amplitude when failing. No other simulation controls were changed.

v0.5.6 — CPR pleth filter persistence

Corrects the underlying cause of the v0.5.5 test failure: in pulseless rhythms, the simulation had reset the pleth low-pass filter at every 250 Hz sample, preventing CPR-induced signals from accumulating. The filter now persists during good-quality chest compressions while QRS-triggered mechanical pulses are still cleared. Stopping CPR in VF/PVT immediately restores no reading. Additional regression coverage includes PVT.

v0.5.7 — Four-group numerical measurement row

The monitor now uses a 75%/25% waveform/numeric column split. The final row has four equally sized measurement groups: CO/CI; SVRI/GEDI/ELWI; reserved empty; and the unchanged NIBP readout. Only headings are rendered in the first two groups; the third has no content. NIBP can be hidden without removing the final row. No physiological simulation behavior was modified.

v0.5.8 — ECG touchscreen controls

Added a monitor-styled ECG settings window, opened by touching either the ECG waveform or numeric HR cell. Edits HR lower/upper alarms and displayed lead (I, II, III, aVR, aVL, aVF, V1–V6), with input validation and Admin sync. Lead changes are schematic display projections only; arrhythmia and pulse simulation remain unchanged.

v0.5.9 — Touch-optimized ECG settings

Restyled the ECG settings window with light-grey text/controls, a neutral 0.8-pixel outer border and thin 0.8-pixel Cairo separators matching the monitor. Replaced the on-monitor HR limit text entries with large 5-bpm −/+ buttons and independent ON/OFF controls; the ECG lead remains a touch-selectable dropdown. Pending changes still require Apply, and Cancel leaves the shared parameters unchanged. No signal generation was altered.

v0.6.0 — Additional touchscreen modules and NIBP manual-first startup

Added touch/click settings panels for SpO₂, ART, CO₂ and the bottom-right NIBP cell. Their threshold editors use large, unit-specific +/− and ON/OFF controls; the panels expose relevant waveform/sensor options and stay synchronized with Admin. NIBP additionally provides interval selection, manual Measure now, Auto ON/OFF and cuff options. Startup no longer initiates a cuff cycle or shows any NIBP reading; Auto is OFF by default. Existing NIBP cycle physics and signal quality behavior are unchanged.

v0.6.1 — Alarm-only monitor touch menus

The ECG, SpO₂, ART, CO₂ and NIBP touch menus now edit only lower/upper alarm limits. Removed ECG lead, signal/sensor, waveform and all NIBP measurement controls from monitor-side menus. These remain available in Admin, including manual NIBP measurement and Auto ON/OFF. No physiological model, alarm evaluation or NIBP startup behavior was changed.

v0.6.4 — NIBP touch controls restored

The monitor-side NIBP settings menu again contains Measure now, Automatic measurement ON/OFF and the measurement interval (1, 3, 5, 10, 20, 30, 60 minutes). These controls are above the horizontal SYS/MAP/DIA alarm matrix and share its monochrome touchscreen styling. Auto and interval are saved with Apply; Measure now starts a cuff cycle immediately regardless of Auto. Both monitor and Admin display the selected settings. Other monitor menus remain limited to alarm thresholds; NIBP cuff placement, the simulated failed-reading option and non-NIBP signal settings remain Admin-only.

v0.6.5 — Two-tone audible alarms

Both standard/technical and critical alarm sounds now consist of two distinct successive pitches. Critical alarms retain their priority and faster repeat interval; standard alarms retain their slower cadence. The Admin test button plays the standard two-tone alert. A single QRS beep is reserved for a later release and is not generated yet. No visual alarm or simulation logic changed.

v0.6.6 — Optional QRS/pulse beep

Added a separate QRS tone checkbox (enabled by default). An 85 ms single-note beep follows actual ECG or mechanical beat events. With a valid SpO₂ reading, the delayed pleth pulse determines the timing and the oxygen saturation determines the pitch in eleven steps from 740 to 87 Hz; otherwise ECG QRS or ART pulses trigger a fixed 500 Hz tone. The two-tone alarm sounds remain unchanged. Added regression tests for band boundaries, event selection and single-tone WAV output.

v0.6.8 — Monitor header controls and selective audible-alarm pause

Added a yellow bell button with a 120-second pause countdown and a grey settings gear to the monitor header. The pause suppresses only alarm conditions active when pressed, with automatic un-silencing of new/recurrent conditions; visual alarms and QRS tones continue. The global monitor settings window contains QRS and audible-alarm switches, alert preset selection, patient name and attribution, and synchronizes its changes with Admin.

v0.6.9 — Actions & Occurrences

Added a separate Admin tab with eight scripted interventions, configurable post-defibrillation rhythm and targets, pause/resume/stop per active timeline, manual override of individual parameters, overlapping-action ownership and an explicit baseline reset. Synthetic defibrillation ECG artifact and scripted invasive pressure/HR/SpO₂/EtCO₂ progressions are independent of NIBP cuff settings. Existing Direct Mode and monitor menus are retained.

v0.6.10 — Persistent CPR controls and defibrillation shortcut

Chest-compression Start/Stop and quality selection are always visible in the Actions & Occurrences tab above the scripted action dropdown and stay synchronized with Direct Mode. CPR was removed from the dropdown because the same controls are now permanently available. A high-contrast yellow one-tap Defibrillation button with a red lightning symbol triggers only the transient ECG shock artifact; rhythm conversion remains available as a separate action.

v0.6.11 — Native PulseAudio / PipeWire audio output

Replaced external pw-play / paplay subprocesses and temporary WAV files with two dedicated Rust playback workers using libpulse-simple-binding. The existing two-tone alarm sounds, SpO₂-dependent QRS tones, rhythms, mute controls, alarm priorities and selective alarm-pause logic are retained. A manual test tone remains available with audible alarms switched off. Flatpak requires the PulseAudio socket and libpulse-simple in its SDK/runtime.