From e6f8ee4293dc03e60ba137dde50fea98ab95135c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Fri, 5 Jun 2026 20:23:44 +0200 Subject: [PATCH] fix norminalization of genset_module's sample_action --- src/pymgrid/modules/genset_module.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pymgrid/modules/genset_module.py b/src/pymgrid/modules/genset_module.py index d0cb992e..e17bb36c 100644 --- a/src/pymgrid/modules/genset_module.py +++ b/src/pymgrid/modules/genset_module.py @@ -360,8 +360,13 @@ def _non_instantaneous_update(self, goal_status): assert self._steps_until_down > 0 self._update_up_down_times() - def sample_action(self, strict_bound=False, **kwargs): - return np.array([np.random.rand(), super().sample_action(strict_bound=strict_bound)]) + def sample_action(self, strict_bound=False): + on_off = np.random.rand() + power = np.random.uniform( + self.running_min_production, + self.running_max_production + ) + return np.array([on_off, power]) def _raise_error(self, ask_value, available_value, as_source=False, as_sink=False, lower_bound=False): try: