summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2018-04-07 16:59:59 -0300
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2018-04-07 16:59:59 -0300
commit4e1e884a21a767f13278e32463b5417569db3534 (patch)
tree24b88bb0296156e6f20147812f2ba2821349e114
parent71379e56edd24c2b4d9ea341710c2a7cda6d3afb (diff)
downloadPSP.git-4e1e884a21a767f13278e32463b5417569db3534.tar.gz
PSP.git-4e1e884a21a767f13278e32463b5417569db3534.tar.xz
PSP.git-4e1e884a21a767f13278e32463b5417569db3534.zip
Bugfixes
-rw-r--r--Project/FileHanding.cpp3
-rw-r--r--Project/ImportForm.cpp254
-rw-r--r--Project/ImportForm.h7
-rw-r--r--Project/Project.mk2
-rw-r--r--Project/PropertiesForm.wxcp295
-rw-r--r--Project/SimulationsSettingsForm.cpp3
-rw-r--r--Project/base/PropertiesFormBase.cpp23
-rw-r--r--Project/base/PropertiesFormBase.h6
8 files changed, 484 insertions, 109 deletions
diff --git a/Project/FileHanding.cpp b/Project/FileHanding.cpp
index 7262c57..91ddcfe 100644
--- a/Project/FileHanding.cpp
+++ b/Project/FileHanding.cpp
@@ -70,6 +70,8 @@ void FileHanding::SaveProject(wxFileName path)
XMLParser::SetNodeValue(doc, pfTolerance, simulationData.powerFlowTolerance);
auto pfMaxIter = XMLParser::AppendNode(doc, powerFlowPropNode, "MaxIterations");
XMLParser::SetNodeValue(doc, pfMaxIter, simulationData.powerFlowMaxIterations);
+ auto pfSlackAngle = XMLParser::AppendNode(doc, powerFlowPropNode, "SlackAngle");
+ XMLParser::SetNodeValue(doc, pfSlackAngle, simulationData.initAngle);
auto stabilityPropNode = XMLParser::AppendNode(doc, simulationPropNode, "Stability");
auto timeStep = XMLParser::AppendNode(doc, stabilityPropNode, "TimeStep");
@@ -284,6 +286,7 @@ bool FileHanding::OpenProject(wxFileName path)
simData.accFator = XMLParser::GetNodeValueDouble(powerFlow, "AccFactor");
simData.powerFlowTolerance = XMLParser::GetNodeValueDouble(powerFlow, "Tolerance");
simData.powerFlowMaxIterations = XMLParser::GetNodeValueInt(powerFlow, "MaxIterations");
+ simData.initAngle = XMLParser::GetNodeValueDouble(powerFlow, "SlackAngle");
// Stability
auto stability = simPropertiesNode->first_node("Stability");
diff --git a/Project/ImportForm.cpp b/Project/ImportForm.cpp
index 0916353..9a8dc96 100644
--- a/Project/ImportForm.cpp
+++ b/Project/ImportForm.cpp
@@ -133,7 +133,8 @@ bool ImportForm::ImportSelectedFiles()
bus->SetElectricalData(data);
busList.push_back(bus);
} break;
- case ANA_GENERATOR: {
+ case ANA_GENERATOR:
+ case ANA_IND_GENERATOR: {
// Find parent bus
Bus* parentBus = GetBusFromID(busList, (*it)->busConnectionID[0].first);
wxPoint2DDouble nodePos =
@@ -150,11 +151,27 @@ bool ImportForm::ImportSelectedFiles()
auto data = syncGenerator->GetElectricalData();
data.name =
wxString::Format("%s %u (%s)", _("Generator"), syncGeneratorList.size() + 1, busData->busName);
- data.activePower = busData->genPower.real();
- data.reactivePower = busData->genPower.imag();
- data.minReactive = busData->minReactivePower;
- data.maxReactive = busData->maxReactivePower;
- data.useMachineBase = false; // ANAREDE use system's base
+ if((*it)->type == ANA_IND_GENERATOR) {
+ ParseAnarede::IndGenData* genData =
+ static_cast<ParseAnarede::IndGenData*>(parseAnarede.GetIndElementDataFromID(
+ (*it)->electricalID, (*it)->busConnectionID[0].second, ANA_IND_GENERATOR));
+ double numUnits = static_cast<double>(genData->numUnits);
+ data.activePower = genData->power.real() * numUnits;
+ data.reactivePower = genData->power.imag() * numUnits;
+ data.maxReactive = genData->maxReactivePower * numUnits;
+ data.minReactive = genData->minReactivePower * numUnits;
+ data.nominalPower = genData->ratedPower * numUnits;
+ double xd = genData->xd / (100.0 * numUnits);
+ data.syncXd = xd > 1e-3 ? xd : 1.0;
+ data.syncXq = genData->xq / (100.0 * numUnits);
+ data.potierReactance = genData->xl / (100.0 * numUnits);
+ } else {
+ data.activePower = busData->genPower.real();
+ data.reactivePower = busData->genPower.imag();
+ data.minReactive = busData->minReactivePower;
+ data.maxReactive = busData->maxReactivePower;
+ data.useMachineBase = false; // ANAREDE use system's base
+ }
syncGenerator->SetElectricalData(data);
@@ -192,89 +209,6 @@ bool ImportForm::ImportSelectedFiles()
syncMotorList.push_back(static_cast<SyncMotor*>(machine));
}
} break;
- case ANA_IND_GENERATOR: {
- // Same as ANA_GENERATOR, but with a transformer connecting the bus
- Bus* parentBus = GetBusFromID(busList, (*it)->busConnectionID[0].first);
- wxPoint2DDouble nodePos =
- parseAnarede.GetNodePositionFromID(parentBus, scale, (*it)->busConnectionNode[0].second);
-
- ParseAnarede::IndGenData* genData = static_cast<ParseAnarede::IndGenData*>(
- parseAnarede.GetIndElementDataFromID((*it)->electricalID, (*it)->busConnectionID[0].second));
- double numUnits = static_cast<double>(genData->numUnits);
-
- wxPoint2DDouble genPosition((*it)->position.m_x * scale,
- (*it)->position.m_y * scale); // Element position.
- // Calculate the new generator position:
- wxPoint2DDouble offset;
- double angle = wxRadToDeg(std::atan2(genPosition.m_y - nodePos.m_y, genPosition.m_x - nodePos.m_x));
-
- int tRot = 0; // Number of transformer rotations
- int bRot = 0; // Number of bus rotations
- if(angle >= -45 && angle <= 45) {
- offset = wxPoint2DDouble(75.0, 0.0);
- tRot = 4;
- bRot = 2;
- } else if(angle < -45 && angle > -135) {
- offset = wxPoint2DDouble(0.0, -75.0);
- tRot = 2;
- } else if(angle <= -135 || angle >= 135) {
- offset = wxPoint2DDouble(-75.0, 0.0);
- bRot = 2;
- } else {
- offset = wxPoint2DDouble(0.0, 75.0);
- tRot = 6;
- }
-
- // Auxiliary bus
- Bus* auxBus = new Bus(genPosition);
- for(int i = 0; i < bRot; ++i) auxBus->Rotate();
- auto auxBusData = auxBus->GetElectricalData();
- auxBusData.name = parentBus->GetElectricalData().name + wxString::Format(" -- %s", _("Auxiliary"));
- auxBus->SetElectricalData(auxBusData);
-
- // Transformer
- Transformer* transformer = new Transformer();
- transformer->AddParent(auxBus, auxBus->GetPosition());
- transformer->AddParent(parentBus, nodePos);
- for(int i = 0; i < tRot; ++i) transformer->Rotate();
- transformer->StartMove(transformer->GetPosition());
- transformer->Move(genPosition - offset);
-
- auto transfData = transformer->GetElectricalData();
- transfData.name =
- wxString::Format("%s %u (%s - %s)", _("Transformer"), transformerList.size() + 1,
- auxBus->GetElectricalData().name, parentBus->GetElectricalData().name);
- transfData.indReactance = genData->xt / (100.0 * numUnits);
- transformer->SetElectricaData(transfData);
-
- // Generator
- SyncGenerator* syncGenerator = new SyncGenerator();
- syncGenerator->SetID((*it)->id);
- syncGenerator->AddParent(auxBus, auxBus->GetPosition());
-
- syncGenerator->StartMove(syncGenerator->GetPosition());
- syncGenerator->Move(genPosition + offset);
-
- for(int i = 0; i < 2; ++i) syncGenerator->Rotate(false); // Set to ANAREDE default rotation
- for(int i = 0; i < (*it)->rotationID * 2; ++i) syncGenerator->Rotate();
-
- auto data = syncGenerator->GetElectricalData();
- data.name = wxString::Format("%s %u (%s)", _("Generator"), syncGeneratorList.size() + 1,
- parentBus->GetElectricalData().name);
- data.activePower = genData->power.real() * numUnits;
- data.reactivePower = genData->power.imag() * numUnits;
- data.maxReactive = genData->maxReactivePower * numUnits;
- data.minReactive = genData->minReactivePower * numUnits;
- data.nominalPower = genData->ratedPower * numUnits;
- data.syncXd = genData->xd / (100.0 * numUnits);
- data.syncXq = genData->xq / (100.0 * numUnits);
- data.potierReactance = genData->xl / (100.0 * numUnits);
- syncGenerator->SetElectricalData(data);
-
- busList.push_back(auxBus);
- transformerList.push_back(transformer);
- syncGeneratorList.push_back(syncGenerator);
- } break;
case ANA_LOAD:
case ANA_IND_LOAD: {
Bus* parentBus = GetBusFromID(busList, (*it)->busConnectionID[0].first);
@@ -308,20 +242,33 @@ bool ImportForm::ImportSelectedFiles()
ParseAnarede::BusData* busData = parseAnarede.GetBusDataFromID((*it)->busConnectionID[0].second);
bool isInductor = false;
- if(busData->shuntReactive <= 0.0) isInductor = true;
Shunt* shuntElement = NULL;
+
+ double ql = 0.0;
+ if((*it)->type == ANA_IND_SHUNT) {
+ ParseAnarede::IndElementData* shuntData = parseAnarede.GetIndElementDataFromID(
+ (*it)->electricalID, (*it)->busConnectionID[0].second, ANA_IND_SHUNT);
+ if(shuntData) {
+ double numUnits = static_cast<double>(shuntData->numUnits);
+ ql = shuntData->power.imag() * numUnits;
+ }
+ } else {
+ ql = busData->shuntReactive;
+ }
+ if(ql <= 0.0) isInductor = true;
+
if(!isInductor) {
Capacitor* cap = new Capacitor();
auto data = cap->GetElectricalData();
data.name = wxString::Format("%s %u (%s)", _("Capacitor"), indList.size() + 1, busData->busName);
- data.reactivePower = busData->shuntReactive;
+ data.reactivePower = ql;
cap->SetElectricalData(data);
shuntElement = cap;
} else {
Inductor* ind = new Inductor();
auto data = ind->GetElectricalData();
data.name = wxString::Format("%s %u (%s)", _("Inductor"), indList.size() + 1, busData->busName);
- data.reactivePower = -busData->shuntReactive;
+ data.reactivePower = std::abs(ql);
ind->SetElectricalData(data);
shuntElement = ind;
}
@@ -365,6 +312,13 @@ bool ImportForm::ImportSelectedFiles()
indMotor->StartMove(indMotor->GetPosition());
indMotor->Move(wxPoint2DDouble((*it)->position.m_x * scale, (*it)->position.m_y * scale));
+ auto data = indMotor->GetElectricalData();
+ data.name = wxString::Format("%s %u (%s)", _("Motor"), indMotorList.size() + 1,
+ parentBus->GetElectricalData().name);
+ data.activePower = 0.0;
+ data.reactivePower = 0.0;
+ indMotor->SetElectricalData(data);
+
for(int i = 0; i < 2; ++i) indMotor->Rotate(false); // Set to ANAREDE default rotation
for(int i = 0; i < (*it)->rotationID * 2; ++i) indMotor->Rotate();
@@ -378,8 +332,9 @@ bool ImportForm::ImportSelectedFiles()
wxPoint2DDouble nodePos2 =
parseAnarede.GetNodePositionFromID(parentBus2, scale, (*it)->busConnectionNode[1].second);
- ParseAnarede::BranchData* branchData = parseAnarede.GetBranchDataFromID(
- (*it)->electricalID, (*it)->busConnectionID[0].second, (*it)->busConnectionID[1].second);
+ ParseAnarede::BranchData* branchData =
+ parseAnarede.GetBranchDataFromID((*it)->electricalID, (*it)->busConnectionID[0].second,
+ (*it)->busConnectionID[1].second, ANA_TRANSFORMER);
Transformer* transformer = new Transformer();
transformer->SetID((*it)->id);
@@ -419,8 +374,9 @@ bool ImportForm::ImportSelectedFiles()
wxPoint2DDouble nodePos2 =
parseAnarede.GetNodePositionFromID(parentBus2, scale, (*it)->busConnectionNode[1].second);
- ParseAnarede::BranchData* branchData = parseAnarede.GetBranchDataFromID(
- (*it)->electricalID, (*it)->busConnectionID[0].second, (*it)->busConnectionID[1].second);
+ ParseAnarede::BranchData* branchData =
+ parseAnarede.GetBranchDataFromID((*it)->electricalID, (*it)->busConnectionID[0].second,
+ (*it)->busConnectionID[1].second, ANA_LINE);
Line* line = new Line();
line->SetID((*it)->id);
@@ -456,7 +412,7 @@ bool ImportForm::ImportSelectedFiles()
}
}
if(bus) {
- // Check loads
+ // Check load data
if(std::abs(busData->loadPower.real()) > 1e-5 ||
std::abs(busData->loadPower.imag()) > 1e-5) { // Have loads
// Find load associated with the bus
@@ -481,10 +437,57 @@ bool ImportForm::ImportSelectedFiles()
loadList.push_back(newLoad);
}
}
- // Check generation
-
+ // Check generation data
+ if(std::abs(busData->genPower.real()) > 1e-5 || std::abs(busData->genPower.imag()) > 1e-5) {
+ // Find synchornous machine associated with bus
+ if(busData->genPower.real() > 0.0) { // Synchronous generator
+ SyncGenerator* syncGenerator = NULL;
+ for(auto itSM = syncGeneratorList.begin(), itSMEnd = syncGeneratorList.end(); itSM != itSMEnd;
+ ++itSM) {
+ if((*itSM)->GetParentList().size() > 0) { // Don't search in empty vectors
+ if((*itSM)->GetParentList()[0] == bus) { // Found load
+ syncGenerator = *itSM;
+ break;
+ }
+ }
+ }
+ if(!syncGenerator) {
+ SyncGenerator* newSyncGenerator = new SyncGenerator(wxString::Format(
+ "%s %u (%s)", _("Generator"), syncGeneratorList.size() + 1, busData->busName));
+ newSyncGenerator->AddParent(bus, bus->GetPosition());
+ auto data = newSyncGenerator->GetElectricalData();
+ data.activePower = busData->genPower.real();
+ data.reactivePower = busData->genPower.imag();
+ newSyncGenerator->SetElectricalData(data);
+
+ syncGeneratorList.push_back(newSyncGenerator);
+ }
+ } else {
+ SyncMotor* syncMotor = NULL;
+ for(auto itSM = syncMotorList.begin(), itSMEnd = syncMotorList.end(); itSM != itSMEnd; ++itSM) {
+ if((*itSM)->GetParentList().size() > 0) { // Don't search in empty vectors
+ if((*itSM)->GetParentList()[0] == bus) { // Found load
+ syncMotor = *itSM;
+ break;
+ }
+ }
+ }
+ if(!syncMotor) {
+ SyncMotor* newSyncMotor = new SyncMotor(wxString::Format(
+ "%s %u (%s)", _("Synchronous compensator"), syncMotorList.size() + 1, busData->busName));
+ newSyncMotor->AddParent(bus, bus->GetPosition());
+ auto data = newSyncMotor->GetElectricalData();
+ data.activePower = std::abs(busData->genPower.real());
+ data.reactivePower = busData->genPower.imag();
+ newSyncMotor->SetElectricalData(data);
+
+ syncMotorList.push_back(newSyncMotor);
+ }
+ }
+ }
}
}
+ // Check for branch data without component (?)
for(auto it = busList.begin(), itEnd = busList.end(); it != itEnd; ++it) elementList.push_back(*it);
for(auto it = transformerList.begin(), itEnd = transformerList.end(); it != itEnd; ++it) elementList.push_back(*it);
@@ -838,6 +841,11 @@ bool ParseAnarede::ParsePWFExeCode(wxString data, wxString exeCode)
if(!GetPWFStructuredData(lineData, 38, 5, branchData->tap, 2)) return false;
if(!GetPWFStructuredData(lineData, 53, 5, branchData->phaseShift, 3)) return false;
+ if(branchData->tap < 1e-3)
+ branchData->type = ANA_LINE;
+ else
+ branchData->type = ANA_TRANSFORMER;
+
m_branchData.push_back(branchData);
}
} else if(exeCode == "DCAI") {
@@ -847,7 +855,6 @@ bool ParseAnarede::ParsePWFExeCode(wxString data, wxString exeCode)
lineData = data.BeforeFirst('\n', &rest);
data = rest;
IndElementData* indData = new IndElementData();
- ;
indData->type = ANA_IND_LOAD;
if(!GetPWFStructuredData(lineData, 9, 2, indData->id)) return false;
@@ -906,6 +913,44 @@ bool ParseAnarede::ParsePWFExeCode(wxString data, wxString exeCode)
m_indElementData.push_back(genData);
}
+ } else if(exeCode == "DBSH") {
+ int lineNumber = 1;
+ wxString lineData = "";
+ int busNumber = -1;
+
+ while(data != "") {
+ wxString rest = "";
+ lineData = data.BeforeFirst('\n', &rest);
+ data = rest;
+
+ if(lineNumber == 1) {
+ if(!GetPWFStructuredData(lineData, 0, 5, busNumber)) return false;
+ } else if(lineData == "FBAN") {
+ lineNumber = 0;
+ busNumber = -1;
+ } else if(lineNumber >= 2 && busNumber != -1) {
+ IndElementData* indShunt = new IndElementData();
+ indShunt->type = ANA_IND_SHUNT;
+ indShunt->busConnection = busNumber;
+
+ if(!GetPWFStructuredData(lineData, 0, 2, indShunt->id)) return false;
+
+ wxString isOnlineCode = lineData.Mid(6, 1);
+ if(isOnlineCode == "L" || isOnlineCode == " ")
+ indShunt->isOnline = true;
+ else if(isOnlineCode == "D")
+ indShunt->isOnline = false;
+ else
+ return false;
+
+ if(!GetPWFStructuredData(lineData, 12, 3, indShunt->numUnits)) return false;
+ double ql;
+ if(!GetPWFStructuredData(lineData, 16, 6, ql)) return false;
+ indShunt->power = std::complex<double>(0.0, ql);
+ m_indElementData.push_back(indShunt);
+ }
+ ++lineNumber;
+ }
}
return true;
@@ -954,19 +999,20 @@ ParseAnarede::BusData* ParseAnarede::GetBusDataFromID(int id)
return NULL;
}
-ParseAnarede::BranchData* ParseAnarede::GetBranchDataFromID(int id, int fromBus, int toBus)
+ParseAnarede::BranchData* ParseAnarede::GetBranchDataFromID(int id, int fromBus, int toBus, ElementTypeAnarede type)
{
for(auto it = m_branchData.begin(), itEnd = m_branchData.end(); it != itEnd; ++it) {
- if((*it)->id == id && (*it)->busConnections.first == fromBus && (*it)->busConnections.second == toBus)
+ if((*it)->id == id && (*it)->busConnections.first == fromBus && (*it)->busConnections.second == toBus &&
+ (*it)->type == type)
return *it;
}
return NULL;
}
-ParseAnarede::IndElementData* ParseAnarede::GetIndElementDataFromID(int id, int busID)
+ParseAnarede::IndElementData* ParseAnarede::GetIndElementDataFromID(int id, int busID, ElementTypeAnarede type)
{
for(auto it = m_indElementData.begin(), itEnd = m_indElementData.end(); it != itEnd; ++it) {
- if((*it)->id == id && (*it)->busConnection == busID) return *it;
+ if((*it)->id == id && (*it)->busConnection == busID && (*it)->type == type) return *it;
}
return NULL;
}
diff --git a/Project/ImportForm.h b/Project/ImportForm.h
index 57341e0..da19734 100644
--- a/Project/ImportForm.h
+++ b/Project/ImportForm.h
@@ -131,12 +131,13 @@ class ParseAnarede
};
struct BranchData {
int id = 0; /**< Branch electrical ID */
+ ElementTypeAnarede type = ANA_LINE; /**< Element type */
std::pair<int, int> busConnections = std::make_pair(0, 0); /**< Branch connection IDs */
bool isOnline = true; /**< Element is online */
double resistance = 0.0; /**< Branch resistance */
double indReactance = 0.0; /**< Branch inductive reactance */
double capSusceptance = 0.0; /**< Branch capacitive susceptance */
- double tap = 1.0; /**< Transformer tap */
+ double tap = 0.0; /**< Transformer tap */
double phaseShift = 0.0; /**< Transformer phase shift */
};
struct IndElementData {
@@ -172,8 +173,8 @@ class ParseAnarede
wxPoint2DDouble GetNodePositionFromID(Bus* bus, double scale, int nodeID);
BusData* GetBusDataFromID(int id);
- BranchData* GetBranchDataFromID(int id, int fromBus, int toBus);
- IndElementData* GetIndElementDataFromID(int id, int busID);
+ BranchData* GetBranchDataFromID(int id, int fromBus, int toBus, ElementTypeAnarede type);
+ IndElementData* GetIndElementDataFromID(int id, int busID, ElementTypeAnarede type);
void ClearData();
diff --git a/Project/Project.mk b/Project/Project.mk
index 3dcd197..aa8162c 100644
--- a/Project/Project.mk
+++ b/Project/Project.mk
@@ -13,7 +13,7 @@ CurrentFileName :=
CurrentFilePath :=
CurrentFileFullPath :=
User :=NDSE-69
-Date :=05/04/2018
+Date :=07/04/2018
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/PropertiesForm.wxcp b/Project/PropertiesForm.wxcp
index f622dcf..5802092 100644
--- a/Project/PropertiesForm.wxcp
+++ b/Project/PropertiesForm.wxcp
@@ -1,7 +1,7 @@
{
"metadata": {
"m_generatedFilesDir": "base/",
- "m_objCounter": 782,
+ "m_objCounter": 791,
"m_includeFiles": [],
"m_bitmapFunction": "wxCDAD0InitBitmapResources",
"m_bitmapsFile": "PropertiesFormBitmaps.cpp",
@@ -2616,6 +2616,299 @@
"m_events": [],
"m_children": []
}]
+ }, {
+ "m_type": 4401,
+ "proportion": 0,
+ "border": 5,
+ "gbSpan": "1,1",
+ "gbPosition": "0,0",
+ "m_styles": [],
+ "m_sizerFlags": ["wxEXPAND"],
+ "m_properties": [{
+ "type": "string",
+ "m_label": "Minimum Size:",
+ "m_value": "-1,-1"
+ }, {
+ "type": "string",
+ "m_label": "Name:",
+ "m_value": "boxSizerLvl4_20"
+ }, {
+ "type": "string",
+ "m_label": "Style:",
+ "m_value": ""
+ }, {
+ "type": "choice",
+ "m_label": "Orientation:",
+ "m_selection": 0,
+ "m_options": ["wxVERTICAL", "wxHORIZONTAL"]
+ }],
+ "m_events": [],
+ "m_children": [{
+ "m_type": 4405,
+ "proportion": 0,
+ "border": 5,
+ "gbSpan": "1,1",
+ "gbPosition": "0,0",
+ "m_styles": [],
+ "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxTOP", "wxALIGN_CENTER_VERTICAL"],
+ "m_properties": [{
+ "type": "winid",
+ "m_label": "ID:",
+ "m_winid": "wxID_ANY"
+ }, {
+ "type": "string",
+ "m_label": "Size:",
+ "m_value": "-1,-1"
+ }, {
+ "type": "string",
+ "m_label": "Minimum Size:",
+ "m_value": "-1,-1"
+ }, {
+ "type": "string",
+ "m_label": "Name:",
+ "m_value": "m_staticTextPFSlackBusAngle"
+ }, {
+ "type": "multi-string",
+ "m_label": "Tooltip:",
+ "m_value": ""
+ }, {
+ "type": "colour",
+ "m_label": "Bg Colour:",
+ "colour": "<Default>"
+ }, {
+ "type": "colour",
+ "m_label": "Fg Colour:",
+ "colour": "<Default>"
+ }, {
+ "type": "font",
+ "m_label": "Font:",
+ "m_value": ""
+ }, {
+ "type": "bool",
+ "m_label": "Hidden",
+ "m_value": false
+ }, {
+ "type": "bool",
+ "m_label": "Disabled",
+ "m_value": false
+ }, {
+ "type": "bool",
+ "m_label": "Focused",
+ "m_value": false
+ }, {
+ "type": "string",
+ "m_label": "Class Name:",
+ "m_value": ""
+ }, {
+ "type": "string",
+ "m_label": "Include File:",
+ "m_value": ""
+ }, {
+ "type": "string",
+ "m_label": "Style:",
+ "m_value": ""
+ }, {
+ "type": "multi-string",
+ "m_label": "Label:",
+ "m_value": "Slack bus angle"
+ }, {
+ "type": "string",
+ "m_label": "Wrap:",
+ "m_value": "-1"
+ }],
+ "m_events": [],
+ "m_children": []
+ }, {
+ "m_type": 4401,
+ "proportion": 0,
+ "border": 5,
+ "gbSpan": "1,1",
+ "gbPosition": "0,0",
+ "m_styles": [],
+ "m_sizerFlags": ["wxEXPAND"],
+ "m_properties": [{
+ "type": "string",
+ "m_label": "Minimum Size:",
+ "m_value": "-1,-1"
+ }, {
+ "type": "string",
+ "m_label": "Name:",
+ "m_value": "boxSizerLvl5_17"
+ }, {
+ "type": "string",
+ "m_label": "Style:",
+ "m_value": ""
+ }, {
+ "type": "choice",
+ "m_label": "Orientation:",
+ "m_selection": 1,
+ "m_options": ["wxVERTICAL", "wxHORIZONTAL"]
+ }],
+ "m_events": [],
+ "m_children": [{
+ "m_type": 4406,
+ "proportion": 1,
+ "border": 5,
+ "gbSpan": "1,1",
+ "gbPosition": "0,0",
+ "m_styles": [],
+ "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxBOTTOM", "wxALIGN_CENTER_VERTICAL"],
+ "m_properties": [{
+ "type": "winid",
+ "m_label": "ID:",
+ "m_winid": "wxID_ANY"
+ }, {
+ "type": "string",
+ "m_label": "Size:",
+ "m_value": "-1,-1"
+ }, {
+ "type": "string",
+ "m_label": "Minimum Size:",
+ "m_value": "-1,-1"
+ }, {
+ "type": "string",
+ "m_label": "Name:",
+ "m_value": "m_textCtrlPFSlackBusAngle"
+ }, {
+ "type": "multi-string",
+ "m_label": "Tooltip:",
+ "m_value": ""
+ }, {
+ "type": "colour",
+ "m_label": "Bg Colour:",
+ "colour": "<Default>"
+ }, {
+ "type": "colour",
+ "m_label": "Fg Colour:",
+ "colour": "<Default>"
+ }, {
+ "type": "font",
+ "m_label": "Font:",
+ "m_value": ""
+ }, {
+ "type": "bool",
+ "m_label": "Hidden",
+ "m_value": false
+ }, {
+ "type": "bool",
+ "m_label": "Disabled",
+ "m_value": false
+ }, {
+ "type": "bool",
+ "m_label": "Focused",
+ "m_value": false
+ }, {
+ "type": "string",
+ "m_label": "Class Name:",
+ "m_value": ""
+ }, {
+ "type": "string",
+ "m_label": "Include File:",
+ "m_value": ""
+ }, {
+ "type": "string",
+ "m_label": "Style:",
+ "m_value": ""
+ }, {
+ "type": "string",
+ "m_label": "Value:",
+ "m_value": "0,0"
+ }, {
+ "type": "string",
+ "m_label": "Text Hint",
+ "m_value": ""
+ }, {
+ "type": "string",
+ "m_label": "Max Length:",
+ "m_value": "0"
+ }, {
+ "type": "bool",
+ "m_label": "Auto Complete Directories:",
+ "m_value": false
+ }, {
+ "type": "bool",
+ "m_label": "Auto Complete Files:",
+ "m_value": false
+ }],
+ "m_events": [],
+ "m_children": []
+ }, {
+ "m_type": 4405,
+ "proportion": 0,
+ "border": 5,
+ "gbSpan": "1,1",
+ "gbPosition": "0,0",
+ "m_styles": [],
+ "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxBOTTOM", "wxALIGN_CENTER_VERTICAL"],
+ "m_properties": [{
+ "type": "winid",
+ "m_label": "ID:",
+ "m_winid": "wxID_ANY"
+ }, {
+ "type": "string",
+ "m_label": "Size:",
+ "m_value": "-1,-1"
+ }, {
+ "type": "string",
+ "m_label": "Minimum Size:",
+ "m_value": "-1,-1"
+ }, {
+ "type": "string",
+ "m_label": "Name:",
+ "m_value": "m_staticTextDeg_1"
+ }, {
+ "type": "multi-string",
+ "m_label": "Tooltip:",
+ "m_value": ""
+ }, {
+ "type": "colour",
+ "m_label": "Bg Colour:",
+ "colour": "<Default>"
+ }, {
+ "type": "colour",
+ "m_label": "Fg Colour:",
+ "colour": "<Default>"
+ }, {
+ "type": "font",
+ "m_label": "Font:",
+ "m_value": ""
+ }, {
+ "type": "bool",
+ "m_label": "Hidden",
+ "m_value": false
+ }, {
+ "type": "bool",
+ "m_label": "Disabled",
+ "m_value": false
+ }, {
+ "type": "bool",
+ "m_label": "Focused",
+ "m_value": false
+ }, {
+ "type": "string",
+ "m_label": "Class Name:",
+ "m_value": ""
+ }, {
+ "type": "string",
+ "m_label": "Include File:",
+ "m_value": ""
+ }, {
+ "type": "string",
+ "m_label": "Style:",
+ "m_value": ""
+ }, {
+ "type": "multi-string",
+ "m_label": "Label:",
+ "m_value": "º"
+ }, {
+ "type": "string",
+ "m_label": "Wrap:",
+ "m_value": "-1"
+ }],
+ "m_events": [],
+ "m_children": []
+ }]
+ }]
}]
}]
}]
diff --git a/Project/SimulationsSettingsForm.cpp b/Project/SimulationsSettingsForm.cpp
index 174b614..1e32b1d 100644
--- a/Project/SimulationsSettingsForm.cpp
+++ b/Project/SimulationsSettingsForm.cpp
@@ -123,6 +123,9 @@ bool SimulationsSettingsForm::ValidateData()
if(!Element::IntFromString(this, m_textCtrlPFMaxIterations->GetValue(), data.powerFlowMaxIterations,
_("Value entered incorrectly in the field \"Max. iterations (Power flow)\".")))
return false;
+ if(!Element::DoubleFromString(this, m_textCtrlPFSlackBusAngle->GetValue(), data.initAngle,
+ _("Value entered incorrectly in the field \"Slack bus angle\".")))
+ return false;
if(!Element::DoubleFromString(this, m_textCtrlTimeStep->GetValue(), data.timeStep,
_("Value entered incorrectly in the field \"Time step\".")))
return false;
diff --git a/Project/base/PropertiesFormBase.cpp b/Project/base/PropertiesFormBase.cpp
index efbd476..60ae2a0 100644
--- a/Project/base/PropertiesFormBase.cpp
+++ b/Project/base/PropertiesFormBase.cpp
@@ -259,6 +259,29 @@ SimulationsSettingsFormBase::SimulationsSettingsFormBase(wxWindow* parent, wxWin
boxSizerLvl4_4->Add(m_textCtrlPFMaxIterations, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
+ wxBoxSizer* boxSizerLvl4_20 = new wxBoxSizer(wxVERTICAL);
+
+ gridSizerLvl_3_4->Add(boxSizerLvl4_20, 0, wxEXPAND, WXC_FROM_DIP(5));
+
+ m_staticTextPFSlackBusAngle = new wxStaticText(m_panelPF, wxID_ANY, _("Slack bus angle"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
+
+ boxSizerLvl4_20->Add(m_staticTextPFSlackBusAngle, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
+
+ wxBoxSizer* boxSizerLvl5_17 = new wxBoxSizer(wxHORIZONTAL);
+
+ boxSizerLvl4_20->Add(boxSizerLvl5_17, 0, wxEXPAND, WXC_FROM_DIP(5));
+
+ m_textCtrlPFSlackBusAngle = new wxTextCtrl(m_panelPF, wxID_ANY, wxT("0,0"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
+ #if wxVERSION_NUMBER >= 3000
+ m_textCtrlPFSlackBusAngle->SetHint(wxT(""));
+ #endif
+
+ boxSizerLvl5_17->Add(m_textCtrlPFSlackBusAngle, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
+
+ m_staticTextDeg_1 = new wxStaticText(m_panelPF, wxID_ANY, _("º"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
+
+ boxSizerLvl5_17->Add(m_staticTextDeg_1, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
+
m_panelStability = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
m_notebook->AddPage(m_panelStability, _("Stability"), false);
diff --git a/Project/base/PropertiesFormBase.h b/Project/base/PropertiesFormBase.h
index 8c02b46..f498e1e 100644
--- a/Project/base/PropertiesFormBase.h
+++ b/Project/base/PropertiesFormBase.h
@@ -95,6 +95,9 @@ protected:
wxTextCtrl* m_textCtrlPFTolerance;
wxStaticText* m_staticTextPFMaxIterations;
wxTextCtrl* m_textCtrlPFMaxIterations;
+ wxStaticText* m_staticTextPFSlackBusAngle;
+ wxTextCtrl* m_textCtrlPFSlackBusAngle;
+ wxStaticText* m_staticTextDeg_1;
wxPanel* m_panelStability;
wxStaticText* m_staticTextTimeStep;
wxTextCtrl* m_textCtrlTimeStep;
@@ -166,6 +169,9 @@ public:
wxTextCtrl* GetTextCtrlPFTolerance() { return m_textCtrlPFTolerance; }
wxStaticText* GetStaticTextPFMaxIterations() { return m_staticTextPFMaxIterations; }
wxTextCtrl* GetTextCtrlPFMaxIterations() { return m_textCtrlPFMaxIterations; }
+ wxStaticText* GetStaticTextPFSlackBusAngle() { return m_staticTextPFSlackBusAngle; }
+ wxTextCtrl* GetTextCtrlPFSlackBusAngle() { return m_textCtrlPFSlackBusAngle; }
+ wxStaticText* GetStaticTextDeg_1() { return m_staticTextDeg_1; }
wxPanel* GetPanelPF() { return m_panelPF; }
wxStaticText* GetStaticTextTimeStep() { return m_staticTextTimeStep; }
wxTextCtrl* GetTextCtrlTimeStep() { return m_textCtrlTimeStep; }