tIntegration = 4.0  # integration end time
tEinschwing = 2.
dt = 0.01  # time step size

# generate one heart to be connected to multiple cycles
theHeart = [Vorhof(), Herzkammer()]
theHeart[0].addNeighbour(theHeart[1])

# create a list of blood circuits, each sharing the same heart
compartments = []
compartments += theHeart
numberOfCircuits = 2
for i in range(numberOfCircuits):
    # create a new circuit
    newCircuit = [Artery(), TerminalVessel(), Artery()]
    # add to list of all compartments
    compartments += newCircuit

    # connect as a ring
    theHeart[1].addNeighbour(newCircuit[0])
    newCircuit[0].addNeighbour(newCircuit[1])
    newCircuit[1].addNeighbour(newCircuit[2])
    newCircuit[2].addNeighbour(theHeart[0])

system = CompartmentSet(*compartments)
subsystem = CompartmentSet(*(theHeart + newCircuit))

# integration and output
if not os.path.exists('out'):
    os.makedirs('out')
Beispiel #2
0
"""
Simulation of a single compartment (in this case an artery)
"""

from __future__ import print_function
import os
from compartments import Artery
import matplotlib.pyplot as plt

tMax = 1.0  # integration end time
dt = 0.01  # time step size
t = 0

# generate a line of connected compartments
compartment = Artery(P1=9000., P2=13000., Q1=0.0003, Q2=0.0003)

t_vals = []
P_vals = []
Q_vals = []
# integration and output
while t < tMax:
    t += dt
    P1, Q2 = compartment.integrate(t)
    t_vals.append(t)
    P_vals.append(P1)
    Q_vals.append(Q2)

print(P_vals)
f, ax = plt.subplots(2, sharex=True)
ax[0].set_title('Druck P')
ax[0].plot(t_vals, P_vals)
Beispiel #3
0
"""
Simulation eines simplen Blutkreislaufs des menschlichen Koerpers
"""

from __future__ import print_function
import os
from compartments import Vorhof, Artery, CompartmentSet
from subprocess import Popen, PIPE

tIntegration = 1.0  # integration end time
tEinschwing = 0.
dt = 0.01  # time step size

# generate a line of connected compartments
compartments = [
    Artery(Q1=0.0003),  # eine Arterie mit einer Quelle links
    Artery(),
    Vorhof(C=Artery().C),  # eine Klappe ohne Vorhof Compliance
    Artery(),
    Artery()
]

# connect as a ring
compartments[0].addNeighbour(compartments[1])
compartments[1].addNeighbour(compartments[2])
compartments[2].addNeighbour(compartments[3])
compartments[3].addNeighbour(compartments[4])
# compartments[4].addNeighbour(compartments[0])
system = CompartmentSet(*compartments)

# integration and output
Beispiel #4
0
     P2=10000.,
     Q1=0.0,
     Q2=0.0
 ),
 Herzkammer(
     C=0.0000002,
     P1=10000.,
     P2=10000.,
     Q1=0.0,
     Q2=0.0
 ),
 Artery(
     R=1000000.,
     L=300.,
     C=0.0000001,
     P1=10000.,
     P2=10000.,
     Q1=0.0000,
     Q2=0.000
 ),
 TerminalVessel(
     R=1000000000.,
     C=0.0000001,
     P1=3000.,
     P2=3000.,
     Q1=0.0,
     Q2=0.0
 ),
 Artery(
     R=100000.,
     L=300.,
Beispiel #5
0
"""

from __future__ import print_function
import os
from compartments import Herzkammer, Vorhof, Artery, TerminalVessel, CompartmentSet
from subprocess import Popen, PIPE

tIntegration = 4.0  # integration end time
tEinschwing = 16.
dt = 0.01  # time step size

# generate a ring of connected compartments
compartments = [
    Vorhof(C=0.000005),
    Herzkammer(C=0.0000001),
    Artery(R=100000., L=300., C=0.0000001),
    TerminalVessel(R=10000000., C=0.000001),
    Artery(R=100000., L=300., C=0.0000001)
]

# connect as a ring
compartments[0].addNeighbour(compartments[1])
compartments[1].addNeighbour(compartments[2])
compartments[2].addNeighbour(compartments[3])
compartments[3].addNeighbour(compartments[4])
compartments[4].addNeighbour(compartments[0])
system = CompartmentSet(*compartments)

# integration and output
if not os.path.exists('out'):
    os.makedirs('out')