PowerGridModel / power-grid-model

Python/C++ library for distribution power system analysis
Mozilla Public License 2.0
147 stars 30 forks source link

[FEATURE] *Provide the power system mismatch* #259

Open SanPen opened 1 year ago

SanPen commented 1 year ago

It would be nice if the results would provide the nodal power mismatch or the norm of this.

This is the stopping criteria for Newton Raphson.

For methods that use voltage iteration similarity as criteria (i.e. Backwards-Forward) provide the power mismatch as well.

TonyXiang8787 commented 2 months ago

The power flow results already include the node injection power which is calculated by network parameters. At the same time all appliances have their power values by appliance parameters.

The difference of these two is the power mismatch. I am hesitating to provide additional attributes for the mismatch. The user can easily calculate this by himself. @petersalemink95 what do you think?

SanPen commented 1 month ago

Hi,

Maybe not the mismatch vector but the norm max(abs(mismatch)) since this is a useful value to decide if to trust the solution.

mgovers commented 1 month ago

a potentially useful consideration here is the following:

TonyXiang8787 commented 1 month ago

@mgovers even with columnar dataset we are not dealing with memory issue. The calculation itself still cost some CPU time. It might not be very much.

But indeed, with columnar dataset we are more permissive to add new attributes. That's why I keep this issue open.

nitbharambe commented 1 month ago

Detailing the steps for finding mismatch in power after calculation. Correct me if I am wrong:

  1. Calculate power flow
  2. Scale the specified powers of loads/gens in input_data of const_impedance and const_current type by result's voltage.
  3. Aggregate all loads/gens of the input_data to node level by summing them up
  4. Subtract with result's nodal power injection and find maximum among them.

How about we provide a utility function to do this? Or what if we have this as addition for the PGM data science toolkit? This problem is a post calculation operation on numpy arrays. Similar might be applicable to bad data detection with chi square test feature request.