summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThales1330 <thaleslima.ufu@gmail.com>2016-11-08 19:07:44 -0200
committerThales1330 <thaleslima.ufu@gmail.com>2016-11-08 19:07:44 -0200
commit457b0509cfcc0848faa0188820e01814ea69c0b1 (patch)
tree0249fa24efe2f4b6dc1d17ecdd715977dce6ad5d
parentb6d4815859b494cc6e5e1f1718a3b410fdd6037a (diff)
downloadPSP.git-457b0509cfcc0848faa0188820e01814ea69c0b1.tar.gz
PSP.git-457b0509cfcc0848faa0188820e01814ea69c0b1.tar.xz
PSP.git-457b0509cfcc0848faa0188820e01814ea69c0b1.zip
Fixing reactive generation limit
-rw-r--r--.codelite/.tern-port2
-rw-r--r--.codelite/PSP.session10
-rw-r--r--.codelite/PSP.tagsbin83373056 -> 83373056 bytes
-rw-r--r--.codelite/compilation.dbbin59392 -> 59392 bytes
-rw-r--r--.codelite/refactoring.dbbin2006016 -> 2015232 bytes
-rw-r--r--Project/PowerFlow.cpp30
-rw-r--r--Project/Project.mk2
-rw-r--r--Project/Release/PSP-UFU.exebin4076970 -> 4077482 bytes
-rw-r--r--Project/Release/PowerFlow.cpp.obin41283 -> 41569 bytes
9 files changed, 25 insertions, 19 deletions
diff --git a/.codelite/.tern-port b/.codelite/.tern-port
index 092b19f..34fcac5 100644
--- a/.codelite/.tern-port
+++ b/.codelite/.tern-port
@@ -1 +1 @@
-50233 \ No newline at end of file
+63451 \ No newline at end of file
diff --git a/.codelite/PSP.session b/.codelite/PSP.session
index fb0bd0a..88a199f 100644
--- a/.codelite/PSP.session
+++ b/.codelite/PSP.session
@@ -47,8 +47,8 @@
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\ElectricCalculation.cpp" Name="FileName"/>
- <int Value="298" Name="FirstVisibleLine"/>
- <int Value="320" Name="CurrentLine"/>
+ <int Value="274" Name="FirstVisibleLine"/>
+ <int Value="299" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
@@ -61,14 +61,14 @@
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\PowerFlow.cpp" Name="FileName"/>
- <int Value="225" Name="FirstVisibleLine"/>
- <int Value="254" Name="CurrentLine"/>
+ <int Value="192" Name="FirstVisibleLine"/>
+ <int Value="216" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\IndMotor.cpp" Name="FileName"/>
- <int Value="0" Name="FirstVisibleLine"/>
+ <int Value="19" Name="FirstVisibleLine"/>
<int Value="54" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
diff --git a/.codelite/PSP.tags b/.codelite/PSP.tags
index 3ac5e12..f1f9c68 100644
--- a/.codelite/PSP.tags
+++ b/.codelite/PSP.tags
Binary files differ
diff --git a/.codelite/compilation.db b/.codelite/compilation.db
index a51ecdd..64955f3 100644
--- a/.codelite/compilation.db
+++ b/.codelite/compilation.db
Binary files differ
diff --git a/.codelite/refactoring.db b/.codelite/refactoring.db
index 11d2cfc..c78a812 100644
--- a/.codelite/refactoring.db
+++ b/.codelite/refactoring.db
Binary files differ
diff --git a/Project/PowerFlow.cpp b/Project/PowerFlow.cpp
index 8d8850f..c66fdec 100644
--- a/Project/PowerFlow.cpp
+++ b/Project/PowerFlow.cpp
@@ -17,10 +17,11 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase,
// Number of buses on the system.
int numberOfBuses = (int)m_busList.size();
- std::vector<BusType> busType; // Bus type
- std::vector<std::complex<double> > voltage; // Voltage of buses
- std::vector<std::complex<double> > power; // Injected power
- std::vector<ReactiveLimits> reactiveLimit; // Limit of reactive power on PV buses
+ std::vector<BusType> busType; // Bus type
+ std::vector<std::complex<double> > voltage; // Voltage of buses
+ std::vector<std::complex<double> > power; // Injected power
+ std::vector<std::complex<double> > loadPower; // Only the load power
+ std::vector<ReactiveLimits> reactiveLimit; // Limit of reactive power on PV buses
reactiveLimit.resize(numberOfBuses);
@@ -61,6 +62,7 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase,
// Fill the power array
power.push_back(std::complex<double>(0.0, 0.0)); // Initial value
+ loadPower.push_back(std::complex<double>(0.0, 0.0));
// Synchronous generator
for(auto itsg = m_syncGeneratorList.begin(); itsg != m_syncGeneratorList.end(); itsg++) {
@@ -93,7 +95,8 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase,
if(bus == syncMotor->GetParentList()[0]) {
SyncMotorElectricalData childData = syncMotor->GetPUElectricalData(systemPowerBase);
power[busNumber] += std::complex<double>(-childData.activePower, childData.reactivePower);
-
+ loadPower[busNumber] += std::complex<double>(-childData.activePower, 0.0);
+
if(busType[busNumber] == BUS_PV) {
if(childData.haveMaxReactive && reactiveLimit[busNumber].maxLimitType != RL_UNLIMITED_SOURCE) {
reactiveLimit[busNumber].maxLimitType = RL_LIMITED;
@@ -116,8 +119,10 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase,
if(load->IsOnline()) {
if(bus == load->GetParentList()[0]) {
LoadElectricalData childData = load->GetPUElectricalData(systemPowerBase);
- if(childData.loadType == CONST_POWER)
+ if(childData.loadType == CONST_POWER) {
power[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
+ loadPower[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
+ }
}
}
}
@@ -129,6 +134,7 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase,
if(bus == indMotor->GetParentList()[0]) {
IndMotorElectricalData childData = indMotor->GetPUElectricalData(systemPowerBase);
power[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
+ loadPower[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
}
}
}
@@ -164,11 +170,11 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase,
// Gauss-Seidel method
std::vector<std::complex<double> > oldVoltage; // Old voltage array.
oldVoltage.resize(voltage.size());
-
+
auto oldBusType = busType;
int iteration = 0; // Current itaration number.
-
+
while(true) {
// Reach the max number of iterations.
if(iteration >= maxIteration) {
@@ -239,15 +245,15 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase,
for(int i = 0; i < numberOfBuses; i++) {
if(busType[i] == BUS_PV) {
if(reactiveLimit[i].maxLimitType == RL_LIMITED) {
- if(power[i].imag() > reactiveLimit[i].maxLimit) {
- power[i] = std::complex<double>(power[i].real(), reactiveLimit[i].maxLimit);
+ 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;
limitReach = true;
}
}
if(reactiveLimit[i].minLimitType == RL_LIMITED) {
- if(power[i].imag() < reactiveLimit[i].minLimit) {
- power[i] = std::complex<double>(power[i].real(), reactiveLimit[i].minLimit);
+ 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;
limitReach = true;
}
diff --git a/Project/Project.mk b/Project/Project.mk
index 79121dc..5d3ff3b 100644
--- a/Project/Project.mk
+++ b/Project/Project.mk
@@ -13,7 +13,7 @@ CurrentFileName :=
CurrentFilePath :=
CurrentFileFullPath :=
User :=Thales
-Date :=07/11/2016
+Date :=08/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/PSP-UFU.exe b/Project/Release/PSP-UFU.exe
index 7f37d30..a07f8ba 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 64f5719..6e734df 100644
--- a/Project/Release/PowerFlow.cpp.o
+++ b/Project/Release/PowerFlow.cpp.o
Binary files differ