Skip to content

Documentation: Improve Power Flow Method Comparisions#1306

Open
Jerry-Jinfeng-Guo wants to merge 9 commits intomainfrom
documentation/improve_pf_documentation_01
Open

Documentation: Improve Power Flow Method Comparisions#1306
Jerry-Jinfeng-Guo wants to merge 9 commits intomainfrom
documentation/improve_pf_documentation_01

Conversation

@Jerry-Jinfeng-Guo
Copy link
Copy Markdown
Member

Improvements as requested in #1003

  • Methods comparision

Signed-off-by: Jerry Jinfeng Guo <jerry.jinfeng.guo@alliander.com>
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo self-assigned this Feb 19, 2026
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo added the documentation Improvements or additions to documentation label Feb 19, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the user manual’s power flow documentation to help users choose an appropriate calculation method (per #1003) by adding a more practical comparison and selection guidance.

Changes:

  • Replaces the power flow algorithm comparison table with columns focused on convergence and typical use cases.
  • Adds a “Choosing the right power flow algorithm” section with selection guidance based on accuracy, speed, and grid characteristics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +277 to +280
#### Choosing the right power flow algorithm

The choice of algorithm depends on your specific requirements for accuracy, speed, and grid characteristics.

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The new #### Choosing the right power flow algorithm subsection now implicitly contains all following content until the next #### heading. This means the general nodal-equation explanation and bus type list end up nested under “Choosing…”, which is likely unintended and makes the document structure confusing. Consider moving this “Choosing…” section further down (e.g., after the general formulation section), or adding an explicit sibling subsection heading (e.g., “Power flow formulation”) before the nodal equations so the scope is clear.

Copilot uses AI. Check for mistakes.
Comment on lines +260 to +265
| Algorithm | Default | Convergence | Typical Use Cases | Algorithm call |
| --------- | ------- | ----------- | ----------------- | -------------- |
| [Newton-Raphson](#newton-raphson-power-flow) | &#10004; | Fast (quadratic) | General purpose, meshed networks, accurate results required | {py:class}`CalculationMethod.newton_raphson <power_grid_model.enum.CalculationMethod.newton_raphson>` |
| [Iterative current](#iterative-current-power-flow) | | Moderate (linear) | Time-series analysis, operational studies, batch calculations | {py:class}`CalculationMethod.iterative_current <power_grid_model.enum.CalculationMethod.iterative_current>` |
| [Linear](#linear-power-flow) | | Single iteration | Constant impedance loads only, quick estimates | {py:class}`CalculationMethod.linear <power_grid_model.enum.CalculationMethod.linear>` |
| [Linear current](#linear-current-power-flow) | | Single iteration | Fast approximations, screening studies, real-time applications | {py:class}`CalculationMethod.linear_current <power_grid_model.enum.CalculationMethod.linear_current>` |
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

This table update drops the previous at-a-glance “Speed” and “Accuracy” comparison in favor of “Convergence” and “Typical Use Cases”. Since the surrounding text in this section emphasizes choosing based on speed vs accuracy, consider either keeping speed/accuracy columns (even as qualitative labels), or adjusting the surrounding prose so the selection criteria aligns with what the table presents.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed.

Therefore power-grid-model will use this method regardless of the input provided by the user in this case.
```

#### Choosing the right power flow algorithm
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

probably also good to reference this in the performance guide

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Please make an issue for that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why? it's a very small change that can be added to this PR, or immediately solved as a follow-up if you really don't want to do it in one go

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo marked this pull request as draft February 20, 2026 08:49

- Use **Newton-Raphson** for regulatory submissions, protection studies, or when you need high confidence in results
- Required for meshed networks with significant power flows
- Most robust algorithm that works in nearly all scenarios
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we want to explicitly mention that it is more likely to run into convergence issues than iterative current?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably a good idea. Also maybe a good idea to re-iterate on contacting us if SparseMatrixError or converge error reaches them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would recommend against it. We have this integrated in the error message for SparseMatrixError and convergence errors are not bugs of PGM.

Copy link
Copy Markdown
Member

@figueroa1395 figueroa1395 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Nothing more to add besides what was already pointed out.


- Use **Newton-Raphson** for regulatory submissions, protection studies, or when you need high confidence in results
- Required for meshed networks with significant power flows
- Most robust algorithm that works in nearly all scenarios
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add this to table instead under convergence.
Newton raphson: robust
Iterative current: less robust

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How do you mean?


**When speed is critical:**

- Use **Linear current** for initial screening, real-time applications, or large-scale studies with many scenarios
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do initial screening or screening studies mean?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Work that does not require most accurate result but at faster paces.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's explicitly write that then.

Jerry-Jinfeng-Guo and others added 5 commits March 2, 2026 13:50
Co-authored-by: Nitish Bharambe <78108900+nitbharambe@users.noreply.github.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Co-authored-by: Nitish Bharambe <78108900+nitbharambe@users.noreply.github.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Co-authored-by: Nitish Bharambe <78108900+nitbharambe@users.noreply.github.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Signed-off-by: Jerry Jinfeng Guo <jerry.jinfeng.guo@alliander.com>
Signed-off-by: Jerry Jinfeng Guo <jerry.jinfeng.guo@alliander.com>
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo marked this pull request as ready for review March 3, 2026 15:42

**When speed is critical:**

- Use **Linear current** for initial screening, real-time applications, or large-scale studies with many scenarios
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's explicitly write that then.

Signed-off-by: Nitish Bharambe <nitish.bharambe@alliander.com>
Signed-off-by: Nitish Bharambe <nitish.bharambe@alliander.com>
@sonarqubecloud
Copy link
Copy Markdown

@nitbharambe nitbharambe disabled auto-merge March 27, 2026 12:17
Copy link
Copy Markdown
Member

@figueroa1395 figueroa1395 left a comment

Choose a reason for hiding this comment

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

Minor comments only. Looks good to me.

Hence if speed is not critical or is a small concern, we recommend using the default
[Newton-Raphson](#newton-raphson-power-flow) method for its robustness across all scenarios.
If the scenarios are mainly timeseries, you can try [Iterative current](#iterative-current-power-flow)
then this method can improve speed significantly via
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
then this method can improve speed significantly via
, this method can improve speed significantly via

Comment on lines +288 to +289
There is a possibility you can face non convergence or lower performance compared to newton raphson method
in case of meshing of networks.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
There is a possibility you can face non convergence or lower performance compared to newton raphson method
in case of meshing of networks.
There is a possibility you can face non convergence or lower performance compared to the newton raphson method if the network is not radial.

It is recommended to limit the range of loading conditions when using linear methods to avoid unrealistic scenarios
where the approximations can give highly inaccurate results.

Overall, these methods are reecommended only for a range of possible voltage deviations that are close to 1 p.u.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this what you inteded to say with "these" here? Or is it for all methods?

Also, small typo:

Suggested change
Overall, these methods are reecommended only for a range of possible voltage deviations that are close to 1 p.u.
Overall, these methods are recommended only for a range of possible voltage deviations that are close to 1 p.u.

Comment on lines +298 to +308
However at unrealistically high load levels it can give worse approximations than the linear method.

Check Power Flow Algorithm Comparison demonstration in
[PGM workshop demonstrations](https://github.com/PowerGridModel/power-grid-model-workshop)
to know more about this behavior.
A strategy for post calculation verification of results is also provided there.

You can identify applicability of linear methods for your use case by experimenting with the Newton-Raphson method to
find the range of loading conditions that are relevant for your use case and then
only use linear methods within this range for the specific grid configuration.
Non convergence of newton raphson is a good signal of unpractical or unfeasible systems.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
However at unrealistically high load levels it can give worse approximations than the linear method.
Check Power Flow Algorithm Comparison demonstration in
[PGM workshop demonstrations](https://github.com/PowerGridModel/power-grid-model-workshop)
to know more about this behavior.
A strategy for post calculation verification of results is also provided there.
You can identify applicability of linear methods for your use case by experimenting with the Newton-Raphson method to
find the range of loading conditions that are relevant for your use case and then
only use linear methods within this range for the specific grid configuration.
Non convergence of newton raphson is a good signal of unpractical or unfeasible systems.
However at unrealistically high load levels it can give worse approximations than the linear method. Check Power Flow Algorithm Comparison demonstration in
[PGM workshop demonstrations](https://github.com/PowerGridModel/power-grid-model-workshop)
to know more about this behavior.
A strategy for post calculation verification of results is also provided there. You can identify applicability of linear methods for your use case by experimenting with the Newton-Raphson method to
find the range of loading conditions that are relevant for your use case and then
only use linear methods within this range for the specific grid configuration.
Non convergence of newton raphson is a good signal of unpractical or unfeasible systems.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just realized this code suggestion is hard to read here. But if you look at the generated docs, you'll see why I suggested this.

@figueroa1395
Copy link
Copy Markdown
Member

@nitbharambe should #1316 follow after this one? Do you think it isn't needed? Or what's the status there?

However at unrealistically high load levels it can give worse approximations than the linear method.

Check Power Flow Algorithm Comparison demonstration in
[PGM workshop demonstrations](https://github.com/PowerGridModel/power-grid-model-workshop)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants