![]() |
deltaFlow
|
Declaration of the Gauss-Seidel load flow solver for power system analysis. More...
#include <Eigen/Dense>#include <utility>#include <vector>

Go to the source code of this file.
Functions | |
| bool | GaussSeidel (const Eigen::MatrixXcd &Y, Eigen::VectorXd &V, Eigen::VectorXd &delta, const Eigen::VectorXi &type_bus, const Eigen::VectorXd &P, const Eigen::VectorXd &Q, int N, int maxIter=1024, double tolerance=1E-8, double omega=1.0, std::vector< std::pair< int, double > > *iterHistory=nullptr) |
| Solves the power flow equations using the Gauss-Seidel iterative method. | |
Declaration of the Gauss-Seidel load flow solver for power system analysis.
The Gauss-Seidel method is an iterative algorithm to solve the power flow equations for bus voltages in a power system. It uses the bus admittance matrix $$ Y_{bus} $$ and iteratively updates the bus voltages $$ V $$ to satisfy the power balance equations:
$$ S_i = V_i \sum_{j=1}^N Y_{ij}^* V_j^* $$
where:
The Gauss-Seidel voltage update for the k-th iteration is:
$$ V_i^{(k+1)} = \frac{1}{Y_{ii}} \left( \frac{S_i^*}{V_i^{*(k)}} - \sum_{j=1, j \neq i}^N Y_{ij} V_j^{(k+1 \text{ or } k)} \right) $$
For voltage-controlled buses (PV buses), the reactive power injection $$ Q_k $$ is unknown initially but can be computed at iteration i by:
$$ Q_k^{(i)} = V_k^{(i)} \sum_{n=1}^N |Y_{kn}| V_n^{(i)} \sin \left( \delta_k^{(i)} - \delta_n^{(i)} - \theta_{kn} \right) $$
The total reactive power generation at bus k is:
$$ Q_{Gk} = Q_k + Q_{Lk} $$
where $$( Q_{Lk} )$$ is the reactive load demand at the bus.
If the calculated $$( Q_{Gk} )$$ remains within its specified limits (e.g., $$ Q_{Gk}^{min} \leq Q_{Gk} \leq Q_{Gk}^{max} $$), the voltage magnitude $$ V_k $$ is fixed at its specified value, and only the voltage angle $$ \delta_k $$ is updated using the Gauss-Seidel formula. This means:
If $$( Q_{Gk} )$$ exceeds its limits during any iteration, the bus type is switched from voltage-controlled (PV) to load bus (PQ), with $$ Q_{Gk} $$ fixed at the violated limit (either $$ Q_{Gk}^{max} $$ or $$ Q_{Gk}^{min} $$). Under this condition, the voltage magnitude $$ V_k $$ is no longer fixed and is recalculated by the load flow program.
To accelerate convergence, a relaxation (or acceleration) coefficient $$ \omega $$ (typically $$(0 < \omega \leq 1) $$) can be applied to the voltage update:
$$ V_i^{(k+1)} = \omega \times V_i^{(k+1)} + (1 - \omega) \times V_i^{(k)} $$
The iteration proceeds until the maximum change in bus voltages between iterations is below a specified tolerance, or the maximum number of iterations is reached.
Definition in file GaussSeidel.H.
| bool GaussSeidel | ( | const Eigen::MatrixXcd & | Y, |
| Eigen::VectorXd & | V, | ||
| Eigen::VectorXd & | delta, | ||
| const Eigen::VectorXi & | type_bus, | ||
| const Eigen::VectorXd & | P, | ||
| const Eigen::VectorXd & | Q, | ||
| int | N, | ||
| int | maxIter = 1024, |
||
| double | tolerance = 1E-8, |
||
| double | omega = 1.0, |
||
| std::vector< std::pair< int, double > > * | iterHistory = nullptr |
||
| ) |
Solves the power flow equations using the Gauss-Seidel iterative method.
Pure solver: no Q-limit checking (handled by outer loop via checkQlimits). PV buses maintain their scheduled voltage magnitude; PQ buses are fully updated.
| Y | The bus admittance matrix ($$ Y_{bus} $$). |
| V | (in/out) Voltage magnitudes [p.u.]. PV buses maintain scheduled value. |
| delta | (in/out) Voltage angles [rad]. |
| type_bus | Bus type vector (1=Slack, 2=PV, 3=PQ). |
| P | Scheduled net active power injections [p.u.] ($$ P_g - P_l $$). |
| Q | Scheduled net reactive power injections [p.u.] ($$ Q_g - Q_l $$). Used only for PQ buses. |
| N | Total number of buses. |
| maxIter | Maximum number of iterations (default: 1024). |
| tolerance | Convergence tolerance for bus voltage updates (default: $$ 1 \times 10^{-8} $$). |
| omega | Relaxation parameter for the Successive Over-Relaxation (SOR) method (default: 1.0; SOR not applied). |
| iterHistory | Optional pointer to store iteration number and error at each step. |
Definition at line 35 of file GaussSeidel.C.
References LOG_CRITICAL, LOG_DEBUG, LOG_WARN, printConvergenceStatus(), and printIterationProgress().
