last day (15 days later) » 

4:07 PM
1
Q: Matematical model for lung ventilation simulation

user3142695I'm trying to create a programatical simulation for respirator ventilation of a lung. Therefore I've read this paper. As this is my first big math problem, I need some assistance to make sure I understand the math part correctly. If I understand it correctly, this equation can be used to calcula...

 
@LutzLehmann I'm sorry, but I did not understand your comment.
@LutzLehmann Oh. Thanks for that. I didn't know about transfer function. Now I understand a bit more. So with some values (R and C) set I do get: I(s)/P(s) = (s^2 + 420s) / (s^2 + 620s + 4000). My input is pressure (P) and I should get the air flow (I) - if I understand you correctly. So I just use e.g. s = 10 cmH2O and do get the flow value for this pressure?
 
Perhaps this maple worksheet will help: MSE_Q4838031
 
@gpmath Wow. Thank you for that. That's heavy stuff for me. I'll try to understand everything.
@gpmath I tried to understand the worksheet. From where do you get the P function (7)? And it would be great if you can give an explanation or a link how to get from (7) to (10). I really want to understand and learn this, but I didn't get the point...
@gpmath If I understand this correctly, you have added a pressure function. In my case I need to use a pressure function like this (top left): media.springernature.com/m685/springer-static/image/… , which is a e^-n function for the inspiration
 
@user3142695 $P(t)$ is defined in the paper (1)(2)(3). But I used it with no slope $\tau=0$ in (14) of the worksheet. The step response of the system is defined as $\mathcal{L}_s^{-1}\left[\frac{H(s)}{s}\right](t)$
@user3142695 It's no problem to simulate the state-space model with a arbitrary pressure function. But tell me, how do you want to simulate your model? With Matlab/Simulink, Python or something else?
 
@gpmath I need to build a script. In this case it will be a web application which should simulate ventilation. So I have to use javascript for this.
 
4:07 PM
@user3142695 Then you'll need an ODE solver library for Javascript.
 
Could you help me on this project? I need someone who can handle the maths. Maybe we can handle this on fivver or something similar?
 
Sure, i can help you.
 
I would pay you for this, ok?
 
Is it that important for you?
 
Yes it is. It is a very important project for me, but I can never handle this by my own.
I want to realize a ventilator simulator for preterm babies. Because treatment of these patient is very difficult, I want to improve training of young doctors.
 
4:16 PM
Okay, i understand. The math is easy for me to handle.
 
:-) To me it looks very difficult. Therefore I can handle 500g babies. I guess this is hard for you :-)
 
Indeed.
 
What do you suggest how should be proceed?
 
What timeline do you have?
 
Should we communicate via email? I have no problem to publish the result here. I'll put the project online for free. I won't make money with this. Will be free access...
No specific timeline. Of course as soon as possible :-) But no time pressure.
 
4:20 PM
That's good, next week my normal job as Senior SW Engineer goes on.
I saw that you are located in Germany?
 
Yes, that's right
 
Me too near Frankfurt/Main.
 
Oh. Sehr schön! Wenn notwendig, komme ich gerne auch nach Frankfurt. Komme aus der Nähe von Düsseldorf.
 
Do you have an idea about the programming framework you want to use?
Weiß nicht ob wir hier deutsch schreiben dürfen.
 
I'm running a nextJS application, so I'm using react as the framework.
Would this be a usable solver library: npmjs.com/package/odex
H(s) = (s^2 + 1,5s) / (30 s^2 + 44,44s + 1481)
This would be the transform function with the parameters for babies (if I calculated this correctly)
The pressure function should look like the screenshot I send you. Looks like a "shark fin".
 
4:31 PM
Sure, could be the right library.
But I'm not an expert in React, more in Angular.
But we need the state-space model not the transfer function.
See eq. (4) in my maple script.
 
Rc = Rp = 30 cmH20/L/s; Cl = Cw = 0,0045 L/cmH20; Cs = 0,0001
For that small babies, there is no differenciation of Rc and Rp or Cl and Cw. We just have R = 30 and C = 0,0045.
The result of the stuff should be a flow graph like the graph below the pressure: media.springernature.com/m685/springer-static/image/…
Hope this is possible at all...
 
How do you want to visualize the results of the simulation?
Do you have a framework like devextreme? https://js.devexpress.com/React/Demos/WidgetsGallery/Demo/Charts/Overview/MaterialBlueLight/
 
Visualisation: neonatologie.de/beatmungssimulation
Using sciChart
So, the visualisation works already, but "only" the data is missing :-)
 
All the better.
You are a medical doctor?
 
yes
 
4:43 PM
Can you embed Typescript components in your project?
 
yes, I can
 
Perfect.
Because the odex math lib also is TypeScript.
 
ok, shouldn't be a problem at all.
 
I could start to write some TypeScript classes which handle the model simulation with the help of the odex lib (is the lib for free?).
 
Oh, that would be fantastic. Yes, the odex lib is free. The npm package (which I would use) is under BSD-2-Clause license.
 
4:52 PM
At first i have to test the numerical quality of the odex lib.
 
Do you provide the data P(t) for the pressure e.g. as list of time and pressure values?
 
Yes, I can do that.
 
https://www.wolframcloud.com/obj/pfeifermaintal/Published/MSE_Q4838031.nb
Look for "Alternative pressure input".
 
You did this in a few minutes???
 
5:07 PM
yes.
 
I'm really impressed
You used the original parameters from the paper, right?
 
yes.
These parameters will then be arguments for the simulation method.
 
This is a original respirator data. Just so get an impression to you. The red parts are just marking artifacts. So your data is quite good. Just the decreasing part of the pressure graph should be a bit straighter. But it looks really good.
 
You also need the Volume as time integral of the airflow?
 
That would be great
 
5:20 PM
No problem, the Volume is already contained in the state-space model.
 
This is the pressure curve, right? Perfect!
 
With 3 parameters, tau1, tau2, T.
tau1, tau2 are time constants for the exp(t/tau) function.
 
So I don't have to provide pressure data as you already have the function...
 
super, as a 4th parameter we could take the amplitude of the pressure curve.
 
The pressure curve has a few more paramters, from which tau can be calculated. I would provide inspiration (here 1 sec) and expiration time (here 0.5 sec), peep (basis pressure; in your example it is 0 - in my case it is 5), pip (which is the max pressure - default 16)
 
5:33 PM
No problem at all.
I would like to end for today.
My mail is pfeifer_maintal@t-online.de
 
Thank you very much so far
I'll message you.
 
You're welcome.
 

last day (15 days later) »