# Loading environment file

**URL:** https://discourse.kitware.com/t/loading-environment-file/557
**Category:** Pulse Physiology Engine
**Created:** [November 22, 2020, 1:21am UTC](https://discourse.kitware.com/t/loading-environment-file/557 "2020-11-22T01:21:56Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![bob.marinier](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@bob.marinier](https://discourse.kitware.com/u/bob.marinier)
#### Post date: [November 22, 2020, 1:21am UTC](https://discourse.kitware.com/t/loading-environment-file/557/1 "2020-11-22T01:21:56Z")

</div>

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:

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

```

But this is what gets printed in the log:

```auto
[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?

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [November 22, 2020, 1:32am UTC](https://discourse.kitware.com/t/loading-environment-file/557/2 "2020-11-22T01:32:42Z")

</div>

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

So, let me check that out…

---

<div class="post-metadata">

### Author: ![bob.marinier](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@bob.marinier](https://discourse.kitware.com/u/bob.marinier)
#### Post date: [November 22, 2020, 1:40am UTC](https://discourse.kitware.com/t/loading-environment-file/557/3 "2020-11-22T01:40:28Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [November 22, 2020, 1:53am UTC](https://discourse.kitware.com/t/loading-environment-file/557/4 "2020-11-22T01:53:02Z")

</div>

Try adding a ./

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [November 22, 2020, 2:02am UTC](https://discourse.kitware.com/t/loading-environment-file/557/5 "2020-11-22T02:02:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [November 22, 2020, 2:33am UTC](https://discourse.kitware.com/t/loading-environment-file/557/6 "2020-11-22T02:33:08Z")

</div>

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](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

```auto
[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!

---

<div class="post-metadata">

### Author: ![bob.marinier](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@bob.marinier](https://discourse.kitware.com/u/bob.marinier)
#### Post date: [November 22, 2020, 9:33pm UTC](https://discourse.kitware.com/t/loading-environment-file/557/7 "2020-11-22T21:33:12Z")

</div>

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