summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.codelite/.tern-port2
-rw-r--r--.codelite/PSP.session14
-rw-r--r--.codelite/PSP.tagsbin83373056 -> 83383296 bytes
-rw-r--r--.codelite/compilation.dbbin59392 -> 59392 bytes
-rw-r--r--.codelite/compile_commands.json8
-rw-r--r--.codelite/refactoring.dbbin2015232 -> 2017280 bytes
-rw-r--r--Project/ElectricCalculation.cpp39
-rw-r--r--Project/ElectricCalculation.h18
-rw-r--r--Project/PowerFlow.cpp4
-rw-r--r--Project/PowerFlow.h13
-rw-r--r--Project/Project.mk2
-rw-r--r--Project/Release/ElectricCalculation.cpp.obin66771 -> 67277 bytes
-rw-r--r--Project/Release/PSP-UFU.exebin4077482 -> 4077528 bytes
-rw-r--r--Project/Release/PowerFlow.cpp.obin41569 -> 42558 bytes
14 files changed, 69 insertions, 31 deletions
diff --git a/.codelite/.tern-port b/.codelite/.tern-port
index 34fcac5..1c7d873 100644
--- a/.codelite/.tern-port
+++ b/.codelite/.tern-port
@@ -1 +1 @@
-63451 \ No newline at end of file
+52884 \ No newline at end of file
diff --git a/.codelite/PSP.session b/.codelite/PSP.session
index 88a199f..c7bc21b 100644
--- a/.codelite/PSP.session
+++ b/.codelite/PSP.session
@@ -40,29 +40,29 @@
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\ElectricCalculation.h" Name="FileName"/>
- <int Value="4" Name="FirstVisibleLine"/>
- <int Value="26" Name="CurrentLine"/>
+ <int Value="18" Name="FirstVisibleLine"/>
+ <int Value="29" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\ElectricCalculation.cpp" Name="FileName"/>
- <int Value="274" Name="FirstVisibleLine"/>
- <int Value="299" Name="CurrentLine"/>
+ <int Value="337" Name="FirstVisibleLine"/>
+ <int Value="354" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\PowerFlow.h" Name="FileName"/>
<int Value="0" Name="FirstVisibleLine"/>
- <int Value="19" Name="CurrentLine"/>
+ <int Value="7" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\PowerFlow.cpp" Name="FileName"/>
- <int Value="192" Name="FirstVisibleLine"/>
- <int Value="216" Name="CurrentLine"/>
+ <int Value="228" Name="FirstVisibleLine"/>
+ <int Value="258" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
diff --git a/.codelite/PSP.tags b/.codelite/PSP.tags
index f1f9c68..8c006be 100644
--- a/.codelite/PSP.tags
+++ b/.codelite/PSP.tags
Binary files differ
diff --git a/.codelite/compilation.db b/.codelite/compilation.db
index 64955f3..ee45d46 100644
--- a/.codelite/compilation.db
+++ b/.codelite/compilation.db
Binary files differ
diff --git a/.codelite/compile_commands.json b/.codelite/compile_commands.json
index c846c88..84734aa 100644
--- a/.codelite/compile_commands.json
+++ b/.codelite/compile_commands.json
@@ -1,9 +1,9 @@
[{
"directory": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project",
- "command": "C:/TDM-GCC-64/bin/g++.exe -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -I. -I. -MG -MP -MT./Release/PowerFlow.cpp.o -MF./Release/PowerFlow.cpp.o.d -MM PowerFlow.cpp",
- "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\PowerFlow.cpp"
+ "command": "C:/TDM-GCC-64/bin/g++.exe -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -I. -I. -MG -MP -MT./Release/ElectricCalculation.cpp.o -MF./Release/ElectricCalculation.cpp.o.d -MM ElectricCalculation.cpp",
+ "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\ElectricCalculation.cpp"
}, {
"directory": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project",
- "command": "C:/TDM-GCC-64/bin/g++.exe -c C:/Users/Thales/Documents/GitHub/PSP/Project/PowerFlow.cpp -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -o ./Release/PowerFlow.cpp.o -I. -I.",
- "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\PowerFlow.cpp"
+ "command": "C:/TDM-GCC-64/bin/g++.exe -c C:/Users/Thales/Documents/GitHub/PSP/Project/ElectricCalculation.cpp -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -o ./Release/ElectricCalculation.cpp.o -I. -I.",
+ "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\ElectricCalculation.cpp"
}] \ No newline at end of file
diff --git a/.codelite/refactoring.db b/.codelite/refactoring.db
index c78a812..2b36bf8 100644
--- a/.codelite/refactoring.db
+++ b/.codelite/refactoring.db
Binary files differ
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
index 0586bd9..031db17 100644
--- a/Project/Release/ElectricCalculation.cpp.o
+++ b/Project/Release/ElectricCalculation.cpp.o
Binary files differ
diff --git a/Project/Release/PSP-UFU.exe b/Project/Release/PSP-UFU.exe
index a07f8ba..2104334 100644
--- a/Project/Release/PSP-UFU.exe
+++ b/Project/Release/PSP-UFU.exe
Binary files differ
diff --git a/Project/Release/PowerFlow.cpp.o b/Project/Release/PowerFlow.cpp.o
index 6e734df..e284cdc 100644
--- a/Project/Release/PowerFlow.cpp.o
+++ b/Project/Release/PowerFlow.cpp.o
Binary files differ