This repository contains a modular model of the human cardiac conduction system written in Modelica as well as an extension of this model that introduces a trigger for premature ventricular contractions (PVCs). It is based on the Seidel-Herzel Model (SHM) of the human baroreflex that was first published by Henrik Seidel in his PhD thesis [1].
The monolithic version of the conduction system model is based on a previous translation of the whole SHM from C to Modelica [2]. This modular version and the PVC extension where developed as an example how a language that is modular, hybrid (supporting multiple formalisms), human-readable, open-source, declarative, and graphical can facilitate model reuse. This will be discussed in detail in an upcoming paper of our research group [3].
The main parts of this project can be found in the following files:
SHMConduction/package.mo
contains a full description of the models in this project.SHMConduction/Components/MonolithicConduction.mo
contains the monolithic version of the contraction model.SHMConduction/Components/ModularConduction.mo
is the main file for the modular version binding all submodules together.SHMConduction/Components/PVC/ModularConductionX.mo
is the main file for the extended modular version with PVCs.SHMConduction/Examples/ModularExample.mo
contains a simulation example that comparesMonolithicConduction.mo
withModularConduction.mo
.SHMConduction/Examples/PVCExample.mo
contains a simulation example that tests the PVC extension for plausibility.
If you want to reproduce the plots in [3], you can alternatively use OMEdit (the IDE of OpenModelica), or the Julia script.
To reproduce the plots with OMEdit you have to use the following steps:
- Download and install OpenModelica.
- Clone this repository with Git or download a ZIP file of the current master branch and extract it with an archive manager of your choice.
- Start OMEdit and open the folder
SHMConduction
with "File" → "Load Library".
For Figure 2:
- Open the model
SHMConduction.Examples.ModularExample
(select from "Libraries Browser" on the left hand side with a double click). - Simulate the model with "Simulation" → "Simulate".
- In the "Variables Browser" on the right hand side select the variables
monC.T_cont
andmodC.T
.
For Figure 4:
- Open the model
SHMConduction.Examples.PVCExample
(select from "Libraries Browser" on the left hand side with a double click). - Navigate to the "Text View" () in the gray bar under the tab
PVCExample
. - Change the value of the parameter
with_sinus
either totrue
to produce Figure 4a or tofalse
for Figure 4b. - Simulate the model with "Simulation" → "Simulate".
- In the "Variables Browser" on the right hand side select the variable
con.T
.
Using the Julia script in scripts/unittests.jl
requires additional software, but eliminates the need to interact with OMEdit and allows you to use a plotting library or tool of your choice.
To reproduce the plots you have to use the following steps:
- Download and install OpenModelica.
- Download and install Julia.
- Clone this repository with Git or download a ZIP file of the current master branch and extract it with an archive manager of your choice.
- Run the following commands in a terminal from the repository folder:
julia --project=. -e 'ENV["PYTHON"]=""; using Pkg; Pkg.instantiate()'
julia scripts/unittests.jl
- This should create the folder
out
with the following result files:
SHMConduction.Examples.ModularExample_res.csv
contains the data for Figure 2 in the columnstime
,monC.T_cont
andmodC.T
.SHMConduction.Examples.PVCExample_res.csv
contains the data for Figure 4a in the columnstime
andcon.T
.PVCNoSinus_res.csv
contains the data for Figure 4b in the columnstime
andcon.T
- Produce the plots with a plotting tool or library of your choice or use the already existing Python script in
scripts/plot_mc_compare.py
which will write the plots as PDF files in to theout
folder. To run the Python script use the following commands:
python -m pip install -r requirements.txt
python scripts/plot_mc_compare.py
The models in this repository are described in the following article:
C. Schölzel, V. Blesius, G. Ernst, and A. Dominik, “Characteristics of mathematical modeling languages that facilitate model reuse in systems biology: a software engineering perspective,” npj Syst Biol Appl, vol. 7, no. 1, p. 27, 2021, doi: 10.1038/s41540-021-00182-w.
[1] H. Seidel, “Nonlinear dynamics of physiological rhythms,” PhD thesis, Technische Universität Berlin, Berlin, Germany, 1997.
[2] C. Schölzel, A. Goesmann, G. Ernst, and A. Dominik, “Modeling biology in Modelica: The human baroreflex,” in Proceedings of the 11th International Modelica Conference, Versailles, France, 2015, pp. 367–376.
[3] C. Schölzel, V. Blesius, G. Ernst, and A. Dominik, “Characteristics of mathematical modeling languages that facilitate model reuse in systems biology: A software engineering perspective,” bioRxiv, preprint 10.1101/2019.12.16.875260v6, 2021. doi: 10.1101/2019.12.16.875260.