CirculatorySystemModels

Documentation for CirculatorySystemModels.

An acausal modelling library for Circulation Models

CirculatorySystemModels.jl is an acausal modelling library for zero-dimensional, or lumped parameter modelling of the circulatory system for ModelingToolkit.jl (MTK).

Integration into MTK and the SciML environment enables efficient solver methods (DifferentialEquations.jl), local and global parameter optimisation (Optimization.jl), Sensitivity Analysis (GlobalSensitivity.jl), and many other features in the SciML framework.

The acausal modelling approach in MTK was chosen to support a "if you can draw it you can model it" paradigm.

The main model states that are modelled throughout these models are:

  • volume flow rate (at nodes and through elements): $q\ [\mathrm{cm^{3}/s}]$ ($[\mathrm{ml/s}]$). Flow into an element is positive, flow out of an element is negative.
  • pressure (at nodes): $p\ [\mathrm{mm_{{Hg}}}]$.
  • pressure difference (over elements): $\Delta p\ [\mathrm{mm_{{Hg}}}]$. The pressure difference is following the usual fluid mechanical definition $\Delta p = p_{out} - p_{in}$. and is usually negative in flow direction!

Units

There are many unit systems that are used in circulation models. This modelling system uses the most common one, which uses $\mathrm{mm_{Hg}}$ for pressures and $\mathrm{ml/s}$ or $\mathrm{cm^3/s}$ for flow rates.

This is a variation of the $\mathrm{[g, cm, s]}$ system, which could be called $\mathrm{[g, cm, s, mm_{Hg}]}$ system.

Different model components are developed based on publications that use different unit systems. In those cases we attempted to keep the equations in the published system and do unit conversions transparently within the component function, while the outside API stays in the $\mathrm{[g, cm, s, mm_{Hg}]}$ system.

All model parameters are to be given in the $\mathrm{[g, cm, s, mm_{Hg}]}$ system unless otherwise specified in the component documentation.

Main variables

The flow is modelled in terms of pressure $p$ and flow $q$. In many 0D models of the circulation system these are replaced by the electrical terms of voltage $v$ and current $i$. For this model we want to use the physiologically relevant parameters. This also avoids the confusion of using the same symbol $v$ to denote both, potential at a connection, and the difference in potential over a component, as is commonly done in electrical analogon models. To denote the pressure drop over a component, this model uses the symbol $\Delta p$.

Time is a variable in all the symbolic operations, so needs to be defined as such (do not use t as a variable name elsewhere!). Variables can be set using the @variables macro.

@variables t