/* * Copyright (C) 2017 Thales Lima Oliveira * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef POWERFLOW_H #define POWERFLOW_H #include "ElectricCalculation.h" #include //_() #include /** * @class PowerFlow * @author Thales Lima Oliveira * @date 06/10/2017 * @brief Calculate the power flow. * @file PowerFlow.h */ class PowerFlow : public ElectricCalculation { public: PowerFlow(); 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, double inertia = 1.0); virtual bool RunGaussNewton(double systemPowerBase = 100e6, int maxIteration = 5000, double error = 1e-6, double initAngle = 0.0, double accFactor = 1.0, double gaussTol = 1e-2, double inertia = 1.0); virtual wxString GetErrorMessage() { return m_errorMsg; } virtual int GetIterations() { return m_iterations; } 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, double inertia); bool CalculateMotorsReactivePower(std::vector > voltage, std::vector > &power); std::vector > > m_yBus; wxString m_errorMsg = ""; int m_numberOfBuses = 0; int m_iterations = 0; }; #endif // POWERFLOW_H