MCPcopy Create free account
hub / github.com/ahalev/python-microgrid / reset

Method reset

src/pymgrid/microgrid/microgrid.py:207–221  ·  view source on GitHub ↗

Reset the microgrid and flush the log. Returns ------- dict[str, list[float]] Observations from resetting the modules as well as the flushed balance log.

(self)

Source from the content-addressed store, hash-verified

205 return trajectory_func
206
207 def reset(self):
208 """
209 Reset the microgrid and flush the log.
210
211 Returns
212 -------
213 dict[str, list[float]]
214 Observations from resetting the modules as well as the flushed balance log.
215 """
216 self._set_trajectory()
217 return {
218 **{name: [module.reset() for module in module_list] for name, module_list in self.modules.iterdict()},
219 **{"balance": self._balance_logger.flush(),
220 "other": self._microgrid_logger.flush()}
221 }
222
223 def _set_trajectory(self):
224 if self.trajectory_func is not None:

Calls 3

_set_trajectoryMethod · 0.95
iterdictMethod · 0.80
flushMethod · 0.80