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?
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.
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.
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.
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