diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2019-07-24 00:02:17 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2019-07-24 00:02:17 -0300 |
commit | 0ca6710a7e003952e1212c8e32ebb2e7c008d508 (patch) | |
tree | 54886abf6d62d9341377d535e52b36016b602107 /Project/PowerFlow.h | |
parent | 7f46d390b8cc1d5f37560f52b222198dbc5e1225 (diff) | |
download | PSP.git-0ca6710a7e003952e1212c8e32ebb2e7c008d508.tar.gz PSP.git-0ca6710a7e003952e1212c8e32ebb2e7c008d508.tar.xz PSP.git-0ca6710a7e003952e1212c8e32ebb2e7c008d508.zip |
Newton bug fixed
Diffstat (limited to 'Project/PowerFlow.h')
-rw-r--r-- | Project/PowerFlow.h | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/Project/PowerFlow.h b/Project/PowerFlow.h index 54780b4..2f3419a 100644 --- a/Project/PowerFlow.h +++ b/Project/PowerFlow.h @@ -20,8 +20,8 @@ #include "ElectricCalculation.h" -#include <wx/string.h> #include <wx/intl.h> //_() +#include <wx/string.h> /** * @class PowerFlow @@ -34,18 +34,59 @@ class PowerFlow : public ElectricCalculation { public: PowerFlow(); - PowerFlow(std::vector<Element*> elementList); + PowerFlow(std::vector<Element *> elementList); ~PowerFlow(); + virtual bool InitPowerFlow(std::vector<BusType> &busType, + std::vector<std::complex<double> > &voltage, + std::vector<std::complex<double> > &power, + std::vector<std::complex<double> > &loadPower, + std::vector<ReactiveLimits> &reactiveLimit, + double systemPowerBase = 100e6, + double initAngle = 0.0); virtual bool RunGaussSeidel(double systemPowerBase = 100e6, int maxIteration = 5000, double error = 1e-6, double initAngle = 0.0, double accFactor = 1.0); + virtual bool RunNewtonRaphson(double systemPowerBase = 100e6, + int maxIteration = 5000, + double error = 1e-6, + double initAngle = 0.0); + virtual bool RunGaussNewton(double systemPowerBase = 100e6, + int maxIteration = 5000, + double error = 1e-6, + double initAngle = 0.0, + double accFactor = 1.0, + double gaussTol = 10); virtual wxString GetErrorMessage() { return m_errorMsg; } + protected: + void GetNumPVPQ(std::vector<BusType> busType, int &numPQ, int &numPV); + std::vector<std::vector<double> > CalculateJacobianMatrix(std::vector<std::complex<double> > voltage, + std::vector<BusType> busType, + int numPV, + int numPQ); + bool CheckReactiveLimits(std::vector<BusType> &busType, + std::vector<ReactiveLimits> &reactiveLimit, + std::vector<std::complex<double> > power, + std::vector<std::complex<double> > loadPower); + + double GaussSeidel(std::vector<BusType> busType, + std::vector<std::complex<double> > &voltage, + std::vector<std::complex<double> > oldVoltage, + std::vector<std::complex<double> > &power, + double accFactor); + void NewtonRaphson(std::vector<BusType> busType, + std::vector<std::complex<double> > &voltage, + std::vector<std::complex<double> > power, + int numPV, + int numPQ, + std::vector<double> dPdQ); + std::vector<std::vector<std::complex<double> > > m_yBus; wxString m_errorMsg = ""; + int m_numberOfBuses = 0; }; #endif // POWERFLOW_H |