Documentation: Improve Power Flow Method Comparisions#1306
Documentation: Improve Power Flow Method Comparisions#1306Jerry-Jinfeng-Guo wants to merge 9 commits intomainfrom
Conversation
Signed-off-by: Jerry Jinfeng Guo <jerry.jinfeng.guo@alliander.com>
There was a problem hiding this comment.
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.
docs/user_manual/calculations.md
Outdated
| #### Choosing the right power flow algorithm | ||
|
|
||
| The choice of algorithm depends on your specific requirements for accuracy, speed, and grid characteristics. | ||
|
|
There was a problem hiding this comment.
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.
docs/user_manual/calculations.md
Outdated
| | Algorithm | Default | Convergence | Typical Use Cases | Algorithm call | | ||
| | --------- | ------- | ----------- | ----------------- | -------------- | | ||
| | [Newton-Raphson](#newton-raphson-power-flow) | ✔ | 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>` | |
There was a problem hiding this comment.
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.
docs/user_manual/calculations.md
Outdated
| 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 |
There was a problem hiding this comment.
probably also good to reference this in the performance guide
There was a problem hiding this comment.
Please make an issue for that.
There was a problem hiding this comment.
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
docs/user_manual/calculations.md
Outdated
|
|
||
| - 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 |
There was a problem hiding this comment.
do we want to explicitly mention that it is more likely to run into convergence issues than iterative current?
There was a problem hiding this comment.
Probably a good idea. Also maybe a good idea to re-iterate on contacting us if SparseMatrixError or converge error reaches them.
There was a problem hiding this comment.
I would recommend against it. We have this integrated in the error message for SparseMatrixError and convergence errors are not bugs of PGM.
figueroa1395
left a comment
There was a problem hiding this comment.
Looks good to me. Nothing more to add besides what was already pointed out.
docs/user_manual/calculations.md
Outdated
|
|
||
| - 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 |
There was a problem hiding this comment.
Add this to table instead under convergence.
Newton raphson: robust
Iterative current: less robust
There was a problem hiding this comment.
How do you mean?
docs/user_manual/calculations.md
Outdated
|
|
||
| **When speed is critical:** | ||
|
|
||
| - Use **Linear current** for initial screening, real-time applications, or large-scale studies with many scenarios |
There was a problem hiding this comment.
What do initial screening or screening studies mean?
There was a problem hiding this comment.
Work that does not require most accurate result but at faster paces.
There was a problem hiding this comment.
Let's explicitly write that then.
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>
docs/user_manual/calculations.md
Outdated
|
|
||
| **When speed is critical:** | ||
|
|
||
| - Use **Linear current** for initial screening, real-time applications, or large-scale studies with many scenarios |
There was a problem hiding this comment.
Let's explicitly write that then.
Signed-off-by: Nitish Bharambe <nitish.bharambe@alliander.com>
|
figueroa1395
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
| then this method can improve speed significantly via | |
| , this method can improve speed significantly via |
| There is a possibility you can face non convergence or lower performance compared to newton raphson method | ||
| in case of meshing of networks. |
There was a problem hiding this comment.
| 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. |
There was a problem hiding this comment.
Is this what you inteded to say with "these" here? Or is it for all methods?
Also, small typo:
| 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. |
| 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. |
There was a problem hiding this comment.
| 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. |
There was a problem hiding this comment.
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.
|
@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) |
There was a problem hiding this comment.
Let's directly cite what you added in https://github.com/PowerGridModel/power-grid-model-workshop/pull/45/changes



Improvements as requested in #1003