summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThales1330 <thaleslima.ufu@gmail.com>2016-11-11 17:54:42 -0200
committerThales1330 <thaleslima.ufu@gmail.com>2016-11-11 17:54:42 -0200
commit8d78d8c052550b9efc1a7de39aa4b776be002396 (patch)
treee3684ae289f428828ca16d91249cd04eac6caa2b
parente49af3edd77a3494ff255c45eeee85bd8b287737 (diff)
downloadPSP.git-8d78d8c052550b9efc1a7de39aa4b776be002396.tar.gz
PSP.git-8d78d8c052550b9efc1a7de39aa4b776be002396.tar.xz
PSP.git-8d78d8c052550b9efc1a7de39aa4b776be002396.zip
Last commit not solved yet
-rw-r--r--.codelite/.tern-port2
-rw-r--r--.codelite/PSP.session8
-rw-r--r--.codelite/PSP.tagsbin83383296 -> 83383296 bytes
-rw-r--r--.codelite/compilation.dbbin59392 -> 59392 bytes
-rw-r--r--.codelite/refactoring.dbbin2017280 -> 2026496 bytes
-rw-r--r--Project/ElectricCalculation.cpp105
-rw-r--r--Project/Project.mk2
-rw-r--r--Project/Release/ElectricCalculation.cpp.obin67277 -> 67619 bytes
-rw-r--r--Project/Release/PSP-UFU.exebin4077528 -> 4078040 bytes
9 files changed, 70 insertions, 47 deletions
diff --git a/.codelite/.tern-port b/.codelite/.tern-port
index 1c7d873..531455e 100644
--- a/.codelite/.tern-port
+++ b/.codelite/.tern-port
@@ -1 +1 @@
-52884 \ No newline at end of file
+49337 \ No newline at end of file
diff --git a/.codelite/PSP.session b/.codelite/PSP.session
index c7bc21b..a67c62a 100644
--- a/.codelite/PSP.session
+++ b/.codelite/PSP.session
@@ -5,8 +5,8 @@
<TabInfoArray Name="TabInfoArray">
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Workspace.cpp" Name="FileName"/>
- <int Value="998" Name="FirstVisibleLine"/>
- <int Value="1020" Name="CurrentLine"/>
+ <int Value="856" Name="FirstVisibleLine"/>
+ <int Value="873" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
@@ -47,8 +47,8 @@
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\ElectricCalculation.cpp" Name="FileName"/>
- <int Value="337" Name="FirstVisibleLine"/>
- <int Value="354" Name="CurrentLine"/>
+ <int Value="367" Name="FirstVisibleLine"/>
+ <int Value="390" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
diff --git a/.codelite/PSP.tags b/.codelite/PSP.tags
index 8c006be..5029ea5 100644
--- a/.codelite/PSP.tags
+++ b/.codelite/PSP.tags
Binary files differ
diff --git a/.codelite/compilation.db b/.codelite/compilation.db
index ee45d46..d7a9493 100644
--- a/.codelite/compilation.db
+++ b/.codelite/compilation.db
Binary files differ
diff --git a/.codelite/refactoring.db b/.codelite/refactoring.db
index 2b36bf8..665b0bf 100644
--- a/.codelite/refactoring.db
+++ b/.codelite/refactoring.db
Binary files differ
diff --git a/Project/ElectricCalculation.cpp b/Project/ElectricCalculation.cpp
index 569a31e..3c4c1e5 100644
--- a/Project/ElectricCalculation.cpp
+++ b/Project/ElectricCalculation.cpp
@@ -352,52 +352,75 @@ void ElectricCalculation::UpdateElementsPowerFlow(std::vector<std::complex<doubl
}
// Set the sync motor reactive power
- for(auto itmg = syncMotorsOnBus.begin(); itmg != syncMotorsOnBus.end(); itmg++) {
- SyncMotor* syncMotor = *itmg;
- if(syncMotor->IsOnline()) {
- 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());
-
- 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());
+ double exceededReactive = 0.0;
+ int numMachines = syncGeneratorsOnBus.size() + syncMotorsOnBus.size();
+ for(auto itsm = syncMotorsOnBus.begin(); itsm != syncMotorsOnBus.end(); itsm++) {
+ SyncMotor* syncMotor = *itsm;
+ SyncMotorElectricalData childData = syncMotor->GetElectricalData();
+
+ bool reachedMachineLimit = false;
+
+ if(busType[i] == BUS_PV || busType[i] == BUS_SLACK) {
+ // 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();
+
+ // 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)(numMachines);
+ if(childData_PU.haveMaxReactive && (reactivePower > childData_PU.maxReactive)) {
+ exceededReactive += reactivePower - childData_PU.maxReactive;
+ reactivePower = childData_PU.maxReactive;
+ reachedMachineLimit = true;
+ } else if(childData_PU.haveMinReactive && (reactivePower < childData_PU.minReactive)) {
+ exceededReactive += reactivePower - childData_PU.minReactive;
+ reactivePower = childData_PU.minReactive;
+ reachedMachineLimit = true;
+ } else if((!childData_PU.haveMaxReactive && reactiveLimit[i].limitReached == RL_MAX_REACHED) ||
+ (!childData_PU.haveMinReactive && reactiveLimit[i].limitReached == RL_MIN_REACHED) ||
+ (!childData_PU.haveMaxReactive && !childData_PU.haveMaxReactive)) {
+ reactivePower += exceededReactive;
+ exceededReactive = 0.0;
}
+ }
- switch(childData.reactivePowerUnit) {
- case UNIT_PU: {
- reactivePower /= systemPowerBase;
- } break;
- case UNIT_kVAr: {
- reactivePower /= 1e3;
- } break;
- case UNIT_MVAr: {
- reactivePower /= 1e6;
- } break;
- default:
- break;
- }
- childData.reactivePower = reactivePower;
+ reactivePower *= systemPowerBase;
+
+ switch(childData.reactivePowerUnit) {
+ case UNIT_PU: {
+ reactivePower /= systemPowerBase;
+ } break;
+ case UNIT_kVAr: {
+ reactivePower /= 1e3;
+ } break;
+ case UNIT_MVAr: {
+ reactivePower /= 1e6;
+ } break;
+ default:
+ break;
}
+ childData.reactivePower = reactivePower;
+ }
- if(childData.activePower > 0.0)
- syncMotor->SetPowerFlowDirection(PF_TO_ELEMENT);
- else
- syncMotor->SetPowerFlowDirection(PF_TO_BUS);
+ if(childData.activePower > 0.0)
+ syncMotor->SetPowerFlowDirection(PF_TO_ELEMENT);
+ else
+ syncMotor->SetPowerFlowDirection(PF_TO_BUS);
+
+ syncMotor->SetElectricalData(childData);
- syncMotor->SetElectricalData(childData);
+ if(reachedMachineLimit) {
+ syncMotorsOnBus.erase(itsm);
+ itsm = syncMotorsOnBus.begin();
}
}
}
diff --git a/Project/Project.mk b/Project/Project.mk
index b867df6..02c8ea2 100644
--- a/Project/Project.mk
+++ b/Project/Project.mk
@@ -13,7 +13,7 @@ CurrentFileName :=
CurrentFilePath :=
CurrentFileFullPath :=
User :=Thales
-Date :=09/11/2016
+Date :=10/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 031db17..bcf3329 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 2104334..74c25d7 100644
--- a/Project/Release/PSP-UFU.exe
+++ b/Project/Release/PSP-UFU.exe
Binary files differ