From fe8fc84ff107a32a4d8ed874c5ee2c17b9a88bec Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Sun, 6 Oct 2024 07:10:06 +0000 Subject: [PATCH] build based on 1452959 --- dev/.documenter-siteinfo.json | 2 +- dev/autodoc/index.html | 2 +- dev/examples/BjordalsbakkeModel/index.html | 2 +- dev/index.html | 2 +- dev/objects.inv | Bin 979 -> 991 bytes dev/search_index.js | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 8dcf669..c0bad91 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-10-05T16:09:31","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-10-06T07:10:02","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/dev/autodoc/index.html b/dev/autodoc/index.html index 75795a7..9466f0f 100644 --- a/dev/autodoc/index.html +++ b/dev/autodoc/index.html @@ -1,2 +1,2 @@ -Method Index · CirculatorySystemModels.jl

Method Index (AutoDoc)

CirculatorySystemModels.CRConstant

CR(;name, R=1.0, C=1.0)

Implements the compliance, resistor subsystem.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).

Named parameters:

R: Component resistance in mmHg*s/ml

C: Component compliance in ml/mmHg

source
CirculatorySystemModels.CRLConstant

CRL(;name, C=1.0, R=1.0, L=1.0)

Implements the compliance, resistor, inductance subsystem.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).

Named parameters:

C: Component compliance in ml/mmHg

R: Component resistance in mmHg*s/ml

L: Component blood inertia in mmHg*s^2/ml

source
CirculatorySystemModels.CapacitorConstant

Capacitor(;name, C=1.0)

Implements a capacitor to represent vessel capacitance.

Parameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

C: capacitance of the vessel in ml/mmHg

source
CirculatorySystemModels.ConstantFlowConstant

ConstantFlow(;name, Q=1.0)

Implements a constant flow source to a system.

Parameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

Q: Constant flow in cm^3/s (ml/s)

source
CirculatorySystemModels.ConstantPressureConstant

ConstantPressure(;name, P=1.0)

Implements a constant pressure source to a system.

Parameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

P: Constant pressure in mmHg

source
CirculatorySystemModels.DHChamberConstant

DHChamber(;name, V₀, Eₘᵢₙ, n₁, n₂, τ, τ₁, τ₂, k, Eshift=0.0, inP=false)

The Double Hill chamber/ventricle model is defined based on the vessel element, but has a time varying elastance function modelling the contraction of muscle fibres

The time varying elastance is calculated using the Double Hill model.

This model uses external helper functions elastance and delastance which describe the elastance function and the first derivative of it.

It calculates the elastance as:

E(t) = (Eₘₐₓ - Eₘᵢₙ) * e(t) + Eₘᵢₙ

where e(t) is the Double-Hill function.

Named parameters:

V₀: stress-free volume (zero pressure volume)

p₀ pressure offset (defaults to zero) this is present in some papers (e.g. Shi), so is provided here for conformity. Defaults to 0.0

Eₘᵢₙ: minimum elastance

Eₘₐₓ: maximum elastance

n₁: rise coefficient

n₂: fall coefficient

τ: pulse length [s]

τ₁: rise timing parameter[s]

τ₂: fall timimg paramter [s]

k: elastance factor*

Eshift: time shift of contraction (for atria)

inP: (Bool) formulate in dp/dt (default: false)

*Note: k is not an independent parameter, it is a scaling factor that corresponds to 1/max(e(t)), which ensures that e(t) varies between zero and 1.0, such that E(t) varies between Eₘᵢₙ and Eₘₐₓ.

source
CirculatorySystemModels.DrivenFlowConstant

DrivenFlow(; name, fun, Q=1.0)

Implements a driven flow source to a system.

Parameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

Q: Constant flow in cm^3/s (ml/s).

τ Length of cardiac cycle is s

fun: Function which modulates the input

source
CirculatorySystemModels.DrivenPressureConstant

DrivenPressure(; name, fun, P=1.0)

Implements a driven pressure source to a system modulated by a function provided.

Parameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

P: Constant pressure in mmHg

fun: Function which modulates the input

source
CirculatorySystemModels.InductanceConstant

Inductance(;name, L=1.0)

Implements the inductance to represent blood inertance.

Parameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

L: Inertia of the fluid in mmHg*s^2/ml

source
CirculatorySystemModels.MynardValve_AtrioventricularConstant

MynardValve_Atrioventricular(; name, ρ, Mrg, Mst, Ann, Kvc, Kvo)

Implements the Mynard description for flow across the atrioventricular valves, full description in [Mynard]. This valve description corresponds to the atrioventricular valves where interia is not considered.

Note: The minimum level of regurgitation has to be set to machine precision eps()

Parameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s) p is scaled to ensure units are consistent throughout.

Named parameters:

name name of the element ρ Blood density in g/cm^3 Mrg Level of regurgitation exhibited by a valve in DN Mst Level of stenosis exhibited by a valve in DN Ann Annulus area in cm^2 Kvc Valve closing rate coefficent in cm^2/(dyness) Kvo Valve opening rate coefficent in cm^2/(dyness)

p is calculated in mmHg q is calculated in cm^3/s (ml/s)

source
CirculatorySystemModels.MynardValve_SemiLunarConstant

MynardValve_SemiLunar(; name, ρ, Leff, Mrg, Mst, Ann, Kvc, Kvo)

Implements the Mynard description for flow across the semilunar valves, full description in [Mynard]. This valve description corresponds to the semilunar valves where interia is an effect we consider.

Note: The minimum level of regurgitation has to be set to machine precision eps()

Parameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s) p is scaled to ensure units are consistent throughout.

Named parameters:

name name of the element ρ Blood density in g/cm^3 Leff An effective length in cm Mrg Level of regurgitation exhibited by a valve in DN Mst Level of stenosis exhibited by a valve in DN Ann Annulus area in cm^2 Kvc Valve closing rate coefficent in cm^2/(dyness) Kvo Valve opening rate coefficent in cm^2/(dyness)

p is calculated in mmHg q is calculated in cm^3/s (ml/s)

source
CirculatorySystemModels.OrificeValveConstant

OrificeValve(;name, CQ=1.0)

Implements the square-root pressure-flow relationship across a valve.

Parameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s)

Named parameters:

CQ Flow coefficent in ml/(s*mmHg^0.5)

source
CirculatorySystemModels.PoiseuilleResistorConstant

PoiseuilleResistor(;name, μ=3e-2, r=0.5, L=5)

Implements the resistance following the Poiseuille law.

Parameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

μ: viscosity of fluid in dyne s / cm^2

r: radius of vessel segmenty in cm

L: length of vessel segment in cm

source
CirculatorySystemModels.QResistorConstant

QResistor(;name, K=1.0)

Implements the quadratic resistor to represent a vessels non-linear resistance to blood flow.

Parameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

K: non-linear resistance of the vessel to the fluid in mmHg*s^2/ml^2

source
CirculatorySystemModels.RRCRConstant

RRCR(;name, R1=1.0, R2=1.0, R3=1.0, C=1.0)

Implements the resistor, resistor, compliance, resistor subsystem.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).

Named parameters:

R1: Component resistance in mmHg*s/ml

R2: Component resistance in mmHg*s/ml

C: Component compliance in ml/mmHg

R3: Component resistance in mmHg*s/ml

source
CirculatorySystemModels.ResistorConstant

Resistor(;name, R=1.0)

Implements the resistor using Ohm's law to represent a vessels linear resistance to blood flow.

Parameter is in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg q calculated in cm^3/s (ml/s)

Named parameters:

R: Resistance of the vessel to the fluid in mmHg*s/ml

source
CirculatorySystemModels.ResistorDiodeConstant

ResistorDiode(;name, R=1e-3)

Implements the resistance across a valve following Ohm's law exhibiting diode like behaviour.

Parameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s)

Named parameters:

R Resistance across the valve in mmHg*s/ml

source
CirculatorySystemModels.ShiAtriumConstant

ShiAtrium(;name, V₀, p₀, Eₘᵢₙ, Eₘₐₓ, τ, τpwb, τpww, inP = false)

Implementation of the Atrium following Shi/Korakianitis.

Named parameters:

name name of the element

V₀ Unstressed chamber volume in ml

p₀ Unstressed chamber pressure in mmHg

Eₘᵢₙ Minimum elastance (diastole) in mmHg/ml

Eₘₐₓ Maximum elastance (systole) in mmHg/ml

τ Length of cardiac cycle in s

τpwb Atrial contraction time in s

τpww Atrial offset time in s

source
CirculatorySystemModels.ShiChamberConstant

ShiChamber(;name, V₀, p₀=0.0, Eₘᵢₙ, Eₘₐₓ, τ, τₑₛ, τₑₚ, Eshift=0.0)

Implemention of a ventricle following Shi/Korakianitis.

This model uses external helper function shiElastance which describes the elastance function.

Named parameters:

V₀ stress-free volume (zero pressure volume)

p₀ pressure offset (defaults to zero) this is present in the original paper, so is provided here for conformity. Defaults to 0.0

Eₘᵢₙ minimum elastance

τ pulse length

τₑₛ end systolic time (end of rising cosine)

τₑₚ end pulse time (end of falling cosine)

Eshift: time shift of contraction (for atria), set to 0 for ventricle

inP: (Bool) formulate in dp/dt (default: false)

source
CirculatorySystemModels.ShiHeartConstant

ShiHeart(; name, τ, LV.V₀, LV.p0, LV.Emin, LV.Emax, LV.τes, LV.τed, LV.Eshift, RV.V₀, RV.p0, RV.Eₘᵢₙ, RV.Eₘₐₓ, RV.τes, RV.τed, RV.Eshift, LA.V₀, LA_p0, LA.Emin, LA.Emax, LA.τes, LA.τed, LA.Eshift, RA.V₀, RA.p0, RA.Emin, RA.Emax, RA.τes, RA.τed, RA.Eshift, AV.CQ, AV.Kp, AV.Kf, AV.Kb, AV.Kv, AV.θmax, AV.θmin, PV.CQ, PV.Kp, PV.Kf, PV.Kb, PV.Kv, PV.θmax, PV.θmin, MV.CQ, MV.Kp, MV.Kf, MV.Kb, MV.Kv, MV.θmax, MV.θmin, TV.CQ, TV.Kp, TV.Kf, TV.Kb, TV.Kv, TV.θmax, TV.θmin)

Models a whole heart, made up of 2 ventricles (Left & Right Ventricle) and 2 atria (Left & Right atrium) created from the ShiChamber element. Includes the 4 corresponding valves (Aortic, Mitral, Pulmonary and Tricuspid valve) created using the ShiValve element.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s). Maximum and Minimum angles given in rad, to convert from degrees multiply angle by pi/180.

Named parameters:

τ Length of the cardiac cycle in s

LV_V₀ Unstressed left ventricular volume in ml

LV_p0 Unstressed left ventricular pressure in mmHg

LV_Emin Minimum left ventricular elastance (diastole) in mmHg/ml

LV_Emax Maximum left ventricular elastance (systole) in mmHg/ml

LV_τes Left ventricular end systolic time in s

LV_τed Left ventricular end distolic time in s

LV_Eshift Shift time of contraction - 0 for left ventricle

RV_V₀ Unstressed right ventricular volume in ml

RV_p0 Unstressed right ventricular pressure in mmHg

RV_Emin Minimum right ventricular elastance (diastole) in mmHg/ml

RV_Emax Maximum right ventricular elastance (systole) in mmHg/ml

RV_τes Right ventricular end systolic time in s

RV_τed Right ventricular end distolic time in s

RV_Eshift Shift time of contraction - 0 for right ventricle

LA_V₀ Unstressed left atrial volume in ml

LA_p0 Unstressed left atrial pressure in mmHg

LA_Emin Minimum left atrial elastance (diastole) in mmHg/ml

LA_Emax Maximum left atrial elastance (systole) in mmHg/ml

LA_τes Left atrial end systolic time in s

LA_τed Left atrial end distolic time in s

LA_Eshift Shift time of contraction in s

RA_V₀ Unstressed right atrial volume in ml

RA_p0 Unstressed right atrial pressure in mmHg

RA_Emin Minimum right atrial elastance (diastole) in mmHg/ml

RA_Emax Maximum right atrial elastance (systole) in mmHg/ml

RA_τes Right atrial end systolic time in s

RA_τed Right atrial end distolic time in s

RA_Eshift Shift time of contraction in s

AV_CQ Aortic valve flow coefficent in ml/(s*mmHg^0.5)

AV_Kp Pressure effect on the aortic valve in rad/(s^2*mmHg)

AV_Kf Frictional effect on the aortic valve in 1/s

AV_Kb Fluid velocity effect on the aortic valve in rad/(s*m)

AV_Kv Vortex effect on the aortic valve in rad/(s*m)

AV_θmax Aortic valve maximum opening angle in rad

AV_θmin Aortic valve minimum opening angle in rad

MV_CQ Mitral valve flow coefficent in ml/(s*mmHg^0.5)

MV_Kp Pressure effect on the mitral valve in rad/(s^2*mmHg)

MV_Kf Frictional effect on the mitral valve in 1/s

MV_Kb Fluid velocity effect on the mitral valve in rad/(s*m)

MV_Kv Vortex effect on the mitral valve in rad/(s*m)

MV_θmax Mitral valve maximum opening angle in rad

MV_θmin Mitral valve minimum opening angle in rad

PV_CQ Pulmonary valve flow coefficent in ml/(s*mmHg^0.5)

PV_Kp Pressure effect on the pulmonary valve in rad/(s^2*mmHg)

PV_Kf Frictional effect on the pulmonary valve in 1/s

PV_Kb Fluid velocity effect on the pulmonary valve in rad/(s*m)

PV_Kv Vortex effect on the pulmonary valve in rad/(s*m)

PV_θmax Pulmonary valve maximum opening angle in rad

PV_θmin Pulmonary valve minimum opening angle in rad

TV_CQ Tricuspid valve flow coefficent in ml/(s*mmHg^0.5)

TV_Kp Pressure effect on the tricuspid valve in rad/(s^2*mmHg)

TV_Kf Frictional effect on the tricuspid valve in 1/s

TV_Kb Fluid velocity effect on the tricuspid valve in rad/(s*m)

TV_Kv Vortex effect on the pulmonary valve in rad/(s*m)

TV_θmax Tricuspid valve maximum opening angle in rad

TV_θmin Tricuspid valve minimum opening angle in rad

source
CirculatorySystemModels.ShiPulmonaryLoopConstant

ShiPulmonaryLoop(; name, PAS.C, PAS.R, PAS.L, PAT.C, PAT.R, PAT.L, PAR.R, PCP.R, PVN.C, PVN.R)

Implements systemic loop as written by Shi in [Shi].

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).

Named parameters:

PAS__C: Artery sinus compliance in ml/mmHg

PAS__R: Artery sinus resistance in mmHg*s/ml

PAS__L: Artery sinus Inductance in mmHg*s^2/ml

PAT__C: Artery compliance in ml/mmHg

PAT__R: Artery resistance in mmHg*s/ml

PAT__L: Artery Inductance in mmHg*s^2/ml

PAR__R: Arteriole resistance in mmHg*s/ml

PCP__R: Capillary resistance in mmHg*s/ml

PVN__C: Vein compliance in ml/mmHg

PVN__R: Vein resistance in mmHg*s/ml

source
CirculatorySystemModels.ShiSystemicLoopConstant

ShiSystemicLoop(; name, SAS.C, SAS.R, SAS.L, SAT.C, SAT.R, SAT.L, SAR.R, SCP.R, SVN.C, SVN.R)

Implements systemic loop as written by Shi in [Shi].

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).

Named parameters:

SAS_C: Aortic sinus compliance in ml/mmHg

SAS_R: Aortic sinus resistance in mmHg*s/ml

SAS_L: Aortic sinus inductance in mmHg*s^2/ml

SAT_C: Artery compliance in ml/mmHg

SAT_R: Artery resistance in mmHg*s/ml

SAT_L: Artery inductance in mmHg*s^2/ml

SAR_R: Arteriole resistance in mmHg*s/ml

SCP_R: Capillary resistance in mmHg*s/ml

SVN_C: Vein compliance in ml/mmHg

SVN_R: Vein resistance in mmHg*s/ml

source
CirculatorySystemModels.WK3Constant

WK3(;name, Rc=1.0, Rp=1.0, C=1.0)

Implements the 3 element windkessel model.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

Rp: Peripheral resistance in mmHg*s/ml

C: Arterial compliance in ml/mmHg

source
CirculatorySystemModels.WK3EConstant

WK3E(;name, Rc=1.0, Rp=1.0, E=1.0)

Implements the 3 element windkessel model. With a vessel elastance instead of a capacitor.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

Rp: Peripheral resistance in mmHg*s/ml

E: Arterial elastance in mmHg/ml

source
CirculatorySystemModels.WK4_PConstant

WK4_P(;name, Rc=1.0, L=1.0, Rp=1.0, C=1.0)

Implements the 4 element windkessel model with parallel inertance.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

L: Inertance/Inductance in mmHgs^2ml^-1

Rp: Peripheral resistance in mmHg*s/ml

C: Arterial compliance in ml/mmHg

source
CirculatorySystemModels.WK4_PEConstant

WK4_PE(;name, Rc=1.0, L=1.0, Rp=1.0, E=1.0)

Implements the 4 element windkessel model with parallel inertance. With a vessel elastance instead of a capacitor.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

L: Inertance/Inductance in mmHgs^2ml^-1

Rp: Peripheral resistance in mmHg*s/ml

E: Arterial elastance in mmHg/ml

source
CirculatorySystemModels.WK4_SConstant

WK4_S(;name, Rc=1.0, L=1.0, Rp=1.0, C=1.0)

Implements the 4 element windkessel model with serial inertance.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

L: Inertance/Inductance in mmHgs^2ml^-1

Rp: Peripheral resistance in mmHg*s/ml

C: Arterial compliance in ml/mmHg

source
CirculatorySystemModels.WK4_SEConstant

WK4_SE(;name, Rc=1.0, L=1.0, Rp=1.0, E=1.0)

Implements the 4 element windkessel model with serial inertance. With a vessel elastance instead of a capacitor.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

L: Inertance/Inductance in mmHgs^2ml^-1

Rp: Peripheral resistance in mmHg*s/ml

E: Arterial elastance in mmHg/ml

source
CirculatorySystemModels.ComplianceMethod

Compliance(; name, V₀=0.0, C=1.0, inP=false, has_ep=false, has_variable_ep=false, p₀=0.0)

Implements the compliance of a vessel.

Parameters are in the cm, g, s system. Pressure in mmHg. p is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

V₀: Unstressed volume ml

C: Vessel compliance in ml/mmHg

inP: (Bool) formulate in dp/dt (default: false)

has_ep: (Bool) if true, add a parameter p₀ for pressure offset e.g., for thoracic pressure (default: false)

p₀: External pressure in mmHg (e.g., thorax pressure, default: 0.0) Note: if this argument is set, it will be used, even if `hasepisfalse.haseponly controls ifp₀` will be exposed as a parameter!

hasvariableep: (Bool) expose pin for variable external pressure (default: false) This pin can be connected to another pin or function providing external pressure. _Note: ifhasvariableepis set totruethis pin is created, independent ofhasep`!

source
CirculatorySystemModels.DShiElastanceMethod

DShiElastance(t, Eₘᵢₙ, Eₘₐₓ, τ, τₑₛ, τₑₚ, Eshift)

Helper function for ShiChamber

Derivative of the elastance function E(t) for ventricle simulation based on Shi's double cosine function.

Parameters:

Eₘᵢₙ: minimum elastance (diastole)

Eₘₐₓ: maximum elastance (systole)

τₑₛ: end systolic time (end of rising cosine)

τₑₚ: end of pulse time (end of falling cosine)

Eshift: time shift of contraction (for atria), set to 0 for ventricle

source
CirculatorySystemModels.ElastanceMethod

Elastance(; name, V₀=0.0, E=1.0, inP=false, has_ep=false, has_variable_ep=false, p₀=0.0)

Implements the elastance of a vessel. Elastance more commonly used to describe the heart.

Parameters are in the cm, g, s system. Pressure in mmHg. p is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

V₀: Unstressed volume ml

E: Vessel elastance in ml/mmHg. Equivalent to compliance as E=1/C

inP: (Bool) formulate in dp/dt (default: false)

has_ep: (Bool) if true, add a parameter p₀ for pressure offset e.g., for thoracic pressure (default: false)

p₀: External pressure in mmHg (e.g., thorax pressure, default: 0.0) Note: if this argument is set, it will be used, even if `hasepisfalse.haseponly controls ifp₀` will be exposed as a parameter!

hasvariableep: (Bool) expose pin for variable external pressure (default: false) This pin can be connected to another pin or function providing external pressure. _Note: ifhasvariableepis set totruethis pin is created, independent ofhasep`!

source
CirculatorySystemModels.ShiElastanceMethod

ShiElastance(t, Eₘᵢₙ, Eₘₐₓ, τ, τₑₛ, τₑₚ, Eshift)

Elastance function E(t) for ventricle simulation based on Shi's double cosine function.

Parameters:

Eₘᵢₙ: minimum elastance (diastole)

Eₘₐₓ: maximum elastance (systole)

τₑₛ: end systolic time (end of rising cosine)

τₑₚ: end of pulse time (end of falling cosine)

Eshift: time shift of contraction (for atria), set to 0 for ventricle

source
CirculatorySystemModels.ShiValveMethod

ShiValve(; name, CQ, Kp, Kf, Kb, Kv, θmax, θmin)

Implements the Shi description for valve opening and closing, full description in [Shi].

Parameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s) Maximum and Minimum angles given in rad, to convert from degrees multiply angle by pi/180.

Named parameters:

CQ Flow coefficent in ml/(s*mmHg^0.5)

Kp Pressure effect on the valve in rad/(s^2*mmHg)

Kf Frictional effect on the valve in 1/s

Kb Fluid velocity effect on the valve in rad/(s*m)

Kv Vortex effect on the valve in rad/(s*m)

θmax Valve maximum opening angle in rad

θmin Valve minimum opening angle in rad

source
CirculatorySystemModels.VariableElastanceMethod

VariableElastance(; name, V₀=0.0, C=1.0, Escale=1.0, fun, inP=false, has_ep=false, has_variable_ep=false, p₀=0.0)

VariableElastance is defined based on the Elastance element, but has a time varying elastance function modelling the contraction of muscle fibres.

Named parameters:

V₀: stress-free volume (zero pressure volume)

Escale: scaling factor (elastance factor)

fun: function object for elastance (must be fun(t))

inP: (Bool) formulate in dp/dt (default: false)

has_ep: (Bool) if true, add a parameter p₀ for pressure offset e.g., for thoracic pressure (default: false)

p₀: External pressure in mmHg (e.g., thorax pressure, default: 0.0) Note: if this argument is set, it will be used, even if `hasepisfalse.haseponly controls ifp₀` will be exposed as a parameter!

hasvariableep: (Bool) expose pin for variable external pressure (default: false) This pin can be connected to another pin or function providing external pressure. _Note: ifhasvariableepis set totruethis pin is created, independent ofhasep`!

source
+Method Index · CirculatorySystemModels.jl

Method Index (AutoDoc)

CirculatorySystemModels.CRConstant

CR(;name, R=1.0, C=1.0)

Implements the compliance, resistor subsystem.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).

Named parameters:

R: Component resistance in mmHg*s/ml

C: Component compliance in ml/mmHg

source
CirculatorySystemModels.CRLConstant

CRL(;name, C=1.0, R=1.0, L=1.0)

Implements the compliance, resistor, inductance subsystem.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).

Named parameters:

C: Component compliance in ml/mmHg

R: Component resistance in mmHg*s/ml

L: Component blood inertia in mmHg*s^2/ml

source
CirculatorySystemModels.CapacitorConstant

Capacitor(;name, C=1.0)

Implements a capacitor to represent vessel capacitance.

Parameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

C: capacitance of the vessel in ml/mmHg

source
CirculatorySystemModels.ConstantFlowConstant

ConstantFlow(;name, Q=1.0)

Implements a constant flow source to a system.

Parameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

Q: Constant flow in cm^3/s (ml/s)

source
CirculatorySystemModels.ConstantPressureConstant

ConstantPressure(;name, P=1.0)

Implements a constant pressure source to a system.

Parameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

P: Constant pressure in mmHg

source
CirculatorySystemModels.DHChamberConstant

DHChamber(;name, V₀, Eₘᵢₙ, n₁, n₂, τ, τ₁, τ₂, k, Eshift=0.0, inP=false)

The Double Hill chamber/ventricle model is defined based on the vessel element, but has a time varying elastance function modelling the contraction of muscle fibres

The time varying elastance is calculated using the Double Hill model.

This model uses external helper functions elastance and delastance which describe the elastance function and the first derivative of it.

It calculates the elastance as:

E(t) = (Eₘₐₓ - Eₘᵢₙ) * e(t) + Eₘᵢₙ

where e(t) is the Double-Hill function.

Named parameters:

V₀: stress-free volume (zero pressure volume)

p₀ pressure offset (defaults to zero) this is present in some papers (e.g. Shi), so is provided here for conformity. Defaults to 0.0

Eₘᵢₙ: minimum elastance

Eₘₐₓ: maximum elastance

n₁: rise coefficient

n₂: fall coefficient

τ: pulse length [s]

τ₁: rise timing parameter[s]

τ₂: fall timimg paramter [s]

k: elastance factor*

Eshift: time shift of contraction (for atria)

inP: (Bool) formulate in dp/dt (default: false)

*Note: k is not an independent parameter, it is a scaling factor that corresponds to 1/max(e(t)), which ensures that e(t) varies between zero and 1.0, such that E(t) varies between Eₘᵢₙ and Eₘₐₓ.

source
CirculatorySystemModels.DrivenFlowConstant

DrivenFlow(; name, fun, Q=1.0)

Implements a driven flow source to a system.

Parameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

Q: Constant flow in cm^3/s (ml/s).

τ Length of cardiac cycle is s

fun: Function which modulates the input

source
CirculatorySystemModels.DrivenPressureConstant

DrivenPressure(; name, fun, P=1.0)

Implements a driven pressure source to a system modulated by a function provided.

Parameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

P: Constant pressure in mmHg

fun: Function which modulates the input

source
CirculatorySystemModels.InductanceConstant

Inductance(;name, L=1.0)

Implements the inductance to represent blood inertance.

Parameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

L: Inertia of the fluid in mmHg*s^2/ml

source
CirculatorySystemModels.MynardValve_AtrioventricularConstant

MynardValve_Atrioventricular(; name, ρ, Mrg, Mst, Ann, Kvc, Kvo)

Implements the Mynard description for flow across the atrioventricular valves, full description in [Mynard]. This valve description corresponds to the atrioventricular valves where interia is not considered.

Note: The minimum level of regurgitation has to be set to machine precision eps()

Parameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s) p is scaled to ensure units are consistent throughout.

Named parameters:

name name of the element ρ Blood density in g/cm^3 Mrg Level of regurgitation exhibited by a valve in DN Mst Level of stenosis exhibited by a valve in DN Ann Annulus area in cm^2 Kvc Valve closing rate coefficent in cm^2/(dyness) Kvo Valve opening rate coefficent in cm^2/(dyness)

p is calculated in mmHg q is calculated in cm^3/s (ml/s)

source
CirculatorySystemModels.MynardValve_SemiLunarConstant

MynardValve_SemiLunar(; name, ρ, Leff, Mrg, Mst, Ann, Kvc, Kvo)

Implements the Mynard description for flow across the semilunar valves, full description in [Mynard]. This valve description corresponds to the semilunar valves where interia is an effect we consider.

Note: The minimum level of regurgitation has to be set to machine precision eps()

Parameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s) p is scaled to ensure units are consistent throughout.

Named parameters:

name name of the element ρ Blood density in g/cm^3 Leff An effective length in cm Mrg Level of regurgitation exhibited by a valve in DN Mst Level of stenosis exhibited by a valve in DN Ann Annulus area in cm^2 Kvc Valve closing rate coefficent in cm^2/(dyness) Kvo Valve opening rate coefficent in cm^2/(dyness)

p is calculated in mmHg q is calculated in cm^3/s (ml/s)

source
CirculatorySystemModels.OrificeValveConstant

OrificeValve(;name, CQ=1.0)

Implements the square-root pressure-flow relationship across a valve.

Parameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s)

Named parameters:

CQ Flow coefficent in ml/(s*mmHg^0.5)

source
CirculatorySystemModels.PoiseuilleResistorConstant

PoiseuilleResistor(;name, μ=3e-2, r=0.5, L=5)

Implements the resistance following the Poiseuille law.

Parameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

μ: viscosity of fluid in dyne s / cm^2

r: radius of vessel segmenty in cm

L: length of vessel segment in cm

source
CirculatorySystemModels.QResistorConstant

QResistor(;name, K=1.0)

Implements the quadratic resistor to represent a vessels non-linear resistance to blood flow.

Parameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

K: non-linear resistance of the vessel to the fluid in mmHg*s^2/ml^2

source
CirculatorySystemModels.RRCRConstant

RRCR(;name, R1=1.0, R2=1.0, R3=1.0, C=1.0)

Implements the resistor, resistor, compliance, resistor subsystem.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).

Named parameters:

R1: Component resistance in mmHg*s/ml

R2: Component resistance in mmHg*s/ml

C: Component compliance in ml/mmHg

R3: Component resistance in mmHg*s/ml

source
CirculatorySystemModels.ResistorConstant

Resistor(;name, R=1.0)

Implements the resistor using Ohm's law to represent a vessels linear resistance to blood flow.

Parameter is in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg q calculated in cm^3/s (ml/s)

Named parameters:

R: Resistance of the vessel to the fluid in mmHg*s/ml

source
CirculatorySystemModels.ResistorDiodeConstant

ResistorDiode(;name, R=1e-3)

Implements the resistance across a valve following Ohm's law exhibiting diode like behaviour.

Parameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s)

Named parameters:

R Resistance across the valve in mmHg*s/ml

source
CirculatorySystemModels.ShiAtriumConstant

ShiAtrium(;name, V₀, p₀, Eₘᵢₙ, Eₘₐₓ, τ, τpwb, τpww, inP = false)

Implementation of the Atrium following Shi/Korakianitis.

Named parameters:

name name of the element

V₀ Unstressed chamber volume in ml

p₀ Unstressed chamber pressure in mmHg

Eₘᵢₙ Minimum elastance (diastole) in mmHg/ml

Eₘₐₓ Maximum elastance (systole) in mmHg/ml

τ Length of cardiac cycle in s

τpwb Atrial contraction time in s

τpww Atrial offset time in s

source
CirculatorySystemModels.ShiChamberConstant

ShiChamber(;name, V₀, p₀=0.0, Eₘᵢₙ, Eₘₐₓ, τ, τₑₛ, τₑₚ, Eshift=0.0)

Implemention of a ventricle following Shi/Korakianitis.

This model uses external helper function shiElastance which describes the elastance function.

Named parameters:

V₀ stress-free volume (zero pressure volume)

p₀ pressure offset (defaults to zero) this is present in the original paper, so is provided here for conformity. Defaults to 0.0

Eₘᵢₙ minimum elastance

τ pulse length

τₑₛ end systolic time (end of rising cosine)

τₑₚ end pulse time (end of falling cosine)

Eshift: time shift of contraction (for atria), set to 0 for ventricle

inP: (Bool) formulate in dp/dt (default: false)

source
CirculatorySystemModels.ShiHeartConstant

ShiHeart(; name, τ, LV.V₀, LV.p0, LV.Emin, LV.Emax, LV.τes, LV.τed, LV.Eshift, RV.V₀, RV.p0, RV.Eₘᵢₙ, RV.Eₘₐₓ, RV.τes, RV.τed, RV.Eshift, LA.V₀, LA_p0, LA.Emin, LA.Emax, LA.τes, LA.τed, LA.Eshift, RA.V₀, RA.p0, RA.Emin, RA.Emax, RA.τes, RA.τed, RA.Eshift, AV.CQ, AV.Kp, AV.Kf, AV.Kb, AV.Kv, AV.θmax, AV.θmin, PV.CQ, PV.Kp, PV.Kf, PV.Kb, PV.Kv, PV.θmax, PV.θmin, MV.CQ, MV.Kp, MV.Kf, MV.Kb, MV.Kv, MV.θmax, MV.θmin, TV.CQ, TV.Kp, TV.Kf, TV.Kb, TV.Kv, TV.θmax, TV.θmin)

Models a whole heart, made up of 2 ventricles (Left & Right Ventricle) and 2 atria (Left & Right atrium) created from the ShiChamber element. Includes the 4 corresponding valves (Aortic, Mitral, Pulmonary and Tricuspid valve) created using the ShiValve element.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s). Maximum and Minimum angles given in rad, to convert from degrees multiply angle by pi/180.

Named parameters:

τ Length of the cardiac cycle in s

LV_V₀ Unstressed left ventricular volume in ml

LV_p0 Unstressed left ventricular pressure in mmHg

LV_Emin Minimum left ventricular elastance (diastole) in mmHg/ml

LV_Emax Maximum left ventricular elastance (systole) in mmHg/ml

LV_τes Left ventricular end systolic time in s

LV_τed Left ventricular end distolic time in s

LV_Eshift Shift time of contraction - 0 for left ventricle

RV_V₀ Unstressed right ventricular volume in ml

RV_p0 Unstressed right ventricular pressure in mmHg

RV_Emin Minimum right ventricular elastance (diastole) in mmHg/ml

RV_Emax Maximum right ventricular elastance (systole) in mmHg/ml

RV_τes Right ventricular end systolic time in s

RV_τed Right ventricular end distolic time in s

RV_Eshift Shift time of contraction - 0 for right ventricle

LA_V₀ Unstressed left atrial volume in ml

LA_p0 Unstressed left atrial pressure in mmHg

LA_Emin Minimum left atrial elastance (diastole) in mmHg/ml

LA_Emax Maximum left atrial elastance (systole) in mmHg/ml

LA_τes Left atrial end systolic time in s

LA_τed Left atrial end distolic time in s

LA_Eshift Shift time of contraction in s

RA_V₀ Unstressed right atrial volume in ml

RA_p0 Unstressed right atrial pressure in mmHg

RA_Emin Minimum right atrial elastance (diastole) in mmHg/ml

RA_Emax Maximum right atrial elastance (systole) in mmHg/ml

RA_τes Right atrial end systolic time in s

RA_τed Right atrial end distolic time in s

RA_Eshift Shift time of contraction in s

AV_CQ Aortic valve flow coefficent in ml/(s*mmHg^0.5)

AV_Kp Pressure effect on the aortic valve in rad/(s^2*mmHg)

AV_Kf Frictional effect on the aortic valve in 1/s

AV_Kb Fluid velocity effect on the aortic valve in rad/(s*m)

AV_Kv Vortex effect on the aortic valve in rad/(s*m)

AV_θmax Aortic valve maximum opening angle in rad

AV_θmin Aortic valve minimum opening angle in rad

MV_CQ Mitral valve flow coefficent in ml/(s*mmHg^0.5)

MV_Kp Pressure effect on the mitral valve in rad/(s^2*mmHg)

MV_Kf Frictional effect on the mitral valve in 1/s

MV_Kb Fluid velocity effect on the mitral valve in rad/(s*m)

MV_Kv Vortex effect on the mitral valve in rad/(s*m)

MV_θmax Mitral valve maximum opening angle in rad

MV_θmin Mitral valve minimum opening angle in rad

PV_CQ Pulmonary valve flow coefficent in ml/(s*mmHg^0.5)

PV_Kp Pressure effect on the pulmonary valve in rad/(s^2*mmHg)

PV_Kf Frictional effect on the pulmonary valve in 1/s

PV_Kb Fluid velocity effect on the pulmonary valve in rad/(s*m)

PV_Kv Vortex effect on the pulmonary valve in rad/(s*m)

PV_θmax Pulmonary valve maximum opening angle in rad

PV_θmin Pulmonary valve minimum opening angle in rad

TV_CQ Tricuspid valve flow coefficent in ml/(s*mmHg^0.5)

TV_Kp Pressure effect on the tricuspid valve in rad/(s^2*mmHg)

TV_Kf Frictional effect on the tricuspid valve in 1/s

TV_Kb Fluid velocity effect on the tricuspid valve in rad/(s*m)

TV_Kv Vortex effect on the pulmonary valve in rad/(s*m)

TV_θmax Tricuspid valve maximum opening angle in rad

TV_θmin Tricuspid valve minimum opening angle in rad

source
CirculatorySystemModels.ShiPulmonaryLoopConstant

ShiPulmonaryLoop(; name, PAS.C, PAS.R, PAS.L, PAT.C, PAT.R, PAT.L, PAR.R, PCP.R, PVN.C, PVN.R)

Implements systemic loop as written by Shi in [Shi].

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).

Named parameters:

PAS__C: Artery sinus compliance in ml/mmHg

PAS__R: Artery sinus resistance in mmHg*s/ml

PAS__L: Artery sinus Inductance in mmHg*s^2/ml

PAT__C: Artery compliance in ml/mmHg

PAT__R: Artery resistance in mmHg*s/ml

PAT__L: Artery Inductance in mmHg*s^2/ml

PAR__R: Arteriole resistance in mmHg*s/ml

PCP__R: Capillary resistance in mmHg*s/ml

PVN__C: Vein compliance in ml/mmHg

PVN__R: Vein resistance in mmHg*s/ml

source
CirculatorySystemModels.ShiSystemicLoopConstant

ShiSystemicLoop(; name, SAS.C, SAS.R, SAS.L, SAT.C, SAT.R, SAT.L, SAR.R, SCP.R, SVN.C, SVN.R)

Implements systemic loop as written by Shi in [Shi].

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).

Named parameters:

SAS_C: Aortic sinus compliance in ml/mmHg

SAS_R: Aortic sinus resistance in mmHg*s/ml

SAS_L: Aortic sinus inductance in mmHg*s^2/ml

SAT_C: Artery compliance in ml/mmHg

SAT_R: Artery resistance in mmHg*s/ml

SAT_L: Artery inductance in mmHg*s^2/ml

SAR_R: Arteriole resistance in mmHg*s/ml

SCP_R: Capillary resistance in mmHg*s/ml

SVN_C: Vein compliance in ml/mmHg

SVN_R: Vein resistance in mmHg*s/ml

source
CirculatorySystemModels.WK3Constant

WK3(;name, Rc=1.0, Rp=1.0, C=1.0)

Implements the 3 element windkessel model.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

Rp: Peripheral resistance in mmHg*s/ml

C: Arterial compliance in ml/mmHg

source
CirculatorySystemModels.WK3EConstant

WK3E(;name, Rc=1.0, Rp=1.0, E=1.0)

Implements the 3 element windkessel model. With a vessel elastance instead of a capacitor.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

Rp: Peripheral resistance in mmHg*s/ml

E: Arterial elastance in mmHg/ml

source
CirculatorySystemModels.WK4_PConstant

WK4_P(;name, Rc=1.0, L=1.0, Rp=1.0, C=1.0)

Implements the 4 element windkessel model with parallel inertance.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

L: Inertance/Inductance in mmHgs^2ml^-1

Rp: Peripheral resistance in mmHg*s/ml

C: Arterial compliance in ml/mmHg

source
CirculatorySystemModels.WK4_PEConstant

WK4_PE(;name, Rc=1.0, L=1.0, Rp=1.0, E=1.0)

Implements the 4 element windkessel model with parallel inertance. With a vessel elastance instead of a capacitor.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

L: Inertance/Inductance in mmHgs^2ml^-1

Rp: Peripheral resistance in mmHg*s/ml

E: Arterial elastance in mmHg/ml

source
CirculatorySystemModels.WK4_SConstant

WK4_S(;name, Rc=1.0, L=1.0, Rp=1.0, C=1.0)

Implements the 4 element windkessel model with serial inertance.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

L: Inertance/Inductance in mmHgs^2ml^-1

Rp: Peripheral resistance in mmHg*s/ml

C: Arterial compliance in ml/mmHg

source
CirculatorySystemModels.WK4_SEConstant

WK4_SE(;name, Rc=1.0, L=1.0, Rp=1.0, E=1.0)

Implements the 4 element windkessel model with serial inertance. With a vessel elastance instead of a capacitor.

Parameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)

Named parameters:

Rc: Characteristic impedance in mmHg*s/ml

L: Inertance/Inductance in mmHgs^2ml^-1

Rp: Peripheral resistance in mmHg*s/ml

E: Arterial elastance in mmHg/ml

source
CirculatorySystemModels.ComplianceMethod

Compliance(; name, V₀=0.0, C=1.0, inP=false, has_ep=false, has_variable_ep=false, p₀=0.0)

Implements the compliance of a vessel.

Parameters are in the cm, g, s system. Pressure in mmHg. p is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

V₀: Unstressed volume ml

C: Vessel compliance in ml/mmHg

inP: (Bool) formulate in dp/dt (default: false)

has_ep: (Bool) if true, add a parameter p₀ for pressure offset e.g., for thoracic pressure (default: false)

p₀: External pressure in mmHg (e.g., thorax pressure, default: 0.0) Note: if this argument is set, it will be used, even if `hasepisfalse.haseponly controls ifp₀` will be exposed as a parameter!

hasvariableep: (Bool) expose pin for variable external pressure (default: false) This pin can be connected to another pin or function providing external pressure. _Note: ifhasvariableepis set totruethis pin is created, independent ofhasep`!

source
CirculatorySystemModels.DShiElastanceMethod

DShiElastance(t, Eₘᵢₙ, Eₘₐₓ, τ, τₑₛ, τₑₚ, Eshift)

Helper function for ShiChamber

Derivative of the elastance function E(t) for ventricle simulation based on Shi's double cosine function.

Parameters:

Eₘᵢₙ: minimum elastance (diastole)

Eₘₐₓ: maximum elastance (systole)

τₑₛ: end systolic time (end of rising cosine)

τₑₚ: end of pulse time (end of falling cosine)

Eshift: time shift of contraction (for atria), set to 0 for ventricle

source
CirculatorySystemModels.ElastanceMethod

Elastance(; name, V₀=0.0, E=1.0, inP=false, has_ep=false, has_variable_ep=false, p₀=0.0)

Implements the elastance of a vessel. Elastance more commonly used to describe the heart.

Parameters are in the cm, g, s system. Pressure in mmHg. p is calculated in mmHg, q is calculated in cm^3/s (ml/s).

Named parameters:

V₀: Unstressed volume ml

E: Vessel elastance in ml/mmHg. Equivalent to compliance as E=1/C

inP: (Bool) formulate in dp/dt (default: false)

has_ep: (Bool) if true, add a parameter p₀ for pressure offset e.g., for thoracic pressure (default: false)

p₀: External pressure in mmHg (e.g., thorax pressure, default: 0.0) Note: if this argument is set, it will be used, even if `hasepisfalse.haseponly controls ifp₀` will be exposed as a parameter!

hasvariableep: (Bool) expose pin for variable external pressure (default: false) This pin can be connected to another pin or function providing external pressure. _Note: ifhasvariableepis set totruethis pin is created, independent ofhasep`!

source
CirculatorySystemModels.ShiElastanceMethod

ShiElastance(t, Eₘᵢₙ, Eₘₐₓ, τ, τₑₛ, τₑₚ, Eshift)

Elastance function E(t) for ventricle simulation based on Shi's double cosine function.

Parameters:

Eₘᵢₙ: minimum elastance (diastole)

Eₘₐₓ: maximum elastance (systole)

τₑₛ: end systolic time (end of rising cosine)

τₑₚ: end of pulse time (end of falling cosine)

Eshift: time shift of contraction (for atria), set to 0 for ventricle

source
CirculatorySystemModels.ShiValveMethod

ShiValve(; name, CQ, Kp, Kf, Kb, Kv, θmax, θmin)

Implements the Shi description for valve opening and closing, full description in [Shi].

Parameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s) Maximum and Minimum angles given in rad, to convert from degrees multiply angle by pi/180.

Named parameters:

CQ Flow coefficent in ml/(s*mmHg^0.5)

Kp Pressure effect on the valve in rad/(s^2*mmHg)

Kf Frictional effect on the valve in 1/s

Kb Fluid velocity effect on the valve in rad/(s*m)

Kv Vortex effect on the valve in rad/(s*m)

θmax Valve maximum opening angle in rad

θmin Valve minimum opening angle in rad

source
CirculatorySystemModels.VariableElastanceMethod

VariableElastance(; name, V₀=0.0, C=1.0, Escale=1.0, fun, inP=false, has_ep=false, has_variable_ep=false, p₀=0.0)

VariableElastance is defined based on the Elastance element, but has a time varying elastance function modelling the contraction of muscle fibres.

Named parameters:

V₀: stress-free volume (zero pressure volume)

Escale: scaling factor (elastance factor)

fun: function object for elastance (must be fun(t))

inP: (Bool) formulate in dp/dt (default: false)

has_ep: (Bool) if true, add a parameter p₀ for pressure offset e.g., for thoracic pressure (default: false)

p₀: External pressure in mmHg (e.g., thorax pressure, default: 0.0) Note: if this argument is set, it will be used, even if `hasepisfalse.haseponly controls ifp₀` will be exposed as a parameter!

hasvariableep: (Bool) expose pin for variable external pressure (default: false) This pin can be connected to another pin or function providing external pressure. _Note: ifhasvariableepis set totruethis pin is created, independent ofhasep`!

source
diff --git a/dev/examples/BjordalsbakkeModel/index.html b/dev/examples/BjordalsbakkeModel/index.html index 78de13d..66d0c27 100644 --- a/dev/examples/BjordalsbakkeModel/index.html +++ b/dev/examples/BjordalsbakkeModel/index.html @@ -188,4 +188,4 @@ img = DisplayAs.Text(DisplayAs.PNG(img)) -imgExample block output

This page was generated using Literate.jl.

+imgExample block output

This page was generated using Literate.jl.

diff --git a/dev/index.html b/dev/index.html index 406d0b8..602bb1d 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · CirculatorySystemModels.jl

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
+Home · CirculatorySystemModels.jl

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 the independent variable in all the symbolic operations, so needs to be defined as such (do not use t as a variable name elsewhere!). This can be set using the @independent_variables macro.

@independent_variables t

Compatibility

From version 0.4.0 CirculatorySystemModels is only compatible with Julia 1.10 and up, and with MTK 9 and higher.

diff --git a/dev/objects.inv b/dev/objects.inv index eb179b3346718478bca917bf6741b352cf3fd42f..dd415ffa2203886eb7c937e775f16bcc4fccdffa 100644 GIT binary patch delta 841 zcmV-P1GfCr2j2&fqkj{WiiU;+%CXwmlV+Q>H>~Ya3-Q0W^T!ykA9d0;sW&}Ywr9S1 z&)OpN@eZQcKlPOd>;zz_0(9_>2P=uuQSU}+pUY^*mrEQeA7x#5i`WtLZvOqfe+Uew zA`_-dcrB5+3m(i+gL}zbp}j=J4o_m0k!u!;M@KNic%gha%YXcJzK0@?jF{vza)|^F zUIBAPT!ieFYr$va)dPX-HB_%1mrE~^JSKlwyg z4GDyVdn7EOLON57S+X)lgG`m7!~nz1n06Q=3M4CI$55c8IDMRp5DmXF+KinO4Evr? z=U(&&Y^4e1<<0-kd}n<5k6hisP8h z74x);JW8XuVc;dB3O#2yXJk%SJ*dg3(CAa$yd}ThY~md@DwZ))vY=!+6O0nsu*)dJ zEHaZz7c;qDKDl}8Hp?;OBv>cq?d$XsA@f>Vq}M2$uz!oZc0jM?lh82w4Rs2Ad%S%uZZRBdjG{!N zjl;B2L_|-micT#v*erX;s_KuBDEQ7Z%TC(kM1KZ!OzZSqsg+eCCho+pQ{G>Vt$HQX zoLXsKXfYQanm)JDua8MK^NN~?E}5+DwAiS*oDMc&*?eOqBBV1z;yx|>bsyzYw=d}4 z20(o~M6P4IjqAVI%6&j;vU5!vTb18x-rPcdpQYCymOn3cMa%DnXS-|YNKQPHZ|jX? zmqNPi3)cR0+SK29JW;C5lCd+luD#QkJ2|&3=N`?FAHbia`embiS^UcG`PJ|Q<~ikg Tnd5uE)4QDLU0M7Ou;vUMUy`0x delta 829 zcmV-D1H$~@2h#_TqkkQgiiU;+%CXwmlV+Q>H>~Zp5#oPw=Z`U7KkB43sW&}Ywr9S1 z&)Omi@E+nMI1Q8!>;zz-LUiz+hf9g^QSV0SfXjHw7YiJ!0A*cxi`WtLZvOsxcnAz8 zA`_-dbS;s&a~@7ngL}zbq5V`O4o?%6k!u!;M@KNkWUc}@%YXcJzDFX7jhN(9a)|^F zUIBB4Ttw`aYr&`F)gyuIHB_%1mrFmDJRyHrGDpUPKqNv%T(SjQa?L|b$iX$rwus3> z4GDyV2P7<@LOK&nSh_Su!%UT-#1Ny+n06Q=3ZzS8$55c8I3CVKgoa-kZN|Y~md@DwZ))vY=!+V~kVTu*)dJ zEH;x%7c;qjKDl}8Hp?;OBv>cq?d$YXA@f>Vq}M2$uz!oZb|c1pp2jrI1~0P|OEJ}4 zuh>lKeCtS4VP-Io7e+UNf&mo+3I-4ZY7EF3S+8VIuwjx*lG3Y*3E&BrXvvvP$jl~W zue-D$J>|by7cAH2!J2TZ{h<(VwLh+HRH!&lIdV9ei*BMt8p4e{^=T>+PBT(7wIzx} zZ-A0#8h<{rFW*wi#IKX%x0K)2?+h2_uGC=92emrAljBy~ZMBaH*Xnp%+!(GRu7gW1 zZ}Dn^p*Ttg8MW5(VFRX4y%5l**8fVZAz6YH5{-v41y-CbBdcD?G$&S?7h24OkEYLU z^y_1i&Ag%}qDv-gJ1sV9E~kS_ST^5Ci5Tfjkho6^f89s9)b#}2+W@F<2gr3|w{e3P zTe*)&O?IwnW2^F8&6``u@3Zv0LHToHSG4?I__n)-j^xxg`L^CTcB#w0Q0-5rP5qt6 z6E>yFEEzj<>)Jbwx#M%oa_-R#`2qY%syiF)%i>pc&##6jFwZH^%N*bPo!;d{@5 MCFP\n LV.V => MCFP/Eₘᵢₙ\n Csa.p => MCFP\n Csa.V => MCFP*C_sa\n Csv.p => MCFP\n Csv.V => MCFP*C_sv\n ]","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"tspan = (0, 20)","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"in this case we use the mean cardiac filling pressure as initial condition, and simulate 20 seconds.","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Then we can define the problem:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"prob = ODEProblem(circ_sys, u0, tspan)","category":"page"},{"location":"examples/BjordalsbakkeModel/#Simulate","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Simulate","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"The ODE problem is now in the MTK/DifferentialEquations.jl format and we can use any DifferentialEquations.jl solver to solve it:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"sol = solve(prob, Vern7(), reltol=1e-12, abstol=1e-12);\nnothing #hide","category":"page"},{"location":"examples/BjordalsbakkeModel/#Results","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Results","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"p1 = plot(sol, idxs=[LV.p, Csa.in.p], tspan=(16 * τ, 17 * τ), xlabel = \"Time [s]\", ylabel = \"Pressure [mmHg]\", hidexaxis = nothing) # Make a line plot\np2 = plot(sol, idxs=[LV.V], tspan=(16 * τ, 17 * τ),xlabel = \"Time [s]\", ylabel = \"Volume [ml]\", linkaxes = :all)\np3 = plot(sol, idxs=[Csa.in.q,Csv.in.q], tspan=(16 * τ, 17 * τ),xlabel = \"Time [s]\", ylabel = \"Flow rate [ml/s]\", linkaxes = :all)\np4 = plot(sol, idxs=(LV.V, LV.p), tspan=(16 * τ, 17 * τ),xlabel = \"Volume [ml]\", ylabel = \"Pressure [mmHg]\", linkaxes = :all)\n\nimg = plot(p1, p2, p3, p4; layout=@layout([a b; c d]), legend = true)\n\nimg = DisplayAs.Text(DisplayAs.PNG(img))\n\nimg","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"This page was generated using Literate.jl.","category":"page"},{"location":"","page":"Home","title":"Home","text":"-\nCurrentModule = CirculatorySystemModels","category":"page"},{"location":"#CirculatorySystemModels","page":"Home","title":"CirculatorySystemModels","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Documentation for CirculatorySystemModels.","category":"page"},{"location":"#An-acausal-modelling-library-for-Circulation-Models","page":"Home","title":"An acausal modelling library for Circulation Models","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"CirculatorySystemModels.jl is an acausal modelling library for zero-dimensional, or lumped parameter modelling of the circulatory system for ModelingToolkit.jl (MTK).","category":"page"},{"location":"","page":"Home","title":"Home","text":"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.","category":"page"},{"location":"","page":"Home","title":"Home","text":"The acausal modelling approach in MTK was chosen to support a \"if you can draw it you can model it\" paradigm.","category":"page"},{"location":"","page":"Home","title":"Home","text":"The main model states that are modelled throughout these models are:","category":"page"},{"location":"","page":"Home","title":"Home","text":"volume flow rate (at nodes and through elements): q mathrmcm^3s (mathrmmls). Flow into an element is positive, flow out of an element is negative.\npressure (at nodes): p mathrmmm_Hg.\npressure difference (over elements): Delta p mathrmmm_Hg. The pressure difference is following the usual fluid mechanical definition Delta p = p_out - p_in. and is usually negative in flow direction!","category":"page"},{"location":"#Units","page":"Home","title":"Units","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"There are many unit systems that are used in circulation models. This modelling system uses the most common one, which uses mathrmmm_Hg for pressures and mathrmmls or mathrmcm^3s for flow rates.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This is a variation of the mathrmg cm s system, which could be called mathrmg cm s mm_Hg system.","category":"page"},{"location":"","page":"Home","title":"Home","text":"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 mathrmg cm s mm_Hg system.","category":"page"},{"location":"","page":"Home","title":"Home","text":"All model parameters are to be given in the mathrmg cm s mm_Hg system unless otherwise specified in the component documentation.","category":"page"},{"location":"#Main-variables","page":"Home","title":"Main variables","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"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.","category":"page"},{"location":"","page":"Home","title":"Home","text":"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.","category":"page"},{"location":"","page":"Home","title":"Home","text":"@variables t","category":"page"}] +[{"location":"autodoc/","page":"Method Index","title":"Method Index","text":"CurrentModule = CirculatorySystemModels","category":"page"},{"location":"autodoc/#Method-Index-(AutoDoc)","page":"Method Index","title":"Method Index (AutoDoc)","text":"","category":"section"},{"location":"autodoc/","page":"Method Index","title":"Method Index","text":"","category":"page"},{"location":"autodoc/","page":"Method Index","title":"Method Index","text":"Modules = [CirculatorySystemModels]","category":"page"},{"location":"autodoc/#CirculatorySystemModels.CR","page":"Method Index","title":"CirculatorySystemModels.CR","text":"CR(;name, R=1.0, C=1.0)\n\nImplements the compliance, resistor subsystem.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).\n\nNamed parameters:\n\nR: Component resistance in mmHg*s/ml\n\nC: Component compliance in ml/mmHg\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.CRL","page":"Method Index","title":"CirculatorySystemModels.CRL","text":"CRL(;name, C=1.0, R=1.0, L=1.0)\n\nImplements the compliance, resistor, inductance subsystem.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).\n\nNamed parameters:\n\nC: Component compliance in ml/mmHg\n\nR: Component resistance in mmHg*s/ml\n\nL: Component blood inertia in mmHg*s^2/ml\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.Capacitor","page":"Method Index","title":"CirculatorySystemModels.Capacitor","text":"Capacitor(;name, C=1.0)\n\nImplements a capacitor to represent vessel capacitance.\n\nParameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).\n\nNamed parameters:\n\nC: capacitance of the vessel in ml/mmHg\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.ConstantFlow","page":"Method Index","title":"CirculatorySystemModels.ConstantFlow","text":"ConstantFlow(;name, Q=1.0)\n\nImplements a constant flow source to a system.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).\n\nNamed parameters:\n\nQ: Constant flow in cm^3/s (ml/s)\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.ConstantPressure","page":"Method Index","title":"CirculatorySystemModels.ConstantPressure","text":"ConstantPressure(;name, P=1.0)\n\nImplements a constant pressure source to a system.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).\n\nNamed parameters:\n\nP: Constant pressure in mmHg\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.DHChamber","page":"Method Index","title":"CirculatorySystemModels.DHChamber","text":"DHChamber(;name, V₀, Eₘᵢₙ, n₁, n₂, τ, τ₁, τ₂, k, Eshift=0.0, inP=false)\n\nThe Double Hill chamber/ventricle model is defined based on the vessel element, but has a time varying elastance function modelling the contraction of muscle fibres\n\nThe time varying elastance is calculated using the Double Hill model.\n\nThis model uses external helper functions elastance and delastance which describe the elastance function and the first derivative of it.\n\nIt calculates the elastance as:\n\nE(t) = (Eₘₐₓ - Eₘᵢₙ) * e(t) + Eₘᵢₙ\n\nwhere e(t) is the Double-Hill function.\n\nNamed parameters:\n\nV₀: stress-free volume (zero pressure volume)\n\np₀ pressure offset (defaults to zero) this is present in some papers (e.g. Shi), so is provided here for conformity. Defaults to 0.0\n\nEₘᵢₙ: minimum elastance\n\nEₘₐₓ: maximum elastance\n\nn₁: rise coefficient\n\nn₂: fall coefficient\n\nτ: pulse length [s]\n\nτ₁: rise timing parameter[s]\n\nτ₂: fall timimg paramter [s]\n\nk: elastance factor*\n\nEshift: time shift of contraction (for atria)\n\ninP: (Bool) formulate in dp/dt (default: false)\n\n*Note: k is not an independent parameter, it is a scaling factor that corresponds to 1/max(e(t)), which ensures that e(t) varies between zero and 1.0, such that E(t) varies between Eₘᵢₙ and Eₘₐₓ.\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.DrivenFlow","page":"Method Index","title":"CirculatorySystemModels.DrivenFlow","text":"DrivenFlow(; name, fun, Q=1.0)\n\nImplements a driven flow source to a system.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).\n\nNamed parameters:\n\nQ: Constant flow in cm^3/s (ml/s).\n\nτ Length of cardiac cycle is s\n\nfun: Function which modulates the input\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.DrivenPressure","page":"Method Index","title":"CirculatorySystemModels.DrivenPressure","text":"DrivenPressure(; name, fun, P=1.0)\n\nImplements a driven pressure source to a system modulated by a function provided.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).\n\nNamed parameters:\n\nP: Constant pressure in mmHg\n\nfun: Function which modulates the input\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.Inductance","page":"Method Index","title":"CirculatorySystemModels.Inductance","text":"Inductance(;name, L=1.0)\n\nImplements the inductance to represent blood inertance.\n\nParameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).\n\nNamed parameters:\n\nL: Inertia of the fluid in mmHg*s^2/ml\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.MynardValve_Atrioventricular","page":"Method Index","title":"CirculatorySystemModels.MynardValve_Atrioventricular","text":"MynardValve_Atrioventricular(; name, ρ, Mrg, Mst, Ann, Kvc, Kvo)\n\nImplements the Mynard description for flow across the atrioventricular valves, full description in [Mynard]. This valve description corresponds to the atrioventricular valves where interia is not considered.\n\nNote: The minimum level of regurgitation has to be set to machine precision eps()\n\nParameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s) p is scaled to ensure units are consistent throughout.\n\nNamed parameters:\n\nname name of the element ρ Blood density in g/cm^3 Mrg Level of regurgitation exhibited by a valve in DN Mst Level of stenosis exhibited by a valve in DN Ann Annulus area in cm^2 Kvc Valve closing rate coefficent in cm^2/(dyness) Kvo Valve opening rate coefficent in cm^2/(dyness)\n\np is calculated in mmHg q is calculated in cm^3/s (ml/s)\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.MynardValve_SemiLunar","page":"Method Index","title":"CirculatorySystemModels.MynardValve_SemiLunar","text":"MynardValve_SemiLunar(; name, ρ, Leff, Mrg, Mst, Ann, Kvc, Kvo)\n\nImplements the Mynard description for flow across the semilunar valves, full description in [Mynard]. This valve description corresponds to the semilunar valves where interia is an effect we consider.\n\nNote: The minimum level of regurgitation has to be set to machine precision eps()\n\nParameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s) p is scaled to ensure units are consistent throughout.\n\nNamed parameters:\n\nname name of the element ρ Blood density in g/cm^3 Leff An effective length in cm Mrg Level of regurgitation exhibited by a valve in DN Mst Level of stenosis exhibited by a valve in DN Ann Annulus area in cm^2 Kvc Valve closing rate coefficent in cm^2/(dyness) Kvo Valve opening rate coefficent in cm^2/(dyness)\n\np is calculated in mmHg q is calculated in cm^3/s (ml/s)\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.OrificeValve","page":"Method Index","title":"CirculatorySystemModels.OrificeValve","text":"OrificeValve(;name, CQ=1.0)\n\nImplements the square-root pressure-flow relationship across a valve.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s)\n\nNamed parameters:\n\nCQ Flow coefficent in ml/(s*mmHg^0.5)\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.PoiseuilleResistor","page":"Method Index","title":"CirculatorySystemModels.PoiseuilleResistor","text":"PoiseuilleResistor(;name, μ=3e-2, r=0.5, L=5)\n\nImplements the resistance following the Poiseuille law.\n\nParameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).\n\nNamed parameters:\n\nμ: viscosity of fluid in dyne s / cm^2\n\nr: radius of vessel segmenty in cm\n\nL: length of vessel segment in cm\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.QResistor","page":"Method Index","title":"CirculatorySystemModels.QResistor","text":"QResistor(;name, K=1.0)\n\nImplements the quadratic resistor to represent a vessels non-linear resistance to blood flow.\n\nParameters are in the cm, g, s system. Pressures in mmHg. Δp is calculated in mmHg, q is calculated in cm^3/s (ml/s).\n\nNamed parameters:\n\nK: non-linear resistance of the vessel to the fluid in mmHg*s^2/ml^2\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.RRCR","page":"Method Index","title":"CirculatorySystemModels.RRCR","text":"RRCR(;name, R1=1.0, R2=1.0, R3=1.0, C=1.0)\n\nImplements the resistor, resistor, compliance, resistor subsystem.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).\n\nNamed parameters:\n\nR1: Component resistance in mmHg*s/ml\n\nR2: Component resistance in mmHg*s/ml\n\nC: Component compliance in ml/mmHg\n\nR3: Component resistance in mmHg*s/ml\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.Resistor","page":"Method Index","title":"CirculatorySystemModels.Resistor","text":"Resistor(;name, R=1.0)\n\nImplements the resistor using Ohm's law to represent a vessels linear resistance to blood flow.\n\nParameter is in the cm, g, s system. Pressure in mmHg. Δp is calculated in mmHg q calculated in cm^3/s (ml/s)\n\nNamed parameters:\n\nR: Resistance of the vessel to the fluid in mmHg*s/ml\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.ResistorDiode","page":"Method Index","title":"CirculatorySystemModels.ResistorDiode","text":"ResistorDiode(;name, R=1e-3)\n\nImplements the resistance across a valve following Ohm's law exhibiting diode like behaviour.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s)\n\nNamed parameters:\n\nR Resistance across the valve in mmHg*s/ml\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.ShiAtrium","page":"Method Index","title":"CirculatorySystemModels.ShiAtrium","text":"ShiAtrium(;name, V₀, p₀, Eₘᵢₙ, Eₘₐₓ, τ, τpwb, τpww, inP = false)\n\nImplementation of the Atrium following Shi/Korakianitis.\n\nNamed parameters:\n\nname name of the element\n\nV₀ Unstressed chamber volume in ml\n\np₀ Unstressed chamber pressure in mmHg\n\nEₘᵢₙ Minimum elastance (diastole) in mmHg/ml\n\nEₘₐₓ Maximum elastance (systole) in mmHg/ml\n\nτ Length of cardiac cycle in s\n\nτpwb Atrial contraction time in s\n\nτpww Atrial offset time in s\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.ShiChamber","page":"Method Index","title":"CirculatorySystemModels.ShiChamber","text":"ShiChamber(;name, V₀, p₀=0.0, Eₘᵢₙ, Eₘₐₓ, τ, τₑₛ, τₑₚ, Eshift=0.0)\n\nImplemention of a ventricle following Shi/Korakianitis.\n\nThis model uses external helper function shiElastance which describes the elastance function.\n\nNamed parameters:\n\nV₀ stress-free volume (zero pressure volume)\n\np₀ pressure offset (defaults to zero) this is present in the original paper, so is provided here for conformity. Defaults to 0.0\n\nEₘᵢₙ minimum elastance\n\nτ pulse length\n\nτₑₛ end systolic time (end of rising cosine)\n\nτₑₚ end pulse time (end of falling cosine)\n\nEshift: time shift of contraction (for atria), set to 0 for ventricle\n\ninP: (Bool) formulate in dp/dt (default: false)\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.ShiHeart","page":"Method Index","title":"CirculatorySystemModels.ShiHeart","text":"ShiHeart(; name, τ, LV.V₀, LV.p0, LV.Emin, LV.Emax, LV.τes, LV.τed, LV.Eshift, RV.V₀, RV.p0, RV.Eₘᵢₙ, RV.Eₘₐₓ, RV.τes, RV.τed, RV.Eshift, LA.V₀, LA_p0, LA.Emin, LA.Emax, LA.τes, LA.τed, LA.Eshift, RA.V₀, RA.p0, RA.Emin, RA.Emax, RA.τes, RA.τed, RA.Eshift, AV.CQ, AV.Kp, AV.Kf, AV.Kb, AV.Kv, AV.θmax, AV.θmin, PV.CQ, PV.Kp, PV.Kf, PV.Kb, PV.Kv, PV.θmax, PV.θmin, MV.CQ, MV.Kp, MV.Kf, MV.Kb, MV.Kv, MV.θmax, MV.θmin, TV.CQ, TV.Kp, TV.Kf, TV.Kb, TV.Kv, TV.θmax, TV.θmin)\n\nModels a whole heart, made up of 2 ventricles (Left & Right Ventricle) and 2 atria (Left & Right atrium) created from the ShiChamber element. Includes the 4 corresponding valves (Aortic, Mitral, Pulmonary and Tricuspid valve) created using the ShiValve element.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s). Maximum and Minimum angles given in rad, to convert from degrees multiply angle by pi/180.\n\nNamed parameters:\n\nτ Length of the cardiac cycle in s\n\nLV_V₀ Unstressed left ventricular volume in ml\n\nLV_p0 Unstressed left ventricular pressure in mmHg\n\nLV_Emin Minimum left ventricular elastance (diastole) in mmHg/ml\n\nLV_Emax Maximum left ventricular elastance (systole) in mmHg/ml\n\nLV_τes Left ventricular end systolic time in s\n\nLV_τed Left ventricular end distolic time in s\n\nLV_Eshift Shift time of contraction - 0 for left ventricle\n\nRV_V₀ Unstressed right ventricular volume in ml\n\nRV_p0 Unstressed right ventricular pressure in mmHg\n\nRV_Emin Minimum right ventricular elastance (diastole) in mmHg/ml\n\nRV_Emax Maximum right ventricular elastance (systole) in mmHg/ml\n\nRV_τes Right ventricular end systolic time in s\n\nRV_τed Right ventricular end distolic time in s\n\nRV_Eshift Shift time of contraction - 0 for right ventricle\n\nLA_V₀ Unstressed left atrial volume in ml\n\nLA_p0 Unstressed left atrial pressure in mmHg\n\nLA_Emin Minimum left atrial elastance (diastole) in mmHg/ml\n\nLA_Emax Maximum left atrial elastance (systole) in mmHg/ml\n\nLA_τes Left atrial end systolic time in s\n\nLA_τed Left atrial end distolic time in s\n\nLA_Eshift Shift time of contraction in s\n\nRA_V₀ Unstressed right atrial volume in ml\n\nRA_p0 Unstressed right atrial pressure in mmHg\n\nRA_Emin Minimum right atrial elastance (diastole) in mmHg/ml\n\nRA_Emax Maximum right atrial elastance (systole) in mmHg/ml\n\nRA_τes Right atrial end systolic time in s\n\nRA_τed Right atrial end distolic time in s\n\nRA_Eshift Shift time of contraction in s\n\nAV_CQ Aortic valve flow coefficent in ml/(s*mmHg^0.5)\n\nAV_Kp Pressure effect on the aortic valve in rad/(s^2*mmHg)\n\nAV_Kf Frictional effect on the aortic valve in 1/s\n\nAV_Kb Fluid velocity effect on the aortic valve in rad/(s*m)\n\nAV_Kv Vortex effect on the aortic valve in rad/(s*m)\n\nAV_θmax Aortic valve maximum opening angle in rad\n\nAV_θmin Aortic valve minimum opening angle in rad\n\nMV_CQ Mitral valve flow coefficent in ml/(s*mmHg^0.5)\n\nMV_Kp Pressure effect on the mitral valve in rad/(s^2*mmHg)\n\nMV_Kf Frictional effect on the mitral valve in 1/s\n\nMV_Kb Fluid velocity effect on the mitral valve in rad/(s*m)\n\nMV_Kv Vortex effect on the mitral valve in rad/(s*m)\n\nMV_θmax Mitral valve maximum opening angle in rad\n\nMV_θmin Mitral valve minimum opening angle in rad\n\nPV_CQ Pulmonary valve flow coefficent in ml/(s*mmHg^0.5)\n\nPV_Kp Pressure effect on the pulmonary valve in rad/(s^2*mmHg)\n\nPV_Kf Frictional effect on the pulmonary valve in 1/s\n\nPV_Kb Fluid velocity effect on the pulmonary valve in rad/(s*m)\n\nPV_Kv Vortex effect on the pulmonary valve in rad/(s*m)\n\nPV_θmax Pulmonary valve maximum opening angle in rad\n\nPV_θmin Pulmonary valve minimum opening angle in rad\n\nTV_CQ Tricuspid valve flow coefficent in ml/(s*mmHg^0.5)\n\nTV_Kp Pressure effect on the tricuspid valve in rad/(s^2*mmHg)\n\nTV_Kf Frictional effect on the tricuspid valve in 1/s\n\nTV_Kb Fluid velocity effect on the tricuspid valve in rad/(s*m)\n\nTV_Kv Vortex effect on the pulmonary valve in rad/(s*m)\n\nTV_θmax Tricuspid valve maximum opening angle in rad\n\nTV_θmin Tricuspid valve minimum opening angle in rad\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.ShiPulmonaryLoop","page":"Method Index","title":"CirculatorySystemModels.ShiPulmonaryLoop","text":"ShiPulmonaryLoop(; name, PAS.C, PAS.R, PAS.L, PAT.C, PAT.R, PAT.L, PAR.R, PCP.R, PVN.C, PVN.R)\n\nImplements systemic loop as written by Shi in [Shi].\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).\n\nNamed parameters:\n\nPAS__C: Artery sinus compliance in ml/mmHg\n\nPAS__R: Artery sinus resistance in mmHg*s/ml\n\nPAS__L: Artery sinus Inductance in mmHg*s^2/ml\n\nPAT__C: Artery compliance in ml/mmHg\n\nPAT__R: Artery resistance in mmHg*s/ml\n\nPAT__L: Artery Inductance in mmHg*s^2/ml\n\nPAR__R: Arteriole resistance in mmHg*s/ml\n\nPCP__R: Capillary resistance in mmHg*s/ml\n\nPVN__C: Vein compliance in ml/mmHg\n\nPVN__R: Vein resistance in mmHg*s/ml\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.ShiSystemicLoop","page":"Method Index","title":"CirculatorySystemModels.ShiSystemicLoop","text":"ShiSystemicLoop(; name, SAS.C, SAS.R, SAS.L, SAT.C, SAT.R, SAT.L, SAR.R, SCP.R, SVN.C, SVN.R)\n\nImplements systemic loop as written by Shi in [Shi].\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s).\n\nNamed parameters:\n\nSAS_C: Aortic sinus compliance in ml/mmHg\n\nSAS_R: Aortic sinus resistance in mmHg*s/ml\n\nSAS_L: Aortic sinus inductance in mmHg*s^2/ml\n\nSAT_C: Artery compliance in ml/mmHg\n\nSAT_R: Artery resistance in mmHg*s/ml\n\nSAT_L: Artery inductance in mmHg*s^2/ml\n\nSAR_R: Arteriole resistance in mmHg*s/ml\n\nSCP_R: Capillary resistance in mmHg*s/ml\n\nSVN_C: Vein compliance in ml/mmHg\n\nSVN_R: Vein resistance in mmHg*s/ml\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.WK3","page":"Method Index","title":"CirculatorySystemModels.WK3","text":"WK3(;name, Rc=1.0, Rp=1.0, C=1.0)\n\nImplements the 3 element windkessel model.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)\n\nNamed parameters:\n\nRc: Characteristic impedance in mmHg*s/ml\n\nRp: Peripheral resistance in mmHg*s/ml\n\nC: Arterial compliance in ml/mmHg\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.WK3E","page":"Method Index","title":"CirculatorySystemModels.WK3E","text":"WK3E(;name, Rc=1.0, Rp=1.0, E=1.0)\n\nImplements the 3 element windkessel model. With a vessel elastance instead of a capacitor.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)\n\nNamed parameters:\n\nRc: Characteristic impedance in mmHg*s/ml\n\nRp: Peripheral resistance in mmHg*s/ml\n\nE: Arterial elastance in mmHg/ml\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.WK4_P","page":"Method Index","title":"CirculatorySystemModels.WK4_P","text":"WK4_P(;name, Rc=1.0, L=1.0, Rp=1.0, C=1.0)\n\nImplements the 4 element windkessel model with parallel inertance.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)\n\nNamed parameters:\n\nRc: Characteristic impedance in mmHg*s/ml\n\nL: Inertance/Inductance in mmHgs^2ml^-1\n\nRp: Peripheral resistance in mmHg*s/ml\n\nC: Arterial compliance in ml/mmHg\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.WK4_PE","page":"Method Index","title":"CirculatorySystemModels.WK4_PE","text":"WK4_PE(;name, Rc=1.0, L=1.0, Rp=1.0, E=1.0)\n\nImplements the 4 element windkessel model with parallel inertance. With a vessel elastance instead of a capacitor.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)\n\nNamed parameters:\n\nRc: Characteristic impedance in mmHg*s/ml\n\nL: Inertance/Inductance in mmHgs^2ml^-1\n\nRp: Peripheral resistance in mmHg*s/ml\n\nE: Arterial elastance in mmHg/ml\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.WK4_S","page":"Method Index","title":"CirculatorySystemModels.WK4_S","text":"WK4_S(;name, Rc=1.0, L=1.0, Rp=1.0, C=1.0)\n\nImplements the 4 element windkessel model with serial inertance.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)\n\nNamed parameters:\n\nRc: Characteristic impedance in mmHg*s/ml\n\nL: Inertance/Inductance in mmHgs^2ml^-1\n\nRp: Peripheral resistance in mmHg*s/ml\n\nC: Arterial compliance in ml/mmHg\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.WK4_SE","page":"Method Index","title":"CirculatorySystemModels.WK4_SE","text":"WK4_SE(;name, Rc=1.0, L=1.0, Rp=1.0, E=1.0)\n\nImplements the 4 element windkessel model with serial inertance. With a vessel elastance instead of a capacitor.\n\nParameters are in the cm, g, s system. Pressure in mmHg. Volume in ml. Flow in cm^3/s (ml/s)\n\nNamed parameters:\n\nRc: Characteristic impedance in mmHg*s/ml\n\nL: Inertance/Inductance in mmHgs^2ml^-1\n\nRp: Peripheral resistance in mmHg*s/ml\n\nE: Arterial elastance in mmHg/ml\n\n\n\n\n\n","category":"constant"},{"location":"autodoc/#CirculatorySystemModels.Compliance-Tuple{}","page":"Method Index","title":"CirculatorySystemModels.Compliance","text":"Compliance(; name, V₀=0.0, C=1.0, inP=false, has_ep=false, has_variable_ep=false, p₀=0.0)\n\nImplements the compliance of a vessel.\n\nParameters are in the cm, g, s system. Pressure in mmHg. p is calculated in mmHg, q is calculated in cm^3/s (ml/s).\n\nNamed parameters:\n\nV₀: Unstressed volume ml\n\nC: Vessel compliance in ml/mmHg\n\ninP: (Bool) formulate in dp/dt (default: false)\n\nhas_ep: (Bool) if true, add a parameter p₀ for pressure offset e.g., for thoracic pressure (default: false)\n\np₀: External pressure in mmHg (e.g., thorax pressure, default: 0.0) Note: if this argument is set, it will be used, even if `hasepisfalse.haseponly controls ifp₀` will be exposed as a parameter!\n\nhasvariableep: (Bool) expose pin for variable external pressure (default: false) This pin can be connected to another pin or function providing external pressure. _Note: ifhasvariableepis set totruethis pin is created, independent ofhasep`!\n\n\n\n\n\n","category":"method"},{"location":"autodoc/#CirculatorySystemModels.DHdelastance-NTuple{10, Any}","page":"Method Index","title":"CirculatorySystemModels.DHdelastance","text":"DHdelastance(t, Eₘᵢₙ, Eₘₐₓ, n₁, n₂, τ, τ₁, τ₂, Eshift, k)\n\nHelper function for DHChamber\n\n\n\n\n\n","category":"method"},{"location":"autodoc/#CirculatorySystemModels.DHelastance-NTuple{10, Any}","page":"Method Index","title":"CirculatorySystemModels.DHelastance","text":"DHelastance(t, Eₘᵢₙ, Eₘₐₓ, n₁, n₂, τ, τ₁, τ₂, Eshift, k)\n\nHelper function for DHChamber\n\n\n\n\n\n","category":"method"},{"location":"autodoc/#CirculatorySystemModels.DShiElastance-NTuple{7, Any}","page":"Method Index","title":"CirculatorySystemModels.DShiElastance","text":"DShiElastance(t, Eₘᵢₙ, Eₘₐₓ, τ, τₑₛ, τₑₚ, Eshift)\n\nHelper function for ShiChamber\n\nDerivative of the elastance function E(t) for ventricle simulation based on Shi's double cosine function.\n\nParameters:\n\nEₘᵢₙ: minimum elastance (diastole)\n\nEₘₐₓ: maximum elastance (systole)\n\nτₑₛ: end systolic time (end of rising cosine)\n\nτₑₚ: end of pulse time (end of falling cosine)\n\nEshift: time shift of contraction (for atria), set to 0 for ventricle\n\n\n\n\n\n","category":"method"},{"location":"autodoc/#CirculatorySystemModels.Elastance-Tuple{}","page":"Method Index","title":"CirculatorySystemModels.Elastance","text":"Elastance(; name, V₀=0.0, E=1.0, inP=false, has_ep=false, has_variable_ep=false, p₀=0.0)\n\nImplements the elastance of a vessel. Elastance more commonly used to describe the heart.\n\nParameters are in the cm, g, s system. Pressure in mmHg. p is calculated in mmHg, q is calculated in cm^3/s (ml/s).\n\nNamed parameters:\n\nV₀: Unstressed volume ml\n\nE: Vessel elastance in ml/mmHg. Equivalent to compliance as E=1/C\n\ninP: (Bool) formulate in dp/dt (default: false)\n\nhas_ep: (Bool) if true, add a parameter p₀ for pressure offset e.g., for thoracic pressure (default: false)\n\np₀: External pressure in mmHg (e.g., thorax pressure, default: 0.0) Note: if this argument is set, it will be used, even if `hasepisfalse.haseponly controls ifp₀` will be exposed as a parameter!\n\nhasvariableep: (Bool) expose pin for variable external pressure (default: false) This pin can be connected to another pin or function providing external pressure. _Note: ifhasvariableepis set totruethis pin is created, independent ofhasep`!\n\n\n\n\n\n","category":"method"},{"location":"autodoc/#CirculatorySystemModels.ShiElastance-NTuple{7, Any}","page":"Method Index","title":"CirculatorySystemModels.ShiElastance","text":"ShiElastance(t, Eₘᵢₙ, Eₘₐₓ, τ, τₑₛ, τₑₚ, Eshift)\n\nElastance function E(t) for ventricle simulation based on Shi's double cosine function.\n\nParameters:\n\nEₘᵢₙ: minimum elastance (diastole)\n\nEₘₐₓ: maximum elastance (systole)\n\nτₑₛ: end systolic time (end of rising cosine)\n\nτₑₚ: end of pulse time (end of falling cosine)\n\nEshift: time shift of contraction (for atria), set to 0 for ventricle\n\n\n\n\n\n","category":"method"},{"location":"autodoc/#CirculatorySystemModels.ShiValve-Tuple{}","page":"Method Index","title":"CirculatorySystemModels.ShiValve","text":"ShiValve(; name, CQ, Kp, Kf, Kb, Kv, θmax, θmin)\n\nImplements the Shi description for valve opening and closing, full description in [Shi].\n\nParameters are in the cm, g, s system. Pressure in mmHg. Flow in cm^3/s (ml/s) Maximum and Minimum angles given in rad, to convert from degrees multiply angle by pi/180.\n\nNamed parameters:\n\nCQ Flow coefficent in ml/(s*mmHg^0.5)\n\nKp Pressure effect on the valve in rad/(s^2*mmHg)\n\nKf Frictional effect on the valve in 1/s\n\nKb Fluid velocity effect on the valve in rad/(s*m)\n\nKv Vortex effect on the valve in rad/(s*m)\n\nθmax Valve maximum opening angle in rad\n\nθmin Valve minimum opening angle in rad\n\n\n\n\n\n","category":"method"},{"location":"autodoc/#CirculatorySystemModels.VariableElastance-Tuple{}","page":"Method Index","title":"CirculatorySystemModels.VariableElastance","text":"VariableElastance(; name, V₀=0.0, C=1.0, Escale=1.0, fun, inP=false, has_ep=false, has_variable_ep=false, p₀=0.0)\n\nVariableElastance is defined based on the Elastance element, but has a time varying elastance function modelling the contraction of muscle fibres.\n\nNamed parameters:\n\nV₀: stress-free volume (zero pressure volume)\n\nEscale: scaling factor (elastance factor)\n\nfun: function object for elastance (must be fun(t))\n\ninP: (Bool) formulate in dp/dt (default: false)\n\nhas_ep: (Bool) if true, add a parameter p₀ for pressure offset e.g., for thoracic pressure (default: false)\n\np₀: External pressure in mmHg (e.g., thorax pressure, default: 0.0) Note: if this argument is set, it will be used, even if `hasepisfalse.haseponly controls ifp₀` will be exposed as a parameter!\n\nhasvariableep: (Bool) expose pin for variable external pressure (default: false) This pin can be connected to another pin or function providing external pressure. _Note: ifhasvariableepis set totruethis pin is created, independent ofhasep`!\n\n\n\n\n\n","category":"method"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"EditURL = \"BjordalsbakkeModel.jl\"","category":"page"},{"location":"examples/BjordalsbakkeModel/#Importing-the-required-packages","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Importing the required packages","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"using CirculatorySystemModels\nusing ModelingToolkit\nusing OrdinaryDiffEq\nusing Plots\nimport DisplayAs","category":"page"},{"location":"examples/BjordalsbakkeModel/#A-simple-single-chamber-model","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"A simple single-chamber model","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"(Image: Single chamber, closed-loop, lumped parameter model of the systemic circulation and the left ventricle. The circuit equivalent formulation of the model is depicted, with the pressures of each compartment, as well as most of the mechanical parameters. The model describes three compartments: the left ventricular, arterial and venous compartments. 𝑃𝑡ℎ is the intrathoracic pressure, 𝑃𝑙𝑣 is the left ventricular pressure and 𝐸𝑙𝑣(𝑡) indicates the left ventricular elastance function.)","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"This follows Bjørdalsbakke et al.","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Bjørdalsbakke, N.L., Sturdy, J.T., Hose, D.R., Hellevik, L.R., 2022. Parameter estimation for closed-loop lumped parameter models of the systemic circulation using synthetic data. Mathematical Biosciences 343, 108731. https://doi.org/10.1016/j.mbs.2021.108731","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Changes from the published version above:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Capacitors are replaced by compliances. These are identical to capacitors, but have an additional parameter, the unstrained volume V_0, which allows for realistic blood volume modelling. Compliances have an inlet and an oulet in line with the flow, rather than the ground connector of the dangling capacitor.\nThe aortic resistor is combined with the valve (diode) in the ResistorDiode element.","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Jupyter Notebook","category":"page"},{"location":"examples/BjordalsbakkeModel/#Define-the-parameters","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Define the parameters","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"All the parameters are taken from table 1 of [Bjørdalsbakke2022].","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Cycle time in seconds","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"τ = 0.85","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Double Hill parameters for the ventricle","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Eₘᵢₙ = 0.03\nEₘₐₓ = 1.5\nn1LV = 1.32;\nn2LV = 21.9;\nTau1fLV = 0.303 * τ;\nTau2fLV = 0.508 * τ","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Resistances and Compliances","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"R_s = 1.11\nC_sa = 1.13\nC_sv = 11.0","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Valve parameters","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Aortic valve basic","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Zao = 0.033","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Mitral valve basic","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Rmv = 0.006","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Inital Pressure (mean cardiac filling pressure)","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"MCFP = 7.0","category":"page"},{"location":"examples/BjordalsbakkeModel/#Calculating-the-additional-k-parameter","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Calculating the additional k parameter","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"The ventricle elastance is modelled as:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"E_l v(t)=left(E_max -E_min right) e(t)+E_min ","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"where e is a double-Hill function, i.e., two Hill-functions, which are multiplied by each other:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"e(tau)= k times fracleft(tau tau_1right)^n_11+left(tau tau_1right)^n_1 times frac11+left(tau tau_2right)^n_2","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"and k is a scaling factor to assure that e(t) has a maximum of e(t)_max = 1:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"k = max left(fracleft(tau tau_1right)^n_11+left(tau tau_1right)^n_1 times frac11+left(tau tau_2right)^n_2 right)^-1","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"nstep = 1000\nt = LinRange(0, τ, nstep)\n\nkLV = 1 / maximum((t ./ Tau1fLV).^n1LV ./ (1 .+ (t ./ Tau1fLV).^n1LV) .* 1 ./ (1 .+ (t ./ Tau2fLV).^n2LV))","category":"page"},{"location":"examples/BjordalsbakkeModel/#Set-up-the-model-elements","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Set up the model elements","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Set up time as a variable t","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"@variables t","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Heart is modelled as a single chamber (we call it LV for \"Left Ventricle\" so the model can be extended later, if required):","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"@named LV = DHChamber(V₀ = 0.0, Eₘₐₓ=Eₘₐₓ, Eₘᵢₙ=Eₘᵢₙ, n₁=n1LV, n₂=n2LV, τ = τ, τ₁=Tau1fLV, τ₂=Tau2fLV, k = kLV, Eshift=0.0)","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"The two valves are simple diodes with a small resistance (resistance is needed, since perfect diodes would connect two elastances/compliances, which will lead to unstable oscillations):","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"@named AV = ResistorDiode(R=Zao)\n@named MV = ResistorDiode(R=Rmv)","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"The main components of the circuit are 1 resistor Rs and two compliances for systemic arteries Csa, and systemic veins Csv (names are arbitrary). Note: one of the compliances is defined in terms of dVdt using the option inV = true. The other without that option is in dpdt.","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"@named Rs = Resistor(R=R_s)\n\n@named Csa = Compliance(C=C_sa)\n@named Csv = Compliance(C=C_sv, inP=true)","category":"page"},{"location":"examples/BjordalsbakkeModel/#Build-the-system","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Build the system","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/#Connections","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Connections","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"The system is built using the connect function. connect sets up the Kirchhoff laws:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"pressures are the same in all connected branches on a connector\nsum of all flow rates at a connector is zero","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"The resulting set of Kirchhoff equations is stored in circ_eqs:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"circ_eqs = [\n connect(LV.out, AV.in)\n connect(AV.out, Csa.in)\n connect(Csa.out, Rs.in)\n connect(Rs.out, Csv.in)\n connect(Csv.out, MV.in)\n connect(MV.out, LV.in)\n]","category":"page"},{"location":"examples/BjordalsbakkeModel/#Add-the-component-equations","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Add the component equations","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"In a second step, the system of Kirchhoff equations is completed by the component equations (both ODEs and AEs), resulting in the full, overdefined ODE set circ_model.","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Note: we do this in two steps.","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"@named _circ_model = ODESystem(circ_eqs, t)\n\n@named circ_model = compose(_circ_model,\n [LV, AV, MV, Rs, Csa, Csv])","category":"page"},{"location":"examples/BjordalsbakkeModel/#Simplify-the-ODE-system","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Simplify the ODE system","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"The crucial step in any acausal modelling is the sympification and reduction of the OD(A)E system to the minimal set of equations. ModelingToolkit.jl does this in the structural_simplify function.","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"circ_sys = structural_simplify(circ_model)","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"circ_sys is now the minimal system of equations. In this case it consists of 3 ODEs for the ventricular volume and the systemic and venous pressures.","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Note: this reduces and optimises the ODE system. It is, therefore, not always obvious, which states it will use and which it will drop. We can use the states and observed function to check this. It is recommended to do this, since small changes can reorder states, observables, and parameters.","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"States in the system are now:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"unknowns(circ_sys)","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Observed variables - the system will drop these from the ODE system that is solved, but it keeps all the algebraic equations needed to calculate them in the system object, as well as the ODEProblem and solution object - are:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"observed(circ_sys)","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"And the parameters (these could be reordered, so check these, too):","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"parameters(circ_sys)","category":"page"},{"location":"examples/BjordalsbakkeModel/#Define-the-ODE-problem","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Define the ODE problem","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"First defined initial conditions u0 and the time span for simulation:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Note: the initial conditions are defined as a parameter map, rather than a vector, since the parameter map allows for changes in order. This map can include non-existant states (like LV.p in this case), which allows for exchanging the compliances or the ventricle for one that's defined in terms of dpdt).","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"u0 = [\n LV.p => MCFP\n LV.V => MCFP/Eₘᵢₙ\n Csa.p => MCFP\n Csa.V => MCFP*C_sa\n Csv.p => MCFP\n Csv.V => MCFP*C_sv\n ]","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"tspan = (0, 20)","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"in this case we use the mean cardiac filling pressure as initial condition, and simulate 20 seconds.","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"Then we can define the problem:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"prob = ODEProblem(circ_sys, u0, tspan)","category":"page"},{"location":"examples/BjordalsbakkeModel/#Simulate","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Simulate","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"The ODE problem is now in the MTK/DifferentialEquations.jl format and we can use any DifferentialEquations.jl solver to solve it:","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"sol = solve(prob, Vern7(), reltol=1e-12, abstol=1e-12);\nnothing #hide","category":"page"},{"location":"examples/BjordalsbakkeModel/#Results","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Results","text":"","category":"section"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"p1 = plot(sol, idxs=[LV.p, Csa.in.p], tspan=(16 * τ, 17 * τ), xlabel = \"Time [s]\", ylabel = \"Pressure [mmHg]\", hidexaxis = nothing) # Make a line plot\np2 = plot(sol, idxs=[LV.V], tspan=(16 * τ, 17 * τ),xlabel = \"Time [s]\", ylabel = \"Volume [ml]\", linkaxes = :all)\np3 = plot(sol, idxs=[Csa.in.q,Csv.in.q], tspan=(16 * τ, 17 * τ),xlabel = \"Time [s]\", ylabel = \"Flow rate [ml/s]\", linkaxes = :all)\np4 = plot(sol, idxs=(LV.V, LV.p), tspan=(16 * τ, 17 * τ),xlabel = \"Volume [ml]\", ylabel = \"Pressure [mmHg]\", linkaxes = :all)\n\nimg = plot(p1, p2, p3, p4; layout=@layout([a b; c d]), legend = true)\n\nimg = DisplayAs.Text(DisplayAs.PNG(img))\n\nimg","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"","category":"page"},{"location":"examples/BjordalsbakkeModel/","page":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","title":"Bjørdalsbakke - Simple Single-Chamber CV-Circuit","text":"This page was generated using Literate.jl.","category":"page"},{"location":"","page":"Home","title":"Home","text":"-\nCurrentModule = CirculatorySystemModels","category":"page"},{"location":"#CirculatorySystemModels","page":"Home","title":"CirculatorySystemModels","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Documentation for CirculatorySystemModels.","category":"page"},{"location":"#An-acausal-modelling-library-for-Circulation-Models","page":"Home","title":"An acausal modelling library for Circulation Models","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"CirculatorySystemModels.jl is an acausal modelling library for zero-dimensional, or lumped parameter modelling of the circulatory system for ModelingToolkit.jl (MTK).","category":"page"},{"location":"","page":"Home","title":"Home","text":"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.","category":"page"},{"location":"","page":"Home","title":"Home","text":"The acausal modelling approach in MTK was chosen to support a \"if you can draw it you can model it\" paradigm.","category":"page"},{"location":"","page":"Home","title":"Home","text":"The main model states that are modelled throughout these models are:","category":"page"},{"location":"","page":"Home","title":"Home","text":"volume flow rate (at nodes and through elements): q mathrmcm^3s (mathrmmls). Flow into an element is positive, flow out of an element is negative.\npressure (at nodes): p mathrmmm_Hg.\npressure difference (over elements): Delta p mathrmmm_Hg. The pressure difference is following the usual fluid mechanical definition Delta p = p_out - p_in. and is usually negative in flow direction!","category":"page"},{"location":"#Units","page":"Home","title":"Units","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"There are many unit systems that are used in circulation models. This modelling system uses the most common one, which uses mathrmmm_Hg for pressures and mathrmmls or mathrmcm^3s for flow rates.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This is a variation of the mathrmg cm s system, which could be called mathrmg cm s mm_Hg system.","category":"page"},{"location":"","page":"Home","title":"Home","text":"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 mathrmg cm s mm_Hg system.","category":"page"},{"location":"","page":"Home","title":"Home","text":"All model parameters are to be given in the mathrmg cm s mm_Hg system unless otherwise specified in the component documentation.","category":"page"},{"location":"#Main-variables","page":"Home","title":"Main variables","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"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.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Time is the independent variable in all the symbolic operations, so needs to be defined as such (do not use t as a variable name elsewhere!). This can be set using the @independent_variables macro.","category":"page"},{"location":"","page":"Home","title":"Home","text":"@independent_variables t","category":"page"},{"location":"#Compatibility","page":"Home","title":"Compatibility","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"From version 0.4.0 CirculatorySystemModels is only compatible with Julia 1.10 and up, and with MTK 9 and higher.","category":"page"}] }