<figure><img src="image_1.png" /></figure>

HAL
open science

# PAS: a Python Anesthesia Simulator for drug control

Bob Aubouin-Pairault, Thao Dang, Mirko Fiacchini

► To cite this version:

Bob Aubouin-Pairault, Thao Dang, Mirko Fiacchini. PAS: a Python Anesthesia Simulator for drug control. Journal of Open Source Software, 2023, 8 (88), pp.5480. 10.21105/joss.05480. hal-04183029

HAL Id: hal-04183029

https://hal.science/hal-04183029v1

Submitted on 18 Aug 2023

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
# PAS: a Python Anesthesia Simulator for drug control

Bob Aubouin-Pairault ⚪¹,²¶, Mirko Fiacchini ⚪¹, and Thao Dang ⚪²

1 Univ. Grenoble Alpes, CNRS, Grenoble INP, GIPSA-lab, 38000 Grenoble, France 2 Univ. Grenoble Alpes, CNRS, Grenoble INP, VERIMAG, 38000 Grenoble, France ¶ Corresponding author

DOI: 10.21105/joss.05480

**Software**

- Review ⚪

<figure><img src="image_3.png" /></figure>

- Repository ⚪

<figure><img src="image_4.png" /></figure>

- Archive ⚪

<figure><img src="image_5.png" /></figure>

Editor: Antonia Mey ⚪ ⚪

<figure><img src="image_6.png" /></figure>

**Reviewers:**

- @yumuk1989

- @JHartzer

Submitted: 07 April 2023

Published: 14 August 2023

**License**

Authors of papers retain copyright
and release the work under a
Creative Commons Attribution 4.0
International License (CC BY 4.0).

## Summary

The Python Anesthesia Simulator (PAS) models the effect of drugs on physiological variables during total intravenous anesthesia. It is particularly dedicated to the control community, to be used as a benchmark for the design of multidrug controllers. The available drugs are propofol, remifentanil, and norepinephrine, the outputs are the bispectral index (BIS), mean arterial pressure (MAP), cardiac output (CO), and tolerance of laryngoscopy (TOL). PAS includes different well-known models along with their uncertainties to simulate inter-patient variability. Blood loss can also be simulated to assess the controller's performance in a shock scenario. Finally, PAS includes standard disturbance profiles and metric computation to facilitate the evaluation of the controller's performance. The statement of need of this package is first discussed; then some pieces of information about the programmed models are provided to the reader. The future developments of the package are discussed at the end.

## Statement of need

Closing the loop for drug dosage during general anesthesia is a challenging task that has attracted the attention of the control community for more than two decades. In fact, the high need for reliability coupled with a highly uncertain system makes the design of a controller arduous work. Numerous closed-loop control strategies have been proposed and reviewed in Ilyas et al. (2017), Copot (2020), Singh & Nath (2022), and Ghita et al. (2020) for instance.

Since it is a long process to clinically test a control method for drug injection, many papers only rely on simulations to demonstrate the advantages of their suggestions. However, two meta-studies Brogi et al. (2017), Puri et al. (2016) agree on the fact that automated control during anesthesia brings better stability to the physiological signals during the procedure. Since the methods that were first tested on simulation led to good performances in clinical situations, it could be concluded that simulations are realistic enough to be used as a first test.

In addition to being significantly faster than clinical tests, simulations also allow researchers to use the same framework to compare their methods. Up to now, many controllers have been proposed and tested on their own frameworks, and it is often hard to compare them properly. This is aggravated by the fact that the code of the algorithms is rarely open-source which makes hard the reproducibility of the results (to the author's knowledge, Coman & Iosif (2022) is the only open-source controller for anesthesia). Ionescu et al. recently address this issue by providing an open-source anesthesia simulator in Ionescu et al. (2021). If this is the first step to a FAIR (Findable, Accessible, Interoperable, Reusable) science, it can be improved. In fact, the measurement noise and disturbance scenarios are not yet specified. Moreover, while the simulator could incorporate them, the level of uncertainty to take into account in the patient model is also not fixed. Finally, the metrics used to compare the performance must be explicit and used by all users to compare the proposed control methods.

With the Python Anesthesia Simulator, a full pipeline is proposed to test control methods for
drug dosage in anesthesia. By using Python, an open-source language, we hope that everyone will be able to use our simulator. If the control community has historically used Matlab, the use of the control package (Fuller et al., 2021) in PAS facilitates the transition, with Matlab compatibility functions. Moreover, from an interdisciplinary point of view, Python is already widely used by the data science and machine learning community. On the anesthesia topic, the database VitalDB (Lee & Jung, 2018) has a Python API and could be used together with PAS to develop data-based approaches, as already done in Aubouin Pairault et al. (2023).

In addition to all the models available to link drugs to their effects, some useful functionalities are available in PAS:

* The uncertainties associated with Pharmacokinetic (PK) and Pharmacodynamic (PD) models are available to model inter-patient variability;

* Initialization of the patient simulator in the maintenance phase (around an equilibrium point) is possible.

* As this simulator also includes hemodynamics, the cardiac output can be used to actualize the PK models as proposed in Bienert et al. (2020);

* A blood loss scenario is available to test the controllers in extreme conditions;

* Standard additive disturbance profiles used in the literature are available;

* Control metric computation is directly available in the package.

## Model information

In PAS all drug effects are described by the well-known Pharmacokinetic-Pharmacodynamic (PK-PD) models. PK models are used to describe the distribution of drugs in the body, and PD models describe the effect of the drug on a specific output. Our simulator includes the most commonly employed models along with their uncertainties following a log-normal distribution for all the parameters. Uncertainties can be activated in the PK and PD parts separately.

## Pharmacokinetics

The standard way to model the Pharmacokinetics of drugs is to use a compartment model. Both propofol and remifentanil have been studied in many clinical trials and the 3-compartment model is considered as the standard way to model those drugs' pharmacokinetics, and it is also implemented in PAS. The different population models available are listed below:

* For propofol: Schnider et al. (1999), Marsh et al. (1991), Struys et al. (2000) (Marsh model with the modified time constant for the effect site compartment), Schüttler & Ihmsen (2000) and Eleveld et al. (2018).

* For remifentanil: Minto et al. (1997) and Eleveld et al. (2017).

Norepinephrine clinical trials are rarer and usually, only one compartment is used to model the distribution of this drug in blood. In PAS the model from Beloeil et al. (2005) is programmed.

Several studies have shown the influence of cardiac output (CO) on the pharmacokinetics of propofol (Adachi et al., 2001; Kurita et al., 2002; Upton et al., 1999). In Bienert et al. (2020) the authors proposed the assumption that the clearance rate of propofol and fentanil could be proportional to CO resulting in a non-constant clearance rate. In the simulator, the same assumption is made for propofol and extended to remifentanil and remifentanil clearance rates PK. It can be activated or deactivated to simulate the interaction between CO and the PK systems.

Blood loss is known to change the distribution of drugs in the body (Johnson et al., 2001, 2003; Kurita et al., 2009). In fact, the reduced volume of blood will affect the PK system of
the drugs. Thus, during a blood loss simulation the blood volume is updated in all the PK models to represent the remaining fraction of the remaining blood volume. As blood loss also strongly impacts the hemodynamic system leading to a decrease in the CO, the clearance rates of the PK system will also decrease.

## Pharmacodynamics

Pharmacodynamics models describe the link between drug concentrations and the observed effect on physiological variables. In PAS, the considered variables are bispectral index (BIS) to characterize the hypnotic system, mean arterial pressure (MAP) and cardiac output (CO) for the hemodynamic system, and tolerance of laryngoscopy (TOL) as an analgesia indicator. Unlike Ionescu et al. (2021) which uses Richmond agitation sedation scale (RASS) to assess analgesia, TOL is chosen due to the availability of more clinical studies on this index. Since this output does not affect the system, another index could be programmed to replace it.

The standard way to model pharmacodynamics is to consider a delay between a rise in blood concentration and the appearance of the physiological effect by adding an effect site compartments. A Hill curve was then used to model the relation between the effect site drug concentration and the dedicated effect.

For BIS and TOL, PAS includes respectively a surface-response model and a hierarchical model to represent the synergic effect of propofol and remifentanil with values from Bouillon et al. (2004).

For MAP and CO, the interaction between drugs has not been studied yet. Thus, the effect of each drug is added to obtain the overall treatment effect:

* For propofol values from Jeleazcov et al. (2015) are used for MAP. For CO, experimental values from Fairfield et al. (1991).

* For remifentanil only studies in infants were found, the parameters from Standing et al. (2010) are used for the MAP effect, and the experimental results from Chanavaz et al. (2005) for the CO effect.

* For remifentanil values from Beloeil et al. (2005) are used for MAP interaction in accordance with the PK model. For the impact on CO, we extrapolate values from Monnet et al. (2011).

Note that for the effect of all drugs on CO, there is no study proposing a Hill curve. Thus, the Hill curve parameters are computed to match experimental results.

## Blood loss

In addition to the effect of blood loss in the PK systems, the crude assumption that MAP and CO are proportional to the blood volume was made in the simulator. The transient behavior of bleeding and transfusion does not verify this assumption, however the steady-state experimental values do agree with it (Rinehart et al., 2011). A more complex hemodynamic model should be integrated to obtain better results. The simulator also takes into account the fact that the BIS pharmacodynamics depends on bleeding (Kurita et al., 2009) leading to a deeper hypnosis state.

## Conclusion and Future development

As shown in the available examples included in PAS, many functions are implemented to support further research on drug control during anesthesia. This package provides a full pipeline for designing and testing multidrug controllers in a wide variety of scenarios. In the future many improvements can be imagined to develop PAS:
* Other drugs or models could be added;

* Neuromuscular blockade system could be implemented as this is an important component of the anesthesia paradigm;

* A more physiological model for the hemodynamic system could be proposed to better link CO and MAP and eventually add Heart Rate as an output variable;

* The respiratory system could be considered to include new variables;

* New shock scenarios could be implemented to test our controller in a diverse environment.

Feedback and input from the community are welcome, in particular, to implement a physiological model which is not our domain of expertise. We also hope that the code of controllers tested on PAS will be released in an open-source manner.

## Acknowledgements

This work has been partially supported by the LabEx PERSYVAL-Lab (ANR-11-LABX-0025-01) funded by the *French program Investissement d'avenir* and the *French-Japanese ANR-JST CyphAI* project. The authors also thank Mathias Réus for his help with practical Python programming and packaging.

## References

Adachi, Y. U., Watanabe, K., Higuchi, H., & Satoh, T. (2001). The Determinants of Propofol Induction of Anesthesia Dose. *Anesthesia & Analgesia, 92*(3), 656. https://doi.org/10.1213/00000539-200103000-00020

Aubouin Pairault, B., Fiacchini, M., & Dang, T. (2023, June). Data-based Pharmacodynamic Modeling for BIS and Mean Arterial Pressure Prediction during General Anesthesia. *ECC 2023 - 21st European Control Conference*. https://doi.org/10.23919/ecc57647.2023.10178214

Beloeil, H., Mazoit, J.-X., Benhamou, D., & Duranteau, J. (2005). Norepinephrine kinetics and dynamics in septic shock and trauma patients. *BJA: British Journal of Anaesthesia, 95*(6), 782-788. https://doi.org/10.1093/bja/aei259

Bienert, A., Sobczyński, P., Młodawska, K., Hartmann-Sobczyńska, R., Grześkowiak, E., & Wiczling, P. (2020). The influence of cardiac output on propofol and fentanyl pharmacokinetics and pharmacodynamics in patients undergoing abdominal aortic surgery. *Journal of Pharmacokinetics and Pharmacodynamics, 47*(6), 583-596. https://doi.org/10.1007/s10928-020-09712-1

Bouillon, T. W., Bruhn, J., Radulescu, L., Andresen, C., Shafer, T. J., Cohane, C., & Shafer, S. L. (2004). Pharmacodynamic Interaction between Propofol and Remifentanil Regarding Hypnosis, Tolerance of Laryngoscopy, Bispectral Index, and Electroencephalographic Approximate Entropy. *Anesthesiology, 100*(6), 1353-1372. https://doi.org/10.1097/00000542-200406000-00006

Brogi, E., Cyr, S., Kazan, R., Giunta, F., & Hemmerling, T. M. (2017). Clinical Performance and Safety of Closed-Loop Systems: A Systematic Review and Meta-analysis of Randomized Controlled Trials. *Anesthesia & Analgesia, 124*(2), 446-455. https://doi.org/10.1213/ANE.0000000000001372

Chanavaz, C., Tirel, O., Wodey, E., Bansard, J. Y., Senhadji, L., Robert, J. C., & Ecoffey, C. (2005). Haemodynamic effects of remifentanil in children with and without intravenous atropine. An echocardiographic study. *BJA: British Journal of Anaesthesia, 94*(1), 74-79. https://doi.org/10.1093/bja/aeh293
Coman, S., & Iosif, D. (2022). AnesthesiaGUIDE: A MATLAB tool to control the anesthesia. *SN Applied Sciences, 4*(1), 3. https://doi.org/10.1007/s42452-021-04885-x

Copot, D. (2020). *Automated drug delivery in anesthesia*. Academic Press. https://doi.org/10.1016/c2017-0-03401-8

Eleveld, D. J., Colin, P., Absalom, A. R., & Struys, M. M. R. F. (2018). Pharmacokinetic-pharmacodynamic model for propofol for broad application in anaesthesia and sedation. *British Journal of Anaesthesia, 120*(5), 942-959. https://doi.org/10.1016/j.bja.2018.01.018

Eleveld, D. J., Proost, J. H., Vereecke, H., Absalom, A. R., Olofsen, E., Vuyk, J., & Struys, M. M. R. F. (2017). An Allometric Model of Remifentanil Pharmacokinetics and Pharmacodynamics. *Anesthesiology, 126*(6), 1005-1018. https://doi.org/10.1097/ALN.0000000000001634

Fairfield, J. E., Dritsas, A., & Beale, R. J. (1991). Haemodynamic Effects of Propofol: Induction with 2.5mg kg-1. *British Journal of Anaesthesia, 67*(5), 618-620. https://doi.org/10.1093/bja/67.5.618

Fuller, S., Greiner, B., Moore, J., Murray, R., van Paassen, R., & Yorke, R. (2021). The Python Control Systems Library (python-control). *2021 60th IEEE Conference on Decision and Control (CDC)*, 4875-4881. https://doi.org/10.1109/CDC45484.2021.9683368

Ghita, M., Neckebroek, M., Muresan, C., & Copot, D. (2020). Closed-Loop Control of Anesthesia: Survey on Actual Trends, Challenges and Perspectives. *IEEE Access, 8*, 206264-206279. https://doi.org/10.1109/ACCESS.2020.3037725

Ilyas, M., Butt, M. F. U., Bilal, M., Mahmood, K., Khaqan, A., & Ali Riaz, R. (2017). A Review of Modern Control Strategies for Clinical Evaluation of Propofol Anesthesia Administration Employing Hypnosis Level Regulation. *BioMed Research International, 2017*, e7432310. https://doi.org/10.1155/2017/7432310

Ionescu, C. M., Neckebroek, M., Ghita, M., & Copot, D. (2021). An Open Source Patient Simulator for Design and Evaluation of Computer Based Multiple Drug Dosing Control for Anesthetic and Hemodynamic Variables. *IEEE Access, 9*, 8680-8694. https://doi.org/10.1109/ACCESS.2021.3049880

Jeleazcov, C., Lavielle, M., Schüttler, J., & Ihmsen, H. (2015). Pharmacodynamic response modelling of arterial blood pressure in adult volunteers during propofol anaesthesia. *BJA: British Journal of Anaesthesia, 115*(2), 213-226. https://doi.org/10.1093/bja/aeu553

Johnson, K. B., Egan, T. D., Kern, S. E., White, J. L., McJames, S. W., Syroid, N., Whiddon, D., & Church, T. (2003). The Influence of Hemorrhagic Shock on Propofol: A Pharmacokinetic and Pharmacodynamic Analysis. *Anesthesiology, 99*(2), 409-420. https://doi.org/10.1097/00000542-200308000-00023

Johnson, K. B., Kern, S. E., Hamber, E. A., McJames, S. W., Kohnstamm, K. M., & Egan, T. D. (2001). Influence of Hemorrhagic Shock on Remifentanil: A Pharmacokinetic and Pharmacodynamic Analysis. *Anesthesiology, 94*(2), 322-332. https://doi.org/10.1097/00000542-200102000-00023

Kurita, T., Morita, K., Kazama, T., & Sato, S. (2002). Influence of Cardiac Output on Plasma Propofol Concentrations during Constant Infusion in Swine. *Anesthesiology, 96*(6), 1498-1503. https://doi.org/10.1097/00000542-200206000-00033

Kurita, T., Takata, K., Morita, K., Morishima, Y., Uraoka, M., Katoh, T., & Sato, S. (2009). The Influence of Hemorrhagic Shock on the Electroencephalographic and Immobilizing Effects of Propofol in a Swine Model. *Anesthesia & Analgesia, 109*(2), 398-404. https://doi.org/10.1213/ane.0b013e3181a96f9a

Lee, H.-C., & Jung, C.-W. (2018). Vital Recorder—a free research tool for automatic recording of high-resolution time-synchronised physiological data from multiple anaesthesia devices.
Scientific Reports, 8(1), 1527. https://doi.org/10.1038/s41598-018-20062-4

Marsh, B., White, M., morton, N., & Kenny, G. N. C. (1991). Pharmacokinetic model Driven Infusion of Propofol in Children. *BJA: British Journal of Anaesthesia*, *67*(1), 41–48.
https://doi.org/10.1093/bja/67.1.41

Minto, C. F., Schnider, T. W., Egan, T. D., Youngs, E., Lemmens, H. J. M., Gambus, P. L., Billard, V., Hoke, J. F., Moore, K. H. P., Hermann, D. J., Muir, K. T., Mandema, J. W., & Shafer, S. L. (1997). Influence of Age and Gender on the Pharmacokinetics and Pharmacodynamics of Remifentanil: I. Model Development. *Anesthesiology*, *86*(1), 10–23.
https://doi.org/10.1097/00000542-199701000-00004

Monnet, X., Jabot, J., Maizel, J., Richard, C., & Teboul, J.-L. (2011). Norepinephrine increases cardiac preload and reduces preload dependency assessed by passive leg raising in septic shock patients*. *Critical Care Medicine*, *39*(4), 689. https://doi.org/10.1097/CCM.0b013e318206d2a3

Puri, G. D., Mathew, P. J., Biswas, I., Dutta, A., Sood, J., Gombar, S., Palta, S., Tsering, M., Gautam, P. L., Jayant, A., Arora, I., Bajaj, V., Punia, T. S., & Singh, G. (2016). A Multicenter Evaluation of a Closed-Loop Anesthesia Delivery System: A Randomized Controlled Trial. *Anesthesia & Analgesia*, *122*(1), 106–114. https://doi.org/10.1213/ANE.0000000000000769

Rinehart, J., Alexander, B., Manach, Y. L., Hofer, C. K., Tavernier, B., Kain, Z. N., & Cannesson, M. (2011). Evaluation of a novel closed-loop fluid-administration system based on dynamic predictors of fluid responsiveness: An in silico simulation study. *Critical Care*, *15*(6), R278. https://doi.org/10.1186/cc10562

Schnider, T. W., Minto, C. F., Shafer, S. L., Gambus, P. L., Andresen, C., Goodale, D. B., & Youngs, E. J. (1999). The Influence of Age on Propofol Pharmacodynamics. *Anesthesiology*, *90*(6), 1502–1516. https://doi.org/10.1097/00000542-199906000-00003

Schüttler, J., & Ihmsen, H. (2000). Population Pharmacokinetics of Propofol: A Multicenter Study. *Anesthesiology*, *92*(3), 727–738. https://doi.org/10.1097/00000542-200003000-00017

Singh, M., & Nath, G. (2022). Artificial intelligence and anesthesia: A narrative review. *Saudi Journal of Anaesthesia*, *16*(1), 86–93. https://doi.org/10.4103/sja.sja_669_21

Standing, J. F., Hammer, G. B., Sam, W. J., & Drover, D. R. (2010). Pharmacokinetic-pharmacodynamic modeling of the hypotensive effect of remifentanil in infants undergoing cranioplasty. *Pediatric Anesthesia*, *20*(1), 7–18. https://doi.org/10.1111/j.1460-9592.2009.03174.x

Struys, M. M. R. F., De Smet, T., Depoorter, B., Versichelen, L. F. M., Mortier, E. P., Dumortier, F. J. E., Shafer, S. L., & Rolly, G. (2000). Comparison of Plasma Compartment versus Two Methods for Effect Compartment-controlled Target-controlled Infusion for Propofol. *Anesthesiology*, *92*(2), 399. https://doi.org/10.1097/00000542-200002000-00021

Upton, R. N., Ludbrook, G. L., Grant, C., & Martinez, A. M. (1999). Cardiac Output is a Determinant of the Initial Concentrations of Propofol After Short-Infusion Administration. *Anesthesia & Analgesia*, *89*(3), 545. https://doi.org/10.1213/00000539-199909000-00002