diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-10-06 17:07:39 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-06 17:07:39 -0300 |
commit | a32372968abb2f4b3bf0472f59c18f5028d20206 (patch) | |
tree | 054de50365749426623bed352a10e84299e84cad /Project | |
parent | fa2776e9a939a793a9e46a0cc5880dda868e7028 (diff) | |
parent | 89befdb9b259d02249876e39ec6fd28860272439 (diff) | |
download | PSP.git-a32372968abb2f4b3bf0472f59c18f5028d20206.tar.gz PSP.git-a32372968abb2f4b3bf0472f59c18f5028d20206.tar.xz PSP.git-a32372968abb2f4b3bf0472f59c18f5028d20206.zip |
Merge pull request #39 from Thales1330/wip/sync-machine-saturation
Wip sync machine saturation
Diffstat (limited to 'Project')
131 files changed, 3422 insertions, 591 deletions
diff --git a/Project/AboutForm.cpp b/Project/AboutForm.cpp index b9d4f88..5de1d2d 100644 --- a/Project/AboutForm.cpp +++ b/Project/AboutForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "AboutForm.h" AboutForm::AboutForm(wxWindow* parent) : AboutFormBase(parent) { Init(); } diff --git a/Project/AboutForm.h b/Project/AboutForm.h index abba7f4..90a43b1 100644 --- a/Project/AboutForm.h +++ b/Project/AboutForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef ABOUTFORM_H #define ABOUTFORM_H #include "PropertiesForm.h" @@ -5,6 +22,13 @@ #include <wx/textfile.h> #include <wx/stdpaths.h> +/** + * @class AboutForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to show some informations. + * @file AboutForm.h + */ class AboutForm : public AboutFormBase { public: diff --git a/Project/Branch.cpp b/Project/Branch.cpp index 326b7e0..8bcbb5e 100644 --- a/Project/Branch.cpp +++ b/Project/Branch.cpp @@ -1,16 +1,31 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Branch.h" -Branch::Branch() - : PowerElement() -{ -} +Branch::Branch() : PowerElement() {} Branch::~Branch() {} bool Branch::NodeContains(wxPoint2DDouble position) { wxRect2DDouble nodeRect1(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize, - 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); + 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); wxRect2DDouble nodeRect2(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize, - m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); + m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, 10 + 2.0 * m_borderSize, + 10 + 2.0 * m_borderSize); if(nodeRect1.Contains(position)) { m_activeNodeID = 1; @@ -34,12 +49,12 @@ bool Branch::SetNodeParent(Element* parent) wxRect2DDouble nodeRect(0, 0, 0, 0); if(m_activeNodeID == 1) { nodeRect = wxRect2DDouble(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize, - 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); + 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); } if(m_activeNodeID == 2) { nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize, - m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, 10 + 2.0 * m_borderSize, - 10 + 2.0 * m_borderSize); + m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, + 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); } if(parent->Intersects(nodeRect)) { @@ -54,8 +69,8 @@ bool Branch::SetNodeParent(Element* parent) // Centralize the node on bus. wxPoint2DDouble parentPt = parent->RotateAtPosition( - m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position. - parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus. + m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position. + parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus. parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); m_pointList[0] = parentPt; @@ -102,7 +117,7 @@ void Branch::UpdateNodes() { if(m_parentList[0]) { wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize, - 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); + 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); if(!m_parentList[0]->Intersects(nodeRect)) { m_parentList[0]->RemoveChild(this); @@ -113,8 +128,8 @@ void Branch::UpdateNodes() } if(m_parentList[1]) { wxRect2DDouble nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize, - m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, 10 + 2.0 * m_borderSize, - 10 + 2.0 * m_borderSize); + m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, + 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); if(!m_parentList[1]->Intersects(nodeRect)) { m_parentList[1]->RemoveChild(this); @@ -156,16 +171,16 @@ void Branch::UpdateSwitchesPosition() void Branch::UpdateSwitches() { - wxPoint2DDouble swCenter = wxPoint2DDouble( - (m_pointList[0].m_x + m_pointList[1].m_x) / 2.0, (m_pointList[0].m_y + m_pointList[1].m_y) / 2.0); - m_switchRect[0] = wxRect2DDouble( - swCenter.m_x - m_switchSize / 2.0, swCenter.m_y - m_switchSize / 2.0, m_switchSize, m_switchSize); + wxPoint2DDouble swCenter = wxPoint2DDouble((m_pointList[0].m_x + m_pointList[1].m_x) / 2.0, + (m_pointList[0].m_y + m_pointList[1].m_y) / 2.0); + m_switchRect[0] = wxRect2DDouble(swCenter.m_x - m_switchSize / 2.0, swCenter.m_y - m_switchSize / 2.0, m_switchSize, + m_switchSize); if(m_switchRect.size() > 1) { swCenter = wxPoint2DDouble((m_pointList[m_pointList.size() - 1].m_x + m_pointList[m_pointList.size() - 2].m_x) / 2.0, - (m_pointList[m_pointList.size() - 1].m_y + m_pointList[m_pointList.size() - 2].m_y) / 2.0); - m_switchRect[1] = wxRect2DDouble( - swCenter.m_x - m_switchSize / 2.0, swCenter.m_y - m_switchSize / 2.0, m_switchSize, m_switchSize); + (m_pointList[m_pointList.size() - 1].m_y + m_pointList[m_pointList.size() - 2].m_y) / 2.0); + m_switchRect[1] = wxRect2DDouble(swCenter.m_x - m_switchSize / 2.0, swCenter.m_y - m_switchSize / 2.0, + m_switchSize, m_switchSize); } } diff --git a/Project/Branch.h b/Project/Branch.h index a782a1e..684c8b4 100644 --- a/Project/Branch.h +++ b/Project/Branch.h @@ -1,36 +1,60 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef BRANCH_H #define BRANCH_H #include "PowerElement.h" #include "Bus.h" +/** + * @class Branch + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Abstract class for branch power elements. + * @file Branch.h + */ class Branch : public PowerElement { -public: - Branch(); - ~Branch(); - - virtual bool Contains(wxPoint2DDouble position) const { return false; } + public: + Branch(); + ~Branch(); + + virtual bool Contains(wxPoint2DDouble position) const { return false; } virtual void Draw(wxPoint2DDouble translation, double scale) const {} virtual void Move(wxPoint2DDouble position) {} virtual void StartMove(wxPoint2DDouble position) {} virtual void MoveNode(Element* parent, wxPoint2DDouble position) {} virtual bool NodeContains(wxPoint2DDouble position); virtual bool SetNodeParent(Element* parent); - virtual void RemoveParent(Element* parent); + virtual void RemoveParent(Element* parent); virtual void UpdateNodes(); virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_ARROW; } virtual bool Intersects(wxRect2DDouble rect) const { return false; } virtual void MovePickbox(wxPoint2DDouble position) {} virtual bool PickboxContains(wxPoint2DDouble position) { return false; } virtual void RotateNode(Element* parent, bool clockwise = true); - virtual void AddPoint(wxPoint2DDouble point) {}; + virtual void AddPoint(wxPoint2DDouble point){}; virtual bool GetContextMenu(wxMenu& menu) { return false; } - virtual void UpdateSwitchesPosition(); - virtual void UpdateSwitches(); + virtual void UpdateSwitchesPosition(); + virtual void UpdateSwitches(); protected: - bool m_inserted = false; + bool m_inserted = false; }; -#endif // BRANCH_H +#endif // BRANCH_H diff --git a/Project/Bus.cpp b/Project/Bus.cpp index c366d76..ee84ec2 100644 --- a/Project/Bus.cpp +++ b/Project/Bus.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Bus.h" #ifdef USING_WX_3_0_X #include "DegreesAndRadians.h" diff --git a/Project/Bus.h b/Project/Bus.h index 17d341b..f4bdb04 100644 --- a/Project/Bus.h +++ b/Project/Bus.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef BUS_H #define BUS_H @@ -17,7 +34,7 @@ struct BusElectricalData { // Power flow (p.u.) std::complex<double> voltage = std::complex<double>(1.0, 0.0); std::complex<double> power = std::complex<double>(0.0, 0.0); - int busType = 2; // PQ + int busType = 2; // PQ // Fault bool hasFault = false; @@ -42,6 +59,13 @@ struct BusElectricalData { std::vector<std::complex<double> > stabVoltageVector; }; +/** + * @class Bus + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Node for power elements. All others power elements are connected through this. + * @file Bus.h + */ class Bus : public PowerElement { public: diff --git a/Project/BusForm.cpp b/Project/BusForm.cpp index 436357e..ca083e7 100644 --- a/Project/BusForm.cpp +++ b/Project/BusForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "BusForm.h" #include "Bus.h" @@ -7,7 +24,7 @@ BusForm::BusForm(wxWindow* parent, Bus* bus) : BusFormBase(parent) m_choiceFaultType->SetString(1, _("Line-to-line")); m_choiceFaultType->SetString(2, _("Double line-to-ground")); m_choiceFaultType->SetString(3, _("Line-to-ground")); - + SetSize(GetBestSize()); m_parent = parent; diff --git a/Project/BusForm.h b/Project/BusForm.h index 38cb9d7..cbbe430 100644 --- a/Project/BusForm.h +++ b/Project/BusForm.h @@ -1,15 +1,40 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef BUSFORM_H #define BUSFORM_H #include "ElementForm.h" class Bus; +/** + * @class BusForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the bus power data. + * @file BusForm.h + */ class BusForm : public BusFormBase { -public: + public: BusForm(wxWindow* parent, Bus* bus); virtual ~BusForm(); -protected: + + protected: virtual void OnFaultTypeChoice(wxCommandEvent& event); virtual void OnControlledVoltageClick(wxCommandEvent& event); virtual void OnInsertFaultClick(wxCommandEvent& event); @@ -17,12 +42,12 @@ protected: virtual void OnNominalVoltageChoice(wxCommandEvent& event); virtual void OnButtonCancelClick(wxCommandEvent& event); virtual void OnButtonOKClick(wxCommandEvent& event); - virtual void EnableCtrlVoltageFields(bool enable = true); - virtual void EnableFaultFields(bool enable = true); - virtual void EnableStabFaultFields(bool enable = true); - virtual void UpdateChoiceBoxes(); - - Bus* m_bus = NULL; - wxWindow* m_parent = NULL; + virtual void EnableCtrlVoltageFields(bool enable = true); + virtual void EnableFaultFields(bool enable = true); + virtual void EnableStabFaultFields(bool enable = true); + virtual void UpdateChoiceBoxes(); + + Bus* m_bus = NULL; + wxWindow* m_parent = NULL; }; -#endif // BUSFORM_H +#endif // BUSFORM_H diff --git a/Project/Camera.cpp b/Project/Camera.cpp index 248a835..58c916c 100644 --- a/Project/Camera.cpp +++ b/Project/Camera.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Camera.h" Camera::Camera() @@ -9,8 +26,8 @@ Camera::Camera() Camera::~Camera() {} wxPoint2DDouble Camera::ScreenToWorld(wxPoint2DDouble screenCoords) const { - return wxPoint2DDouble( - screenCoords.m_x / m_scale - m_translation.m_x, screenCoords.m_y / m_scale - m_translation.m_y); + return wxPoint2DDouble(screenCoords.m_x / m_scale - m_translation.m_x, + screenCoords.m_y / m_scale - m_translation.m_y); } void Camera::SetTranslation(wxPoint2DDouble screenPoint) diff --git a/Project/Camera.h b/Project/Camera.h index 141047f..8c0427f 100644 --- a/Project/Camera.h +++ b/Project/Camera.h @@ -1,11 +1,35 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CAMERA_H #define CAMERA_H #include <wx/geometry.h> +/** + * @class Camera + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Class responsible for the correct visualization of the elements on screen. + * @file Camera.h + */ class Camera { -public: + public: Camera(); ~Camera(); @@ -20,8 +44,7 @@ public: wxPoint2DDouble ScreenToWorld(wxPoint2DDouble screenCoords) const; double GetZoomMin() const { return m_zoomMin; } double GetZoomMax() const { return m_zoomMax; } - -protected: + protected: wxPoint2DDouble m_translation; wxPoint2DDouble m_translationStartPt; double m_scale; @@ -32,4 +55,4 @@ protected: double m_zoomMax = 3.0; }; -#endif // CAMERA_H +#endif // CAMERA_H diff --git a/Project/Capacitor.cpp b/Project/Capacitor.cpp index 75b74f4..4f7491f 100644 --- a/Project/Capacitor.cpp +++ b/Project/Capacitor.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ReactiveShuntElementForm.h" #include "Capacitor.h" diff --git a/Project/Capacitor.h b/Project/Capacitor.h index c124396..1a6ed57 100644 --- a/Project/Capacitor.h +++ b/Project/Capacitor.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CAPACITOR_H #define CAPACITOR_H @@ -11,9 +28,16 @@ struct CapacitorElectricalData { ElectricalUnit reactivePowerUnit = UNIT_MVAr; }; +/** + * @class Capacitor + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Shunt capactior power element. + * @file Capacitor.h + */ class Capacitor : public Shunt { -public: + public: Capacitor(); Capacitor(wxString name); ~Capacitor(); @@ -30,8 +54,8 @@ public: virtual CapacitorElectricalData GetElectricalData() { return m_electricalData; } virtual CapacitorElectricalData GetPUElectricalData(double systemPowerBase); virtual void SetElectricalData(CapacitorElectricalData electricalData) { m_electricalData = electricalData; } -protected: + protected: CapacitorElectricalData m_electricalData; }; -#endif // CAPACITOR_H +#endif // CAPACITOR_H diff --git a/Project/ChartView.cpp b/Project/ChartView.cpp index acfc939..0a5d73c 100644 --- a/Project/ChartView.cpp +++ b/Project/ChartView.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ChartView.h" #include "ElementPlotData.h" diff --git a/Project/ChartView.h b/Project/ChartView.h index 8f5c3d9..82bb621 100644 --- a/Project/ChartView.h +++ b/Project/ChartView.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CHARTVIEW_H #define CHARTVIEW_H #include "ChartViewBase.h" @@ -13,6 +30,13 @@ class PlotData; class ElementPlotData; +/** + * @class ChartView + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief This class is responsible to manage the charts generated in the transient electromechanical studies. + * @file ChartView.h + */ class ChartView : public ChartViewBase { public: diff --git a/Project/ConnectionLine.cpp b/Project/ConnectionLine.cpp index 0258f2e..672c6e8 100644 --- a/Project/ConnectionLine.cpp +++ b/Project/ConnectionLine.cpp @@ -1,11 +1,24 @@ -#include "ConnectionLine.h" +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ -ConnectionLine::ConnectionLine() : ControlElement(-1) -{ -} +#include "ConnectionLine.h" -ConnectionLine::ConnectionLine(Node* firstNode, int id) - : ControlElement(id) +ConnectionLine::ConnectionLine() : ControlElement(-1) {} +ConnectionLine::ConnectionLine(Node* firstNode, int id) : ControlElement(id) { wxPoint2DDouble pt = firstNode->GetPosition(); m_tmpSndPt = pt; @@ -17,7 +30,6 @@ ConnectionLine::ConnectionLine(Node* firstNode, int id) } ConnectionLine::~ConnectionLine() {} - void ConnectionLine::Draw(wxPoint2DDouble translation, double scale) const { // Line selected (Layer 1). @@ -156,7 +168,6 @@ void ConnectionLine::StartMove(wxPoint2DDouble position) } wxPoint2DDouble ConnectionLine::GetMidPoint() const { return ((m_pointList[2] + m_pointList[3]) / 2.0); } - bool ConnectionLine::SetParentLine(ConnectionLine* parent) { if(m_nodeList[0]->GetNodeType() != Node::NODE_IN) return false; diff --git a/Project/ConnectionLine.h b/Project/ConnectionLine.h index c0355cd..768ef9f 100644 --- a/Project/ConnectionLine.h +++ b/Project/ConnectionLine.h @@ -1,8 +1,32 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CONNECTIONLINE_H #define CONNECTIONLINE_H #include "ControlElement.h" +/** + * @class ConnectionLine + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Connection between two control elements or other connection line and an element. + * @file ConnectionLine.h + */ class ConnectionLine : public ControlElement { public: @@ -29,10 +53,9 @@ class ConnectionLine : public ControlElement virtual bool SetParentLine(ConnectionLine* parent); virtual std::vector<ConnectionLine*> GetLineChildList() const; - + virtual double GetValue() const { return m_value; } virtual void SetValue(double value) { m_value = value; } - Element* GetCopy(); protected: @@ -43,7 +66,7 @@ class ConnectionLine : public ControlElement ConnectionLineType m_type = ELEMENT_ELEMENT; ConnectionLine* m_parentLine = NULL; - + double m_value; }; diff --git a/Project/Constant.cpp b/Project/Constant.cpp index f0c90fc..1c375f1 100644 --- a/Project/Constant.cpp +++ b/Project/Constant.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Constant.h" #include "ConstantForm.h" diff --git a/Project/Constant.h b/Project/Constant.h index 3f84b91..367916d 100644 --- a/Project/Constant.h +++ b/Project/Constant.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CONSTANT_H #define CONSTANT_H @@ -8,6 +25,13 @@ class ConstantForm; +/** + * @class Constant + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief A control element that provides a constant value. + * @file Constant.h + */ class Constant : public ControlElement { public: @@ -20,11 +44,10 @@ class Constant : public ControlElement virtual bool ShowForm(wxWindow* parent, Element* element); virtual void Rotate(bool clockwise = true); virtual void UpdateText() { SetValue(m_value); } - virtual void SetValue(double value); virtual double GetValue() const { return m_value; } virtual void UpdatePoints(); - + virtual Element* GetCopy(); protected: diff --git a/Project/ConstantForm.cpp b/Project/ConstantForm.cpp index f7d29d1..7db739b 100644 --- a/Project/ConstantForm.cpp +++ b/Project/ConstantForm.cpp @@ -1,10 +1,27 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ConstantForm.h" #include "Constant.h" ConstantForm::ConstantForm(wxWindow* parent, Constant* constant) : ConstantFormBase(parent) { SetSize(GetBestSize()); - + m_parent = parent; m_constant = constant; diff --git a/Project/ConstantForm.h b/Project/ConstantForm.h index ca7a44a..ab91a55 100644 --- a/Project/ConstantForm.h +++ b/Project/ConstantForm.h @@ -1,9 +1,33 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CONSTANTFORM_H #define CONSTANTFORM_H #include "ElementForm.h" class Constant; +/** + * @class ConstantForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the constant control data. + * @file ConstantForm.h + */ class ConstantForm : public ConstantFormBase { public: @@ -14,7 +38,7 @@ class ConstantForm : public ConstantFormBase protected: virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } virtual void OnOKButtonClick(wxCommandEvent& event); - + wxWindow* m_parent = NULL; Constant* m_constant = NULL; }; diff --git a/Project/ControlEditor.cpp b/Project/ControlEditor.cpp index b72f6dd..75fe6c3 100644 --- a/Project/ControlEditor.cpp +++ b/Project/ControlEditor.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ControlEditor.h" #ifdef USING_WX_3_0_X diff --git a/Project/ControlEditor.h b/Project/ControlEditor.h index 674ed5d..dfa76ab 100644 --- a/Project/ControlEditor.h +++ b/Project/ControlEditor.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CONTROLEDITOR_H #define CONTROLEDITOR_H @@ -36,6 +53,13 @@ class ElementDataObject; enum ControlElementButtonID { ID_IO = 0, ID_TF, ID_SUM, ID_CONST, ID_LIMITER, ID_GAIN, ID_MULT, ID_EXP, ID_RATELIM }; +/** + * @class ControlElementButton + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief This class is responsible to handle the user interaction with control elements. + * @file ControlEditor.h + */ class ControlElementButton : public wxWindow { public: diff --git a/Project/ControlElement.cpp b/Project/ControlElement.cpp index 29a1fec..0a37803 100644 --- a/Project/ControlElement.cpp +++ b/Project/ControlElement.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ControlElement.h" #ifdef USING_WX_3_0_X #include "DegreesAndRadians.h" diff --git a/Project/ControlElement.h b/Project/ControlElement.h index 7d0e620..1a6b8ac 100644 --- a/Project/ControlElement.h +++ b/Project/ControlElement.h @@ -1,8 +1,32 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CONTROLELEMENT_H #define CONTROLELEMENT_H #include "Element.h" +/** + * @class Node + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Node of a control element. This class manages the user interaction with the connection and control elements. + * @file ControlElement.h + */ class Node { public: @@ -50,6 +74,13 @@ class Node double m_angle = 0.0; }; +/** + * @class ControlElement + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @file ControlElement.h + * @brief Base class of a control element. Provide general methods to other control classes. + */ class ControlElement : public Element { public: diff --git a/Project/ControlElementContainer.cpp b/Project/ControlElementContainer.cpp index edfe684..3c420e7 100644 --- a/Project/ControlElementContainer.cpp +++ b/Project/ControlElementContainer.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ControlElementContainer.h" #include "ControlEditor.h" #include "ControlElement.h" diff --git a/Project/ControlElementContainer.h b/Project/ControlElementContainer.h index 62b63e3..b9b9118 100644 --- a/Project/ControlElementContainer.h +++ b/Project/ControlElementContainer.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CONTROLELEMENTCONTAINER_H #define CONTROLELEMENTCONTAINER_H @@ -17,6 +34,14 @@ class ControlElement; #include "Sum.h" #include "TransferFunction.h" +/** + * @class ControlElementContainer + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Class that can contain all control elements. + * Can identify (using RTTI) the elements from a generic list and store them separately. + * @file ControlElementContainer.h + */ class ControlElementContainer { public: diff --git a/Project/ControlElementSolver.cpp b/Project/ControlElementSolver.cpp index 7c58512..175a329 100644 --- a/Project/ControlElementSolver.cpp +++ b/Project/ControlElementSolver.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ControlElementSolver.h" #include "ControlElementContainer.h" diff --git a/Project/ControlElementSolver.h b/Project/ControlElementSolver.h index 26b8ec5..44925f5 100644 --- a/Project/ControlElementSolver.h +++ b/Project/ControlElementSolver.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CONTROLELEMENTSOLVER_H #define CONTROLELEMENTSOLVER_H @@ -17,6 +34,14 @@ class RateLimiter; class Sum; class TransferFunction; +/** + * @class ControlElementSolver + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Solves in the time the control system. + * Can solve the control system directly from a ControlEditor or from a ControlEditorElement. + * @file ControlElementSolver.h + */ class ControlElementSolver { public: diff --git a/Project/ControlSystemTest.cpp b/Project/ControlSystemTest.cpp index ed1ea39..604adcb 100644 --- a/Project/ControlSystemTest.cpp +++ b/Project/ControlSystemTest.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ControlSystemTest.h" #include "ControlEditor.h" @@ -10,7 +27,7 @@ ControlSystemTest::ControlSystemTest(ControlEditor* parent, : ControlSystemTestBase(parent) { SetSize(GetBestSize()); - + m_inputType = inputType; m_startTime = startTime; m_slope = slope; diff --git a/Project/ControlSystemTest.h b/Project/ControlSystemTest.h index 0a66ae3..e82caac 100644 --- a/Project/ControlSystemTest.h +++ b/Project/ControlSystemTest.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef CONTROLSYSTEMTEST_H #define CONTROLSYSTEMTEST_H @@ -5,13 +22,25 @@ class ControlEditor; +/** + * @class ControlSystemTest + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit properties to test the control system created. + * @file ControlSystemTest.h + */ class ControlSystemTest : public ControlSystemTestBase { -public: - ControlSystemTest(ControlEditor* parent, int* inputType, double* startTime, double* slope, double* timeStep, double* simTime); + public: + ControlSystemTest(ControlEditor* parent, + int* inputType, + double* startTime, + double* slope, + double* timeStep, + double* simTime); virtual ~ControlSystemTest(); - -protected: + + protected: virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } virtual void OnRunButtonClick(wxCommandEvent& event); int* m_inputType = NULL; @@ -20,4 +49,4 @@ protected: double* m_timeStep = NULL; double* m_simTime = NULL; }; -#endif // CONTROLSYSTEMTEST_H +#endif // CONTROLSYSTEMTEST_H diff --git a/Project/DataReport.cpp b/Project/DataReport.cpp index 01a1e1d..1db2e2a 100644 --- a/Project/DataReport.cpp +++ b/Project/DataReport.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "DataReport.h" #include "Workspace.h" #include "ElectricCalculation.h" diff --git a/Project/DataReport.h b/Project/DataReport.h index f262cb9..6babdf2 100644 --- a/Project/DataReport.h +++ b/Project/DataReport.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef DATAREPORT_H #define DATAREPORT_H @@ -6,6 +23,13 @@ class Workspace; class ElectricCalculation; +/** + * @class DataReport + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form that shows the results of power flow and fault calculations. + * @file DataReport.h + */ class DataReport : public DataReportBase { public: diff --git a/Project/ElectricCalculation.cpp b/Project/ElectricCalculation.cpp index 485325f..36e7a9a 100644 --- a/Project/ElectricCalculation.cpp +++ b/Project/ElectricCalculation.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ElectricCalculation.h" #ifdef USING_WX_3_0_X #include "DegreesAndRadians.h" diff --git a/Project/ElectricCalculation.h b/Project/ElectricCalculation.h index 93c422b..9dee71a 100644 --- a/Project/ElectricCalculation.h +++ b/Project/ElectricCalculation.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef ELECTRICCALCULATION_H #define ELECTRICCALCULATION_H @@ -43,8 +60,8 @@ struct ReactiveLimits { * @class ElectricCalculation * @author Thales Lima Oliveira * @date 09/01/2017 - * @file ElectricCalculation.h * @brief Base class of electric calculations, with general methods. + * @file ElectricCalculation.h */ class ElectricCalculation { diff --git a/Project/Electromechanical.cpp b/Project/Electromechanical.cpp index 57a275a..4b8a711 100644 --- a/Project/Electromechanical.cpp +++ b/Project/Electromechanical.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Electromechanical.h" #include "ControlElementSolver.h" @@ -7,7 +24,8 @@ Electromechanical::Electromechanical(wxWindow* parent, std::vector<Element*> ele GetElementsFromList(elementList); SetEventTimeList(); - m_powerSystemBase = GetPowerValue(data.basePower, data.basePowerUnit); + Bus dummyBus; + m_powerSystemBase = dummyBus.GetValueFromUnit(data.basePower, data.basePowerUnit); m_systemFreq = data.stabilityFrequency; m_simTime = data.stabilitySimulationTime; m_timeStep = data.timeStep; @@ -397,42 +415,14 @@ std::complex<double> Electromechanical::GetSyncMachineAdmittance(SyncGenerator* auto data = generator->GetElectricalData(); double k = 1.0; // Power base change factor. if(data.useMachineBase) { - double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit); + double oldBase = generator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit); k = m_powerSystemBase / oldBase; } - double xd = 0.0; - double xq = 0.0; double ra = data.armResistance * k; - - switch(data.model) { - case Machines::SM_MODEL_1: { - xq = data.transXd * k; - xd = xq; - } break; - case Machines::SM_MODEL_2: { - xd = data.transXd * k; - xq = data.transXq * k; - if(xq == 0.0) { - xq = data.syncXq * k; - if(xq == 0.0) { - xq = data.syncXd * k; - } - } - } break; - case Machines::SM_MODEL_3: { - xd = data.transXd * k; - xq = data.transXq * k; - if(xq == 0.0) xq = xd; - } break; - case Machines::SM_MODEL_4: - case Machines::SM_MODEL_5: { - xd = data.subXd * k; - xq = data.subXq * k; - if(xd == 0.0) xd = xq; - if(xq == 0.0) xq = xd; - } break; - } + auto smModelData = GetSyncMachineModelData(generator); + double xd = smModelData.xd; + double xq = smModelData.xq; double xdq = 0.5 * (xd + xq); return (std::complex<double>(ra, -xdq) / std::complex<double>(ra * ra + xd * xq, 0.0)); } @@ -454,14 +444,14 @@ bool Electromechanical::InitializeDynamicElements() if(syncGenerator->IsOnline()) { double k = 1.0; // Power base change factor. if(data.useMachineBase) { - double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit); + double oldBase = syncGenerator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit); k = m_powerSystemBase / oldBase; } data.terminalVoltage = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().voltage; std::complex<double> conjS(dataPU.activePower, -dataPU.reactivePower); - std::complex<double> conjV = std::conj(data.terminalVoltage); - std::complex<double> ia = conjS / conjV; + std::complex<double> vt = data.terminalVoltage; + std::complex<double> ia = conjS / std::conj(vt); double xd = data.syncXd * k; double xq = data.syncXq * k; @@ -473,28 +463,86 @@ bool Electromechanical::InitializeDynamicElements() } else if(data.syncXq == 0.0) xq = data.syncXd * k; + double sd = 1.0; + double sq = 1.0; + double satF = 1.0; + double xp = data.potierReactance * k; + bool hasSaturation = false; + if(data.satFactor != 0.0) { // Have saturation. + satF = (data.satFactor - 1.2) / std::pow(1.2, 7); + if(xp == 0.0) xp = 0.8 * (data.transXd * k); + hasSaturation = true; + } + // Initialize state variables - std::complex<double> eq0 = data.terminalVoltage + std::complex<double>(ra, xq) * ia; - data.delta = std::arg(eq0); + std::complex<double> eq0 = vt + std::complex<double>(ra, xq) * ia; + double delta = std::arg(eq0); + + double id0, iq0, vd0, vq0; + ABCtoDQ0(ia, delta, id0, iq0); + ABCtoDQ0(vt, delta, vd0, vq0); + + // Initialize saturation + double xqs = xq; + double xds = xd; + if(hasSaturation) { + double oldDelta = 0; + bool exit = false; + int numIt = 0; + while(!exit) { + oldDelta = delta; + ABCtoDQ0(ia, delta, id0, iq0); + ABCtoDQ0(vt, delta, vd0, vq0); + + // Direct-axis Potier voltage. + double epd = vd0 + ra * id0 + xp * iq0; + + sq = 1.0 + satF * (xq / xd) * std::pow(epd, 6); + xqs = (xq - xp) / sq + xp; + eq0 = data.terminalVoltage + std::complex<double>(ra, xqs) * ia; + delta = std::arg(eq0); + if(std::abs(delta - oldDelta) < m_saturationTolerance) { + exit = true; + } else if(numIt >= m_maxIterations) { + m_errorMsg = _("Error on initializate the saturation values of \"") + data.name + _("\"."); + return false; + } + numIt++; + } + // Quadrature-axis Potier voltage. + double epq = vq0 + ra * iq0 - xp * id0; + sd = 1.0 + satF * std::pow(epq, 6); + xds = (xd - xp) / sd + xp; + /*CalculateSyncMachineSaturation(syncGenerator, id0, iq0, sq, sd, true, k); + xqs = (xq - xp) / sq + xp; + xds = (xd - xp) / sd + xp; + eq0 = data.terminalVoltage + std::complex<double>(ra, xqs) * ia; + delta = std::arg(eq0);*/ + } - double fi0 = std::arg(ia); - double id0, iq0; - // ABCtoDQ0(ia, data.delta - fi0, id0, iq0); - iq0 = std::abs(ia) * std::cos(data.delta - fi0); - id0 = -std::abs(ia) * std::sin(data.delta - fi0); + double ef0 = vq0 + ra * iq0 - xds * id0; - data.initialFieldVoltage = std::abs(eq0) - (xd - xq) * id0; + data.initialFieldVoltage = ef0 * sd; data.fieldVoltage = data.initialFieldVoltage; data.pm = std::real((data.terminalVoltage * std::conj(ia)) + (std::abs(ia) * std::abs(ia) * ra)); data.speed = 2.0 * M_PI * m_systemFreq; - + data.delta = delta; data.pe = data.pm; data.electricalPower = std::complex<double>(dataPU.activePower, dataPU.reactivePower); + data.sd = sd; + data.sq = sq; + data.id = id0; + data.iq = iq0; // Variables to extrapolate. data.oldIq = iq0; data.oldId = id0; data.oldPe = data.pe; + data.oldSd = sd; + data.oldSq = sq; + + m_sdC = sd; + m_sqC = sq; switch(data.model) { case Machines::SM_MODEL_1: { @@ -510,7 +558,7 @@ bool Electromechanical::InitializeDynamicElements() case Machines::SM_MODEL_2: { double tranXd = data.transXd * k; - data.tranEq = data.initialFieldVoltage + (xd - tranXd) * id0; + data.tranEq = ef0 + (xd - tranXd) * (id0 / sd); data.tranEd = 0.0; data.subEd = 0.0; data.subEq = 0.0; @@ -520,8 +568,8 @@ bool Electromechanical::InitializeDynamicElements() double tranXq = data.transXq * k; if(tranXq == 0.0) tranXq = tranXd; - data.tranEq = data.initialFieldVoltage + (xd - tranXd) * id0; - data.tranEd = -(xq - tranXq) * iq0; + data.tranEq = ef0 + (xd - tranXd) * (id0 / sd); + data.tranEd = -(xq - tranXq) * (iq0 / sq); data.subEd = 0.0; data.subEq = 0.0; @@ -533,10 +581,10 @@ bool Electromechanical::InitializeDynamicElements() if(subXd == 0.0) subXd = subXq; if(subXq == 0.0) subXq = subXd; - data.tranEq = data.initialFieldVoltage + (xd - tranXd) * id0; + data.tranEq = ef0 + (xd - tranXd) * (id0 / sd); data.tranEd = 0.0; - data.subEq = data.tranEq + (tranXd - subXd) * id0; - data.subEd = -(xq - subXq) * iq0; + data.subEq = data.tranEq + (tranXd - subXd) * (id0 / sd); + data.subEd = -(xq - subXq) * (iq0 / sq); } break; case Machines::SM_MODEL_5: { double tranXd = data.transXd * k; @@ -546,10 +594,10 @@ bool Electromechanical::InitializeDynamicElements() if(subXd == 0.0) subXd = subXq; if(subXq == 0.0) subXq = subXd; - data.tranEq = data.initialFieldVoltage + (xd - tranXd) * id0; - data.tranEd = -(xq - tranXq) * iq0; - data.subEq = data.tranEq + (tranXd - subXd) * id0; - data.subEd = data.tranEd - (tranXq - subXq) * iq0; + data.tranEq = ef0 + (xd - tranXd) * (id0 / sd); + data.tranEd = -(xq - tranXq) * (iq0 / sq); + data.subEq = data.tranEq + (tranXd - subXd) * (id0 / sd); + data.subEd = data.tranEd - (tranXq - subXq) * (iq0 / sq); } break; default: break; @@ -593,7 +641,7 @@ bool Electromechanical::InitializeDynamicElements() return true; } -void Electromechanical::CalculateMachinesCurrents() +bool Electromechanical::CalculateMachinesCurrents() { // Reset injected currents vector for(unsigned int i = 0; i < m_iBus.size(); ++i) m_iBus[i] = std::complex<double>(0.0, 0.0); @@ -604,73 +652,77 @@ void Electromechanical::CalculateMachinesCurrents() if(syncGenerator->IsOnline()) { double k = 1.0; // Power base change factor. if(data.useMachineBase) { - double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit); + double oldBase = syncGenerator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit); k = m_powerSystemBase / oldBase; } - double xd = 0.0; - double xq = 0.0; double ra = data.armResistance * k; + double xp = data.potierReactance * k; + if(xp == 0.0) xp = 0.8 * data.transXd * k; + int n = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().number; std::complex<double> e = std::complex<double>(0.0, 0.0); std::complex<double> v = m_vBus[n]; std::complex<double> iInj = m_iBus[n]; - double xdq = 0.0; - switch(data.model) { - case Machines::SM_MODEL_1: { - DQ0toABC(data.tranEd, data.tranEq, data.delta, e); - xq = data.transXd * k; - xd = xq; - } break; - case Machines::SM_MODEL_2: { - DQ0toABC(data.tranEd, data.tranEq, data.delta, e); - xd = data.transXd * k; - xq = data.transXq * k; - if(xq == 0.0) { - xq = data.syncXq * k; - if(xq == 0.0) { - xq = data.syncXd * k; - } - } - } break; - case Machines::SM_MODEL_3: { - DQ0toABC(data.tranEd, data.tranEq, data.delta, e); - xd = data.transXd * k; - xq = data.transXq * k; - if(xq == 0.0) xq = xd; - } break; - case Machines::SM_MODEL_4: - case Machines::SM_MODEL_5: { - DQ0toABC(data.subEd, data.subEq, data.delta, e); - xd = data.subXd * k; - xq = data.subXq * k; - if(xd == 0.0) xd = xq; - if(xq == 0.0) xq = xd; - } break; + auto smModelData = GetSyncMachineModelData(syncGenerator); + DQ0toABC(smModelData.ed, smModelData.eq, data.delta, e); + double xd = smModelData.xd; + double xq = smModelData.xq; + + double sd = data.sd; + double sq = data.sq; + double id, iq; + + // Calculate the saturation effect + if(data.satFactor != 0.0) { + if(!CalculateSyncMachineSaturation(syncGenerator, id, iq, sd, sq, false, k)) return false; } + + double xdq, xds, xqs, xdqs; xdq = 0.5 * (xd + xq); + xds = (xd - xp) / sd + xp; + xqs = (xq - xp) / sq + xp; + xdqs = 0.5 * (xds + xqs); std::complex<double> y0 = std::complex<double>(ra, -xdq) / std::complex<double>(ra * ra + xd * xq, 0.0); - std::complex<double> iUnadj = y0 * e; + // std::complex<double> iUnadjusted = y0 * e; + std::complex<double> iUnadjusted = y0 * v; - std::complex<double> iAdj = - std::complex<double>(0.0, -((0.5 * (xq - xd)) / (ra * ra + xd * xq))) * (std::conj(e) - std::conj(v)); - iAdj = iAdj * std::cos(2.0 * data.delta) + iAdj * std::complex<double>(0.0, std::sin(2.0 * data.delta)); + // [Ref] Arrillaga, J.; Arnold, C. P.. "Computer Modelling of Electrical Power Systems". Pg. 225-226 + // [Ref] Dommell, H. W.; Sato, N.. "Fast transient stability solutions". IEEE Transactions on Power + // Apparatus and Systems, PAS-91 (4), 1643-1650 + std::complex<double> iSaliency = std::complex<double>(0.0, -((0.5 * (xqs - xds)) / (ra * ra + xds * xqs))) * + (std::conj(e) - std::conj(v)); + iSaliency = iSaliency * std::cos(2.0 * data.delta) + + iSaliency * std::complex<double>(0.0, std::sin(2.0 * data.delta)); - iInj = iUnadj + iAdj; + // [Ref] Arrillaga, J.; Arnold, C. P.; Computer Modelling of Electrical Power Systems. Pg. 258-259 + std::complex<double> y0s = std::complex<double>(ra, -xdqs) / std::complex<double>(ra * ra + xds * xqs, 0.0); + std::complex<double> iSaturation = y0s * (e - v); - m_iBus[n] += iInj; + iInj = iUnadjusted + iSaliency + iSaturation; - std::complex<double> iMachine = iInj - y0 * v; + m_iBus[n] += iInj; + // Remove the current flowing through y0 (i.e. iUnadjusted in this case, y0 is inserted in admittance + // matrix) to calculate the electrical power. + std::complex<double> iMachine = iInj - iUnadjusted; data.electricalPower = v * std::conj(iMachine); + + ABCtoDQ0(iMachine, data.delta, id, iq); + + data.id = id; + data.iq = iq; + data.sd = sd; + data.sq = sq; } else { data.electricalPower = std::complex<double>(0.0, 0.0); } syncGenerator->SetElectricalData(data); } + return true; } void Electromechanical::CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq, double k) @@ -713,31 +765,41 @@ void Electromechanical::CalculateIntegrationConstants(SyncGenerator* syncGenerat if(data.model == Machines::SM_MODEL_2 || data.model == Machines::SM_MODEL_3 || data.model == Machines::SM_MODEL_4 || data.model == Machines::SM_MODEL_5) { data.icTranEq.m = m_timeStep / (2.0f * transTd0 + m_timeStep); - data.icTranEq.c = (1.0f - 2.0 * data.icTranEq.m) * data.tranEq + + // data.icTranEq.c = (1.0f - 2.0 * data.icTranEq.m) * data.tranEq + + // data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id); + data.icTranEq.c = (1.0 - data.icTranEq.m * (1.0 + data.sd)) * data.tranEq + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id); } // Ed' if(data.model == Machines::SM_MODEL_3 || data.model == Machines::SM_MODEL_4 || data.model == Machines::SM_MODEL_5) { data.icTranEd.m = m_timeStep / (2.0f * transTq0 + m_timeStep); - data.icTranEd.c = (1.0f - 2.0f * data.icTranEd.m) * data.tranEd - data.icTranEd.m * (syncXq - transXq) * iq; + // data.icTranEd.c = (1.0f - 2.0f * data.icTranEd.m) * data.tranEd - data.icTranEd.m * (syncXq - transXq) * iq; + data.icTranEd.c = + (1.0 - data.icTranEd.m * (1.0 + data.sq)) * data.tranEd - data.icTranEd.m * (syncXq - transXq) * iq; } // Eq'' if(data.model == Machines::SM_MODEL_4 || data.model == Machines::SM_MODEL_5) { data.icSubEq.m = m_timeStep / (2.0f * subTd0 + m_timeStep); - data.icSubEq.c = - (1.0f - 2.0f * data.icSubEq.m) * data.subEq + data.icSubEq.m * (data.tranEq + (transXd - subXd) * id); + // data.icSubEq.c = + // (1.0f - 2.0f * data.icSubEq.m) * data.subEq + data.icSubEq.m * (data.tranEq + (transXd - subXd) * id); + data.icSubEq.c = (1.0 - data.icSubEq.m * (1.0 + data.sd)) * data.subEq + + data.icSubEq.m * (data.sd * data.tranEq + (transXd - subXd) * id); } // Ed'' if(data.model == Machines::SM_MODEL_4) { data.icSubEd.m = m_timeStep / (2.0f * subTq0 + m_timeStep); - data.icSubEd.c = (1.0f - 2.0f * data.icSubEd.m) * data.subEd - data.icSubEd.m * (syncXq - subXq) * iq; + // data.icSubEd.c = (1.0f - 2.0f * data.icSubEd.m) * data.subEd - data.icSubEd.m * (syncXq - subXq) * iq; + data.icSubEd.c = + (1.0f - data.icSubEd.m * (1.0 + data.sq)) * data.subEd - data.icSubEd.m * (syncXq - subXq) * iq; } if(data.model == Machines::SM_MODEL_5) { data.icSubEd.m = m_timeStep / (2.0f * subTq0 + m_timeStep); - data.icSubEd.c = - (1.0f - 2.0f * data.icSubEd.m) * data.subEd + data.icSubEd.m * (data.tranEd - (transXq - subXq) * iq); + // data.icSubEd.c = + // (1.0f - 2.0f * data.icSubEd.m) * data.subEd + data.icSubEd.m * (data.tranEd - (transXq - subXq) * iq); + data.icSubEd.c = (1.0f - data.icSubEd.m * (1.0 + data.sq)) * data.subEd + + data.icSubEd.m * (data.sq * data.tranEd - (transXq - subXq) * iq); } syncGenerator->SetElectricalData(data); @@ -745,37 +807,39 @@ void Electromechanical::CalculateIntegrationConstants(SyncGenerator* syncGenerat bool Electromechanical::SolveSynchronousMachines() { - // CalculateMachinesCurrents(); for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) { SyncGenerator* syncGenerator = *it; auto data = syncGenerator->GetElectricalData(); if(syncGenerator->IsOnline()) { - int n = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().number; - double id, iq, pe; - + double id, iq, pe, sd, sq; pe = data.pe; + id = data.id; + iq = data.iq; + sd = data.sd; + sq = data.sq; double k = 1.0; // Power base change factor. if(data.useMachineBase) { - double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit); + double oldBase = syncGenerator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit); k = m_powerSystemBase / oldBase; } - std::complex<double> iMachine = std::conj(data.electricalPower) / std::conj(m_vBus[n]); - - ABCtoDQ0(iMachine, data.delta, id, iq); - // Calculate integration constants. CalculateIntegrationConstants(syncGenerator, id, iq, k); - CalculateSyncMachineNonIntVariables(syncGenerator, id, iq, pe, k); + if(!CalculateSyncMachineNonIntVariables(syncGenerator, id, iq, sd, sq, pe, k)) return false; // Extrapolate nonintegrable variables. id = 2.0 * id - data.oldId; iq = 2.0 * iq - data.oldIq; pe = 2.0 * pe - data.oldPe; + sd = 2.0 * sd - data.oldSd; + sq = 2.0 * sq - data.oldSq; + + m_sdC = sd; + m_sqC = sq; - CalculateSyncMachineIntVariables(syncGenerator, id, iq, pe, k); + CalculateSyncMachineIntVariables(syncGenerator, id, iq, sd, sq, pe, k); } else { CalculateIntegrationConstants(syncGenerator, 0.0f, 0.0f); } @@ -789,7 +853,7 @@ bool Electromechanical::SolveSynchronousMachines() error = 0.0; // Calculate the injected currents. - CalculateMachinesCurrents(); + if(!CalculateMachinesCurrents()) return false; // Calculate the buses voltages. m_vBus = LUEvaluate(m_yBusU, m_yBusL, m_iBus); @@ -800,16 +864,23 @@ bool Electromechanical::SolveSynchronousMachines() auto data = syncGenerator->GetElectricalData(); - double id, iq, pe; - double k = 1.0; // Power base change factor. + double id = data.id; + double iq = data.iq; + double pe = data.pe; + double sd = data.sd; + double sq = data.sq; + + // Power base change factor. + double k = 1.0; if(data.useMachineBase) { - double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit); + double oldBase = syncGenerator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit); k = m_powerSystemBase / oldBase; } - CalculateSyncMachineNonIntVariables(syncGenerator, id, iq, pe, k); + // Calculate id, iq, dq, sd + if(!CalculateSyncMachineNonIntVariables(syncGenerator, id, iq, sd, sq, pe, k)) return false; - double genError = CalculateSyncMachineIntVariables(syncGenerator, id, iq, pe, k); + double genError = CalculateSyncMachineIntVariables(syncGenerator, id, iq, sd, sq, pe, k); if(genError > error) error = genError; } @@ -844,46 +915,6 @@ bool Electromechanical::SolveSynchronousMachines() return true; } -double Electromechanical::GetPowerValue(double value, ElectricalUnit unit) -{ - switch(unit) { - case UNIT_PU: { - return value; - } break; - case UNIT_VA: { - return value; - } break; - case UNIT_kVA: { - return value * 1e3; - } break; - case UNIT_MVA: { - return value * 1e6; - } break; - case UNIT_W: { - return value; - } break; - case UNIT_kW: { - return value * 1e3; - } break; - case UNIT_MW: { - return value * 1e6; - } break; - case UNIT_VAr: { - return value; - } break; - case UNIT_kVAr: { - return value * 1e3; - } break; - case UNIT_MVAr: { - return value * 1e6; - } break; - default: { - return 0.0; - } break; - } - return 0.0; -} - void Electromechanical::SaveData() { for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) { @@ -910,6 +941,8 @@ void Electromechanical::SaveData() m_wErrorVector.push_back(m_wError); m_numItVector.push_back(m_numIt); + m_sdCVector.push_back(m_sdC); + m_sqCVector.push_back(m_sqC); } void Electromechanical::SetSyncMachinesModel() @@ -922,9 +955,11 @@ void Electromechanical::SetSyncMachinesModel() } } -void Electromechanical::CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator, +bool Electromechanical::CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator, double& id, double& iq, + double& sd, + double& sq, double& pe, double k) { @@ -938,23 +973,35 @@ void Electromechanical::CalculateSyncMachineNonIntVariables(SyncGenerator* syncG double vd, vq; ABCtoDQ0(data.terminalVoltage, data.delta, vd, vq); - if(syncGenerator->IsOnline()) { - std::complex<double> iMachine = std::conj(data.electricalPower) / std::conj(m_vBus[n]); - ABCtoDQ0(iMachine, data.delta, id, iq); + if(data.satFactor != 0.0) { + if(!CalculateSyncMachineSaturation(syncGenerator, id, iq, sd, sq, true, k)) return false; + data.sd = sd; + data.sq = sq; + data.oldSd = sd; + data.oldSq = sq; + } + if(syncGenerator->IsOnline()) { pe = id * vd + iq * vq + (id * id + iq * iq) * data.armResistance * k; } else { pe = id = iq = 0.0f; } data.pe = pe; + data.id = id; + data.iq = iq; + data.oldPe = pe; data.oldId = id; data.oldIq = iq; syncGenerator->SetElectricalData(data); + + return true; } double Electromechanical::CalculateSyncMachineIntVariables(SyncGenerator* syncGenerator, double id, double iq, + double sd, + double sq, double pe, double k) { @@ -979,8 +1026,12 @@ double Electromechanical::CalculateSyncMachineIntVariables(SyncGenerator* syncGe // There is no differential equations. } break; case Machines::SM_MODEL_2: { - double tranEq = - data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (data.syncXd * k - data.transXd * k) * id); + double syncXd, transXd; + syncXd = data.syncXd * k; + transXd = data.transXd * k; + + double tranEq = (data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id)) / + (1.0 + data.icTranEq.m * (sd - 1.0)); error = std::max(error, std::abs(data.tranEq - tranEq)); data.tranEq = tranEq; @@ -994,10 +1045,12 @@ double Electromechanical::CalculateSyncMachineIntVariables(SyncGenerator* syncGe if(syncXq == 0.0) syncXq = syncXd; if(transXq == 0.0) transXq = transXd; - double tranEq = data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id); + double tranEq = (data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id)) / + (1.0 + data.icTranEq.m * (sd - 1.0)); error = std::max(error, std::abs(data.tranEq - tranEq)); - double tranEd = data.icTranEd.c - data.icTranEd.m * (syncXq - transXq) * iq; + double tranEd = + (data.icTranEd.c - data.icTranEd.m * (syncXq - transXq) * iq) / (1.0 + data.icTranEd.m * (sq - 1.0)); error = std::max(error, std::abs(data.tranEd - tranEd)); data.tranEq = tranEq; @@ -1020,13 +1073,16 @@ double Electromechanical::CalculateSyncMachineIntVariables(SyncGenerator* syncGe if(subXd == 0.0) subXd = subXq; if(subXq == 0.0) subXq = subXd; - double tranEq = data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id); + double tranEq = (data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id)) / + (1.0 + data.icTranEq.m * (sd - 1.0)); error = std::max(error, std::abs(data.tranEq - tranEq)); - double subEq = data.icSubEq.c + data.icSubEq.m * (tranEq + (transXd - subXd) * id); + double subEq = (data.icSubEq.c + data.icSubEq.m * (sd * tranEq + (transXd - subXd) * id)) / + (1.0 + data.icSubEq.m * (sd - 1.0)); error = std::max(error, std::abs(data.subEq - subEq)); - double subEd = data.icSubEd.c - data.icSubEd.m * (syncXq - subXq) * iq; + double subEd = + (data.icSubEd.c - data.icSubEd.m * ((syncXq - subXq) * iq)) / (1.0 + data.icSubEd.m * (sq - 1.0)); error = std::max(error, std::abs(data.subEd - subEd)); data.tranEq = tranEq; @@ -1046,16 +1102,20 @@ double Electromechanical::CalculateSyncMachineIntVariables(SyncGenerator* syncGe if(subXd == 0.0) subXd = subXq; if(subXq == 0.0) subXq = subXd; - double tranEq = data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id); + double tranEq = (data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id)) / + (1.0 + data.icTranEq.m * (sd - 1.0)); error = std::max(error, std::abs(data.tranEq - tranEq)); - double tranEd = data.icTranEd.c - data.icTranEd.m * (syncXq - transXq) * iq; + double tranEd = + (data.icTranEd.c - data.icTranEd.m * (syncXq - transXq) * iq) / (1.0 + data.icTranEd.m * (sq - 1.0)); error = std::max(error, std::abs(data.tranEd - tranEd)); - double subEq = data.icSubEq.c + data.icSubEq.m * (tranEq + (transXd - subXd) * id); + double subEq = (data.icSubEq.c + data.icSubEq.m * (sd * tranEq + (transXd - subXd) * id)) / + (1.0 + data.icSubEq.m * (sd - 1.0)); error = std::max(error, std::abs(data.subEq - subEq)); - double subEd = data.icSubEd.c + data.icSubEd.m * (tranEd - (transXq - subXq) * iq); + double subEd = (data.icSubEd.c + data.icSubEd.m * (sq * tranEd - (transXq - subXq) * iq)) / + (1.0 + data.icSubEd.m * (sq - 1.0)); error = std::max(error, std::abs(data.subEd - subEd)); data.tranEq = tranEq; @@ -1080,7 +1140,7 @@ void Electromechanical::CalculateReferenceSpeed() auto data = syncGenerator->GetElectricalData(); double k = 1.0; // Power base change factor. if(data.useMachineBase) { - double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit); + double oldBase = syncGenerator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit); k = m_powerSystemBase / oldBase; } sumH += data.inertia / k; @@ -1092,3 +1152,148 @@ void Electromechanical::CalculateReferenceSpeed() m_refSpeed = 2.0 * M_PI * m_systemFreq; } } + +bool Electromechanical::CalculateSyncMachineSaturation(SyncGenerator* syncMachine, + double& id, + double& iq, + double& sd, + double& sq, + bool updateCurrents, + double k) +{ + // [Ref] Arrillaga, J.; Arnold, C. P.. "Computer Modelling of Electrical Power Systems". Pg. 254-260 + auto data = syncMachine->GetElectricalData(); + auto smDataModel = GetSyncMachineModelData(syncMachine); + + int n = static_cast<Bus*>(syncMachine->GetParentList()[0])->GetElectricalData().number; + if(syncMachine->IsOnline()) { + data.terminalVoltage = m_vBus[n]; + } + double idCalc = id; + double iqCalc = iq; + double sdCalc = sd; + double sqCalc = sq; + + double vd, vq; + ABCtoDQ0(data.terminalVoltage, data.delta, vd, vq); + double deltaVd = smDataModel.ed - vd; + double deltaVq = smDataModel.eq - vq; + + double ra = data.armResistance * k; + double xd = smDataModel.xd; + double xq = smDataModel.xq; + + double syncXd = data.syncXd * k; + double syncXq = data.syncXq * k; + if(data.model == Machines::SM_MODEL_1) { + syncXq = data.transXd * k; + syncXd = syncXq; + } else if(data.syncXq == 0.0) + syncXq = data.syncXd * k; + + double xp = data.potierReactance * k; + if(xp == 0.0) xp = 0.8 * data.transXd * k; + double satFacd = (data.satFactor - 1.2) / std::pow(1.2, 7); + double satFacq = satFacd * (syncXq / syncXd); + + bool exit = false; + int iterations = 0; + while(!exit) { + double oldSd = sdCalc; + double oldSq = sqCalc; + + // Saturated reactances. + double xds = (xd - xp) / sdCalc + xp; + double xqs = (xq - xp) / sqCalc + xp; + // dq currents. + double den = 1.0 / (ra * ra + xds * xqs); + iqCalc = den * (ra * deltaVq + xds * deltaVd); + idCalc = den * (-xqs * deltaVq + ra * deltaVd); + // Potier voltages + double epq = vq + ra * iqCalc - xp * idCalc; + double epd = vd + ra * idCalc + xp * iqCalc; + // Saturation factors. + // Gauss + /*sdCalc = 1.0 + satFacd * std::pow(epq, 6); + sqCalc = 1.0 + satFacq * std::pow(epd, 6);*/ + + // Newton-raphson + double f1 = 1.0 - sdCalc + satFacd * std::pow(epq, 6); + double f2 = 1.0 - sqCalc + satFacq * std::pow(epd, 6); + double dF1dSd = + (6.0 * satFacd * std::pow(epq, 5) * xp * (xd - xp) * deltaVq) / ((sdCalc - 1.0) * xp + xd) - 1.0; + double dF2dSq = + (6.0 * satFacq * std::pow(epd, 5) * xp * (xq - xp) * deltaVd) / ((sqCalc - 1.0) * xp + xq) - 1.0; + + sdCalc = sdCalc - f1 / dF1dSd; + sqCalc = sqCalc - f2 / dF2dSq; + + double error = std::abs(sdCalc - oldSd) + std::abs(sqCalc - oldSq); + if(error < m_saturationTolerance) exit = true; + + iterations++; + if((iterations >= m_maxIterations) & !exit) { + m_errorMsg = + _("It was not possible to solve the saturation of the synchronous machine \"") + data.name + wxT("\"."); + return false; + } + } + + sd = sdCalc; + sq = sqCalc; + if(updateCurrents) { + id = idCalc; + iq = iqCalc; + } + return true; +} + +SyncMachineModelData Electromechanical::GetSyncMachineModelData(SyncGenerator* syncMachine) +{ + SyncMachineModelData smModelData; + + auto data = syncMachine->GetElectricalData(); + double k = 1.0; // Power base change factor. + if(data.useMachineBase) { + double oldBase = syncMachine->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit); + k = m_powerSystemBase / oldBase; + } + + switch(data.model) { + case Machines::SM_MODEL_1: { + smModelData.ed = data.tranEd; + smModelData.eq = data.tranEq; + smModelData.xq = data.transXd * k; + smModelData.xd = smModelData.xq; + } break; + case Machines::SM_MODEL_2: { + smModelData.ed = data.tranEd; + smModelData.eq = data.tranEq; + smModelData.xd = data.transXd * k; + smModelData.xq = data.transXq * k; + if(smModelData.xq == 0.0) { + smModelData.xq = data.syncXq * k; + if(smModelData.xq == 0.0) { + smModelData.xq = data.syncXd * k; + } + } + } break; + case Machines::SM_MODEL_3: { + smModelData.ed = data.tranEd; + smModelData.eq = data.tranEq; + smModelData.xd = data.transXd * k; + smModelData.xq = data.transXq * k; + if(smModelData.xq == 0.0) smModelData.xq = smModelData.xd; + } break; + case Machines::SM_MODEL_4: + case Machines::SM_MODEL_5: { + smModelData.ed = data.subEd; + smModelData.eq = data.subEq; + smModelData.xd = data.subXd * k; + smModelData.xq = data.subXq * k; + if(smModelData.xd == 0.0) smModelData.xd = smModelData.xq; + if(smModelData.xq == 0.0) smModelData.xq = smModelData.xd; + } break; + } + return smModelData; +} diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index b25a53b..bd6784d 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -1,12 +1,53 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef ELECTROMECHANICAL_H #define ELECTROMECHANICAL_H #include "ElectricCalculation.h" #include <wx/progdlg.h> +#include <wx/log.h> class ControlElementSolver; +/** + * @brief Synchronous machine data for different models + * + * This struct have the parameters and calculated data that depends on each machine model. + */ +struct SyncMachineModelData { + /** Direct-axis reactance (transient for models 1, 2 and 3; subtransient for models 4 and 5) */ + double xd; + /** Quadrature-axis reactance (transient for models 1, 2 and 3; subtransient for models 4 and 5) */ + double xq; + /** Direct-axis internal voltage (transient for models 1, 2 and 3; subtransient for models 4 and 5) */ + double ed; + /** Quadrature-axis internal voltage (transient for models 1, 2 and 3; subtransient for models 4 and 5) */ + double eq; +}; + +/** + * @class Electromechanical + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 23/09/2017 + * @brief Calculates the electromechanical transient based on disturbances (e.g. system fault). + * @file Electromechanical.h + */ class Electromechanical : public ElectricCalculation { public: @@ -21,6 +62,8 @@ class Electromechanical : public ElectricCalculation std::vector<double> m_transEdErrorVector; std::vector<double> m_transEqErrorVector; std::vector<double> m_numItVector; + std::vector<double> m_sdCVector; + std::vector<double> m_sqCVector; protected: void SetEventTimeList(); @@ -28,18 +71,38 @@ class Electromechanical : public ElectricCalculation void SetEvent(double currentTime); inline bool EventTrigger(double eventTime, double currentTime); - double GetPowerValue(double value, ElectricalUnit unit); + // double GetPowerValue(double value, ElectricalUnit unit); void InsertSyncMachinesOnYBus(); std::complex<double> GetSyncMachineAdmittance(SyncGenerator* generator); bool InitializeDynamicElements(); - void CalculateMachinesCurrents(); + bool CalculateMachinesCurrents(); void CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq, double k = 1.0); bool SolveSynchronousMachines(); void SetSyncMachinesModel(); - double CalculateSyncMachineIntVariables(SyncGenerator* syncGenerator, double id, double iq, double pe, double k = 1.0); - void CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator, double& id, double& iq, double& pe, double k = 1.0); + SyncMachineModelData GetSyncMachineModelData(SyncGenerator* syncMachine); + double CalculateSyncMachineIntVariables(SyncGenerator* syncGenerator, + double id, + double iq, + double sd, + double sq, + double pe, + double k = 1.0); + bool CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator, + double& id, + double& iq, + double& sd, + double& sq, + double& pe, + double k = 1.0); void CalculateReferenceSpeed(); + bool CalculateSyncMachineSaturation(SyncGenerator* syncMachine, + double& id, + double& iq, + double& sd, + double& sq, + bool updateCurrents = true, + double k = 1.0); void SaveData(); @@ -64,6 +127,7 @@ class Electromechanical : public ElectricCalculation double m_ctrlTimeStepMultiplier = 0.1; double m_tolerance = 1e-8; int m_maxIterations = 100; + double m_saturationTolerance = 1e-8; std::vector<double> m_eventTimeList; std::vector<bool> m_eventOccurrenceList; @@ -72,6 +136,8 @@ class Electromechanical : public ElectricCalculation // tests double m_wError = 0.0; + double m_sdC = 1.0; + double m_sqC = 1.0; double m_numIt = 0; }; diff --git a/Project/Element.cpp b/Project/Element.cpp index 0b6202e..27bcfb5 100644 --- a/Project/Element.cpp +++ b/Project/Element.cpp @@ -1,17 +1,33 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Element.h" #ifdef USING_WX_3_0_X #include "DegreesAndRadians.h" #endif Element::Element() { m_selectionColour.SetRGBA(0.0, 0.5, 1.0, 0.5); } - Element::~Element() {} - void Element::SetPosition(const wxPoint2DDouble position) { m_position = position; - m_rect = wxRect2DDouble(m_position.m_x - m_width / 2.0 - m_borderSize, - m_position.m_y - m_height / 2.0 - m_borderSize, m_width + 2.0 * m_borderSize, m_height + 2.0 * m_borderSize); + m_rect = + wxRect2DDouble(m_position.m_x - m_width / 2.0 - m_borderSize, m_position.m_y - m_height / 2.0 - m_borderSize, + m_width + 2.0 * m_borderSize, m_height + 2.0 * m_borderSize); } void Element::DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode) const @@ -25,11 +41,11 @@ void Element::DrawCircle(wxPoint2DDouble position, double radius, int numSegment } void Element::DrawArc(wxPoint2DDouble position, - double radius, - double initAngle, - double finalAngle, - int numSegments, - GLenum mode) const + double radius, + double initAngle, + double finalAngle, + int numSegments, + GLenum mode) const { double initAngRad = wxDegToRad(initAngle); double finalAngRad = wxDegToRad(finalAngle); @@ -52,7 +68,7 @@ void Element::DrawTriangle(std::vector<wxPoint2DDouble> points, GLenum mode) con void Element::DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode) const { - glBegin(mode); // TODO: GL_QUADS é obsoleto (OpenGL 3.0+), encontrar outra solução. + glBegin(mode); // TODO: GL_QUADS é obsoleto (OpenGL 3.0+), encontrar outra solução. glVertex2d(position.m_x - width / 2.0, position.m_y - height / 2.0); glVertex2d(position.m_x - width / 2.0, position.m_y + height / 2.0); glVertex2d(position.m_x + width / 2.0, position.m_y + height / 2.0); @@ -62,7 +78,7 @@ void Element::DrawRectangle(wxPoint2DDouble position, double width, double heigh void Element::DrawRectangle(wxPoint2DDouble* points, GLenum mode) const { - glBegin(mode); // TODO: GL_QUADS é obsoleto (OpenGL 3.0+), encontrar outra solução. + glBegin(mode); // TODO: GL_QUADS é obsoleto (OpenGL 3.0+), encontrar outra solução. glVertex2d(points[0].m_x, points[0].m_y); glVertex2d(points[1].m_x, points[1].m_y); glVertex2d(points[2].m_x, points[2].m_y); @@ -93,9 +109,9 @@ wxPoint2DDouble Element::RotateAtPosition(wxPoint2DDouble pointToRotate, double double radAngle = angle; if(degrees) radAngle = wxDegToRad(angle); return wxPoint2DDouble(std::cos(radAngle) * (pointToRotate.m_x - m_position.m_x) - - std::sin(radAngle) * (pointToRotate.m_y - m_position.m_y) + m_position.m_x, - std::sin(radAngle) * (pointToRotate.m_x - m_position.m_x) + - std::cos(radAngle) * (pointToRotate.m_y - m_position.m_y) + m_position.m_y); + std::sin(radAngle) * (pointToRotate.m_y - m_position.m_y) + m_position.m_x, + std::sin(radAngle) * (pointToRotate.m_x - m_position.m_x) + + std::cos(radAngle) * (pointToRotate.m_y - m_position.m_y) + m_position.m_y); } void Element::StartMove(wxPoint2DDouble position) @@ -105,18 +121,17 @@ void Element::StartMove(wxPoint2DDouble position) } void Element::Move(wxPoint2DDouble position) { SetPosition(m_movePos + position - m_moveStartPt); } - wxPoint2DDouble Element::WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX, double offsetY) const { return wxPoint2DDouble(m_position.m_x + offsetX + translation.m_x, m_position.m_y + offsetY + translation.m_y) * - scale; + scale; } wxPoint2DDouble Element::WorldToScreen(wxPoint2DDouble position, - wxPoint2DDouble translation, - double scale, - double offsetX, - double offsetY) const + wxPoint2DDouble translation, + double scale, + double offsetX, + double offsetY) const { return wxPoint2DDouble(position.m_x + offsetX + translation.m_x, position.m_y + offsetY + translation.m_y) * scale; } @@ -130,14 +145,14 @@ void Element::DrawPoint(wxPoint2DDouble position, double size) const } bool Element::RotatedRectanglesIntersects(wxRect2DDouble rect1, - wxRect2DDouble rect2, - double angle1, - double angle2) const + wxRect2DDouble rect2, + double angle1, + double angle2) const { - wxPoint2DDouble rect1Corners[4] = { rect1.GetLeftTop(), rect1.GetLeftBottom(), rect1.GetRightBottom(), - rect1.GetRightTop() }; - wxPoint2DDouble rect2Corners[4] = { rect2.GetLeftTop(), rect2.GetLeftBottom(), rect2.GetRightBottom(), - rect2.GetRightTop() }; + wxPoint2DDouble rect1Corners[4] = {rect1.GetLeftTop(), rect1.GetLeftBottom(), rect1.GetRightBottom(), + rect1.GetRightTop()}; + wxPoint2DDouble rect2Corners[4] = {rect2.GetLeftTop(), rect2.GetLeftBottom(), rect2.GetRightBottom(), + rect2.GetRightTop()}; wxPoint2DDouble rect1Center(rect1.m_x + rect1.m_width / 2.0, rect1.m_y + rect1.m_height / 2.0); wxPoint2DDouble rect2Center(rect2.m_x + rect2.m_width / 2.0, rect2.m_y + rect2.m_height / 2.0); @@ -146,26 +161,28 @@ bool Element::RotatedRectanglesIntersects(wxRect2DDouble rect1, double radAngle2 = wxDegToRad(angle2); for(int i = 0; i < 4; i++) { - rect1Corners[i] = wxPoint2DDouble(std::cos(radAngle1) * (rect1Corners[i].m_x - rect1Center.m_x) - - std::sin(radAngle1) * (rect1Corners[i].m_y - rect1Center.m_y) + rect1Center.m_x, - std::sin(radAngle1) * (rect1Corners[i].m_x - rect1Center.m_x) + - std::cos(radAngle1) * (rect1Corners[i].m_y - rect1Center.m_y) + rect1Center.m_y); - - rect2Corners[i] = wxPoint2DDouble(std::cos(radAngle2) * (rect2Corners[i].m_x - rect2Center.m_x) - - std::sin(radAngle2) * (rect2Corners[i].m_y - rect2Center.m_y) + rect2Center.m_x, - std::sin(radAngle2) * (rect2Corners[i].m_x - rect2Center.m_x) + - std::cos(radAngle2) * (rect2Corners[i].m_y - rect2Center.m_y) + rect2Center.m_y); + rect1Corners[i] = + wxPoint2DDouble(std::cos(radAngle1) * (rect1Corners[i].m_x - rect1Center.m_x) - + std::sin(radAngle1) * (rect1Corners[i].m_y - rect1Center.m_y) + rect1Center.m_x, + std::sin(radAngle1) * (rect1Corners[i].m_x - rect1Center.m_x) + + std::cos(radAngle1) * (rect1Corners[i].m_y - rect1Center.m_y) + rect1Center.m_y); + + rect2Corners[i] = + wxPoint2DDouble(std::cos(radAngle2) * (rect2Corners[i].m_x - rect2Center.m_x) - + std::sin(radAngle2) * (rect2Corners[i].m_y - rect2Center.m_y) + rect2Center.m_x, + std::sin(radAngle2) * (rect2Corners[i].m_x - rect2Center.m_x) + + std::cos(radAngle2) * (rect2Corners[i].m_y - rect2Center.m_y) + rect2Center.m_y); } //[Ref] http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604 // Find the rectangles axis to project - wxPoint2DDouble axis[4] = { rect1Corners[3] - rect1Corners[0], rect1Corners[3] - rect1Corners[2], - rect2Corners[3] - rect2Corners[0], rect2Corners[3] - rect2Corners[2] }; + wxPoint2DDouble axis[4] = {rect1Corners[3] - rect1Corners[0], rect1Corners[3] - rect1Corners[2], + rect2Corners[3] - rect2Corners[0], rect2Corners[3] - rect2Corners[2]}; // Calculate the projected points to each axis - wxPoint2DDouble rect1ProjPts[4][4]; // [axis][corner] - wxPoint2DDouble rect2ProjPts[4][4]; // [axis][corner] + wxPoint2DDouble rect1ProjPts[4][4]; // [axis][corner] + wxPoint2DDouble rect2ProjPts[4][4]; // [axis][corner] for(int i = 0; i < 4; i++) { double den = axis[i].m_x * axis[i].m_x + axis[i].m_y * axis[i].m_y; for(int j = 0; j < 4; j++) { @@ -178,8 +195,8 @@ bool Element::RotatedRectanglesIntersects(wxRect2DDouble rect1, } // Calculate the scalar value to identify the max and min values on projections - double rect1Scalar[4][4]; //[axis][corner] - double rect2Scalar[4][4]; //[axis][corner] + double rect1Scalar[4][4]; //[axis][corner] + double rect2Scalar[4][4]; //[axis][corner] for(int i = 0; i < 4; i++) { for(int j = 0; j < 4; j++) { rect1Scalar[i][j] = rect1ProjPts[i][j].m_x * axis[i].m_x + rect1ProjPts[i][j].m_y * axis[i].m_y; @@ -229,7 +246,7 @@ void Element::GeneralMenuItens(wxMenu& menu) { wxFileName exeFileName(wxStandardPaths::Get().GetExecutablePath()); wxString exePath = exeFileName.GetPath(); - + wxMenuItem* clockItem = new wxMenuItem(&menu, ID_ROTATE_CLOCK, _("Rotate clockwise")); clockItem->SetBitmap(wxImage(exePath + "\\..\\data\\images\\menu\\rotateClock16.png")); menu.Append(clockItem); @@ -248,8 +265,8 @@ void Element::CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& righ // Check rect corners boundaries. // Get rectangle corners - wxPoint2DDouble rectCorner[4] = { m_rect.GetLeftTop(), m_rect.GetLeftBottom(), m_rect.GetRightBottom(), - m_rect.GetRightTop() }; + wxPoint2DDouble rectCorner[4] = {m_rect.GetLeftTop(), m_rect.GetLeftBottom(), m_rect.GetRightBottom(), + m_rect.GetRightTop()}; // Rotate corners. for(int i = 0; i < 4; ++i) { rectCorner[i] = RotateAtPosition(rectCorner[i], m_angle); @@ -334,7 +351,6 @@ void Element::ReplaceParent(Element* oldParent, Element* newParent) } void Element::AddChild(Element* child) { m_childList.push_back(child); } - void Element::RemoveChild(Element* child) { for(auto it = m_childList.begin(); it != m_childList.end(); ++it) { @@ -359,7 +375,6 @@ void OpenGLColour::SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble } OpenGLColour::OpenGLColour() { SetRGBA(1.0, 1.0, 1.0, 1.0); } - OpenGLColour::OpenGLColour(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) { SetRGBA(red, green, blue, alpha); @@ -368,7 +383,7 @@ OpenGLColour::OpenGLColour(GLdouble red, GLdouble green, GLdouble blue, GLdouble double Element::PointToLineDistance(wxPoint2DDouble point, int* segmentNumber) const { //[Ref] http://geomalgorithms.com/a02-_lines.html - double distance = 100.0; // Big initial distance. + double distance = 100.0; // Big initial distance. wxPoint2DDouble p0 = point; for(int i = 1; i < (int)m_pointList.size() - 2; i++) { diff --git a/Project/Element.h b/Project/Element.h index 2cd7392..21f8def 100644 --- a/Project/Element.h +++ b/Project/Element.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef ELEMENT_H #define ELEMENT_H @@ -44,12 +61,12 @@ enum ContextMenuID { * @class OpenGLColour * @author Thales Lima Oliveira * @date 18/01/2017 - * @file Element.h * @brief Class to manage color of OpenGL. + * @file Element.h */ class OpenGLColour { -public: + public: /** * @brief Default construnctor. Use SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha). */ @@ -68,7 +85,6 @@ public: * @brief Destructor. */ virtual ~OpenGLColour() {} - /** * @brief Set the colour in RGBA. The colour values must be between 0.0 and 1.0. * @param red Red colour value. @@ -83,7 +99,7 @@ public: * @return RGBA colour. */ const GLdouble* GetRGBA() const { return rgba; } -protected: + protected: GLdouble rgba[4]; }; @@ -91,12 +107,12 @@ protected: * @class Element * @author Thales Lima Oliveira <thales@ufu.br> * @date 19/09/2017 - * @file Element.h * @brief Base class of all elements of the program. This class is responsible for manage graphical and his data. + * @file Element.h */ class Element { -public: + public: /** * @brief Constructor. */ @@ -112,13 +128,11 @@ public: * @param dragging True if is dragging, false otherwise. */ void SetDragging(bool dragging = true) { m_dragging = dragging; } - /** * @brief Set element height. * @param height Height value. */ void SetHeight(double height) { m_height = height; } - /** * @brief Set the element position and update the rectangle. * @param position Position value. @@ -130,31 +144,26 @@ public: * @param selected True if selected, false otherwise. */ void SetSelected(bool selected = true) { m_selected = selected; } - /** * @brief Set element width. * @param width Width value. */ void SetWidth(double width) { m_width = width; } - /** * @brief Set element angle * @param angle Angle value in degrees. */ void SetAngle(double angle) { m_angle = angle; } - /** * @brief Set if the pickbox is shown. * @param showPickbox True if show, false otherwise. */ void ShowPickbox(bool showPickbox = true) { m_showPickbox = showPickbox; } - /** * @brief Set the size of the border (shown in selected elements). * @param borderSize Border size. */ void SetBorderSize(double borderSize) { m_borderSize = borderSize; } - /** * @brief Set if the element is online or offline. * @param online True if online, false if offline. @@ -166,73 +175,61 @@ public: * @param pointList List of points. */ virtual void SetPointList(std::vector<wxPoint2DDouble> pointList) { m_pointList = pointList; } - /** * @brief Get the element rectangle. * @return Element rectangle. */ wxRect2DDouble GetRect() const { return m_rect; } - /** * @brief Get the element position. * @return Element position. */ wxPoint2DDouble GetPosition() const { return m_position; } - /** * @brief Checks if the element is being dragged. * @return True if is being dragged, false otherwise. */ bool IsDragging() const { return m_dragging; } - /** * @brief Get the element height. * @return Element height. */ double GetHeight() const { return m_height; } - /** * @brief Checks if the element is selected. * @return True if selected, false otherwise. */ bool IsSelected() const { return m_selected; } - /** * @brief Get the element width. * @return Element width. */ double GetWidth() const { return m_width; } - /** * @brief Get the element angle. * @return Angle value. */ double GetAngle() const { return m_angle; } - /** * @brief Get the angle of rotation. * @return Rotation angle. */ double GetRotationAngle() const { return m_rotationAngle; } - /** * @brief Checks if the pickbox is shown. * @return True if the pickbox is show, false otherwise. */ bool IsPickboxShown() const { return m_showPickbox; } - /** * @brief Checks if the element is online or offline. * @return True if online, false if offline. */ bool IsOnline() const { return m_online; } - /** * @brief Get the list of points that connect the element to bus. * @return List of points. */ virtual std::vector<wxPoint2DDouble> GetPointList() const { return m_pointList; } - /** * @brief Add a parent to the element. This method must be used on power elements that connect to a bus, so the * parent must be a bus. @@ -241,13 +238,11 @@ public: * @param position Node position in the parent. */ virtual bool AddParent(Element* parent, wxPoint2DDouble position) { return false; } - /** * @brief Add a parent to the element. * @param parent Element parent. */ virtual void AddParent(Element* parent) { m_parentList.push_back(parent); } - /** * @brief Checks if the element contains a position. * @param position Position to be checked. @@ -265,19 +260,16 @@ public: * @return Copy of the element. */ virtual Element* GetCopy() { return NULL; } - /** * @brief Set the element ID. * @param id Element ID. */ virtual void SetID(int id) { m_elementID = id; } - /** * @brief Get the element ID. * @return Element ID. */ virtual int GetID() const { return m_elementID; } - /** * @brief Add a child to the child list. * @param child New child. @@ -302,33 +294,28 @@ public: * @return Tip text. */ virtual wxString GetTipText() const { return wxEmptyString; } - /** * @brief Draw the element. * @param translation Translation of the system. * @param scale Scale of the system. */ virtual void Draw(wxPoint2DDouble translation, double scale) const {} - /** * @brief Rotate the element. * @param clockwise True to rotate clockwise, false to rotate counter-clockwise. */ virtual void Rotate(bool clockwise = true) {} - /** * @brief Get the element contex menu. * @param menu menu that will be inserted the element itens. * @return True if was possible to build the menu, false otherwise. */ virtual bool GetContextMenu(wxMenu& menu) { return false; } - /** * @brief Add point to the list of points that connect the element to the bus. * @param point Point to be added. */ virtual void AddPoint(wxPoint2DDouble point) {} - /** * @brief Update the element attributes related to the movement. * @param position Start move position. @@ -348,19 +335,16 @@ public: * @param position New node position. */ virtual void MoveNode(Element* parent, wxPoint2DDouble position) {} - /** * @brief Check if a node contains a point. If contains, set the attributes related to node movement. * @param position Position tested. * @return True if at least one node contains the position, false otherwise. */ virtual bool NodeContains(wxPoint2DDouble position) { return false; } - /** * @brief Update the nodes according to the parents. If a parent is removed, use this method. */ virtual void UpdateNodes() {} - /** * @brief Set a perent to the node. If all conditions are met, a new parent are added to the element and the points * related to the nodes will be calculated. @@ -368,13 +352,11 @@ public: * @return True if was possible to set the parent. */ virtual bool SetNodeParent(Element* parent) { return false; } - /** * @brief Remove a parent. * @param parent Parent to be removed. */ virtual void RemoveParent(Element* parent) {} - /** * @brief Replace a parent. * @param oldParent Parent to be replaced. @@ -388,7 +370,6 @@ public: * @param clockwise True to rotate clockwise, false to rotate counter-clockwise. */ virtual void RotateNode(Element* parent, bool clockwise = true) {} - /** * @brief Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be * calculated. @@ -396,29 +377,24 @@ public: * @return True if the element constains the pickbox, false otherwise. */ virtual bool PickboxContains(wxPoint2DDouble position) { return false; } - /** * @brief Move the pickbox. * @param position position that the pickbox will be moved. */ virtual void MovePickbox(wxPoint2DDouble position) {} - /** * @brief Get the best cursor to shown to the user when the mouse is above a pickbox. * @return Cursor. */ virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_ARROW; } - /** * @brief Remove the pickboxes. */ virtual void ResetPickboxes() { m_activePickboxID = ID_PB_NONE; } - /** * @brief Remove the active nodes. */ virtual void ResetNodes() { m_activeNodeID = 0; } - /** * @brief Convert the element position to screen position. * @param translation System translation. @@ -426,8 +402,10 @@ public: * @param offsetX Offset in X axis. * @param offsetY Offset if Y axis. */ - virtual wxPoint2DDouble - WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX = 0.0, double offsetY = 0.0) const; + virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble translation, + double scale, + double offsetX = 0.0, + double offsetY = 0.0) const; /** * @brief Convert a generic position to screen position. @@ -438,10 +416,10 @@ public: * @param offsetY Offset in Y axis. */ virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble position, - wxPoint2DDouble translation, - double scale, - double offsetX = 0.0, - double offsetY = 0.0) const; + wxPoint2DDouble translation, + double scale, + double offsetX = 0.0, + double offsetY = 0.0) const; /** * @brief Check if two roteted rectangles intersect. @@ -450,8 +428,10 @@ public: * @param angle1 Rotation algle of first rectangle. * @param angle2 Rotation angle of second rectangle. */ - virtual bool - RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const; + virtual bool RotatedRectanglesIntersects(wxRect2DDouble rect1, + wxRect2DDouble rect2, + double angle1, + double angle2) const; /** * @brief Draw a circle. @@ -462,11 +442,11 @@ public: */ virtual void DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode = GL_LINE_LOOP) const; virtual void DrawArc(wxPoint2DDouble position, - double radius, - double initAngle, - double finalAngle, - int numSegments, - GLenum mode = GL_LINE_LOOP) const; + double radius, + double initAngle, + double finalAngle, + int numSegments, + GLenum mode = GL_LINE_LOOP) const; /** * @brief Draw rectangle. @@ -524,13 +504,11 @@ public: * @return Parent list. */ virtual std::vector<Element*> GetParentList() const { return m_parentList; } - /** * @brief Get the Child list. * @return Child List. */ virtual std::vector<Element*> GetChildList() const { return m_childList; } - // virtual wxPoint2DDouble GetMoveStartPosition() const { return m_moveStartPt; } // virtual wxPoint2DDouble GetMovePosition() const { return m_movePos; } @@ -554,7 +532,6 @@ public: * @return True if the form is shown, false otherwise. */ virtual bool ShowForm(wxWindow* parent, Element* element) { return false; } - /** * @brief Get a double value from a string. Show a error message if the conversion fail. * @param parent Message box parent. @@ -588,7 +565,7 @@ public: */ virtual double PointToLineDistance(wxPoint2DDouble point, int* segmentNumber = NULL) const; -protected: + protected: int m_elementID = 0; std::vector<Element*> m_parentList; std::vector<Element*> m_childList; @@ -622,4 +599,4 @@ protected: OpenGLColour m_selectionColour; }; -#endif // ELEMENT_H +#endif // ELEMENT_H diff --git a/Project/ElementDataObject.cpp b/Project/ElementDataObject.cpp index 0ea01cb..6f27b22 100644 --- a/Project/ElementDataObject.cpp +++ b/Project/ElementDataObject.cpp @@ -1,13 +1,28 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ElementDataObject.h" -ElementDataObject::ElementDataObject() - : wxDataObjectSimple(wxDataFormat("PSPCopy")) +ElementDataObject::ElementDataObject() : wxDataObjectSimple(wxDataFormat("PSPCopy")) { m_elementsLists = new ElementsLists(); } -ElementDataObject::ElementDataObject(std::vector<Element*> elementList) - : wxDataObjectSimple(wxDataFormat("PSPCopy")) +ElementDataObject::ElementDataObject(std::vector<Element*> elementList) : wxDataObjectSimple(wxDataFormat("PSPCopy")) { m_elementsLists = new ElementsLists(); if(elementList.size() > 0) { diff --git a/Project/ElementDataObject.h b/Project/ElementDataObject.h index 3baf792..838411d 100644 --- a/Project/ElementDataObject.h +++ b/Project/ElementDataObject.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef ELEMENTDATAOBJECT_H #define ELEMENTDATAOBJECT_H @@ -9,9 +26,16 @@ struct ElementsLists { std::vector<Bus*> parentList; }; +/** + * @class ElementDataObject + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Class to store the elements in the clipboard. + * @file ElementDataObject.h + */ class ElementDataObject : public wxDataObjectSimple { -public: + public: ElementDataObject(); ElementDataObject(std::vector<Element*> elementList); ~ElementDataObject(); @@ -21,9 +45,8 @@ public: bool SetData(size_t len, const void* buf) override; ElementsLists* GetElementsLists() { return m_elementsLists; } - -protected: + protected: ElementsLists* m_elementsLists = NULL; }; -#endif // ELEMENTDATAOBJECT_H +#endif // ELEMENTDATAOBJECT_H diff --git a/Project/ElementPlotData.cpp b/Project/ElementPlotData.cpp index ca1fd84..d08108b 100644 --- a/Project/ElementPlotData.cpp +++ b/Project/ElementPlotData.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ElementPlotData.h" ElementPlotData::ElementPlotData(wxString name, CurveType curveType) diff --git a/Project/ElementPlotData.h b/Project/ElementPlotData.h index 5c67575..16c6017 100644 --- a/Project/ElementPlotData.h +++ b/Project/ElementPlotData.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef ELEMENTPLOTDATA_H #define ELEMENTPLOTDATA_H @@ -7,6 +24,14 @@ #include <vector> +/** + * @class PlotData + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief This class is responsible to manage the graphical data of electromechanical result to be plotted on chart + * viewer. + * @file ElementPlotData.h + */ class PlotData : public wxTreeItemData { public: @@ -53,7 +78,7 @@ class ElementPlotData NUM_ELEMENTS, CT_TIME }; - ElementPlotData() {}; + ElementPlotData(){}; ElementPlotData(wxString name, CurveType curveType); ~ElementPlotData(); diff --git a/Project/Exponential.cpp b/Project/Exponential.cpp index 3ff1842..64af421 100644 --- a/Project/Exponential.cpp +++ b/Project/Exponential.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Exponential.h" #include "ExponentialForm.h" diff --git a/Project/Exponential.h b/Project/Exponential.h index 7510266..accdd48 100644 --- a/Project/Exponential.h +++ b/Project/Exponential.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef EXPONENTIAL_H #define EXPONENTIAL_H @@ -5,12 +22,19 @@ class ExponentialForm; +/** + * @class Exponential + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Generates an output following an exponential function. + * @file Exponential.h + */ class Exponential : public ControlElement { -public: + public: Exponential(int id); ~Exponential(); - + virtual void Draw(wxPoint2DDouble translation, double scale) const; virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); } virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); } @@ -18,18 +42,25 @@ public: virtual void Rotate(bool clockwise = true); virtual void UpdatePoints(); - - virtual void GetValues(double& aValue, double &bValue); + + virtual void GetValues(double& aValue, double& bValue); virtual void SetValues(double aValue, double bValue); + /** + * @brief Calculates the exponential. + * + * <center>\f$ output = A\cdot e^{B\cdot input} \f$</center> + * @param input Input value. + * @param timeStep Time step. + * @return Aways true. + */ virtual bool Solve(double input, double timeStep); - + virtual Element* GetCopy(); - -protected: + + protected: double m_aValue = 0.001; double m_bValue = 5.0; - }; -#endif // EXPONENTIAL_H +#endif // EXPONENTIAL_H diff --git a/Project/ExponentialForm.cpp b/Project/ExponentialForm.cpp index 4ab040b..752c032 100644 --- a/Project/ExponentialForm.cpp +++ b/Project/ExponentialForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ExponentialForm.h" #include "Exponential.h" diff --git a/Project/ExponentialForm.h b/Project/ExponentialForm.h index c53ef9f..7459be7 100644 --- a/Project/ExponentialForm.h +++ b/Project/ExponentialForm.h @@ -1,9 +1,33 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef EXPONENTIALFORM_H #define EXPONENTIALFORM_H #include "ElementForm.h" class Exponential; +/** + * @class ExponentialForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the exponential control data. + * @file ExponentialForm.h + */ class ExponentialForm : public ExponentialFormBase { public: diff --git a/Project/Fault.cpp b/Project/Fault.cpp index 40b03d7..3d335fd 100644 --- a/Project/Fault.cpp +++ b/Project/Fault.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Fault.h" #ifdef USING_WX_3_0_X #include "DegreesAndRadians.h" diff --git a/Project/Fault.h b/Project/Fault.h index ea68997..ef10189 100644 --- a/Project/Fault.h +++ b/Project/Fault.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef FAULT_H #define FAULT_H @@ -6,13 +23,13 @@ * @class Fault * @author Thales Lima Oliveira * @date 10/01/2017 - * @file Fault.h * @brief Calculate the fault of the system and update the elements data. + * @file Fault.h */ class Fault : public ElectricCalculation { -public: + public: /** * @brief Contructor. * @param elementList List of elements in workspace @@ -52,10 +69,9 @@ public: * @return Error message. */ virtual wxString GetErrorMessage() { return m_errorMsg; } - -protected: + protected: wxString m_errorMsg = ""; - + double m_systemPowerBase; std::vector<std::vector<std::complex<double> > > m_zBusPos; @@ -75,4 +91,4 @@ protected: std::vector<std::complex<double> > m_posFaultVoltageC; }; -#endif // FAULT_H +#endif // FAULT_H diff --git a/Project/FileHanding.cpp b/Project/FileHanding.cpp index f5b881d..e1a8e4b 100644 --- a/Project/FileHanding.cpp +++ b/Project/FileHanding.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "FileHanding.h" FileHanding::~FileHanding() {} diff --git a/Project/FileHanding.h b/Project/FileHanding.h index c952824..83c7587 100644 --- a/Project/FileHanding.h +++ b/Project/FileHanding.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef FILEHANDING_H #define FILEHANDING_H @@ -16,6 +33,13 @@ #include "rapidXML/rapidxml_print.hpp" #include "rapidXML/rapidxml_utils.hpp" +/** + * @class FileHanding + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Save and opens the projects created on disk. + * @file FileHanding.h + */ class FileHanding { public: diff --git a/Project/Gain.cpp b/Project/Gain.cpp index d6dc7a2..98dfa8c 100644 --- a/Project/Gain.cpp +++ b/Project/Gain.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Gain.h" #include "GainForm.h" diff --git a/Project/Gain.h b/Project/Gain.h index 82b2793..7245e2f 100644 --- a/Project/Gain.h +++ b/Project/Gain.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef GAIN_H #define GAIN_H @@ -8,6 +25,13 @@ class GainForm; +/** + * @class Gain + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Provide an output multiplying the input by a constant. + * @file Gain.h + */ class Gain : public ControlElement { public: @@ -24,17 +48,24 @@ class Gain : public ControlElement virtual void SetValue(double value); virtual double GetValue() const { return m_value; } virtual void UpdatePoints(); - + /** + * @brief Multiply the input by a constant + * + * <center>\f$ output = K \cdot input \f$</center> + * @param input Input value. + * @param timeStep Time step. + * @return Always true. + */ virtual bool Solve(double input, double timeStep); - + virtual Element* GetCopy(); protected: double m_value = 1.0; - + wxGLString* m_glStringValue = NULL; int m_fontSize = 10; - + std::vector<wxPoint2DDouble> m_triPts; }; diff --git a/Project/GainForm.cpp b/Project/GainForm.cpp index 03a70ef..a844b9b 100644 --- a/Project/GainForm.cpp +++ b/Project/GainForm.cpp @@ -1,10 +1,27 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "GainForm.h" #include "Gain.h" GainForm::GainForm(wxWindow* parent, Gain* gain) : GainFormBase(parent) { SetSize(GetBestSize()); - + m_parent = parent; m_gain = gain; diff --git a/Project/GainForm.h b/Project/GainForm.h index 45d6c40..32bc629 100644 --- a/Project/GainForm.h +++ b/Project/GainForm.h @@ -1,15 +1,39 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef GAINFORM_H #define GAINFORM_H #include "ElementForm.h" class Gain; +/** + * @class GainForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the gain control data. + * @file GainForm.h + */ class GainForm : public GainFormBase { public: GainForm(wxWindow* parent, Gain* gain); virtual ~GainForm(); - + virtual bool ValidateData(); protected: diff --git a/Project/GeneralPropertiesForm.cpp b/Project/GeneralPropertiesForm.cpp index 90ecf29..2761d16 100644 --- a/Project/GeneralPropertiesForm.cpp +++ b/Project/GeneralPropertiesForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "GeneralPropertiesForm.h" #include "PropertiesData.h" diff --git a/Project/GeneralPropertiesForm.h b/Project/GeneralPropertiesForm.h index 77bf4d2..f1d4382 100644 --- a/Project/GeneralPropertiesForm.h +++ b/Project/GeneralPropertiesForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef GENERALPROPERTIESFORM_H #define GENERALPROPERTIESFORM_H @@ -8,17 +25,24 @@ class PropertiesData; +/** + * @class GeneralPropertiesForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the software's general data. + * @file GeneralPropertiesForm.h + */ class GeneralPropertiesForm : public GeneralPropertiesFormBase { -public: + public: GeneralPropertiesForm(wxWindow* parent, PropertiesData* properties); virtual ~GeneralPropertiesForm(); - -protected: + + protected: virtual void OnButtonCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } virtual void OnButtonOKClick(wxCommandEvent& event); virtual bool ValidateData(); - + PropertiesData* m_properties = NULL; }; -#endif // GENERALPROPERTIESFORM_H +#endif // GENERALPROPERTIESFORM_H diff --git a/Project/GeneratorStabForm.cpp b/Project/GeneratorStabForm.cpp index 2280906..7a68391 100644 --- a/Project/GeneratorStabForm.cpp +++ b/Project/GeneratorStabForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "GeneratorStabForm.h" #include "SwitchingForm.h" #include "SyncGenerator.h" diff --git a/Project/GeneratorStabForm.h b/Project/GeneratorStabForm.h index 4ff2127..86aab5b 100644 --- a/Project/GeneratorStabForm.h +++ b/Project/GeneratorStabForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef GENERATORSTABFORM_H #define GENERATORSTABFORM_H @@ -8,6 +25,13 @@ class SyncGenerator; class ControlEditor; class ControlElementContainer; +/** + * @class GeneratorStabForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the synchronous generator data for electromechanical studies. + * @file GeneratorStabForm.h + */ class GeneratorStabForm : public GeneratorStabFormBase { public: diff --git a/Project/GraphicalElement.cpp b/Project/GraphicalElement.cpp index 87a5302..d9fa9e5 100644 --- a/Project/GraphicalElement.cpp +++ b/Project/GraphicalElement.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "GraphicalElement.h" GraphicalElement::GraphicalElement() : Element() diff --git a/Project/GraphicalElement.h b/Project/GraphicalElement.h index 86ca30d..ab03b6f 100644 --- a/Project/GraphicalElement.h +++ b/Project/GraphicalElement.h @@ -1,14 +1,37 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef GRAPHICALELEMENT_H #define GRAPHICALELEMENT_H #include "Element.h" +/** + * @class GraphicalElement + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Abstract class for graphical elements shown with power elements in workspace. + * @file GraphicalElement.h + */ class GraphicalElement : public Element { -public: + public: GraphicalElement(); ~GraphicalElement(); - }; -#endif // GRAPHICALELEMENT_H +#endif // GRAPHICALELEMENT_H diff --git a/Project/IOControl.cpp b/Project/IOControl.cpp index 2eab8de..bf40200 100644 --- a/Project/IOControl.cpp +++ b/Project/IOControl.cpp @@ -1,10 +1,27 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "IOControl.h" #include "IOControlForm.h" IOControl::IOControl(int ioFlags, int id) : ControlElement(id) { m_ioFlags = ioFlags; - + Node* node = new Node(m_position, Node::NODE_IN, m_borderSize); m_nodeList.push_back(node); diff --git a/Project/IOControl.h b/Project/IOControl.h index 513b008..307cc1a 100644 --- a/Project/IOControl.h +++ b/Project/IOControl.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef IOCONTROL_H #define IOCONTROL_H @@ -8,6 +25,13 @@ class IOControlForm; +/** + * @class IOControl + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Provides the communication with the power element. + * @file IOControl.h + */ class IOControl : public ControlElement { public: @@ -36,8 +60,8 @@ class IOControl : public ControlElement virtual void SetValue(IOFlags value); virtual int GetIOFlags() const { return m_ioFlags; } virtual Node::NodeType GetType() { return m_ioNodeType; } - virtual Element* GetCopy(); + protected: IOFlags m_value; int m_ioFlags; diff --git a/Project/IOControlForm.cpp b/Project/IOControlForm.cpp index c4527d6..583e534 100644 --- a/Project/IOControlForm.cpp +++ b/Project/IOControlForm.cpp @@ -1,9 +1,26 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "IOControlForm.h" IOControlForm::IOControlForm(wxWindow* parent, IOControl* ioControl) : IOControlFormBase(parent) { SetSize(GetBestSize()); - + m_parent = parent; m_ioControl = ioControl; diff --git a/Project/IOControlForm.h b/Project/IOControlForm.h index 8b3f2d9..a1c3d36 100644 --- a/Project/IOControlForm.h +++ b/Project/IOControlForm.h @@ -1,15 +1,39 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef IOCONTROLFORM_H #define IOCONTROLFORM_H #include "ElementForm.h" #include "IOControl.h" +/** + * @class IOControlForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the input/output control data. + * @file IOControlForm.h + */ class IOControlForm : public IOControlFormBase { public: IOControlForm(wxWindow* parent, IOControl* ioControl); virtual ~IOControlForm(); - + virtual bool ValidateData(); protected: @@ -20,8 +44,8 @@ class IOControlForm : public IOControlFormBase wxWindow* m_parent; IOControl* m_ioControl; - + std::vector<IOControl::IOFlags> m_inputFlags; - std::vector<IOControl::IOFlags> m_outputFlags; + std::vector<IOControl::IOFlags> m_outputFlags; }; #endif // IOCONTROLFORM_H diff --git a/Project/IndMotor.cpp b/Project/IndMotor.cpp index 8fab5c4..64d40c4 100644 --- a/Project/IndMotor.cpp +++ b/Project/IndMotor.cpp @@ -1,15 +1,25 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "IndMotorForm.h" #include "IndMotor.h" -IndMotor::IndMotor() - : Machines() -{ -} -IndMotor::IndMotor(wxString name) - : Machines() -{ - m_electricalData.name = name; -} +IndMotor::IndMotor() : Machines() {} +IndMotor::IndMotor(wxString name) : Machines() { m_electricalData.name = name; } IndMotor::~IndMotor() {} void IndMotor::DrawSymbol() const { diff --git a/Project/IndMotor.h b/Project/IndMotor.h index 1a40511..511eb61 100644 --- a/Project/IndMotor.h +++ b/Project/IndMotor.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef INDMOTOR_H #define INDMOTOR_H @@ -5,8 +22,7 @@ class IndMotorForm; -struct IndMotorElectricalData -{ +struct IndMotorElectricalData { wxString name; double activePower = 100.0; ElectricalUnit activePowerUnit = UNIT_MW; @@ -14,14 +30,21 @@ struct IndMotorElectricalData ElectricalUnit reactivePowerUnit = UNIT_MVAr; }; +/** + * @class IndMotor + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Induction motor power element. + * @file IndMotor.h + */ class IndMotor : public Machines { public: IndMotor(); IndMotor(wxString name); ~IndMotor(); - - virtual Element* GetCopy(); + + virtual Element* GetCopy(); virtual void DrawSymbol() const; virtual bool GetContextMenu(wxMenu& menu); virtual wxString GetTipText() const; diff --git a/Project/IndMotorForm.cpp b/Project/IndMotorForm.cpp index 6af2433..d758c18 100644 --- a/Project/IndMotorForm.cpp +++ b/Project/IndMotorForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "IndMotorForm.h" #include "IndMotor.h" @@ -62,7 +79,7 @@ void IndMotorForm::OnStabilityButtonClick(wxCommandEvent& event) bool IndMotorForm::ValidateData() { IndMotorElectricalData data; - + data.name = m_textCtrlName->GetValue(); if(!m_indMotor->DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower, diff --git a/Project/IndMotorForm.h b/Project/IndMotorForm.h index 561bb25..ffdd742 100644 --- a/Project/IndMotorForm.h +++ b/Project/IndMotorForm.h @@ -1,9 +1,33 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef INDMOTORFORM_H #define INDMOTORFORM_H #include "ElementForm.h" class IndMotor; +/** + * @class IndMotorForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the induction motor power data. + * @file IndMotorForm.h + */ class IndMotorForm : public IndMotorFormBase { public: diff --git a/Project/Inductor.cpp b/Project/Inductor.cpp index ca0dcd8..c3fe3cd 100644 --- a/Project/Inductor.cpp +++ b/Project/Inductor.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ReactiveShuntElementForm.h" #include "Inductor.h" diff --git a/Project/Inductor.h b/Project/Inductor.h index 64e6889..ffd65da 100644 --- a/Project/Inductor.h +++ b/Project/Inductor.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef INDUCTOR_H #define INDUCTOR_H @@ -11,14 +28,21 @@ struct InductorElectricalData { ElectricalUnit reactivePowerUnit = UNIT_MVAr; }; +/** + * @class Inductor + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Inductor shunt power element. + * @file Inductor.h + */ class Inductor : public Shunt { public: Inductor(); Inductor(wxString name); ~Inductor(); - - virtual Element* GetCopy(); + + virtual Element* GetCopy(); virtual bool AddParent(Element* parent, wxPoint2DDouble position); virtual void Draw(wxPoint2DDouble translation, double scale) const; virtual bool Contains(wxPoint2DDouble position) const; diff --git a/Project/Limiter.cpp b/Project/Limiter.cpp index 8519482..830ef6a 100644 --- a/Project/Limiter.cpp +++ b/Project/Limiter.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Limiter.h" #include "LimiterForm.h" @@ -91,9 +108,11 @@ void Limiter::UpdatePoints() bool Limiter::Solve(double input, double timeStep) { m_output = input; - if(m_output > m_upLimit) m_output = m_upLimit; - else if(m_output < m_lowLimit) m_output = m_lowLimit; - + if(m_output > m_upLimit) + m_output = m_upLimit; + else if(m_output < m_lowLimit) + m_output = m_lowLimit; + return true; } diff --git a/Project/Limiter.h b/Project/Limiter.h index 82617a7..396ae16 100644 --- a/Project/Limiter.h +++ b/Project/Limiter.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef LIMITER_H #define LIMITER_H @@ -5,12 +22,19 @@ class LimiterForm; +/** + * @class Limiter + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Limits the input value by superior and inferior values. + * @file Limiter.h + */ class Limiter : public ControlElement { -public: + public: Limiter(int id); ~Limiter(); - + virtual void Draw(wxPoint2DDouble translation, double scale) const; virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); } virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); } @@ -19,18 +43,16 @@ public: virtual bool Solve(double input, double timeStep); virtual void UpdatePoints(); - + double GetUpLimit() const { return m_upLimit; } double GetLowLimit() const { return m_lowLimit; } - void SetUpLimit(double upLimit) { m_upLimit = upLimit; } void SetLowLimit(double lowLimit) { m_lowLimit = lowLimit; } - virtual Element* GetCopy(); - -protected: + + protected: double m_upLimit = 5.0; double m_lowLimit = -5.0; }; -#endif // LIMITER_H +#endif // LIMITER_H diff --git a/Project/LimiterForm.cpp b/Project/LimiterForm.cpp index a43d6d2..8874d2d 100644 --- a/Project/LimiterForm.cpp +++ b/Project/LimiterForm.cpp @@ -1,10 +1,27 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "LimiterForm.h" #include "Limiter.h" LimiterForm::LimiterForm(wxWindow* parent, Limiter* limiter) : LimiterFormBase(parent) { SetSize(GetBestSize()); - + m_limiter = limiter; m_parent = parent; diff --git a/Project/LimiterForm.h b/Project/LimiterForm.h index f26ee9d..96deb61 100644 --- a/Project/LimiterForm.h +++ b/Project/LimiterForm.h @@ -1,9 +1,33 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef LIMITERFORM_H #define LIMITERFORM_H #include "ElementForm.h" class Limiter; +/** + * @class LimiterForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the limit control data. + * @file LimiterForm.h + */ class LimiterForm : public LimiterFormBase { public: diff --git a/Project/Line.cpp b/Project/Line.cpp index 540d844..215c6b5 100644 --- a/Project/Line.cpp +++ b/Project/Line.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Line.h" Line::Line() : Branch() diff --git a/Project/Line.h b/Project/Line.h index 513dc11..aa6baf2 100644 --- a/Project/Line.h +++ b/Project/Line.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef LINE_H #define LINE_H @@ -32,6 +49,13 @@ struct LineElectricalData { std::complex<double> faultCurrent[2][3]; }; +/** + * @class Line + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Power line element. + * @file Line.h + */ class Line : public Branch { public: diff --git a/Project/LineForm.cpp b/Project/LineForm.cpp index beab909..f0df0c7 100644 --- a/Project/LineForm.cpp +++ b/Project/LineForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "LineForm.h" #include "SwitchingForm.h" #include "Line.h" diff --git a/Project/LineForm.h b/Project/LineForm.h index 523e8bb..f80eafa 100644 --- a/Project/LineForm.h +++ b/Project/LineForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef LINEFORM_H #define LINEFORM_H #include "ElementForm.h" @@ -5,20 +22,27 @@ class Line; class SwitchingForm; +/** + * @class LineForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the line power data. + * @file LineForm.h + */ class LineForm : public LineFormBase { -public: + public: LineForm(wxWindow* parent, Line* line); virtual ~LineForm(); -protected: + + protected: virtual void OnCancelButtonClick(wxCommandEvent& event); virtual void OnOKButtonClick(wxCommandEvent& event); virtual void OnStabilityButtonClick(wxCommandEvent& event); - virtual void ReplaceStaticTextLabelChar(wxStaticText* staticText, wchar_t newChar); - virtual bool ValidateData(); - - wxWindow* m_parent = NULL; - Line* m_line = NULL; - + virtual void ReplaceStaticTextLabelChar(wxStaticText* staticText, wchar_t newChar); + virtual bool ValidateData(); + + wxWindow* m_parent = NULL; + Line* m_line = NULL; }; -#endif // LINEFORM_H +#endif // LINEFORM_H diff --git a/Project/Load.cpp b/Project/Load.cpp index c490d24..64cca31 100644 --- a/Project/Load.cpp +++ b/Project/Load.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Load.h" Load::Load() : Shunt() {} diff --git a/Project/Load.h b/Project/Load.h index ce71e5f..2244a88 100644 --- a/Project/Load.h +++ b/Project/Load.h @@ -1,17 +1,29 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef LOAD_H #define LOAD_H #include "LoadForm.h" #include "Shunt.h" -enum LoadType -{ - CONST_POWER = 0, - CONST_IMPEDANCE -}; +enum LoadType { CONST_POWER = 0, CONST_IMPEDANCE }; -struct LoadElectricalData -{ +struct LoadElectricalData { wxString name; double activePower = 100.0; ElectricalUnit activePowerUnit = UNIT_MW; @@ -20,14 +32,21 @@ struct LoadElectricalData LoadType loadType = CONST_POWER; }; +/** + * @class Load + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Loas shunt power element. + * @file Load.h + */ class Load : public Shunt { public: Load(); Load(wxString name); ~Load(); - - virtual Element* GetCopy(); + + virtual Element* GetCopy(); virtual bool AddParent(Element* parent, wxPoint2DDouble position); virtual void Draw(wxPoint2DDouble translation, double scale) const; virtual void Rotate(bool clockwise = true); @@ -37,7 +56,6 @@ class Load : public Shunt LoadElectricalData GetElectricalData() { return m_electricalData; } LoadElectricalData GetPUElectricalData(double systemPowerBase); void SetElectricalData(LoadElectricalData electricalData) { m_electricalData = electricalData; } - protected: std::vector<wxPoint2DDouble> m_triangPts; LoadElectricalData m_electricalData; diff --git a/Project/LoadForm.cpp b/Project/LoadForm.cpp index 270723a..67fd356 100644 --- a/Project/LoadForm.cpp +++ b/Project/LoadForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "LoadForm.h" #include "SwitchingForm.h" #include "Load.h" diff --git a/Project/LoadForm.h b/Project/LoadForm.h index 27f03c5..eff53c8 100644 --- a/Project/LoadForm.h +++ b/Project/LoadForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef LOADFORM_H #define LOADFORM_H #include "ElementForm.h" @@ -5,6 +22,13 @@ class Load; class SwitchingForm; +/** + * @class LoadForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the load power data. + * @file LoadForm.h + */ class LoadForm : public LoadFormBase { public: diff --git a/Project/Machines.cpp b/Project/Machines.cpp index c793469..8ee940f 100644 --- a/Project/Machines.cpp +++ b/Project/Machines.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Machines.h" #include "ControlElementContainer.h" diff --git a/Project/Machines.h b/Project/Machines.h index c1814d5..db6f449 100644 --- a/Project/Machines.h +++ b/Project/Machines.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef MACHINES_H #define MACHINES_H @@ -6,6 +23,13 @@ class ControlElementContainer; class ControlElementSolver; +/** + * @class Machines + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Abstract class for rotary machines power elements. + * @file Machines.h + */ class Machines : public PowerElement { public: diff --git a/Project/MainFrame.cpp b/Project/MainFrame.cpp index 436f1fd..429eabf 100644 --- a/Project/MainFrame.cpp +++ b/Project/MainFrame.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "MainFrame.h" #include "ArtMetro.h" #include "Workspace.h" diff --git a/Project/MainFrame.h b/Project/MainFrame.h index 2b91b20..e4f19b2 100644 --- a/Project/MainFrame.h +++ b/Project/MainFrame.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef MAINFRAME_H #define MAINFRAME_H @@ -34,8 +51,8 @@ enum { * @class MainFrame * @author Thales Lima Oliveira <thales@ufu.br> * @date 19/09/2017 - * @file MainFrame.h * @brief Main frame of the program. This class manage the ribbon menu and the notebook behavior. + * @file MainFrame.h */ class MainFrame : public MainFrameBase { diff --git a/Project/Multiplier.cpp b/Project/Multiplier.cpp index a44f254..2b5d702 100644 --- a/Project/Multiplier.cpp +++ b/Project/Multiplier.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Multiplier.h" #include "ConnectionLine.h" diff --git a/Project/Multiplier.h b/Project/Multiplier.h index 76a8679..f675b34 100644 --- a/Project/Multiplier.h +++ b/Project/Multiplier.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef MULTIPLIER_H #define MULTIPLIER_H @@ -5,6 +22,13 @@ class ConnectionLine; +/** + * @class Multiplier + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Multiplies two inputs. + * @file Multiplier.h + */ class Multiplier : public ControlElement { public: @@ -18,9 +42,9 @@ class Multiplier : public ControlElement virtual void Rotate(bool clockwise = true); virtual void UpdatePoints(); - + virtual bool Solve(double input, double timeStep); - + virtual Element* GetCopy(); }; diff --git a/Project/PowerElement.cpp b/Project/PowerElement.cpp index 379d341..4c4e072 100644 --- a/Project/PowerElement.cpp +++ b/Project/PowerElement.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "PowerElement.h" #ifdef USING_WX_3_0_X #include "DegreesAndRadians.h" diff --git a/Project/PowerElement.h b/Project/PowerElement.h index 9bf125d..93a2357 100644 --- a/Project/PowerElement.h +++ b/Project/PowerElement.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef POWERELEMENT_H #define POWERELEMENT_H @@ -70,8 +87,8 @@ enum PowerFlowDirection { * @class SwitchingData * @author Thales Lima Oliveira * @date 18/01/2017 - * @file PowerElement.h * @brief Switching data of power elements. + * @file PowerElement.h */ struct SwitchingData { std::vector<SwitchingType> swType; /**< Type of switching */ @@ -82,8 +99,8 @@ struct SwitchingData { * @class IntegrationConstant * @author Thales Lima Oliveira * @date 24/05/2017 - * @file PowerElement.h * @brief Integration constants to calculate dynamic elements through trapezoidal integration method + * @file PowerElement.h */ struct IntegrationConstant { double c; /**< C value */ @@ -92,10 +109,10 @@ struct IntegrationConstant { /** * @class PowerElement - * @author Thales Lima Oliveira + * @author Thales Lima Oliveira <thales@ufu.br> * @date 18/01/2017 + * @brief Abstract class of power elements. * @file PowerElement.h - * @brief Base class of power elements. */ class PowerElement : public Element { diff --git a/Project/PowerFlow.cpp b/Project/PowerFlow.cpp index fe59067..4a2b7c9 100644 --- a/Project/PowerFlow.cpp +++ b/Project/PowerFlow.cpp @@ -1,23 +1,30 @@ -#include "PowerFlow.h" - -PowerFlow::PowerFlow() - : ElectricCalculation() -{ -} +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ -PowerFlow::PowerFlow(std::vector<Element*> elementList) - : ElectricCalculation() -{ - GetElementsFromList(elementList); -} +#include "PowerFlow.h" +PowerFlow::PowerFlow() : ElectricCalculation() {} +PowerFlow::PowerFlow(std::vector<Element*> elementList) : ElectricCalculation() { GetElementsFromList(elementList); } PowerFlow::~PowerFlow() {} - bool PowerFlow::RunGaussSeidel(double systemPowerBase, - int maxIteration, - double error, - double initAngle, - double accFactor) + int maxIteration, + double error, + double initAngle, + double accFactor) { // Calculate the Ybus. if(!GetYBus(m_yBus, systemPowerBase)) { @@ -28,11 +35,11 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase, // Number of buses on the system. int numberOfBuses = static_cast<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<std::complex<double> > loadPower; // Only the load 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); @@ -72,7 +79,7 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase, } // Fill the power array - power.push_back(std::complex<double>(0.0, 0.0)); // Initial value + power.push_back(std::complex<double>(0.0, 0.0)); // Initial value loadPower.push_back(std::complex<double>(0.0, 0.0)); // Synchronous generator @@ -179,12 +186,12 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase, } // Gauss-Seidel method - std::vector<std::complex<double> > oldVoltage; // Old voltage array. + std::vector<std::complex<double> > oldVoltage; // Old voltage array. oldVoltage.resize(voltage.size()); auto oldBusType = busType; - int iteration = 0; // Current itaration number. + int iteration = 0; // Current itaration number. while(true) { // Reach the max number of iterations. @@ -214,7 +221,7 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase, // Apply the acceleration factor. newVolt = std::complex<double>(accFactor * (newVolt.real() - voltage[i].real()) + voltage[i].real(), - accFactor * (newVolt.imag() - voltage[i].imag()) + voltage[i].imag()); + accFactor * (newVolt.imag() - voltage[i].imag()) + voltage[i].imag()); voltage[i] = newVolt; } @@ -238,15 +245,15 @@ bool PowerFlow::RunGaussSeidel(double systemPowerBase, // Apply the acceleration factor. newVolt = std::complex<double>(accFactor * (newVolt.real() - voltage[i].real()) + voltage[i].real(), - accFactor * (newVolt.imag() - voltage[i].imag()) + voltage[i].imag()); + accFactor * (newVolt.imag() - voltage[i].imag()) + voltage[i].imag()); // Keep the same voltage magnitude. voltage[i] = std::complex<double>(std::abs(voltage[i]) * std::cos(std::arg(newVolt)), - std::abs(voltage[i]) * std::sin(std::arg(newVolt))); + std::abs(voltage[i]) * std::sin(std::arg(newVolt))); } - double busError = std::max( - std::abs(voltage[i].real() - oldVoltage[i].real()), std::abs(voltage[i].imag() - oldVoltage[i].imag())); + double busError = std::max(std::abs(voltage[i].real() - oldVoltage[i].real()), + std::abs(voltage[i].imag() - oldVoltage[i].imag())); if(busError > iterationError) iterationError = busError; } diff --git a/Project/PowerFlow.h b/Project/PowerFlow.h index 29e205a..54780b4 100644 --- a/Project/PowerFlow.h +++ b/Project/PowerFlow.h @@ -1,28 +1,51 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef POWERFLOW_H #define POWERFLOW_H #include "ElectricCalculation.h" #include <wx/string.h> -#include <wx/intl.h> //_() +#include <wx/intl.h> //_() +/** + * @class PowerFlow + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Calculate the power flow. + * @file PowerFlow.h + */ class PowerFlow : public ElectricCalculation { -public: + public: PowerFlow(); PowerFlow(std::vector<Element*> elementList); ~PowerFlow(); virtual bool RunGaussSeidel(double systemPowerBase = 100e6, - int maxIteration = 5000, - double error = 1e-6, - double initAngle = 0.0, - double accFactor = 1.0); + int maxIteration = 5000, + double error = 1e-6, + double initAngle = 0.0, + double accFactor = 1.0); virtual wxString GetErrorMessage() { return m_errorMsg; } - -protected: + protected: std::vector<std::vector<std::complex<double> > > m_yBus; wxString m_errorMsg = ""; }; -#endif // POWERFLOW_H +#endif // POWERFLOW_H diff --git a/Project/Project.mk b/Project/Project.mk index 922d62d..d74ffe2 100644 --- a/Project/Project.mk +++ b/Project/Project.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=NDSE-69 -Date :=19/09/2017 +Date :=05/10/2017 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/PropertiesData.cpp b/Project/PropertiesData.cpp index a9a57c4..dc12c82 100644 --- a/Project/PropertiesData.cpp +++ b/Project/PropertiesData.cpp @@ -1,10 +1,21 @@ -#include "PropertiesData.h" - -PropertiesData::PropertiesData() -{ -} +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ -PropertiesData::~PropertiesData() -{ -} +#include "PropertiesData.h" +PropertiesData::PropertiesData() {} +PropertiesData::~PropertiesData() {} diff --git a/Project/PropertiesData.h b/Project/PropertiesData.h index 634e60e..3e6bbf6 100644 --- a/Project/PropertiesData.h +++ b/Project/PropertiesData.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef PROPERTIESDATA_H #define PROPERTIESDATA_H @@ -37,6 +54,13 @@ struct GeneralData { GUITheme theme = THEME_LIGHT; }; +/** + * @class PropertiesData + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief General and simulation data manager. + * @file PropertiesData.h + */ class PropertiesData { public: diff --git a/Project/RateLimiter.cpp b/Project/RateLimiter.cpp index ea0db25..afba0ee 100644 --- a/Project/RateLimiter.cpp +++ b/Project/RateLimiter.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "RateLimiter.h" #include "RateLimiterForm.h" diff --git a/Project/RateLimiter.h b/Project/RateLimiter.h index 49596db..3d57498 100644 --- a/Project/RateLimiter.h +++ b/Project/RateLimiter.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef RATELIMITER_H #define RATELIMITER_H @@ -5,6 +22,13 @@ class RateLimiterForm; +/** + * @class RateLimiter + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Limits the rising and/or falling rate.<br> + * @file RateLimiter.h + */ class RateLimiter : public ControlElement { public: @@ -23,11 +47,26 @@ class RateLimiter : public ControlElement double GetLowLimit() const { return m_lowLimit; } void SetUpLimit(double upLimit) { m_upLimit = upLimit; } void SetLowLimit(double lowLimit) { m_lowLimit = lowLimit; } - + /** + * @brief Calculate the rate and limits it if exceeds.<br> + * + * The rate is calculated by: + * <center>\f$ rate = \frac{x(i) - y(i-1)}{\Delta t} \f$</center> + * Where, \f$ x(i) \f$ is the current input and \f$ y(i-1) \f$ is the previous output.<br><br> + * If the \f$rate\f$ is greater than rising rate (\f$ R \f$), the output will be:<br> + * <center>\f$ output = \Delta t \cdot R + y(i-1)\f$</center> + * If the \f$rate\f$ is lower than falling rate (\f$ F \f$), the output will be:<br><br> + * <center>\f$ output = \Delta t \cdot F + y(i-1) \f$</center> + * Otherwise: + * <center>\f$ output = input \f$</center>. + * @param input Input value. + * @param timeStep Time step. + * @return Always true. + */ virtual bool Solve(double input, double timeStep); - + virtual Element* GetCopy(); - + protected: double m_upLimit = 5.0; double m_lowLimit = -5.0; diff --git a/Project/RateLimiterForm.cpp b/Project/RateLimiterForm.cpp index c9b8a24..fa962d6 100644 --- a/Project/RateLimiterForm.cpp +++ b/Project/RateLimiterForm.cpp @@ -1,10 +1,27 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "RateLimiterForm.h" #include "RateLimiter.h" RateLimiterForm::RateLimiterForm(wxWindow* parent, RateLimiter* rateLimiter) : RateLimiterFormBase(parent) { SetSize(GetBestSize()); - + m_rateLimiter = rateLimiter; m_parent = parent; @@ -27,7 +44,7 @@ bool RateLimiterForm::ValidateData() m_rateLimiter->SetUpLimit(upLimit); m_rateLimiter->SetLowLimit(lowLimit); - + return true; } diff --git a/Project/RateLimiterForm.h b/Project/RateLimiterForm.h index 539504e..6958169 100644 --- a/Project/RateLimiterForm.h +++ b/Project/RateLimiterForm.h @@ -1,9 +1,33 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef RATELIMITERFORM_H #define RATELIMITERFORM_H #include "ElementForm.h" class RateLimiter; +/** + * @class RateLimiterForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the rate limit control data. + * @file RateLimiterForm.h + */ class RateLimiterForm : public RateLimiterFormBase { public: @@ -12,9 +36,9 @@ class RateLimiterForm : public RateLimiterFormBase bool ValidateData(); protected: - virtual void OnCancelButtonClick(wxCommandEvent& event) {EndModal(wxID_OK);} + virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_OK); } virtual void OnOKButtonClick(wxCommandEvent& event); - + wxWindow* m_parent = NULL; RateLimiter* m_rateLimiter = NULL; }; diff --git a/Project/ReactiveShuntElementForm.cpp b/Project/ReactiveShuntElementForm.cpp index ededa6b..985127d 100644 --- a/Project/ReactiveShuntElementForm.cpp +++ b/Project/ReactiveShuntElementForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "ReactiveShuntElementForm.h" #include "SwitchingForm.h" #include "Capacitor.h" diff --git a/Project/ReactiveShuntElementForm.h b/Project/ReactiveShuntElementForm.h index c5562c2..241e092 100644 --- a/Project/ReactiveShuntElementForm.h +++ b/Project/ReactiveShuntElementForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef REACTIVESHUNTELEMENTFORM_H #define REACTIVESHUNTELEMENTFORM_H #include "ElementForm.h" @@ -7,6 +24,13 @@ class Capacitor; class Inductor; class SwitchingForm; +/** + * @class ReactiveShuntElementForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the reactive shunt element power data. + * @file ReactiveShuntElementForm.h + */ class ReactiveShuntElementForm : public ReactiveShuntElementFormBase { public: diff --git a/Project/Shunt.cpp b/Project/Shunt.cpp index a0caab7..63def85 100644 --- a/Project/Shunt.cpp +++ b/Project/Shunt.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Shunt.h" Shunt::Shunt() : PowerElement() {} diff --git a/Project/Shunt.h b/Project/Shunt.h index 15b8efb..94424a4 100644 --- a/Project/Shunt.h +++ b/Project/Shunt.h @@ -1,15 +1,39 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef SHUNT_H #define SHUNT_H #include "PowerElement.h" #include "Bus.h" +/** + * @class Shunt + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Abstract class for shunt power elements. + * @file Shunt.h + */ class Shunt : public PowerElement { -public: - Shunt(); - ~Shunt(); - + public: + Shunt(); + ~Shunt(); + virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); } virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); } virtual void Move(wxPoint2DDouble position); @@ -24,9 +48,8 @@ public: protected: void UpdateSwitchesPosition(); void UpdatePowerFlowArrowsPosition(); - void DrawGround(wxPoint2DDouble position) const; + void DrawGround(wxPoint2DDouble position) const; bool m_inserted = false; - }; -#endif // SHUNT_H +#endif // SHUNT_H diff --git a/Project/SimulationsSettingsForm.cpp b/Project/SimulationsSettingsForm.cpp index 714e49b..a203662 100644 --- a/Project/SimulationsSettingsForm.cpp +++ b/Project/SimulationsSettingsForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "SimulationsSettingsForm.h" #include "PropertiesData.h" diff --git a/Project/SimulationsSettingsForm.h b/Project/SimulationsSettingsForm.h index d6b0a08..045a0c6 100644 --- a/Project/SimulationsSettingsForm.h +++ b/Project/SimulationsSettingsForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef SIMULATIONSSETTINGSFORM_H #define SIMULATIONSSETTINGSFORM_H @@ -5,17 +22,25 @@ class PropertiesData; +/** + * @class SimulationsSettingsForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the simulation data. + * @file SimulationsSettingsForm.h + */ class SimulationsSettingsForm : public SimulationsSettingsFormBase { -public: + public: SimulationsSettingsForm(wxWindow* parent, PropertiesData* properties); virtual ~SimulationsSettingsForm(); -protected: + + protected: virtual void OnPFMethodChoiceSelected(wxCommandEvent& event); virtual void OnButtonCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } virtual void OnButtonOKClick(wxCommandEvent& event); virtual bool ValidateData(); - + PropertiesData* m_properties; }; -#endif // SIMULATIONSSETTINGSFORM_H +#endif // SIMULATIONSSETTINGSFORM_H diff --git a/Project/Sum.cpp b/Project/Sum.cpp index 45dc80d..37d10f9 100644 --- a/Project/Sum.cpp +++ b/Project/Sum.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Sum.h" #include "SumForm.h" #include "ConnectionLine.h" diff --git a/Project/Sum.h b/Project/Sum.h index 72a71a5..e91e139 100644 --- a/Project/Sum.h +++ b/Project/Sum.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef SUM_H #define SUM_H @@ -6,9 +23,16 @@ class SumForm; class ConnectionLine; +/** + * @class Sum + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Sum the all inputs (can choose the input signal). + * @file Sum.h + */ class Sum : public ControlElement { -public: + public: enum Signal { SIGNAL_POSITIVE = 0, SIGNAL_NEGATIVE }; Sum(int id); ~Sum(); @@ -18,20 +42,19 @@ public: virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); } virtual bool ShowForm(wxWindow* parent, Element* element); virtual void Rotate(bool clockwise = true); - + virtual std::vector<Signal> GetSignalList() const { return m_signalList; } virtual void SetSignalList(std::vector<Signal> signalList) { m_signalList = signalList; } - virtual bool Solve(double input, double timeStep); - + virtual void UpdatePoints(); void AddInNode(); void RemoveInNode(); - + virtual Element* GetCopy(); -protected: + protected: std::vector<Signal> m_signalList; }; -#endif // SUM_H +#endif // SUM_H diff --git a/Project/SumForm.cpp b/Project/SumForm.cpp index fb0fa58..028b004 100644 --- a/Project/SumForm.cpp +++ b/Project/SumForm.cpp @@ -1,11 +1,27 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "SumForm.h" #include "Sum.h" -SumForm::SumForm(wxWindow* parent, Sum* sum) - : SumFormBase(parent) +SumForm::SumForm(wxWindow* parent, Sum* sum) : SumFormBase(parent) { SetSize(GetBestSize()); - + m_parent = parent; m_sum = sum; @@ -27,7 +43,6 @@ SumForm::SumForm(wxWindow* parent, Sum* sum) } SumForm::~SumForm() {} - void SumForm::OnOKClick(wxCommandEvent& event) { if(ValidateData()) EndModal(wxID_OK); @@ -39,8 +54,9 @@ bool SumForm::ValidateData() for(int i = 0; i < (int)m_textCtrlSigns->GetValue().length(); ++i) { if(m_textCtrlSigns->GetValue()[i] != ' ') signalStr += m_textCtrlSigns->GetValue()[i]; } - if(signalStr.size() < 2){ - wxMessageDialog msg(this, _("You must assign at least two signals."), _("Error"), wxOK | wxCENTRE | wxICON_ERROR); + if(signalStr.size() < 2) { + wxMessageDialog msg(this, _("You must assign at least two signals."), _("Error"), + wxOK | wxCENTRE | wxICON_ERROR); msg.ShowModal(); return false; } @@ -55,7 +71,8 @@ bool SumForm::ValidateData() signalList.push_back(Sum::SIGNAL_NEGATIVE); } break; default: { - wxMessageDialog msg(this, _("Value entered incorrectly in the field \"Signs\"."), _("Error"), wxOK | wxCENTRE | wxICON_ERROR); + wxMessageDialog msg(this, _("Value entered incorrectly in the field \"Signs\"."), _("Error"), + wxOK | wxCENTRE | wxICON_ERROR); msg.ShowModal(); return false; } diff --git a/Project/SumForm.h b/Project/SumForm.h index cf29421..9610202 100644 --- a/Project/SumForm.h +++ b/Project/SumForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef SUMFORM_H #define SUMFORM_H @@ -5,18 +22,25 @@ class Sum; +/** + * @class SumForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the sum control data. + * @file SumForm.h + */ class SumForm : public SumFormBase { -public: + public: SumForm(wxWindow* parent, Sum* sum); virtual ~SumForm(); - + bool ValidateData(); - -protected: + + protected: virtual void OnCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } virtual void OnOKClick(wxCommandEvent& event); wxWindow* m_parent = NULL; Sum* m_sum = NULL; }; -#endif // SUMFORM_H +#endif // SUMFORM_H diff --git a/Project/SwitchingForm.cpp b/Project/SwitchingForm.cpp index 29da9c2..8a52553 100644 --- a/Project/SwitchingForm.cpp +++ b/Project/SwitchingForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "SwitchingForm.h" #include "PowerElement.h" diff --git a/Project/SwitchingForm.h b/Project/SwitchingForm.h index cf39701..973648e 100644 --- a/Project/SwitchingForm.h +++ b/Project/SwitchingForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef SWITCHINGFORM_H #define SWITCHINGFORM_H @@ -5,13 +22,21 @@ class PowerElement; +/** + * @class SwitchingForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the switching data of power elements for electromechanical transient studies. + * @file SwitchingForm.h + */ class SwitchingForm : public SwitchingFormBase { -public: + public: SwitchingForm(wxWindow* parent); SwitchingForm(wxWindow* parent, PowerElement* element); virtual ~SwitchingForm(); -protected: + + protected: virtual void OnDownButtonClick(wxCommandEvent& event); virtual void OnUpButtonClick(wxCommandEvent& event); virtual void OnChangeProperties(wxPropertyGridEvent& event); @@ -20,9 +45,9 @@ protected: virtual void OnInsertButtonClick(wxCommandEvent& event); virtual void OnOKButtonClick(wxCommandEvent& event); virtual void OnRemoveButtonClick(wxCommandEvent& event); - + int m_maxID = 0; - + PowerElement* m_element = NULL; }; -#endif // SWITCHINGFORM_H +#endif // SWITCHINGFORM_H diff --git a/Project/SyncGenerator.cpp b/Project/SyncGenerator.cpp index 709e456..74806b6 100644 --- a/Project/SyncGenerator.cpp +++ b/Project/SyncGenerator.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "SyncMachineForm.h" #include "SyncGenerator.h" #include "ControlElementContainer.h" diff --git a/Project/SyncGenerator.h b/Project/SyncGenerator.h index 23ab87d..cb1b146 100644 --- a/Project/SyncGenerator.h +++ b/Project/SyncGenerator.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef SYNCGENERATOR_H #define SYNCGENERATOR_H @@ -82,11 +99,17 @@ struct SyncGeneratorElectricalData { double subEq; double subEd; double pe; - + double id; + double iq; + double sd; + double sq; + // Variables to extrapolate double oldId; double oldIq; double oldPe; + double oldSd; + double oldSq; // Integration constants IntegrationConstant icSpeed; @@ -107,6 +130,13 @@ struct SyncGeneratorElectricalData { Machines::SyncMachineModel model = Machines::SM_MODEL_1; }; +/** + * @class SyncGenerator + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Synchronous generator power element. + * @file SyncGenerator.h + */ class SyncGenerator : public Machines { public: diff --git a/Project/SyncMachineForm.cpp b/Project/SyncMachineForm.cpp index 6ca490a..486a043 100644 --- a/Project/SyncMachineForm.cpp +++ b/Project/SyncMachineForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "GeneratorStabForm.h" #include "SyncMachineForm.h" #include "SyncGenerator.h" diff --git a/Project/SyncMachineForm.h b/Project/SyncMachineForm.h index 518d16c..0a611ad 100644 --- a/Project/SyncMachineForm.h +++ b/Project/SyncMachineForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef SYNCMACHINEFORM_H #define SYNCMACHINEFORM_H @@ -7,6 +24,13 @@ class GeneratorStabForm; class SyncGenerator; class SyncMotor; +/** + * @class SyncMachineForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the synchronous machine power data. + * @file SyncMachineForm.h + */ class SyncMachineForm : public SyncMachineFormBase { public: diff --git a/Project/SyncMotor.cpp b/Project/SyncMotor.cpp index fb24bac..1a5b20d 100644 --- a/Project/SyncMotor.cpp +++ b/Project/SyncMotor.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "SyncMachineForm.h" #include "SyncMotor.h" diff --git a/Project/SyncMotor.h b/Project/SyncMotor.h index f6f21c4..4950922 100644 --- a/Project/SyncMotor.h +++ b/Project/SyncMotor.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef SYNCMOTOR_H #define SYNCMOTOR_H @@ -107,6 +124,13 @@ struct SyncMotorElectricalData { Machines::SyncMachineModel model = Machines::SM_MODEL_1; }; +/** + * @class SyncMotor + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Synchronous motor (synchronous compensator) power element. + * @file SyncMotor.h + */ class SyncMotor : public Machines { public: diff --git a/Project/Text.cpp b/Project/Text.cpp index aa36aef..52ec26f 100644 --- a/Project/Text.cpp +++ b/Project/Text.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "TextForm.h" #include "Text.h" diff --git a/Project/Text.h b/Project/Text.h index 062032c..f5544f1 100644 --- a/Project/Text.h +++ b/Project/Text.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef TEXT_H #define TEXT_H @@ -45,9 +62,16 @@ enum DataType { DATA_PF_CURRENT }; +/** + * @class Text + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Element that shows power element informations in workspace. + * @file Text.h + */ class Text : public GraphicalElement { -public: + public: Text(); Text(wxPoint2DDouble position); ~Text(); @@ -79,8 +103,7 @@ public: int GetFontSize() const { return m_fontSize; } const ElectricalUnit GetUnit() const { return m_unit; } int GetDecimalPlaces() const { return m_decimalPlaces; } - -protected: + protected: wxGLString* m_glString = NULL; wxGLStringArray* m_glStringArray = NULL; @@ -98,4 +121,4 @@ protected: int m_decimalPlaces = 2; }; -#endif // TEXT_H +#endif // TEXT_H diff --git a/Project/TextForm.cpp b/Project/TextForm.cpp index b2624ba..993593c 100644 --- a/Project/TextForm.cpp +++ b/Project/TextForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "TextForm.h" TextForm::TextForm(wxWindow* parent, Text* text, std::vector<Element*> elementList, double systemPowerBase) diff --git a/Project/TextForm.h b/Project/TextForm.h index 069c0e4..e6d08e8 100644 --- a/Project/TextForm.h +++ b/Project/TextForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef TEXTFORM_H #define TEXTFORM_H #include "ElementForm.h" @@ -5,9 +22,16 @@ #include "Text.h" #include "ElectricCalculation.h" +/** + * @class TextForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the text graphical data. + * @file TextForm.h + */ class TextForm : public TextFormBase { -public: + public: TextForm(wxWindow* parent, Text* text, std::vector<Element*> elementList, double systemPowerBase = 100e6); virtual ~TextForm(); @@ -21,7 +45,7 @@ public: virtual void Preview(); virtual bool ValidateData(); -protected: + protected: virtual void OnUnitChoiceSelected(wxCommandEvent& event); virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } virtual void OnOKButtonClick(wxCommandEvent& event); @@ -38,4 +62,4 @@ protected: ElectricCalculation m_allElements; double m_systemPowerBase; }; -#endif // TEXTFORM_H +#endif // TEXTFORM_H diff --git a/Project/TransferFunction.cpp b/Project/TransferFunction.cpp index b91627a..ed6640a 100644 --- a/Project/TransferFunction.cpp +++ b/Project/TransferFunction.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "TransferFunction.h" #include "TransferFunctionForm.h" @@ -256,7 +273,8 @@ void TransferFunction::CalculateSpaceState(int maxIteration, double error) int order = static_cast<int>(m_denominator.size()); std::vector<double> denominator = m_denominator; std::vector<double> numerator; - + + //[Ref.] http://lpsa.swarthmore.edu/Representations/SysRepTransformations/TF2SS.html int k = order; for(int i = 0; i < order; i++) { int numIndex = i - (order - static_cast<int>(m_numerator.size())); diff --git a/Project/TransferFunction.h b/Project/TransferFunction.h index aab4bd2..af84ba5 100644 --- a/Project/TransferFunction.h +++ b/Project/TransferFunction.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef TRANSFERFUNCTION_H #define TRANSFERFUNCTION_H @@ -8,6 +25,13 @@ class TransferFunctionForm; +/** + * @class TransferFunction + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Calculates the time response by a frequency domain transfer function. + * @file TransferFunction.h + */ class TransferFunction : public ControlElement { public: @@ -34,9 +58,23 @@ class TransferFunction : public ControlElement virtual void UpdateTFText(); virtual void UpdateText() { UpdateTFText(); } virtual SpaceState GetSpaceState() { return m_ss; } + /** + * @brief Convert the transfer function to space state on controllable canonical form (CCF). + * @param maxIteration Max number of solution iteration. + * @param error Tolerance for calculation. + */ virtual void CalculateSpaceState(int maxIteration = 100, double error = 1e-3); + /** + * @brief Calculates the time response by the space state form of transfer function. + * + * Uses the implicit trapezoidal rule to solve: + * <center>\f$ y_{n+1}=y_n+\frac{1}{2}h(y'_n+y'_{n+1}) \f$</center> + * @param input Input value. + * @param timeStep Time step. + * @return true if the calculation converges, false otherwise. + */ virtual bool Solve(double input, double timeStep); - + virtual Element* GetCopy(); protected: diff --git a/Project/TransferFunctionForm.cpp b/Project/TransferFunctionForm.cpp index 0317da6..0d8450e 100644 --- a/Project/TransferFunctionForm.cpp +++ b/Project/TransferFunctionForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "TransferFunctionForm.h" #include "TransferFunction.h" @@ -5,7 +22,7 @@ TransferFunctionForm::TransferFunctionForm(wxWindow* parent, TransferFunction* t : TransferFunctionFormBase(parent) { SetSize(GetBestSize()); - + m_parent = parent; m_tf = transferFunction; LoadTFData(); diff --git a/Project/TransferFunctionForm.h b/Project/TransferFunctionForm.h index 269eda6..ebc3b26 100644 --- a/Project/TransferFunctionForm.h +++ b/Project/TransferFunctionForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef TRANSFERFUNCTIONFORM_H #define TRANSFERFUNCTIONFORM_H @@ -5,19 +22,26 @@ class TransferFunction; +/** + * @class TransferFunctionForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the transfer function control data. + * @file TransferFunctionForm.h + */ class TransferFunctionForm : public TransferFunctionFormBase { -public: + public: TransferFunctionForm(wxWindow* parent, TransferFunction* transferFunction); virtual ~TransferFunctionForm(); bool ValidateData(); -protected: + protected: virtual void OnCancelClick(wxCommandEvent& event); virtual void OnOKClick(wxCommandEvent& event); void LoadTFData(); - + wxWindow* m_parent = NULL; TransferFunction* m_tf = NULL; }; -#endif // TRANSFERFUNCTIONFORM_H +#endif // TRANSFERFUNCTIONFORM_H diff --git a/Project/Transformer.cpp b/Project/Transformer.cpp index 8f8ecb5..75816ce 100644 --- a/Project/Transformer.cpp +++ b/Project/Transformer.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "TransformerForm.h" #include "Transformer.h" @@ -460,7 +477,7 @@ TransformerElectricalData Transformer::GetPUElectricalData(double systemBasePowe // Resistance double r = data.resistance; - if(data.resistanceUnit == UNIT_PU) { + if(data.resistanceUnit == UNIT_PU) { if(data.useTransformerPower) data.resistance = (r * transformerBaseImpedance) / systemBaseImpedance; } else { data.resistance = r / systemBaseImpedance; @@ -501,16 +518,16 @@ TransformerElectricalData Transformer::GetPUElectricalData(double systemBasePowe // Secondary ground ind reactance double xgs = data.secondaryGrndReactance; if(data.useTransformerPower) data.secondaryGrndReactance = (xgs * transformerBaseImpedance) / systemBaseImpedance; - + if(!m_online) { - data.powerFlow[0] = std::complex<double>(0,0); - data.powerFlow[1] = std::complex<double>(0,0); - data.faultCurrent[0][0] = std::complex<double>(0,0); - data.faultCurrent[0][1] = std::complex<double>(0,0); - data.faultCurrent[0][2] = std::complex<double>(0,0); - data.faultCurrent[1][0] = std::complex<double>(0,0); - data.faultCurrent[1][1] = std::complex<double>(0,0); - data.faultCurrent[1][2] = std::complex<double>(0,0); + data.powerFlow[0] = std::complex<double>(0, 0); + data.powerFlow[1] = std::complex<double>(0, 0); + data.faultCurrent[0][0] = std::complex<double>(0, 0); + data.faultCurrent[0][1] = std::complex<double>(0, 0); + data.faultCurrent[0][2] = std::complex<double>(0, 0); + data.faultCurrent[1][0] = std::complex<double>(0, 0); + data.faultCurrent[1][1] = std::complex<double>(0, 0); + data.faultCurrent[1][2] = std::complex<double>(0, 0); } return data; diff --git a/Project/Transformer.h b/Project/Transformer.h index 689b8f6..3b0d314 100644 --- a/Project/Transformer.h +++ b/Project/Transformer.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef TRANSFORMER_H #define TRANSFORMER_H @@ -37,8 +54,8 @@ struct TransformerElectricalData { bool useTransformerPower = false; // Power flow (p.u.) - std::complex<double> current[2] = { std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0) }; - std::complex<double> powerFlow[2] = { std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0) }; + std::complex<double> current[2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)}; + std::complex<double> powerFlow[2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)}; // Fault double zeroResistance = 0.0; @@ -51,9 +68,16 @@ struct TransformerElectricalData { std::complex<double> faultCurrent[2][3]; }; +/** + * @class Transformer + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 06/10/2017 + * @brief Two-winding transformer power element. + * @file Transformer.h + */ class Transformer : public Branch { -public: + public: Transformer(); Transformer(wxString name); virtual ~Transformer(); @@ -78,9 +102,9 @@ public: virtual void SetElectricaData(TransformerElectricalData electricalData) { m_electricalData = electricalData; } virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit); -protected: + protected: void UpdatePowerFlowArrowsPosition(); TransformerElectricalData m_electricalData; }; -#endif // TRANSFORMER_H +#endif // TRANSFORMER_H diff --git a/Project/TransformerForm.cpp b/Project/TransformerForm.cpp index 920b0a0..7c921c4 100644 --- a/Project/TransformerForm.cpp +++ b/Project/TransformerForm.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "TransformerForm.h" #include "SwitchingForm.h" #include "Transformer.h" @@ -6,8 +23,8 @@ TransformerForm::TransformerForm(wxWindow* parent, Transformer* transformer) : T { m_choiceResistance->SetString(1, L'\u03A9'); m_choiceReactance->SetString(1, L'\u03A9'); - - //Reset connections choice labels (to be translated) + + // Reset connections choice labels (to be translated) m_choiceConnection->SetString(0, _("Grounded Wye - Grounded Wye")); m_choiceConnection->SetString(1, _("Wye - Grounded Wye")); m_choiceConnection->SetString(2, _("Grounded Wye - Wye")); @@ -99,7 +116,7 @@ TransformerForm::TransformerForm(wxWindow* parent, Transformer* transformer) : T m_textCtrlTurnRatio->SetValue(Transformer::StringFromDouble(data.turnsRatio)); m_textCtrlPhaseShift->SetValue(Transformer::StringFromDouble(data.phaseShift)); - + m_checkUseTransformerPower->SetValue(data.useTransformerPower); m_textCtrlZeroResistance->SetValue(Transformer::StringFromDouble(data.zeroResistance)); diff --git a/Project/TransformerForm.h b/Project/TransformerForm.h index fb76809..82daadc 100644 --- a/Project/TransformerForm.h +++ b/Project/TransformerForm.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef TRANSFORMERFORM_H #define TRANSFORMERFORM_H @@ -6,6 +23,13 @@ class SwitchingForm; class Transformer; +/** + * @class TransformerForm + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Form to edit the transformer power data. + * @file TransformerForm.h + */ class TransformerForm : public TransformerFormBase { public: diff --git a/Project/Workspace.cpp b/Project/Workspace.cpp index 70bd345..bd385b5 100644 --- a/Project/Workspace.cpp +++ b/Project/Workspace.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "Workspace.h" #include "Camera.h" #include "Element.h" @@ -1451,6 +1468,8 @@ bool Workspace::RunStability() } ElementPlotData tests(_("Error"), ElementPlotData::CT_TEST); tests.AddData(stability.m_wErrorVector, _("Speed error")); + tests.AddData(stability.m_sdCVector, _("Sd")); + tests.AddData(stability.m_sqCVector, _("Sq")); tests.AddData(stability.m_numItVector, _("Number iterations")); plotDataList.push_back(tests); diff --git a/Project/Workspace.h b/Project/Workspace.h index 09b94e5..7cc8b33 100644 --- a/Project/Workspace.h +++ b/Project/Workspace.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef WORKSPACE_H #define WORKSPACE_H @@ -57,9 +74,9 @@ enum ElementID { * @class Workspace * @author Thales Lima Oliveira <thales@ufu.br> * @date 19/09/2017 + * @brief This class manages the graphical and power elements. + * It is responsible for handling the user's interaction with the elements. * @file Workspace.h - * @brief This class manages the graphical and power elements. It is responsible for handling the user's interaction - * with the elements. */ class Workspace : public WorkspaceBase { |