diff options
Diffstat (limited to 'Project')
-rw-r--r-- | Project/ElectricCalculation.cpp | 39 | ||||
-rw-r--r-- | Project/ElectricCalculation.h | 18 | ||||
-rw-r--r-- | Project/PowerFlow.cpp | 4 | ||||
-rw-r--r-- | Project/PowerFlow.h | 13 | ||||
-rw-r--r-- | Project/Project.mk | 2 | ||||
-rw-r--r-- | Project/Release/ElectricCalculation.cpp.o | bin | 66771 -> 67277 bytes | |||
-rw-r--r-- | Project/Release/PSP-UFU.exe | bin | 4077482 -> 4077528 bytes | |||
-rw-r--r-- | Project/Release/PowerFlow.cpp.o | bin | 41569 -> 42558 bytes |
8 files changed, 57 insertions, 19 deletions
diff --git a/Project/ElectricCalculation.cpp b/Project/ElectricCalculation.cpp index a68cc19..569a31e 100644 --- a/Project/ElectricCalculation.cpp +++ b/Project/ElectricCalculation.cpp @@ -159,6 +159,7 @@ bool ElectricCalculation::GetYBus(std::vector<std::vector<std::complex<double> > void ElectricCalculation::UpdateElementsPowerFlow(std::vector<std::complex<double> > voltage, std::vector<std::complex<double> > power, std::vector<BusType> busType, + std::vector<ReactiveLimits> reactiveLimit, double systemPowerBase) { // Buses voltages @@ -243,6 +244,7 @@ void ElectricCalculation::UpdateElementsPowerFlow(std::vector<std::complex<doubl std::vector<SyncGenerator*> syncGeneratorsOnBus; std::vector<SyncMotor*> syncMotorsOnBus; std::complex<double> loadPower(0.0, 0.0); + for(auto itsg = m_syncGeneratorList.begin(); itsg != m_syncGeneratorList.end(); itsg++) { SyncGenerator* syncGenerator = *itsg; if(bus == syncGenerator->GetParentList()[0] && syncGenerator->IsOnline()) @@ -309,8 +311,21 @@ void ElectricCalculation::UpdateElementsPowerFlow(std::vector<std::complex<doubl childData.activePower = activePower; } if(busType[i] == BUS_PV || busType[i] == BUS_SLACK) { - double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase / - (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size()); + // double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase / + // (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size()); + SyncGeneratorElectricalData childData_PU = generator->GetPUElectricalData(systemPowerBase); + + double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase; + + if(reactiveLimit[i].limitReached == RL_MAX_REACHED) + reactivePower *= (childData_PU.maxReactive / reactiveLimit[i].maxLimit); + + else if(reactiveLimit[i].limitReached == RL_MIN_REACHED) + reactivePower *= (childData_PU.minReactive / reactiveLimit[i].minLimit); + + else + reactivePower /= (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size()); + switch(childData.reactivePowerUnit) { case UNIT_PU: { reactivePower /= systemPowerBase; @@ -343,8 +358,24 @@ void ElectricCalculation::UpdateElementsPowerFlow(std::vector<std::complex<doubl SyncMotorElectricalData childData = syncMotor->GetElectricalData(); if(busType[i] == BUS_PV || busType[i] == BUS_SLACK) { - double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase / - (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size()); + // double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase / + // (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size()); + + SyncMotorElectricalData childData_PU = syncMotor->GetPUElectricalData(systemPowerBase); + + double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase; + + // Bus reachd maximum reactive limit. + if(reactiveLimit[i].limitReached == RL_MAX_REACHED) + reactivePower *= (childData_PU.maxReactive / reactiveLimit[i].maxLimit); + // Bus reached minimum reactive limit. + else if(reactiveLimit[i].limitReached == RL_MIN_REACHED) + reactivePower *= (childData_PU.minReactive / reactiveLimit[i].minLimit); + // Bus didn't reach any limits + else { + reactivePower /= (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size()); + } + switch(childData.reactivePowerUnit) { case UNIT_PU: { reactivePower /= systemPowerBase; diff --git a/Project/ElectricCalculation.h b/Project/ElectricCalculation.h index ac573cd..2b449a1 100644 --- a/Project/ElectricCalculation.h +++ b/Project/ElectricCalculation.h @@ -17,6 +17,23 @@ enum BusType { BUS_SLACK = 0, BUS_PV, BUS_PQ }; +enum ReactiveLimitsType { + RL_UNLIMITED = 0, // The bus can generate any ammount of reactive power. + RL_LIMITED, // The bus reactive power generation is limited. + RL_UNLIMITED_SOURCE, // The bus have at least one source of infinite reative power. + RL_MAX_REACHED, // Max limit reached + RL_MIN_REACHED, // Min limit reached + RL_NONE_REACHED // No limits reached +}; + +struct ReactiveLimits { + double maxLimit = 0.0; + double minLimit = 0.0; + ReactiveLimitsType maxLimitType = RL_UNLIMITED; + ReactiveLimitsType minLimitType = RL_UNLIMITED; + ReactiveLimitsType limitReached = RL_NONE_REACHED; +}; + class ElectricCalculation { public: @@ -27,6 +44,7 @@ class ElectricCalculation 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); protected: diff --git a/Project/PowerFlow.cpp b/Project/PowerFlow.cpp index c66fdec..023ce26 100644 --- a/Project/PowerFlow.cpp +++ b/Project/PowerFlow.cpp @@ -248,6 +248,7 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase, if(power[i].imag() - loadPower[i].imag() > reactiveLimit[i].maxLimit) { power[i] = std::complex<double>(power[i].real(), reactiveLimit[i].maxLimit + loadPower[i].imag()); busType[i] = BUS_PQ; + reactiveLimit[i].limitReached = RL_MAX_REACHED; limitReach = true; } } @@ -255,6 +256,7 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase, if(power[i].imag() - loadPower[i].imag() < reactiveLimit[i].minLimit) { power[i] = std::complex<double>(power[i].real(), reactiveLimit[i].minLimit + loadPower[i].imag()); busType[i] = BUS_PQ; + reactiveLimit[i].limitReached = RL_MIN_REACHED; limitReach = true; } } @@ -274,7 +276,7 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase, power[i] = sBus; } - UpdateElementsPowerFlow(voltage, power, oldBusType, systemPowerBase); + UpdateElementsPowerFlow(voltage, power, oldBusType, reactiveLimit, systemPowerBase); wxString str = ""; for(auto itb = m_busList.begin(); itb != m_busList.end(); itb++) { diff --git a/Project/PowerFlow.h b/Project/PowerFlow.h index 0ead448..1e5c621 100644 --- a/Project/PowerFlow.h +++ b/Project/PowerFlow.h @@ -7,19 +7,6 @@ #include <wx/intl.h> //_() #include <wx/log.h> //temp -enum ReactiveLimitsType { - RL_UNLIMITED = 0, // The bus can generate any ammount of reactive power. - RL_LIMITED, // The bus reactive power generation is limited. - RL_UNLIMITED_SOURCE, // The bus have at least one source of infinite reative power. -}; - -struct ReactiveLimits { - double maxLimit = 0.0; - double minLimit = 0.0; - ReactiveLimitsType maxLimitType = RL_UNLIMITED; - ReactiveLimitsType minLimitType = RL_UNLIMITED; -}; - class PowerFlow : public ElectricCalculation { public: diff --git a/Project/Project.mk b/Project/Project.mk index 5d3ff3b..b867df6 100644 --- a/Project/Project.mk +++ b/Project/Project.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=Thales -Date :=08/11/2016 +Date :=09/11/2016 CodeLitePath :="C:/Program Files/CodeLite" LinkerName :=C:/TDM-GCC-64/bin/g++.exe SharedObjectLinkerName :=C:/TDM-GCC-64/bin/g++.exe -shared -fPIC diff --git a/Project/Release/ElectricCalculation.cpp.o b/Project/Release/ElectricCalculation.cpp.o Binary files differindex 0586bd9..031db17 100644 --- a/Project/Release/ElectricCalculation.cpp.o +++ b/Project/Release/ElectricCalculation.cpp.o diff --git a/Project/Release/PSP-UFU.exe b/Project/Release/PSP-UFU.exe Binary files differindex a07f8ba..2104334 100644 --- a/Project/Release/PSP-UFU.exe +++ b/Project/Release/PSP-UFU.exe diff --git a/Project/Release/PowerFlow.cpp.o b/Project/Release/PowerFlow.cpp.o Binary files differindex 6e734df..e284cdc 100644 --- a/Project/Release/PowerFlow.cpp.o +++ b/Project/Release/PowerFlow.cpp.o |