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

fixes skipped na values from confromloads #218

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion emf/loadflow_tool/scaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,11 @@ def scale_balance(network: pp.network.Network,
scalable_loads_diff = (scalable_loads['country'].map(offset_acnp) * scalable_loads.p_participation)
scalable_loads_target = scalable_loads.p0 + scalable_loads_diff
scalable_loads_target.dropna(inplace=True) # removing loads which target value is NaN. It can be because missing target ACNP for this area
conform_loads_na = conform_loads.merge((scalable_loads_target.reset_index())[['id']], left_index=True,
right_on='id').set_index('id')# removing loads which target value is NaN. It can be because missing target ACNP for this area
network.update_loads(id=scalable_loads_target.index,
p0=scalable_loads_target.to_list(),
q0=(scalable_loads_target * conform_loads.power_factor).to_list()) # maintain power factor
q0=(scalable_loads_target * conform_loads_na.power_factor).to_list()) # maintain power factor

# Solving post-scale loadflow
pf_results = pp.loadflow.run_ac(network=network, parameters=lf_settings)
Expand Down
Loading