Mechanical Ventilator Pulse Action

Hi I wanted to use the Pulse Physiology Engine to simulate an Ambu bag in Unity

While I would realy like to be able to link the squeeze’s of the Ambu bag in VR and line that to pulse model, I am not sure that’s possible, if it is could you please explain how.

What I thought would be possible to was to modify the PulseAction.VentilateMask example and adjust the flow rate to simulate the Ambu bag compression rate.

there seams for be a Mechanical Ventilation model in the system there is an example on how to set it up in JSON

“AnyAction”: [{
“PatientAction”: {
“MechanicalVentilation”: { “State”:“On”,
“Flow”: { “ScalarVolumePerTime”: { “Value”:1.0, “Unit”:“mL/s” } },
“Pressure”: { “ScalarPressure”: { “Value”:10.0, “Unit”:“cmH2O” } },
“GasFraction”: { “Name”:“Oxygen”,
“Amount”: { “Scalar0To1”: { “Value”:0.3 } } },
“GasFraction”: { “Name”:“CarbonDioxide”,
“Amount”: { “Scalar0To1”: { “Value”:0.1 } } },
“GasFraction”: { “Name”:“Nitrogen”,
“Amount”: { “Scalar0To1”: { “Value”:0.6 } } }

and there seams to be some documentation here

what I don’t understand is how to make Mechanical Ventilation action. And I am not sure where that documentation explain what is need to set up an Action?

This is the code I tried to set up based on the SEAnesthesiaMachineConfiguration, but it does not work and seams to crash the vitals monitor when sent with no errors. I cant find where is set the gas fraction and I am not sure this is how I am meant to set up the pressure.

case PulseAction.AmbuBag:
SEMechanicalVentilatorConfiguration am = new SEMechanicalVentilatorConfiguration();
am.GetConfiguration().GetExpirationCycleFlow().SetValue(5, VolumePerTimeUnit.L_Per_min);
am.GetConfiguration().GetPositiveEndExpiredPressure().SetValue(1, PressureUnit.cmH2O);
am.GetConfiguration().GetPeakInspiratoryPressure().SetValue(10.5, PressureUnit.cmH2O);


Hi Dr Holmes

We actually just added a BVM action that could be what you are looking for. It was not included in this latest update to the unity asset, but the Pulse unity asset is really our c# api along with builds for various operating systems. What OS are you using to do your app?

Hi Abray

BVM action would be great, where would I find that example / documentation in the main code. As I understand it from the unity documentation the main pulse engine is built into a DLL to use in unity, could this BVM be built as such.

I am building VR Tracheostomy Emergency simulation app for NHS wales for VR android Pico Neo3 and Oculus Quest 1/2. My test show that this works for the oculus platform, I haven’t tested the neo3 platform as yet. The BVM is part of the emergency algorithm we following and it be better for it to be linked to the patient, but the block airway action already gives a lot of functionality we want.

I can build 1 managed dll for the C# api, but I have to build individual specific dlls for each native platform if you want pulse to actually execute on the target device. (if the device is not a client with pulse running on a server laptop). So I’d have to build 1 or 2 android dlls for you.

But check this out and see what you think

Generally, the Pulse master branch is what the release is (and unity), the 3.x branch is all the latest features being tested together until the next release, but it’s generally pretty safe, just might not have complete documentation,and there might be an occasional hiccup or two requiring a quick fix.

Do you have experience building and running with C++,in case you want to run and experiment with the api? What is your primary development box OS?

Thanks the instantaneous method seams exactly what I would like to have. I am little confused as on line 149 it says
how does that link to the instantaneous object? I thought it would have been

How is the android version specific dlls work, if you have to build specific dlls for each native platform? What is happening at the moment in the unity plugin.

I have a little experience with C++ mainly porting from it. I develop in Windows for VR. I will download the lastest build you have pionted and see how its built, is there a guide to building the dll.

how would I set up to call the action in unity for the instantaneous once the dll has been built.

I am not sure you want the instantaneous action. That is intended to take in data from a pressure or flow sensor installed in a physical BVM and sample data at something like 10hz to translate the squeeze profile of a user into pulse.

For a game, you probably want to predefined a full squeeze profile and process a squeeze action when the click a button.

Squeeze, instantaneous and automatic are 3 distinct and independent ways to define the BVM use.

I provide various PulseC.dll, PulseC.dylib, and files in the asset and tell unity which platforms they are for in our asset. (32 bit and 64bit Android, win32, win64, winArm64, Linux, Mac, magic leap, etc…)

The Readme on the main repository page has build instructions and links to our wiki with more details for building on windows. You can give that a shot. I could also walk you through the process via video chat, or maybe easier for me to build the current 3.x branch for you. Android native builds can be complicated… But it’s documented in the Readme doccross section.

I think having all 3 modes would be useful for different settings (NPC, PC user, VR user) my aim was virtual model of bag which you squeeze which creates the airflow, on a oculus this would be based on the change in the grip. On a haptic glove there would be the restriction of airflow.

Yeah, I could see hooking the instantaneous to the haptic trigger on a joystick or a haptic glove
You would just need to create your own flow curve you map the haptic extents to

just send me an email if you want to set up a chat

Privacy Notice