ibpsa / project1-boptest

Building Optimization Performance Tests
Other
105 stars 69 forks source link

Endpoint to get all measurement/setpoints at current simulation time #359

Closed mschaar closed 2 weeks ago

mschaar commented 2 years ago

I'm part of the RWTH agentlib team and want to implement the BOPTEST module into our multi agent system library. The current problem is to get all controller setpoints from BOPTEST to pass them to my multi agent controllers. It would be nice to have an endpoint to get all available points at the current simulation time (or pass a list with the needed points) - Example Endpoint: GET /current_states, PARAMETER: point_list, if point_list is empty just return all points.

Maybe I misunderstood the documentation and there is a way to get all current values from your api. If there are any uncertainties in my description, please let me know.

javiarrobas commented 2 years ago

Hey @mschaar, thanks for reaching out! I'm not sure I understand your issue, though. The available set of setpoints is invariant during runtime and can be retrieved at all times using GET inputs. Then, the subset of inputs to overwrite is selected with the "activate" variables in the data passed to the advance call. If you're asking for the setpoints used by the baseline controller of the emulator, those can be obtained from the measurements. The available set of measurements can be obtained with GET measurements or from the testcase documentation. Did you have a look at this tutorial? it may be of great help.

mschaar commented 2 years ago

Hi @JavierArroyoBastida, maybe it is easier to talk via MS Teams, then it is much easier to describe the problem. Do you have time for this?

javiarrobas commented 2 years ago

This week is a bit tight for me. Maybe we could arrange a call for next week. A description through here would be appreciated though since it can be useful to others in the future.

dhblum commented 2 years ago

To get current values for all measurement points, you can do something like (pseudo-code):

points = GET /measurements
for point in points:
   data[point] = PUT /results with point_name=point, start_time=current_time, final_time=current_time 

Does this help?

mschaar commented 2 years ago

This is the solution I'm using right now. This is slowing down the simulation... Isn't it possible to implement something like:

points = requests.get( /measurements ).json()
print(points)

{ .... 'conCooRo2_reaCoo_y': {'Minimum': None, 'Description': 'Cooling control signal measurement as fraction of maximum for zone Ro2', 'Unit': '1', 'Maximum': None, value=10 }, ....}

That the current simulation value is added to the measurement field, this would safe much requests and time.

dhblum commented 2 years ago

Ok I see. The current values of all measurements are returned when using /advance. I'd just like to know, is this still not sufficient?

mschaar commented 2 years ago

Maybe it's easier to describe my problem in a short session via MS Teams. Do you have time this or next week? Maybe you can send me an invitation to my Mail Address: mario.schaar@eonerc.rwth-aachen.de. I would be happy to hear from you.

dhblum commented 2 years ago

@mschaar Wanted to let you know that we've closed Issue #364 via PR #377. This implements a fix so that data for control signals returned through the /advance and /results requests are equal to the baseline signals if not being overwritten and equal to the overwriting value if overwritten. This will allow you to get the baseline set point data. Note also that the current state values of all points are still returned when the /advance call completes, or obtainable otherwise with the /results request.

dhblum commented 2 weeks ago

Closing as addressed and stale.