Brorb is a browser-based, biophysically-grounded simulation and visualization of the mammalian respiratory and cardiovascular systems. It couples a neural Central Pattern Generator (CPG) with mechanical models of the lungs, gas exchange, hemodynamics, and the heart.
The simulation engine (sim/) is built as a modular set of coupled differential equations solved in real-time.
An activity-based model of the ventral respiratory column (VRC).
- Architecture: A five-population neural network (pre-I/I, early-I, post-I, aug-E, late-E) following Molkov et al. (2017).
- Dynamics: Produces a three-phase respiratory rhythm (Inspiration, Post-Inspiration, and Expiration) through synaptic inhibition and intrinsic membrane properties like INaP bursting and adaptation.
- Modulation: Rate is controlled via tonic drives rather than timescale adjustments, allowing for realistic physiological transitions.
- Phrenic Output: Models phrenic motor neuron activity (Ramp-I) driven by the CPG.
- Mechanics: Diaphragm displacement and lung volume dynamics considering compliance and resistance.
- Hering-Breuer Reflex: Pulmonary stretch receptor feedback that modulates the CPG to prevent over-inflation.
-
Gas Dynamics: Tracks arterial
$PaCO_2$ and$PaO_2$ levels based on metabolic production/consumption and alveolar ventilation. -
Feedback Loops:
-
Central Chemoreceptors: Slow-acting medullary response to
$CO_2$ . -
Peripheral Chemoreceptors: Fast-acting carotid body response to both
$CO_2$ and hypoxia ($O_2$ ).
-
Central Chemoreceptors: Slow-acting medullary response to
-
$O_2$ Saturation: Computes$SpO_2$ using the Severinghaus-Hill equation.
- Cardiac Vagal Motor Neurons (CVMN): Integrated into the brainstem model to produce Respiratory Sinus Arrhythmia (RSA) as an emergent property of CPG-CVMN coupling.
- Frank-Starling Mechanism: Stroke volume is determined by filling time, contractility (sympathetic + ischemia), and afterload.
- Hemodynamics: Mean Arterial Pressure (MAP) is computed as Cardiac Output (CO) × Total Peripheral Resistance (TPR).
- Pathophysiology: Supports cardiac rhythms including Normal Sinus, Ventricular Tachycardia (VT), Ventricular Fibrillation (VF), and Asystole.
- Baroreflex: Senses MAP and adjusts sympathetic and vagal tones.
- Sympathetic Tone: Modulates heart rate, contractility, and peripheral vasoconstriction.
- Vagal Surge: Models the terminal bradycardia response to severe hypoxia.
A generative, shader-like visualization of the "vitality" of the system.
- Respiration: Size and color reflect lung volume and respiratory phase.
-
Vitals: Glow intensity and color shifts (e.g., cyanosis) reflect
$SpO_2$ , cardiac output, and stress. - Particles: Motion driven by the breathing phase and system vitality.
A skeuomorphic medical instrument panel providing full transparency into the simulation:
- CPG Circuit: Real-time firing rates and synaptic activity.
- Anatomy: Cross-sections of lung and heart mechanics.
- ECG: Multi-lead-style trace with rhythm-specific morphologies.
-
Vitals Readout: Comprehensive telemetry for
$PaCO_2$ ,$SpO_2$ , MAP, HR, and Stress. - Strip Chart: 10-second history of major physiological variables.
A lightweight overlay for real-time monitoring of internal state variables and population activity.
Brorb features biological entrainment via microphone input:
- Breath Detection: An
AudioWorklet-based envelope follower detects external exhalations. - Entrainment: Detected breaths provide excitatory drive to the CPG's post-inspiratory population, allowing the user to "breath with" or guide the simulation.
- Start: Click the screen to initialize the AudioContext and microphone.
vKey: Toggle the Dashboard view.dKey: Toggle the Debug Overlay.- Controls: Use the dashboard to simulate metabolic stress, respiratory arrest, or myocardial infarction (Heart Attack).
- Engine: Vanilla JavaScript (ES6 Modules).
- Solver: 4th-order Runge-Kutta (RK4) for neural and mechanical ODEs.
- Rendering: HTML5 Canvas API.
- No Dependencies: Runs entirely in the browser with no server-side requirements.