Skip to content

Commit f846f8e

Browse files
committed
Issue #5: Send grid state after line disconnection in Anticipation cards
1 parent ca35f9d commit f846f8e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

usecases_examples/PowerGrid/app/models/Simulator.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ def run_simulator(self, com):
360360

361361
if "Anticipation N-1" in self.listen.current_issues:
362362
if self.obs.current_step >= self.config['scenario_first_step']:
363-
364363
com.push_step = self.obs.current_step + send_tempo
365364
if com.cab_api_on is True and context_just_sent is False:
366365
if not img_b64_current:
@@ -390,9 +389,11 @@ def run_simulator(self, com):
390389
f"\"description\": \"{x}\"}} }}\n\n"
391390
)
392391

393-
if not img_b64_forecast:
394-
img_b64_forecast = create_observation_image(obs_forecast._obs_env,
395-
obs_forecast)
392+
n_1_line_name = x[0].split(":")[-1]
393+
n_1_line_id = self.obs.name_line.tolist().index(n_1_line_name)
394+
obs_forecast_n_1, *_ = self.obs.simulate(self.env.action_space({"set_line_status":[(n_1_line_id,-1)]}), self.config['time_step_forecast'])
395+
img_b64_forecast = create_observation_image(obs_forecast_n_1._obs_env,
396+
obs_forecast_n_1)
396397
com.send_event_online(context_date,
397398
self.config['scenario_first_step'],
398399
self.listen.trigger_kpis(

0 commit comments

Comments
 (0)