powsybl / pypowsybl

A PowSyBl and Python integration based on GraalVM native image
Mozilla Public License 2.0
55 stars 12 forks source link

Load Flow API updates #709

Closed jeandemanged closed 8 months ago

jeandemanged commented 8 months ago

Please check if the PR fulfills these requirements

Does this PR already have an issue describing the problem?

No

What kind of change does this PR introduce?

Feature

What is the current behavior?

LoadFlow API not aligned with powsybl-core (LoadFlowParameters, LoadFlowResults), See changes that are not accounted so far:

What is the new behavior (if this is a feature change)? LoadFlow API aligned with powsybl-core:

Does this PR introduce a breaking change or deprecate an API?

If yes, please check if the following requirements are fulfilled

What changes might users need to make in their application due to this PR? (migration steps)

see above listed changes marked ⚠️

# before
lf.Parameters(simul_shunt=True)
# now
lf.Parameters(shunt_compensator_voltage_control_on=True)
# before
lf.Parameters(no_generator_reactive_limits=False)
# now
lf.Parameters(use_reactive_limits=True)

This enum constant was not used to known PowSyBl LoadFlow providers/implementations. If you were using it/testing for this outcome, just replace with ComponentStatus.FAILED. LoadFlow providers/implementations are supposed to provide failure reason in the new status_text field.


results = lf.run_ac(n)
# before
print(results[0].slack_bus_id)
print(results[0].slack_bus_active_power_mismatch)
# now
print(results[0].slack_bus_results[0].id)
print(results[0].slack_bus_results[0].active_power_mismatch)

Other information:

Including ComponentResult-s metrics is left for future work.