Loading environment file

I see that there is an AnchorageDecember.json environment file. I would like to load this and try running my scenario under those conditions. I see that there is an HowTo-EnvironmentChange.cpp, but it shows how to programmatically set environmental conditions, whereas I’d like to load the ones from the existing file. How can I do that? I tried this in Java:

SEChangeEnvironmentalConditions env = new SEChangeEnvironmentalConditions();
env.setEnvironmentalConditionsFile("environments/AnchorageDecember.json");
this.pulseEngine.processAction(env);

But this is what gets printed in the log:

[INFO ] [2020-11-21 20:18:18,293] [JavaFX Application Thread] [CppPulseEngine]  : [0(s)] [Action] 0(s), Environment Action : Change Environmental Conditions
	SurroundingType: NullSurrounding
	Air Velocity: Not Set
	Ambient Temperature: Not Set
	Atmospheric Pressure: Not Set
	Clothing Resistance: Not Set
	Emissivity: Not Set
	Mean Radiant Temperature: Not Set
	Relative Humidity: Not Set
	Respiration Ambient Temperature: Not Set

Seems like it didn’t work. What’s the right way to do this?

That should be correct…
I assume your working dir is the Pulse bin…

So, let me check that out…

If that is correct, I probably have the relative path incorrect. The working directory is in my application, where I have copied the environment directory. I’ll check the path.

Try adding a ./

No no, I see the same thing… hang on
Seems like Java is not doing something …

Yeah, the Java API is not coded right
I updated the API to work as you have understood it
I created a new branch off of the hemorrhage branch to address this
https://gitlab.kitware.com/physiology/engine/-/tree/feature/environment_java
I added a new HowTo and I believe this is doing what you would expect

I am going to have to go through the Java API and double check other actions that support files and make sure they are also correct…later…

But check this out, the skin temp is going down, so it looks like I successfully transported the patient into Alaska

[INFO] FileUtils::47::Loading native library : PulseJNI
[INFO] HowTo_Envionment::79::Simulation Time(s) 0.0
[INFO] HowTo_Envionment::80::TidalVolume (L) 0.504784581131343
[INFO] HowTo_Envionment::81::EndTidalOxygenFraction 0.15376845833377517
[INFO] HowTo_Envionment::82::Respiration Rate (bpm) 11.999999999999968
[INFO] HowTo_Envionment::83::Core Temp (F) 98.62738630887827
[INFO] HowTo_Envionment::84::Skin Temp (F) 91.48207092550751
[INFO] HowTo_Envionment$MyListener::29:: : [0(s)] [Action] 0(s), Environment Action : Change Environmental Conditions
	Environmental Conditions File: ./environments/AnchorageDecember.json
[INFO] HowTo_Envionment::93::Simulation Time(s) 599.9999999997443
[INFO] HowTo_Envionment::94::TidalVolume (L) 0.5138758666977075
[INFO] HowTo_Envionment::95::EndTidalOxygenFraction 0.15099326056664616
[INFO] HowTo_Envionment::96::Respiration Rate (bpm) 12.14574898785422
[INFO] HowTo_Envionment::97::Core Temp (F) 98.60134319844269
[INFO] HowTo_Envionment::98::Skin Temp (F) 82.24466906923954

Thanks for finding this!

Confirmed the branch is working for me, too – I didn’t even have to put the leading ./. Thank you!

Privacy Notice