From 0ca6710a7e003952e1212c8e32ebb2e7c008d508 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Wed, 24 Jul 2019 00:02:17 -0300 Subject: Newton bug fixed --- Project/PowerFlow.h | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'Project/PowerFlow.h') 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 #include //_() +#include /** * @class PowerFlow @@ -34,18 +34,59 @@ class PowerFlow : public ElectricCalculation { public: PowerFlow(); - PowerFlow(std::vector elementList); + PowerFlow(std::vector elementList); ~PowerFlow(); + virtual bool InitPowerFlow(std::vector &busType, + std::vector > &voltage, + std::vector > &power, + std::vector > &loadPower, + std::vector &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, int &numPQ, int &numPV); + std::vector > CalculateJacobianMatrix(std::vector > voltage, + std::vector busType, + int numPV, + int numPQ); + bool CheckReactiveLimits(std::vector &busType, + std::vector &reactiveLimit, + std::vector > power, + std::vector > loadPower); + + double GaussSeidel(std::vector busType, + std::vector > &voltage, + std::vector > oldVoltage, + std::vector > &power, + double accFactor); + void NewtonRaphson(std::vector busType, + std::vector > &voltage, + std::vector > power, + int numPV, + int numPQ, + std::vector dPdQ); + std::vector > > m_yBus; wxString m_errorMsg = ""; + int m_numberOfBuses = 0; }; #endif // POWERFLOW_H -- cgit