Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

actual_dispatch added to target_dispatch when the previous target_dispatch is 0 but actual_dispatch is not #367

Closed
richardwth opened this issue Sep 16, 2022 · 1 comment · Fixed by #383
Labels
bug Something isn't working

Comments

@richardwth
Copy link

Environment

  • Grid2op version: 1.7.2
  • System: ubuntu18.04

Bug description

When obs.target_dispatch is 0 and obs.actual_dispatch is not 0 at time t, the obs.actual_dispatch will be added to obs.target_dispatch given an redispatch action at the next step.

How to reproduce

from grid2op import make
from lightsim2grid import LightSimBackend

backend = LightSimBackend()
env = make(".../L2RPN_wcci2022_starting_kit/input_data_local", backend=backend)

env.set_id(0) 
obs = env.reset()
env.fast_forward_chronics(10)
obs = env.get_obs()
gen_id = 2

# Step 11
act = env.action_space()
act.redispatch = [(gen_id, -3.5)]
obs, reward, done, info = env.step(act)
print('step {}: id {}, gen {:.1f}, actual {:.1f}, target {:.1f}, forecast {:.1f}'.format(
    obs.current_step, gen_id, obs.gen_p[gen_id], obs.actual_dispatch[gen_id], obs.target_dispatch[gen_id], obs.get_forecasted_inj()[0][gen_id]))

# Step 12
act = env.action_space()
act.redispatch = [(gen_id, +3.5)]
obs, reward, done, info = env.step(act)
print('step {}: id {}, gen {:.1f}, actual {:.1f}, target {:.1f}, forecast {:.1f}'.format(
    obs.current_step, gen_id, obs.gen_p[gen_id], obs.actual_dispatch[gen_id], obs.target_dispatch[gen_id], obs.get_forecasted_inj()[0][gen_id]))

# Step 13
act = env.action_space()
act.redispatch = [(gen_id, +1.5)]
obs, reward, done, info = env.step(act)
print('step {}: id {}, gen {:.1f}, actual {:.1f}, target {:.1f}, forecast {:.1f}'.format(
    obs.current_step, gen_id, obs.gen_p[gen_id], obs.actual_dispatch[gen_id], obs.target_dispatch[gen_id], obs.get_forecasted_inj()[0][gen_id]))

Current output

step 11: id 2, gen 342.7, actual -3.5, target -3.5, forecast 348.6
step 12: id 2, gen 346.2, actual -2.5, target 0.0, forecast 353.8
step 13: id 2, gen 349.7, actual -1.4, target -1.0, forecast 355.7

Expected output

step 11: id 2, gen 342.7, actual -3.5, target -3.5, forecast 348.6
step 12: id 2, gen 346.2, actual -2.5, target 0.0, forecast 353.8
step 13: id 2, gen 349.7, actual -1.4, target 1.5, forecast 355.7
@richardwth richardwth added the bug Something isn't working label Sep 16, 2022
@BDonnot
Copy link
Collaborator

BDonnot commented Sep 28, 2022

Hello,

Thanks for reporting this issue.

This is indeed an incorrect behaviour and the setpoint should indeed be +1.5 (as you mentionned) after the third action here. I'll see where the bug occurs and try to fix it "asap" (though i'm not sure when)

Benjamin

BDonnot added a commit to BDonnot/Grid2Op that referenced this issue Dec 2, 2022
@BDonnot BDonnot linked a pull request Dec 12, 2022 that will close this issue
@BDonnot BDonnot closed this as completed Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants