1. Blood loss simulation

In this simulation, we will see how the physiological variable is affected by a blood loss of 20% of the total blood volume. The inputs drug rates will remain constant.

[1]:
import matplotlib.pyplot as plt
import python_anesthesia_simulator as pas

1.1. Definition of the patient simulation

In this cell, a class instance of the simulator is created and initialized at maintenance phase.

Then the rate of the blood loss and fluid replacement are detailled.

[2]:
ts = 5 # time step in seconds
age, height, weight, gender = 74, 164, 88, 1
George = pas.Patient([age, height, weight, gender], ts=ts,
                           model_propo="Eleveld", model_remi="Eleveld", co_update=True)

#init the patient at maintenance
George.initialized_at_maintenance(bis_target=50,  tol_target=0.9, map_target=80)

# details of the blood loss
start_bleeding_time = 1 # 1 minute
blood_loss = 0.1 # 10% blood loss
blood_loss_time = 1 # 1 minute
blood_rate = George.blood_volume*blood_loss*1000/blood_loss_time # blood loss rate (ml/min)
# details of the fluid replacement
start_transfusion_time = 7 # 7 minutes
transfusion_time = 10 # 10 minutes
transfusion_rate = George.blood_volume*blood_loss*1000/transfusion_time # fluid replacement rate (ml/min)

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************

1.2. Simulation

[3]:
N_simu = int(30 * 60/ts) # 30 minutes simulation

for index in range(N_simu):
    if index*ts> start_bleeding_time*60 and index*ts<=(start_bleeding_time + blood_loss_time)*60:
        # blood loss
        George.one_step(u_propo=George.u_propo_eq, u_remi=George.u_remi_eq,
                        u_nore=George.u_nore_eq, blood_rate= - blood_rate, noise=False)
    elif index*ts> (start_transfusion_time)*60 and index*ts<=(start_transfusion_time + transfusion_time)*60:
        # fluid replacement
        George.one_step(u_propo=George.u_propo_eq, u_remi=George.u_remi_eq,
                        u_nore=George.u_nore_eq, blood_rate=transfusion_rate, noise=False)
    else:
        # no blood loss or fluid replacement
        George.one_step(u_propo=George.u_propo_eq, u_remi=George.u_remi_eq,
                        u_nore=George.u_nore_eq, noise=False)

1.3. Results

[4]:
# plot concentration of propofol, remifentanil and norepinephrine
fig, ax = plt.subplots(2)
Time = George.dataframe['Time']/60
ax[0].plot(Time, George.dataframe['blood_volume'])
ax[0].set_ylabel("Blood_volume (L)")
ax[0].grid()
ax[1].plot(Time, George.dataframe['x_propo_1']*10, label="Propofol (x10))")
ax[1].plot(Time, George.dataframe['x_remi_1']*10, label="Remifentanil (x10))")
ax[1].plot(Time, George.dataframe['c_blood_nore'], label="Norepinephrine")
ax[1].set_ylabel("Blood Concentration")
ax[1].set_xlabel("Time (min)")
plt.legend()
plt.grid()
plt.show()
../_images/examples_blood_loss_simu_7_0.png
[5]:
# plot bis, map and co
fig, ax = plt.subplots(3)
ax[0].plot(Time, George.dataframe['blood_volume'])
ax[0].set_ylabel("Blood_volume (L)")
ax[0].grid()
ax[1].plot(Time, George.dataframe['BIS'])
ax[1].set_ylabel("BIS")
ax[1].grid()
ax[2].plot(Time, George.dataframe['MAP'], label="MAP")
ax[2].plot(Time, George.dataframe['CO']*10, label="CO (x10)")
ax[2].set_ylabel("MAP and CO")
ax[2].set_xlabel("Time (min)")
plt.legend(loc="upper right")
plt.grid()
plt.show()

../_images/examples_blood_loss_simu_8_0.png

Here 4 phases can be distinguished:

  • Bleeding phase: the patient loses blood

  • Maintenance phase: No fluid management but low blood volume

  • Transfusion phase: the patient receives blood

  • Recovery phase: No fluid management, normal blood volume right after the transfusion

During the bleeding phase, the patient loses blood and the blood volume decreases. The BIS decrease because the propofol sensitivity of the patient increase.
MAP and CO decrease as well due to the assumption of direct proportionality between blood volume and Hemodynamic variable.

During the maintenance phase, the concentration of all drugs increase because of the low blood volume and the constant drug rate. Thus BIS decrease and MAP increase.

During the transfusion phase, the blood volume increases. The bis increase because the propofol sensitivity of the patient decrease. MAP and CO increase as well due to the assumption of direct proportionality between blood volume and Hemodynamic variable.

During the recovery phase, the concentration of all drugs decrease because of the higher blood volume and the constant drug rate. Thus all the variable return to their initial value.