roseau.load_flow._solvers
#
Module Contents#
Classes#
This is an abstract class for all the solvers. 

This is an abstract class for all the NewtonRaphson solvers. 

The classical NewtonRaphson algorithm. 

The NewtonRaphson algorithm with the Goldstein and Price linear search. It has better stability than the 
 class AbstractSolver(network: ElectricalNetwork)#
Bases:
abc.ABC
This is an abstract class for all the solvers.
AbstractSolver constructor.
 Parameters:
network – The electrical network for which the load flow needs to be solved.
 classmethod from_dict(data: JsonDict, network: ElectricalNetwork) typing_extensions.Self #
AbstractSolver constructor from dict.
 Parameters:
data – The solver data.
network – The electrical network for which the load flow needs to be solved.
 Returns:
The constructed solver.
 solve_load_flow(max_iterations: int, tolerance: float) tuple[int, float] #
Solve the load flow for the network the solver was constructed with.
 Parameters:
tolerance – Required tolerance value on the residuals for the convergence.
max_iterations – The maximum number of allowed iterations.
 Returns:
The number of iterations and the final residual.
 reset_inputs() None #
Reset the input vector (which is used for the first step of the newton algorithm) to its initial value
 abstract update_network(network: ElectricalNetwork) None #
If the network has changed, we need to recreate a solver for this new network.
 class AbstractNewton(network: ElectricalNetwork, optimize_tape: bool = DEFAULT_TAPE_OPTIMIZATION)#
Bases:
AbstractSolver
,abc.ABC
This is an abstract class for all the NewtonRaphson solvers.
AbstractNewton constructor.
 Parameters:
network – The electrical network for which the load flow needs to be solved.
optimize_tape – If True, a tape optimization will be performed. This operation might take a bit of time, but will make every subsequent load flow to run faster.
 save_matrix(prefix: str) None #
Output files of the jacobian and vector matrix of the first newton step. Those files can be used to launch an eigen solver benchmark (see https://eigen.tuxfamily.org/dox/group__TopicSparseSystems.html)
 Parameters:
prefix – The prefix of the name of the files. They will be output as prefix.mtx and prefix_m.mtx to follow Eigen solver benchmark convention.
 class Newton(network: ElectricalNetwork, optimize_tape: bool = AbstractNewton.DEFAULT_TAPE_OPTIMIZATION)#
Bases:
AbstractNewton
The classical NewtonRaphson algorithm.
Newton constructor.
 Parameters:
network – The electrical network for which the load flow needs to be solved.
optimize_tape – If True, a tape optimization will be performed. This operation might take a bit of time, but will make every subsequent load flow to run faster.
 update_network(network: ElectricalNetwork) None #
If the network has changed, we need to recreate a solver for this new network.
 class NewtonGoldstein(network: ElectricalNetwork, m1: float = DEFAULT_M1, m2: float = DEFAULT_M2, optimize_tape: bool = AbstractNewton.DEFAULT_TAPE_OPTIMIZATION)#
Bases:
AbstractNewton
The NewtonRaphson algorithm with the Goldstein and Price linear search. It has better stability than the classical NewtonRaphson, without losing performance.
NewtonGoldstein constructor.
 Parameters:
network – The electrical network for which the load flow needs to be solved.
optimize_tape – If True, a tape optimization will be performed. This operation might take a bit of time, but will make every subsequent load flow iteration to run faster.
m1 – The first constant of the Goldstein and Price linear search.
m2 – The second constant of the Goldstein and Price linear search.
 update_network(network: ElectricalNetwork) None #
If the network has changed, we need to recreate a solver for this new network.