Get the priority list and then deploy on the microgrid for some number of steps. Parameters --------- max_steps : int or None, default None Maximum number of RBC steps. If None, run until the microgrid terminates. verbose : bool, default False
(self, max_steps=None, verbose=False)
| 64 | self.microgrid.reset() |
| 65 | |
| 66 | def run(self, max_steps=None, verbose=False): |
| 67 | """ |
| 68 | Get the priority list and then deploy on the microgrid for some number of steps. |
| 69 | |
| 70 | Parameters |
| 71 | --------- |
| 72 | max_steps : int or None, default None |
| 73 | Maximum number of RBC steps. If None, run until the microgrid terminates. |
| 74 | |
| 75 | verbose : bool, default False |
| 76 | Whether to display a progress bar. |
| 77 | |
| 78 | Returns |
| 79 | ------- |
| 80 | log : pd.DataFrame |
| 81 | Results of running the rule-based control algorithm. |
| 82 | |
| 83 | """ |
| 84 | self.reset() |
| 85 | |
| 86 | for _ in tqdm(range(self._get_num_iter(max_steps)), desc="RBC Progress", disable=(not verbose)): |
| 87 | action = self.get_action() |
| 88 | _, _, done, _ = self.microgrid.step(action, normalized=False) |
| 89 | if done: |
| 90 | break |
| 91 | |
| 92 | return self.microgrid.get_log(as_frame=True) |
| 93 | |
| 94 | def _get_num_iter(self, max_steps): |
| 95 | if max_steps is not None: |
nothing calls this directly
no test coverage detected