Skip to content

Add precomputed_load_profile generator#34

Closed
hithuv wants to merge 3 commits intogridfm:mainfrom
hithuv:feature/precomputed-load-profile
Closed

Add precomputed_load_profile generator#34
hithuv wants to merge 3 commits intogridfm:mainfrom
hithuv:feature/precomputed-load-profile

Conversation

@hithuv
Copy link

@hithuv hithuv commented Jan 15, 2026

To generate data with precomputed load scenarios loaded from a csv with columns: load_scenario, load, p_mw, q_mvar

Add this argument to config yaml file
scenario_file: "/path/to/load-scenarios/load-scenarios-precomputed-temp.csv" # precomputed scenarios (cols: load_scenario, load, p_mw, q_mvar)


# Optional strict coverage check (comment out if you allow missing => 0)
expected = n_buses * n_scenarios
actual = df[["load_scenario", "load"]].drop_duplicates().shape[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why drop duplicates?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll modify it to ensure strict checks

out = np.zeros((n_buses, n_scenarios, 2), dtype=float)

# If duplicates exist, keep last
df = df.sort_index().drop_duplicates(subset=["load_scenario", "load"], keep="last")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt we enforce no duplicate from the start?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will update with checks to ensure right bus numbers, right load_scenario numbers, no duplicates, etc

@albanpuech
Copy link
Collaborator

@hithuv can you please check the following? maybe in the init of the class

  • Ensure your scenario file uses continuous 0-based bus indices
  • Verify that scenario indices in your CSV cover 0..n_scenarios-1; otherwise, adjust n_scenarios or pad missing scenarios.
  • check there is no duplicate

@hithuv hithuv closed this Jan 21, 2026
@hithuv hithuv deleted the feature/precomputed-load-profile branch January 21, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants