Compbiomed 2023 presentation Tomas Kulhanek
Created by Tomas Kulhanek

Bodylight.js - toolchain for in-browser simulation of simple and complex mathematical models
Bodylight.js 2.0 - Introduction

acknowledgment


team current and past

What language/technology do you use for modeling?

Models
Is it a model? equations

Elena Zappon Efficient Reduced Order Modeling for Coupled Problems in Cardiac Electrophysiology, CompBioMed2023, 13th September 2023
Is it a model? component diagram

Magdalena Otta et al. A 0D model of lower limb haemodynamics: sensitivity analysis, CompBioMed2023, 13th September 2023
Is it a model? block schema

A C Guyton, T G Coleman, H J Granger, Circulation: overall regulation, Annu Rev Physiol.1972;34:13-46.doi: 10.1146/annurev.ph.34.030172.000305.
Correction after reimplementation in 2010

J.Kofránek, et al., Restoration of Guyton‘s Diagram for Regulation of the Circulation ...Physiol Res. 2010;59(6):897-908.doi: 10.33549/physiolres.931838.
explanatory models
to explain:
- equations
- way of computation
- physical reality
who is the audience?
- mathematician/computer scientist
- biomedical engineer
- other domain expert
- clinicians, physicians
- healthcare staff
- students of medicine
- patient
model of glucose insulin regulation - equations



model of glucose insulin regulation - block schema

model of glucose insulin regulation - acausal and component modeling (compartment modeling)

components




Tomas Kulhanek, Jiri Kofranek. Experience with Teaching Different Modeling Techniques on the example of Glucose Insulin Regulation Model,
Annu Int Conf IEEE Eng Med Biol Soc. 2020 Jul;2020:6024-6027. doi: 10.1109/EMBC44109.2020.9176535
Guyton's original scheme

implementation in component and acausal modeling language

Frank-Starling law is much more visible in component model - "force of the heart muscle depends on pressure of incoming blood".
Physiomodel

Complex model of physiology in Modelica based on HumMod and Physiolibrary
https://physiomodel.org
>60 000 equations
simulators
who is the audience?
- mathematician/computer scientist
- biomedical engineer
- other domain expert
- clinicians, physicians
- healthcare staff
- students of medicine
- patient
from model to web simulator and where bodylight.js fills the missing pieces

bodylight.js
- scripts translate model - FMU (standard C-source,C-binary following API) to WebAssembly
- javascript library
- custom element for model
- custom element for animation
- custom element for other useful web libraries and simplified elements
- Optional tools (composer, editor) to simplify creating and deploying web simulators
1. export model to FMU with C source code

2.compile to WebAssembly

Configuration and scripts to facilitate compilation with emscripten
emcc … -O3 –closure 0 …
https://github.com/creative-connections/Bodylight.js-FMU-Compiler
3. download JS with WebAssembly and use it in <bdl-fmi> web component

webcomponents - HTML elements

webcomponents - custom elements


- custom tag for model: fmi


- custom tag for chart


webcomponents - custom elements animation


simulator with web components - src
<script src=" bodylight.bundle.js" ></script>
...
<body aurelia-app="webcomponents">
...

we can put HTML/CSS styling

in-browser simulation - serverless apps examples
web simulators in a browser / desktop/tablet

native mobile apps


control HW mannequin

bring virtual reality to life

simulator of glucose/insulin

circulation
hemodynamics
summary
- Bodylight.js - library to enable in-browser simulation
- Visualisation power to explain complexity of human physiology

bodylight.physiome.cz (with source codes at GITHUB)
Currently only models in Modelica language can be simulated - in future other languages and technologies can be integrated just by implementing standard FMI API



explanatory simulators

model of circulation and its regulation
Physiolibrary
https://physiolibrary.org