![]() |
Power System Platform
2026w10a-beta
|
Base class for electrical calculations providing general utility methods. More...
#include <ElectricCalculation.h>

Public Member Functions | |
| ElectricCalculation () | |
| Constructor. | |
| ~ElectricCalculation () | |
| Destructor. | |
| virtual void | GetElementsFromList (std::vector< Element * > elementList) |
| Separate the power elements from a generic list. | |
| virtual bool | GetYBus (std::vector< std::vector< std::complex< double > > > &yBus, double systemPowerBase, YBusSequence sequence=POSITIVE_SEQ, bool includeSyncMachines=false, bool allLoadsAsImpedances=false, bool usePowerFlowVoltagesOnImpedances=false) |
| Get the admittance matrix from the list of elements (use GetElementsFromList first). | |
| virtual bool | InvertMatrix (std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::vector< std::complex< double > > > &inverse) |
| Invert a matrix. | |
| virtual void | UpdateElementsPowerFlow (std::vector< std::complex< double > > voltage, std::vector< std::complex< double > > power, std::vector< BusType > busType, std::vector< ReactiveLimits > reactiveLimit, double systemPowerBase) |
| Update the elements after the power flow calculation. | |
| void | ABCtoDQ0 (std::complex< double > complexValue, double angle, double &dValue, double &qValue) |
| Convert a complex phasor in ABC representation to DQ components. | |
| void | DQ0toABC (double dValue, double qValue, double angle, std::complex< double > &complexValue) |
| Convert DQ components to a complex phasor in ABC representation. | |
| std::vector< std::complex< double > > | GaussianElimination (std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::complex< double > > array) |
| Solve a linear system using Gaussian elimination (complex version). | |
| std::vector< double > | GaussianElimination (std::vector< std::vector< double > > matrix, std::vector< double > array) |
| Solve a linear system using Gaussian elimination (real version). | |
| Machines::SyncMachineModel | GetMachineModel (SyncGenerator *generator) |
| Get the synchronous machine model used by the generator based on user-defined parameters. | |
| std::vector< std::complex< double > > | ComplexMatrixTimesVector (std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::complex< double > > vector) |
| Multiply a complex matrix by a complex vector. | |
| void | GetLUDecomposition (std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::vector< std::complex< double > > > &matrixL, std::vector< std::vector< std::complex< double > > > &matrixU) |
| Compute the LU decomposition of a matrix. | |
| std::vector< std::complex< double > > | LUEvaluate (std::vector< std::vector< std::complex< double > > > u, std::vector< std::vector< std::complex< double > > > l, std::vector< std::complex< double > > b) |
| Solve a linear system using LU decomposition. | |
| bool | GetParentBus (Element *childElement, Bus *&parentBus) |
| Get the parent bus of a given shunt element. | |
| bool | GetParentBus (Element *childElement, Bus *&parentBus1, Bus *&parentBus2) |
| Get the parent buses of a two-terminal element (branch). | |
| bool | CalculateEMTElementsAdmittance (const double &basePower, wxString &errorMsg) |
| Calculate the admittance of EMT elements. | |
| bool | CalculateEMTElementsPower (const double &basePower, wxString &errorMsg, bool updateCurrent=true) |
| Calculate the power of EMT elements. | |
| double | CalculateEMTPowerError (const std::vector< std::complex< double > > &voltage, std::vector< std::complex< double > > &power, const double &basePower, wxString &errorMsg) |
| Calculate the power mismatch error for EMT simulation. | |
| const std::vector< PowerElement * > | GetPowerElementList () const |
| Get the power elements of the system (use GetElementsFromList first). | |
| const std::vector< Bus * > | GetBusList () const |
| Get the buses of the system (use GetElementsFromList first). | |
| const std::vector< Capacitor * > | GetCapacitorList () const |
| Get the capacitors of the system (use GetElementsFromList first). | |
| const std::vector< IndMotor * > | GetIndMotorList () const |
| Get the induction motors of the system (use GetElementsFromList first). | |
| const std::vector< Inductor * > | GetInductorList () const |
| Get the inductors of the system (use GetElementsFromList first). | |
| const std::vector< Line * > | GetLineList () const |
| Get the lines of the system (use GetElementsFromList first). | |
| const std::vector< Load * > | GetLoadList () const |
| Get the loads of the system (use GetElementsFromList first). | |
| const std::vector< SyncGenerator * > | GetSyncGeneratorList () const |
| Get the synchronous generators of the system (use GetElementsFromList first). | |
| const std::vector< SyncMotor * > | GetSyncMotorList () const |
| Get the synchronous motors of the system (use GetElementsFromList first). | |
| const std::vector< Transformer * > | GetTransformerList () const |
| Get the transformers of the system (use GetElementsFromList first). | |
| const std::vector< HarmCurrent * > | GetHarmCurrentList () const |
| Get the harmonic current source of the system (use GetElementsFromList first). | |
| const std::vector< EMTElement * > | GetEMTElementList () const |
| Get the electromagnetic element list of the system (use GetElementsFromList first). | |
Protected Member Functions | |
| void | GetNextConnection (const unsigned int &checkBusNumber, const std::vector< std::vector< std::complex< double > > > &yBus, std::vector< bool > &connToSlack) |
| Recursively check if a bus is electrically connected to the slack bus. | |
| void | DistributeReactivePower (std::vector< ReactiveMachine > &machines, double qTotal) |
| Distribute reactive power among synchronous machines connected to the same bus. | |
Protected Attributes | |
| std::vector< PowerElement * > | m_powerElementList |
| List of power elements in the system. | |
| std::vector< Bus * > | m_busList |
| List of buses in the system. | |
| std::vector< Capacitor * > | m_capacitorList |
| List of capacitor elements in the system. | |
| std::vector< IndMotor * > | m_indMotorList |
| List of induction motors in the system. | |
| std::vector< Inductor * > | m_inductorList |
| List of inductors in the system. | |
| std::vector< Line * > | m_lineList |
| List of transmission lines in the system. | |
| std::vector< Load * > | m_loadList |
| List of load elements in the system. | |
| std::vector< SyncGenerator * > | m_syncGeneratorList |
| List of synchronous generators in the system. | |
| std::vector< SyncMotor * > | m_syncMotorList |
| List of synchronous motors in the system. | |
| std::vector< Transformer * > | m_transformerList |
| List of transformers in the system. | |
| std::vector< HarmCurrent * > | m_harmCurrentList |
| List of harmonic current sources in the system. | |
| std::vector< EMTElement * > | m_emtElementList |
| List of electromagnetic transient (EMT) elements in the system. | |
Base class for electrical calculations providing general utility methods.
This class provides common utilities used by different electrical calculations such as power flow, short-circuit analysis and EMT simulations.
Definition at line 115 of file ElectricCalculation.h.
| ElectricCalculation::ElectricCalculation | ( | ) |
| ElectricCalculation::~ElectricCalculation | ( | ) |
| void ElectricCalculation::ABCtoDQ0 | ( | std::complex< double > | complexValue, |
| double | angle, | ||
| double & | dValue, | ||
| double & | qValue | ||
| ) |
Convert a complex phasor in ABC representation to DQ components.
| complexValue | Complex phasor value in ABC reference frame. |
| angle | Electrical angle used for the transformation. |
| dValue | Resulting direct-axis component. |
| qValue | Resulting quadrature-axis component. |
Definition at line 829 of file ElectricCalculation.cpp.
| bool ElectricCalculation::CalculateEMTElementsAdmittance | ( | const double & | basePower, |
| wxString & | errorMsg | ||
| ) |
Calculate the admittance of EMT elements.
| basePower | System base power. |
| errorMsg | Error message in case of failure. |
Definition at line 1057 of file ElectricCalculation.cpp.
| bool ElectricCalculation::CalculateEMTElementsPower | ( | const double & | basePower, |
| wxString & | errorMsg, | ||
| bool | updateCurrent = true |
||
| ) |
Calculate the power of EMT elements.
| basePower | System base power. |
| errorMsg | Error message in case of failure. |
| updateCurrent | If true, update the element currents during the calculation unsing EMTElement::CalculateCurrent(wxString&, const bool&). |
Definition at line 1075 of file ElectricCalculation.cpp.

| double ElectricCalculation::CalculateEMTPowerError | ( | const std::vector< std::complex< double > > & | voltage, |
| std::vector< std::complex< double > > & | power, | ||
| const double & | basePower, | ||
| wxString & | errorMsg | ||
| ) |
Calculate the power mismatch error for EMT simulation.
| voltage | Vector with bus voltages. |
| power | Vector with injected powers. |
| basePower | System base power. |
| errorMsg | Error message in case of failure. |
Definition at line 1109 of file ElectricCalculation.cpp.

| std::vector< std::complex< double > > ElectricCalculation::ComplexMatrixTimesVector | ( | std::vector< std::vector< std::complex< double > > > | matrix, |
| std::vector< std::complex< double > > | vector | ||
| ) |
Multiply a complex matrix by a complex vector.
| matrix | Complex matrix. |
| vector | Complex vector. |
Definition at line 946 of file ElectricCalculation.cpp.
|
protected |
Distribute reactive power among synchronous machines connected to the same bus.
The method ensures that reactive power limits of individual machines are respected during the distribution process.
| machines | List of machines participating in the reactive power sharing. |
| qTotal | Total reactive power to be distributed. |
Definition at line 408 of file ElectricCalculation.cpp.

| void ElectricCalculation::DQ0toABC | ( | double | dValue, |
| double | qValue, | ||
| double | angle, | ||
| std::complex< double > & | complexValue | ||
| ) |
Convert DQ components to a complex phasor in ABC representation.
| dValue | Direct-axis component. |
| qValue | Quadrature-axis component. |
| angle | Electrical angle used for the transformation. |
| complexValue | Resulting complex phasor in ABC reference frame. |
Definition at line 835 of file ElectricCalculation.cpp.
| std::vector< double > ElectricCalculation::GaussianElimination | ( | std::vector< std::vector< double > > | matrix, |
| std::vector< double > | array | ||
| ) |
Solve a linear system using Gaussian elimination (real version).
| matrix | Coefficient matrix of the system. |
| array | Right-hand side vector. |
Definition at line 886 of file ElectricCalculation.cpp.
| std::vector< std::complex< double > > ElectricCalculation::GaussianElimination | ( | std::vector< std::vector< std::complex< double > > > | matrix, |
| std::vector< std::complex< double > > | array | ||
| ) |
Solve a linear system using Gaussian elimination (complex version).
| matrix | Coefficient matrix of the system. |
| array | Right-hand side vector. |
Definition at line 842 of file ElectricCalculation.cpp.
|
inline |
Get the buses of the system (use GetElementsFromList first).
Definition at line 298 of file ElectricCalculation.h.
|
inline |
Get the capacitors of the system (use GetElementsFromList first).
Definition at line 303 of file ElectricCalculation.h.
|
virtual |
Separate the power elements from a generic list.
| elementList | List of generic elements. |
Definition at line 27 of file ElectricCalculation.cpp.

|
inline |
Get the electromagnetic element list of the system (use GetElementsFromList first).
Definition at line 348 of file ElectricCalculation.h.
|
inline |
Get the harmonic current source of the system (use GetElementsFromList first).
Definition at line 343 of file ElectricCalculation.h.
|
inline |
Get the induction motors of the system (use GetElementsFromList first).
Definition at line 308 of file ElectricCalculation.h.
|
inline |
Get the inductors of the system (use GetElementsFromList first).
Definition at line 313 of file ElectricCalculation.h.
|
inline |
Get the lines of the system (use GetElementsFromList first).
Definition at line 318 of file ElectricCalculation.h.
|
inline |
Get the loads of the system (use GetElementsFromList first).
Definition at line 323 of file ElectricCalculation.h.
| void ElectricCalculation::GetLUDecomposition | ( | std::vector< std::vector< std::complex< double > > > | matrix, |
| std::vector< std::vector< std::complex< double > > > & | matrixL, | ||
| std::vector< std::vector< std::complex< double > > > & | matrixU | ||
| ) |
Compute the LU decomposition of a matrix.
| matrix | Matrix to be decomposed. |
| matrixL | Lower triangular matrix. |
| matrixU | Upper triangular matrix. |
Definition at line 960 of file ElectricCalculation.cpp.
| Machines::SyncMachineModel ElectricCalculation::GetMachineModel | ( | SyncGenerator * | generator | ) |
Get the synchronous machine model used by the generator based on user-defined parameters.
| generator | Pointer to the synchronous generator. |
Definition at line 929 of file ElectricCalculation.cpp.
|
protected |
Recursively check if a bus is electrically connected to the slack bus.
| checkBusNumber | Index of the bus being checked. |
| yBus | Admittance matrix of the system. |
| connToSlack | Boolean vector indicating if each bus is connected to the slack bus. |
Definition at line 392 of file ElectricCalculation.cpp.


Get the parent bus of a given shunt element.
| childElement | Pointer to the element. |
| parentBus | Pointer to the parent bus. |
Definition at line 1036 of file ElectricCalculation.cpp.

| bool ElectricCalculation::GetParentBus | ( | Element * | childElement, |
| Bus *& | parentBus1, | ||
| Bus *& | parentBus2 | ||
| ) |
Get the parent buses of a two-terminal element (branch).
| childElement | Pointer to the element. |
| parentBus1 | Pointer to the first parent bus. |
| parentBus2 | Pointer to the second parent bus. |
Definition at line 1046 of file ElectricCalculation.cpp.

|
inline |
Get the power elements of the system (use GetElementsFromList first).
Definition at line 293 of file ElectricCalculation.h.
|
inline |
Get the synchronous generators of the system (use GetElementsFromList first).
Definition at line 328 of file ElectricCalculation.h.
|
inline |
Get the synchronous motors of the system (use GetElementsFromList first).
Definition at line 333 of file ElectricCalculation.h.
|
inline |
Get the transformers of the system (use GetElementsFromList first).
Definition at line 338 of file ElectricCalculation.h.
|
virtual |
Get the admittance matrix from the list of elements (use GetElementsFromList first).
| yBus | Admittance matrix. The previous content will be erased. |
| systemPowerBase | Base power of the system. |
| sequence | Sequence of admittance matrix (positive, negative and zero). |
| includeSyncMachines | Include the synchronous machines on calculation. |
Definition at line 81 of file ElectricCalculation.cpp.


|
virtual |
Invert a matrix.
| matrix | Matrix to invert. |
| inverse | Inverted matrix. The previous content will be erased. |
Definition at line 760 of file ElectricCalculation.cpp.

| std::vector< std::complex< double > > ElectricCalculation::LUEvaluate | ( | std::vector< std::vector< std::complex< double > > > | u, |
| std::vector< std::vector< std::complex< double > > > | l, | ||
| std::vector< std::complex< double > > | b | ||
| ) |
Solve a linear system using LU decomposition.
| u | Upper triangular matrix. |
| l | Lower triangular matrix. |
| b | Right-hand side vector. |
Definition at line 1011 of file ElectricCalculation.cpp.
|
virtual |
Update the elements after the power flow calculation.
| voltage | Array with the buses voltages. |
| power | Array with the buses injected power. |
| busType | Array with the buses type. |
| reactiveLimit | Array with the reactive limit data. |
| systemPowerBase | Base power of the system. |
Definition at line 453 of file ElectricCalculation.cpp.

|
protected |
List of buses in the system.
Definition at line 370 of file ElectricCalculation.h.
|
protected |
List of capacitor elements in the system.
Definition at line 372 of file ElectricCalculation.h.
|
protected |
List of electromagnetic transient (EMT) elements in the system.
Definition at line 390 of file ElectricCalculation.h.
|
protected |
List of harmonic current sources in the system.
Definition at line 388 of file ElectricCalculation.h.
|
protected |
List of induction motors in the system.
Definition at line 374 of file ElectricCalculation.h.
|
protected |
List of inductors in the system.
Definition at line 376 of file ElectricCalculation.h.
|
protected |
List of transmission lines in the system.
Definition at line 378 of file ElectricCalculation.h.
|
protected |
List of load elements in the system.
Definition at line 380 of file ElectricCalculation.h.
|
protected |
List of power elements in the system.
Definition at line 368 of file ElectricCalculation.h.
|
protected |
List of synchronous generators in the system.
Definition at line 382 of file ElectricCalculation.h.
|
protected |
List of synchronous motors in the system.
Definition at line 384 of file ElectricCalculation.h.
|
protected |
List of transformers in the system.
Definition at line 386 of file ElectricCalculation.h.