upb-lea / openmodelica-microgrid-gym

OpenModelica Microgrid Gym (OMG): An OpenAI Gym Environment for Microgrids
GNU General Public License v3.0
184 stars 38 forks source link

Normalized env history #109

Closed Webbah closed 3 years ago

Webbah commented 3 years ago

It seems like currently the normalized env outputs are stored in the history if env.is_normaized == True. That leads to 'wrong' env plots showing the normalized values but not the real-world (simulated) measured: MicrosoftTeams-image (4)

Values should be [15,-15] A.

Re-normalize before stored to hist?

https://github.com/upb-lea/openmodelica-microgrid-gym/blob/0ae67d388bb9f6c3e92af18641fe766bd99fe7bf/openmodelica_microgrid_gym/env/modelica.py#L318-L320

stheid commented 3 years ago

The hotfix would obvoiusly be:

outputs = self.net.augment(self._state, self.is_normalized) 
outputs = np.hstack([outputs, self.measure(outputs)]) 
raw = self.net.augment(self._state, False) 
raw = np.hstack([raw, self.measure(outputs)]) 
self.history.append(raw) 

another way would be to denormalize the data on rendering. I am not sure if that is all that elegant however.

I think we should think critically what we actually want to remember. i think remembering the unnormalized data is ok as long we make sure to return the normalized data. Hence the elegant solution would be along the lines of the first hotfix (maybe a little more DRY though).

Webbah commented 3 years ago

Hotfix does result in a 100 Hz current.