BDonnot / lightsim2grid

LightSim2grid implements a c++ backend targeting the Grid2Op (https://github.com/rte-france/grid2op) platform.
https://lightsim2grid.readthedocs.io/en/latest/
Mozilla Public License 2.0
49 stars 9 forks source link

newtonpf.py: choose solver based on distributed_slack parameter #42

Closed rbolgaryn closed 2 years ago

rbolgaryn commented 2 years ago

+Some small changes

rbolgaryn commented 2 years ago

I noticed that if I uncomment the division by baseMVA then a test fails in pandapower, due to tolerances. Do you accept tolerance in MVA in newton and translate it in pu internally? Or do you consider the tolerance in a different way?

In pandapower tolerance is considered like this:

def _check_for_convergence(F, tol):
    # calc infinity norm
    return linalg.norm(F, Inf) < tol

Can you please double-check?

BDonnot commented 2 years ago

Can you please double-check?

I can confirm that inside the c++ solver nothing is done with respect to the tolerance.

The c++ code looks like:

bool BaseSolver::_check_for_convergence(const RealVect & F,
                                        real_type tol)
{
    const auto norm_inf = F.lpNorm<Eigen::Infinity>();
    bool res =  norm_inf  < tol;
    return res;
}

So it's exactly the same as the one you mentionned