You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR: each time you use newtonpf you can replace it with newton_ls when it can be imported. Lightsim2grid also supports other algorithms: DC and Gauss Seidel, for now and I plan on introducing the HELM at some point which might be linked to your issue #114 and Grid2op/lightsim2grid#17. The only case when lightsim2grid should not be used is when something "smarter" is happening inside the newtonpf function (such as "iwamoto" or "voltage_dependant_loads"). In all other cases, newton_ls can act as a full replacement of pandapower newton_pf.
I think the checks to use lightsim2grid or not are not correctly implemented in pandapower (I refer to the function _check_lightsim2grid_compatibility in auxilliary.py fine)
Currently it is:
def_check_lightsim2grid_compatibility(net, lightsim2grid, voltage_dependend_loads, algorithm, enforce_q_lims):
iflightsim2grid:
ifnotlightsim2grid_available: # check 1return_deactive("option 'lightsim2grid' is True activates but module cannot be imported. ""I'll deactive lightsim2grid.")
ifalgorithm!='nr': # check 2raiseValueError("option 'lightsim2grid' is True activates but algorithm is not 'nr'.")
ifvoltage_dependend_loads: # check 3return_deactive("option 'lightsim2grid' is True but voltage dependend loads are in your grid.""I'll deactive lightsim2grid.")
ifenforce_q_lims: # check 4return_deactive("option 'lightsim2grid' is True and enforce_q_lims is True. This is not supported.""I'll deactive lightsim2grid.")
iflen(net.ext_grid) >1: # check 5return_deactive("option 'lightsim2grid' is True and multiple ext_grids are in the grid.""I'll deactive lightsim2grid.")
ifnp.any(net.gen.bus.isin(net.ext_grid.bus)): # check 6return_deactive("option 'lightsim2grid' is True and gens are at slack buses.""I'll deactive lightsim2grid.")
I think the is a confusion between what lightsim2grid does itself, and what the "newtonpf" function of lightsim2grid does.
The lightsim2grid newtonpf function is an implementation of a NR solver, so basically the netwonpf function of pandapower that does not support voltage dependants loads.
So basically:
# check 1 valid: You CANNOT use lightsim2grid in such case, of course
# check 2 => not valid: lightsim2grid can do dc approximation and Gauss Seidel, but the "newtonpf" function of lightsim2grid cannot (let me know if you want equivalent function, it's rather easy to do!). You would just need to use another function of lightsim2grid, for example "from lightsim2grid.solver import dc_pf" and / or "from lightsim2grid.solver import gauss_seidel_pf". You could use lightsim2grid in this case, but not (of course) its newtonpf function.
#check 3 valid: in pandapower, voltage_dependend_loads are handled inside the newtonpf function, lightsim2grid does not do it, so indeed, lightsim2grid will not work in these cases. You CANNOT use lightsim2grid in such case.
# check 4=> not valid: the way you enforce the q_limits in pandapower is to loop and perform successive calls to the newtonpf function, in this case using the lightsim2grid equivalent is perfectly fine. You CAN use lightsim2grid newtonpf function in this case.
# check 6 -> not valid: actually it's even the exact opposite. In lightsim2grid, only the generators are considered as slack buses. There is no concept of "ext_grid" in lightsim2grid. And by the way, this is not relevant when using the newtonpf function, ext_grid and generators with slack bus are handled before that when defining the pv , pq and ref index vectors (used in newtonpf). You CAN use lightsim2grid newtonpf function in this case.
On an external topic, with lightsim2grid, I can also perfectly reproduce the current behaviour of pandapower regarding "distributed_slack" argument. I could force to use an algorithm only valid (I believe) for "single slack" even when there is a distributed slack (as it seems to be the case for pandapower at the moment, when there are different slack and the option dist_slack is not set to True)
The text was updated successfully, but these errors were encountered:
Yes sure let's schedule such a meeting by mail (would be easier I think :-) )
I was trying recently to get "lightsim2grid" more usable yes (so improved the doc etc.) and this includes making better integration between lightsim2grid and pandapower. This is why I put "a lot" of issues in pandapower recently.
Hello,
TL;DR: each time you use
newtonpf
you can replace it withnewton_ls
when it can be imported. Lightsim2grid also supports other algorithms: DC and Gauss Seidel, for now and I plan on introducing the HELM at some point which might be linked to your issue #114 and Grid2op/lightsim2grid#17. The only case when lightsim2grid should not be used is when something "smarter" is happening inside thenewtonpf
function (such as "iwamoto" or "voltage_dependant_loads"). In all other cases,newton_ls
can act as a full replacement of pandapowernewton_pf
.I think the checks to use lightsim2grid or not are not correctly implemented in pandapower (I refer to the function
_check_lightsim2grid_compatibility
inauxilliary.py
fine)Currently it is:
I think the is a confusion between what lightsim2grid does itself, and what the "newtonpf" function of lightsim2grid does.
The lightsim2grid newtonpf function is an implementation of a NR solver, so basically the netwonpf function of pandapower that does not support voltage dependants loads.
So basically:
# check 1
valid: You CANNOT use lightsim2grid in such case, of course# check 2
=> not valid: lightsim2grid can do dc approximation and Gauss Seidel, but the "newtonpf" function of lightsim2grid cannot (let me know if you want equivalent function, it's rather easy to do!). You would just need to use another function of lightsim2grid, for example "from lightsim2grid.solver import dc_pf" and / or "from lightsim2grid.solver import gauss_seidel_pf". You could use lightsim2grid in this case, but not (of course) itsnewtonpf
function.#check 3
valid: in pandapower,voltage_dependend_loads
are handled inside thenewtonpf
function, lightsim2grid does not do it, so indeed, lightsim2grid will not work in these cases. You CANNOT use lightsim2grid in such case.# check 4
=> not valid: the way you enforce theq_limits
in pandapower is to loop and perform successive calls to thenewtonpf
function, in this case using the lightsim2grid equivalent is perfectly fine. You CAN use lightsim2grid newtonpf function in this case.# check 5
-> super weird behaviour of pandapower in this case. In this case the "distributed_slack" option should be set, see issue Inconsistent behaviour when multiple slacks on the grid (but you don't specifydistributed_slack=True
in the runpp function #1399 (and also maybe Maybe some issues with distributed slack Newton Raphson #1408) . And by the way, distributed slack buses are now available (since today :-) ) in lightsim2grid. The interface to use them follows the pandapower signature (cf some docs here https://lightsim2grid.readthedocs.io/en/latest/use_solver.html ). You CAN use lightsim2grid newtonpf function in this case (and I may even argue: you should use it in this case)# check 6
-> not valid: actually it's even the exact opposite. In lightsim2grid, only the generators are considered as slack buses. There is no concept of "ext_grid" in lightsim2grid. And by the way, this is not relevant when using thenewtonpf
function,ext_grid
and generators with slack bus are handled before that when defining thepv
,pq
andref
index vectors (used in newtonpf). You CAN use lightsim2grid newtonpf function in this case.On an external topic, with lightsim2grid, I can also perfectly reproduce the current behaviour of pandapower regarding "distributed_slack" argument. I could force to use an algorithm only valid (I believe) for "single slack" even when there is a distributed slack (as it seems to be the case for pandapower at the moment, when there are different slack and the option
dist_slack
is not set toTrue
)The text was updated successfully, but these errors were encountered: