OrgPad logo

EMBO 2023 - Bodylight.js

Created by Tomas Kulhanek

#modeling, #physiology, #simulation

EMBO 2023 - Bodylight.js

Tomáš Kulhánek - Bodylight.js

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

image

code in programming language

Model

equations

image

image

image

image

block schema

image

component modeling (compartment modeling)

image

components

image

image

image

image

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

image

OpenModelica, Dymola (by Dassault Systemes), System Modeler (by Wolfram) ...

component (compartment) model (having DAE or ODE) follows physical reality

Is it a model? block schema

image

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

image

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.

Physiomodel

https://physiomodel.org                >60 000 equations

Mateják, M., Kofránek, J. (2015), Physiomodel – An Integrative Physiology in Modelica, Proceedings of 37th AnnualInternational Conference of the IEEE Engineering in Medicine and Biology Society, IEEE, Milano (It), pp. 1464-1467, ISSN: 1557- 170X.

firefox hapzg4QnJR

circulatory dynamics

image

implementation in component and acausal modeling language

image

Frank-Starling law

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

POWERPNT scB6gQSIAm

Physiolibrary, Chemical

https://physiolibrary.org

Marek Mateják, Tomáš Kulhánek, Jan Šilar, Pavol Privitzer, Filip Ježek, Jiří Kofránek: Physiolibrary - Modelica library for Physiology, In Conference Proceeding,

#1 award for best open-source library - for Physiolibrary 10th International Modelica Conference, March 12, 2014, Lund, Sweden, (DOI:10.3384/ECP14096499)

#1 award for best open-source library - for Chemical 11th International Modelica Conference, 2015,  September 21-23, 2015, Paris, France

compile code to executable

Simulation

specialized modeling simulation tool

portable application

Why simulation?

image

missing pieces for portable web application

image

1. export model to FMU with C source code

image

bodylight.js

  1.  scripts to translate model from FMU (co-simulation mode with C source code) to WebAssembly
  2. webcomponents - javascript library  with reusable and configurable custom elements
    1. for model simulation 
    2.  for animation
    3. for other visualisation/communication etc.
  3. optional tools (composer, editor) to simplify creating and deploying web simulators

2.compile to WebAssembly

image

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

image

webcomponents - HTML elements

POWERPNT e4sDsmlrVX

webcomponents - custom elements animation

image

firefox jMeSh19NxA

webcomponents - custom elements

image

range

image

firefox I8uGRV2pqg

firefox vth3zNcRRV

firefox vEtlzn8tvj

in-browser simulator - INDEX.HTML

1. download or refer bodylight.bundle.js

2.include web components in HTML source:

<body aurelia-app="webcomponents">

...

image

we can put HTML/CSS styling

image

HTML + webcompontens = in-browser simulator

simulator of glucose/insulin

firefox C1zReN0kIX

simulator of iron metabolism

firefox x0PGsba4hE

simulator of hemodynamics

firefox qYlwYk59B0

co-simulation of multiple models

image

respiration

Dymola sdXGmJf24o

blood-gas exchange

Dymola qmDZxxtrfj

hemodynamics of cardiovascular system

Dymola 9CIA5zGnUy

native mobile apps

imagePOWERPNT Mjc6Qcjhym

digital appendix of scientific paper

firefox fjKgpq2PYp

image

firefox Z6IuwQAnlM

firefox icx2MQ5dWd

give life to VR/AR

vr

image

image

image

simulator of cardiorespiratory treated with ECMO

POWERPNT 4kJE4xB8Wg

REST API

control HW mannequin

hwmanequin

summary

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

Tomáš Kulhánek, Ph.D.

(seek for collaboration, contract, visit, job)

image

future: AI / ML assisted modeling - SciML  - physiology informed neural network

value of simulation based on scientific models for educational and clinical app

image

https://bodylight.physiome.cz

https://egolem.online/demo

firefox 9hklclwGdh

firefox vEtlzn8tvj

supported FMI export

+

+

or

performance - WASM 12% slower than native code

image

image

 
WASM1 ~ requestAnimationFrame( () -> {
...
fmiDoStep();
...
})
WASM3 ~ requestAnimationFrame( () -> {
...
fmiDoStep();
fmiDoStep();
fmiDoStep();
...
})

+

simulator1

static HTML pages - GITHUB pages

simulator2

Supporting tools

Bodylight.js-FMU-Compiler

image

Configuration and scripts to facilitate compilation with emscripten

emcc … -O3 –closure 0 …

https://github.com/creative-connections/Bodylight.js-FMU-Compiler

Bodylight Editor

firefox DCYRyuhlNq

Bodylight VirtualMachine

image

Physiolibrary

https://physiolibrary.org