summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.codelite/.tern-port2
-rw-r--r--.codelite/PSP.session48
-rw-r--r--.codelite/PSP.tagsbin84313088 -> 84322304 bytes
-rw-r--r--.codelite/compilation.dbbin63488 -> 63488 bytes
-rw-r--r--.codelite/refactoring.dbbin2219008 -> 2255872 bytes
-rw-r--r--Project/Bus.h14
-rw-r--r--Project/Project.mk2
-rw-r--r--Project/Release/Bus.cpp.obin40981 -> 41853 bytes
-rw-r--r--Project/Release/BusForm.cpp.obin113688 -> 119004 bytes
-rw-r--r--Project/Release/ElectricCalculation.cpp.obin67499 -> 71739 bytes
-rw-r--r--Project/Release/Line.cpp.obin160820 -> 162676 bytes
-rw-r--r--Project/Release/MainFrame.cpp.obin141269 -> 141269 bytes
-rw-r--r--Project/Release/PSP-UFU.exebin4211221 -> 4232274 bytes
-rw-r--r--Project/Release/PowerFlow.cpp.obin42558 -> 43132 bytes
-rw-r--r--Project/Release/Text.cpp.obin47041 -> 53898 bytes
-rw-r--r--Project/Release/TextForm.cpp.obin165811 -> 166463 bytes
-rw-r--r--Project/Release/Workspace.cpp.obin206375 -> 210077 bytes
-rw-r--r--Project/Text.cpp103
-rw-r--r--Project/Text.h2
19 files changed, 129 insertions, 42 deletions
diff --git a/.codelite/.tern-port b/.codelite/.tern-port
index 2a0f5c7..4dfdd5b 100644
--- a/.codelite/.tern-port
+++ b/.codelite/.tern-port
@@ -1 +1 @@
-53784 \ No newline at end of file
+54807 \ No newline at end of file
diff --git a/.codelite/PSP.session b/.codelite/PSP.session
index bd4fc99..6777ae1 100644
--- a/.codelite/PSP.session
+++ b/.codelite/PSP.session
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<Session Name="C:\Users\Thales\Documents\GitHub\PSP\PSP.workspace">
- <int Value="0" Name="m_selectedTab"/>
+ <int Value="7" Name="m_selectedTab"/>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\PSP.workspace" Name="m_workspaceName"/>
<TabInfoArray Name="TabInfoArray">
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Workspace.cpp" Name="FileName"/>
- <int Value="928" Name="FirstVisibleLine"/>
- <int Value="949" Name="CurrentLine"/>
+ <int Value="934" Name="FirstVisibleLine"/>
+ <int Value="950" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
@@ -33,8 +33,8 @@
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Element.cpp" Name="FileName"/>
- <int Value="325" Name="FirstVisibleLine"/>
- <int Value="341" Name="CurrentLine"/>
+ <int Value="0" Name="FirstVisibleLine"/>
+ <int Value="4" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
@@ -47,22 +47,15 @@
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Text.h" Name="FileName"/>
- <int Value="0" Name="FirstVisibleLine"/>
- <int Value="20" Name="CurrentLine"/>
+ <int Value="57" Name="FirstVisibleLine"/>
+ <int Value="83" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Text.cpp" Name="FileName"/>
- <int Value="117" Name="FirstVisibleLine"/>
- <int Value="133" Name="CurrentLine"/>
- <wxArrayString Name="Bookmarks"/>
- <IntVector Name="CollapsedFolds"/>
- </TabInfo>
- <TabInfo>
- <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\ElectricCalculation.h" Name="FileName"/>
- <int Value="30" Name="FirstVisibleLine"/>
- <int Value="40" Name="CurrentLine"/>
+ <int Value="54" Name="FirstVisibleLine"/>
+ <int Value="76" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
@@ -76,7 +69,28 @@
<TabInfo>
<wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\TextForm.cpp" Name="FileName"/>
<int Value="1193" Name="FirstVisibleLine"/>
- <int Value="1209" Name="CurrentLine"/>
+ <int Value="1211" Name="CurrentLine"/>
+ <wxArrayString Name="Bookmarks"/>
+ <IntVector Name="CollapsedFolds"/>
+ </TabInfo>
+ <TabInfo>
+ <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Bus.cpp" Name="FileName"/>
+ <int Value="0" Name="FirstVisibleLine"/>
+ <int Value="18" Name="CurrentLine"/>
+ <wxArrayString Name="Bookmarks"/>
+ <IntVector Name="CollapsedFolds"/>
+ </TabInfo>
+ <TabInfo>
+ <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Bus.h" Name="FileName"/>
+ <int Value="13" Name="FirstVisibleLine"/>
+ <int Value="26" Name="CurrentLine"/>
+ <wxArrayString Name="Bookmarks"/>
+ <IntVector Name="CollapsedFolds"/>
+ </TabInfo>
+ <TabInfo>
+ <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\wxGLString.h" Name="FileName"/>
+ <int Value="140" Name="FirstVisibleLine"/>
+ <int Value="156" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
<IntVector Name="CollapsedFolds"/>
</TabInfo>
diff --git a/.codelite/PSP.tags b/.codelite/PSP.tags
index c287d0c..ab2e805 100644
--- a/.codelite/PSP.tags
+++ b/.codelite/PSP.tags
Binary files differ
diff --git a/.codelite/compilation.db b/.codelite/compilation.db
index 1015797..b9d6d94 100644
--- a/.codelite/compilation.db
+++ b/.codelite/compilation.db
Binary files differ
diff --git a/.codelite/refactoring.db b/.codelite/refactoring.db
index 2e7ba05..9e1852f 100644
--- a/.codelite/refactoring.db
+++ b/.codelite/refactoring.db
Binary files differ
diff --git a/Project/Bus.h b/Project/Bus.h
index 836d2f7..470d4cb 100644
--- a/Project/Bus.h
+++ b/Project/Bus.h
@@ -11,7 +11,7 @@ struct BusElectricalData {
ElectricalUnit nominalVoltageUnit = UNIT_kV;
bool isVoltageControlled = false;
double controlledVoltage = 1.0;
- int controlledVoltageUnitChoice = 0; // 0 = p.u., 1 = same as nominalVoltageUnit (UNIT_V or UNIT_kV).
+ int controlledVoltageUnitChoice = 0; // 0 = p.u., 1 = same as nominalVoltageUnit (UNIT_V or UNIT_kV).
bool slackBus = false;
// Power flow (p.u.)
@@ -21,8 +21,14 @@ struct BusElectricalData {
bool hasFault = false;
FaultData faultType = FAULT_THREEPHASE;
FaultData faultLocation = FAULT_LINE_A;
+ // p.u. fault data
double faultResistance = 0.0;
double faultReactance = 0.0;
+ std::complex<double> faultCurrent[3] = { std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
+ std::complex<double>(0.0, 0.0) };
+ std::complex<double> faultVoltage[3] = { std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
+ std::complex<double>(0.0, 0.0) };
+ double scPower = 0.0;
// Stability
bool plotBus = false;
@@ -35,7 +41,7 @@ struct BusElectricalData {
class Bus : public Element
{
- public:
+public:
Bus();
Bus(wxPoint2DDouble position);
Bus(wxPoint2DDouble position, wxString name);
@@ -53,8 +59,8 @@ class Bus : public Element
virtual void SetElectricalData(BusElectricalData electricalData) { m_electricalData = electricalData; }
virtual bool ShowForm(wxWindow* parent, Element* element);
- protected:
+protected:
BusElectricalData m_electricalData;
};
-#endif // BUS_H
+#endif // BUS_H
diff --git a/Project/Project.mk b/Project/Project.mk
index 8fed411..8ab3b2c 100644
--- a/Project/Project.mk
+++ b/Project/Project.mk
@@ -13,7 +13,7 @@ CurrentFileName :=
CurrentFilePath :=
CurrentFileFullPath :=
User :=Thales
-Date :=06/12/2016
+Date :=07/12/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/Bus.cpp.o b/Project/Release/Bus.cpp.o
index a0baa28..444c5dc 100644
--- a/Project/Release/Bus.cpp.o
+++ b/Project/Release/Bus.cpp.o
Binary files differ
diff --git a/Project/Release/BusForm.cpp.o b/Project/Release/BusForm.cpp.o
index 1644878..3aff5ba 100644
--- a/Project/Release/BusForm.cpp.o
+++ b/Project/Release/BusForm.cpp.o
Binary files differ
diff --git a/Project/Release/ElectricCalculation.cpp.o b/Project/Release/ElectricCalculation.cpp.o
index 79d5b45..7dc5f55 100644
--- a/Project/Release/ElectricCalculation.cpp.o
+++ b/Project/Release/ElectricCalculation.cpp.o
Binary files differ
diff --git a/Project/Release/Line.cpp.o b/Project/Release/Line.cpp.o
index 8467f11..1bc1c62 100644
--- a/Project/Release/Line.cpp.o
+++ b/Project/Release/Line.cpp.o
Binary files differ
diff --git a/Project/Release/MainFrame.cpp.o b/Project/Release/MainFrame.cpp.o
index 0ce9351..07fd41c 100644
--- a/Project/Release/MainFrame.cpp.o
+++ b/Project/Release/MainFrame.cpp.o
Binary files differ
diff --git a/Project/Release/PSP-UFU.exe b/Project/Release/PSP-UFU.exe
index c863055..d591cb9 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 e284cdc..1abafea 100644
--- a/Project/Release/PowerFlow.cpp.o
+++ b/Project/Release/PowerFlow.cpp.o
Binary files differ
diff --git a/Project/Release/Text.cpp.o b/Project/Release/Text.cpp.o
index 3734ca0..9911071 100644
--- a/Project/Release/Text.cpp.o
+++ b/Project/Release/Text.cpp.o
Binary files differ
diff --git a/Project/Release/TextForm.cpp.o b/Project/Release/TextForm.cpp.o
index 09a81f7..cc9a9ca 100644
--- a/Project/Release/TextForm.cpp.o
+++ b/Project/Release/TextForm.cpp.o
Binary files differ
diff --git a/Project/Release/Workspace.cpp.o b/Project/Release/Workspace.cpp.o
index ccb9bf6..1200399 100644
--- a/Project/Release/Workspace.cpp.o
+++ b/Project/Release/Workspace.cpp.o
Binary files differ
diff --git a/Project/Text.cpp b/Project/Text.cpp
index 7082e17..eb94de0 100644
--- a/Project/Text.cpp
+++ b/Project/Text.cpp
@@ -51,13 +51,26 @@ void Text::Draw(wxPoint2DDouble translation, double scale)
}
// Draw text (layer 2)
-
glColor4d(0.0, 0.0, 0.0, 1.0);
- wxGLString glString(m_text);
- glString.setFont(wxFont(m_fontSize, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
- glString.consolidate(&dc);
- glString.bind();
- glString.render(m_position.m_x, m_position.m_y);
+ if(!m_isMultlineText) { // Only one line
+ wxGLString glString(m_text);
+ glString.setFont(wxFont(m_fontSize, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
+ glString.consolidate(&dc);
+ glString.bind();
+ glString.render(m_position.m_x, m_position.m_y);
+ } else { // Multiples lines
+ wxGLStringArray glStringArray;
+ // Fill the string array.
+ for(int i = 0; i < (int)m_multlineText.size(); i++) glStringArray.addString(m_multlineText[i]);
+ glStringArray.setFont(wxFont(m_fontSize, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
+ glStringArray.consolidate(&dc);
+ glStringArray.bind();
+ // The text will be printed centralized.
+ for(int i = 0; i < (int)m_multlineText.size(); i++) {
+ glStringArray.get(i).render(m_position.m_x, m_position.m_y - m_height / 2.0 +
+ glStringArray.get(i).getheight() * double(i) + glStringArray.get(i).getheight() / 2.0);
+ }
+ }
glPopMatrix();
}
@@ -73,14 +86,40 @@ void Text::SetText(wxString text)
m_text = text;
// Creating a glString to get the text size.
- wxGLString glString(m_text);
- glString.setFont(wxFont(m_fontSize, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
- wxScreenDC dc;
- glString.consolidate(&dc);
- glString.bind();
-
- m_width = glString.getWidth();
- m_height = glString.getheight();
+ int numberOfLines = m_text.Freq('\n') + 1;
+ if(numberOfLines == 1) { // Only one line
+ m_isMultlineText = false;
+ wxGLString glString(m_text);
+ glString.setFont(wxFont(m_fontSize, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
+ wxScreenDC dc;
+ glString.consolidate(&dc);
+ glString.bind();
+
+ m_width = glString.getWidth();
+ m_height = glString.getheight();
+ } else {
+ m_isMultlineText = true;
+ m_multlineText.clear();
+ wxString text = m_text;
+ double w = 0.0, h = 0.0;
+ for(int i = 0; i < numberOfLines; ++i) {
+ wxString nextLine;
+ wxString currentLine = text.BeforeFirst('\n', &nextLine);
+ text = nextLine;
+ m_multlineText.push_back(currentLine);
+
+ wxGLString glString(currentLine);
+ glString.setFont(wxFont(m_fontSize, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
+ wxScreenDC dc;
+ glString.consolidate(&dc);
+ glString.bind();
+
+ if(w < glString.getWidth()) w = glString.getWidth(); // Get the major width.
+ h = glString.getheight();
+ }
+ m_width = w;
+ m_height = h * (double)numberOfLines;
+ }
// Update text rectangle.
SetPosition(m_position);
@@ -115,26 +154,52 @@ void Text::UpdateText(double systemPowerBase)
Bus* bus = (Bus*)m_element;
if(bus) {
BusElectricalData data = bus->GetEletricalData();
+ double baseVoltage = data.nominalVoltage;
+ if(data.nominalVoltageUnit == UNIT_kV) baseVoltage *= 1e3;
+ double baseCurrent = systemPowerBase / (std::sqrt(3.0) * baseVoltage);
+
switch(m_dataType) {
case DATA_NAME: {
SetText(bus->GetEletricalData().name);
} break;
case DATA_VOLTAGE: {
- double baseVoltage = data.nominalVoltage;
- if(data.nominalVoltageUnit == UNIT_kV) baseVoltage *= 1e3;
double voltage = std::abs(data.voltage);
switch(m_unit) {
case UNIT_PU: {
- SetText(wxString::FromDouble(voltage, m_decimalPlaces) + _(" p.u."));
+ SetText(wxString::FromDouble(voltage, m_decimalPlaces) + " p.u.");
} break;
case UNIT_V: {
- SetText(wxString::FromDouble(voltage * baseVoltage, m_decimalPlaces) + _(" V"));
+ SetText(wxString::FromDouble(voltage * baseVoltage, m_decimalPlaces) + " V");
} break;
case UNIT_kV: {
- SetText(wxString::FromDouble(voltage * baseVoltage / 1e3, m_decimalPlaces) + _(" kV"));
+ SetText(wxString::FromDouble(voltage * baseVoltage / 1e3, m_decimalPlaces) + " kV");
} break;
}
} break;
+ case DATA_ANGLE: {
+ double angle = std::arg(data.voltage);
+ switch(m_unit) {
+ case UNIT_RADIAN: {
+ SetText(wxString::FromDouble(angle, m_decimalPlaces) + " rad");
+ } break;
+ case UNIT_DEGREE: {
+ SetText(wxString::FromDouble(wxRadToDeg(angle), m_decimalPlaces) + "°");
+ } break;
+ }
+ } break;
+ case DATA_SC_CURRENT: {
+ double faultCurrent[3] = { std::abs(data.faultCurrent[0]), std::abs(data.faultCurrent[1]),
+ std::abs(data.faultCurrent[2]) };
+ switch(m_unit) {
+ case UNIT_PU: {
+ wxString str =
+ "Ia = " + wxString::FromDouble(faultCurrent[0], m_decimalPlaces) + " p.u.";
+ str += "\nIb = " + wxString::FromDouble(faultCurrent[1], m_decimalPlaces) + " p.u.";
+ str += "\nIc = " + wxString::FromDouble(faultCurrent[2], m_decimalPlaces) + " p.u.";
+ SetText(str);
+ } break;
+ }
+ }
}
}
} break;
diff --git a/Project/Text.h b/Project/Text.h
index 98aeb65..80f35fa 100644
--- a/Project/Text.h
+++ b/Project/Text.h
@@ -80,6 +80,8 @@ class Text : public Element
protected:
wxString m_text = _("Text");
+ std::vector<wxString> m_multlineText;
+ bool m_isMultlineText = false;
int m_fontSize = 10;
Element* m_element = NULL;