Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2022 Jan;16(1):61-69.
doi: 10.1177/19322968211032249. Epub 2021 Jul 30.

Efficient Closed Loop Simulation of Do-It-Yourself Artificial Pancreas Systems

Affiliations

Efficient Closed Loop Simulation of Do-It-Yourself Artificial Pancreas Systems

Jana Schmitzer et al. J Diabetes Sci Technol. 2022 Jan.

Abstract

Background: Numerical simulations, also referred to as in silico trials, are nowadays the first step toward approval of new artificial pancreas (AP) systems. One suitable tool to run such simulations is the UVA/Padova Type 1 Diabetes Metabolic Simulator (T1DMS). It was used by Toffanin et al. to provide data about safety and efficacy of AndroidAPS, one of the most wide-spread do-it-yourself AP systems. However, the setup suffered from slow simulation speed. The objective of this work is to speed up simulation by implementing the algorithm directly in MATLAB®/Simulink®.

Method: Firstly, AndroidAPS is re-implemented in MATLAB® and verified. Then, the function is incorporated into T1DMS. To evaluate the new setup, a scenario covering 2 days in real time is run for 30 virtual patients. The results are compared to those presented in the literature.

Results: Unit tests and integration tests proved the equivalence of the new implementation and the original AndroidAPS code. Simulation of the scenario required approximately 15 minutes, corresponding to a speed-up factor of roughly 1000 with respect to real time. The results closely resemble those presented by Toffanin et al. Discrepancies were to be expected because a different virtual population was considered. Also, some parameters could not be extracted from and harmonized with the original setup.

Conclusions: The new implementation facilitates extensive in silico trials of AndroidAPS due to the significant reduction of runtime. This provides a cheap and fast means to test new versions of the algorithm before they are shared with the community.

Keywords: AndroidAPS; artificial pancreas; glycemic control; hybrid closed-loop; in silico trial; type 1 diabetes.

PubMed Disclaimer

Conflict of interest statement

Declaration of Conflicting Interests: The author(s) declared the following potential conflicts of interest with respect to the research, authorship, and/or publication of this article: Adrian Tappe reports personal fees from Roche Diabetes Care, personal fees from IME-DC, personal fees and non-financial support from Ypsomed, personal fees from Hi.health GmbH, personal fees from Science-Consulting in Diabetes GmbH and personal fees from Dexcom outside the submitted work.

Figures

Figure 1.
Figure 1.
The four main components of the T1DMS with their respective inputs and outputs. Abbreviations: CR, carb ratio; DIA, duration of insulin activity; ISF, insulin sensitivity factor.
Figure 2.
Figure 2.
Times of day and amount of CHO of the main meals and snacks given in the two-day-scenario used for the simulation.
Figure 3.
Figure 3.
Median and IQR (25th to 75th percentiles) of the BG values of all 30 in silico patients, plotted over the duration of the two-day scenario. The target range is colored as a horizontal area, the postprandial periods (PP) and the two nights (N) as vertical areas.
Figure 4.
Figure 4.
Mean of the BG values and the CHO intake of all 30 in silico patients. The target range is shown as a colored horizontal area and the two nights (N) are marked as colored vertical areas.
Figure 5.
Figure 5.
Meal boluses with SMB, basal rates as well as basis basal rate calculated by AndroidAPS during the 48 h simulation, shown as an example for an adult in silico patient. The two nights (N) are marked as colored vertical areas.

References

    1. Katsarou A, Gudbjörnsdottir S, Rawshani A, et al.. Type 1 diabetes mellitus. Nat Rev Dis Primers. 2017;3:17016. doi:10.1038/nrdp.2017.16 - DOI - PubMed
    1. Cryer PE, Davis SN, Shamoon H. Hypoglycemia in diabetes. Diabetes Care. 2003;6(26):1902-1912. - PubMed
    1. Lewis DM. History and perspective on DIY closed looping. J Diabetes Sci Technol. 2019;4(13):790-793. - PMC - PubMed
    1. OpenAPS. Open artificial pancreas system (OpenAPS). 2020. Accessed February 15, 2021. https://openaps.org/
    1. OpenAPS. OpenAPS documentation - revision a071bc01. 2020. Accessed March 8, 2021. https://openaps.readthedocs.io/en/latest/index.html