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

change reference values using callback? #116

Closed Webbah closed 3 years ago

Webbah commented 3 years ago

Till now the reference values are changed in model_params as "side-function" while e.g. a model_parameter L is changed like

` def reference_step(t):

        if t >= .05:
            i_ref[:] = i_ref2
        else:
            i_ref[:] = i_ref1

        return partial(l_load.give_value, n=2)(t)`

and used in the env definition as follows: model_params={'lc.resistor1.R': partial(r_load.give_value, n=0), 'lc.inductor3.L': reference_step},

Possible to change the reference values without including it into a change of the pysical model parameters (L,R,C)?

stheid commented 3 years ago

seems related to #99

Maybe the issue can be solved by allowing general callback functions that are executed in the context of the net.Component or the net.Network class during before their augment function

Webbah commented 3 years ago

In the RL-Example we will directly focus on voltage control, therefore the cascaded (traditional PIPI) structure is not needed.

stheid commented 3 years ago

We discussed that it would be nice to have but not nessecary. Hence some time will be spent to try to implement it and if not successful document here on how it could be implemented quick and dirty here.