Query for EnvironmentConditions

Hi,

I’m running a very simple scenario in Java where I set an initial AtmosphericPressure value that is then updated during the simulation.

What I would like to now is how to retrieve the current AtmosphericPressure from the engine?

In Java, you need to specify the values you are going to be querying from the engine beforehand. For this, you need to create a SEDataRequest instance and register it with the appropriate manager. But I A SEDataRequest has a category and a property name and I don’t know what the values of these properties should be.

For example, to query for the Pulmonary Arterial Pressure you can create the following SEDataRequest:

SEDataRequest hr = new SEDataRequest();
hr.setCategory(eCategory.Physiology);
hr.setPropertyName("PulmonaryArterialPressure");

What should I use for the AtmosphericPressure? Is there a document listing all the possible property names for every category?

Regards,

It looks like the best place in the documentation for data requests is here:
https://pulse.kitware.com/_scenario_file.html
And the environment system properties are defined here : https://pulse.kitware.com/_c_d_m_tables.html#EnvironmentalConditionsTable

Also, I use a naming convention in the code, since eCategory starts with a lowercase e, that denotes the type is an enum, you can then go look at the definition of the enum. (In eclipse, just highlight the whole word and hit F3 or right click it and choose ‘Open Declaration’ and it will take you to the protobuf generated class that defines the enum.

You can also find the structure (And hopefully a definition) of ALL the classes/enums used in Pulse here: https://pulse.kitware.com/modules.html

I am also seriously considering moving Java data exchange (between C++ and Java) to functionally work like C# and Python. So you still fill out data requests, but after you call AdvanceTime, you call a PullData method that returns a list of doubles of your data requests in the order in which you added/created your data requests using the data request manager. What do you think about that? It would make usability consistent in all of our supported languages.

Thanks!!

Thank you for your prompt response.

For what I can tell, the property name that I have to use is “AtmosphericPressure” (I took it from the table in your second link). But when using it, I get the following error:

INFO  Main$MyListener::80:: : [0(s)] Converging to a steady state
FATAL:Unknown Data Request : AtmosphericPressure : 
FATAL Main$MyListener::101:: : [0.02(s)] Unknown Data Request : AtmosphericPressure
TODO Handle this Failure : [0.02(s)] Unknown Data Request : AtmosphericPressure 
ERROR PulseEngine::115::Unable to initialize engine
ERROR PulseEngine::123::Engine has died
INFO  Main::235::Something bad happened

The code I’m using to create the request is:

        SEDataRequest ap = new SEDataRequest();
        ap.setCategory(eCategory.Environment);
        ap.setPropertyName("AtmosphericPressure");
        ap.setUnit(PressureUnit.mmHg.toString());

Am I missing something obvious?

Regarding adding a new PullData method, I think it makes sense. It will make things less verbose, but I would still leave the possibility of query the different elements one by one if needed. But this of course is just my opinion.

Regards,

Oh, the system is actually
https://pulse.kitware.com/_c_d_m_tables.html#EnvironmentTable

And you want to get to the environmental conditions, so looking here
https://gitlab.kitware.com/physiology/engine/blob/master/cdm/cpp/system/environment/SEEnvironment.cpp#L57
It looks like I’m using a dash as a delimiter to build a property sting in a class hierarchy

I think you should make the string
“Conditions-AtmosphericPressure”

A bit confusing, and data request documentation could be improved. Thanks for your patience

Using Conditions-AtmosphericPressure got me past the error, but I’m getting a NaN when I query for the value using this code:

//PulseEngine pe...
pe.environment.getConditions().getAtmosphericPressure().getValue(PressureUnit.mmHg);

I’ll keep investigating. I really appreciate your time and prompt responses!

Regards,

I bet it’s not hooked up in the Java engine.
I have some pretty crazy logic to pull doubles from C++ then push that data to the appropriate CDM class object and I may not have hooked up the push to environment objects.

This is kind of why I want to only return an array of ordered doubles from the engine. Lots of connections need to be made otherwise (point of failure)

You can try to just make the double return public in the Java engine class

Privacy Notice