diff options
-rw-r--r-- | Project/Branch.cpp | 2 | ||||
-rw-r--r-- | Project/Branch.h | 4 | ||||
-rw-r--r-- | Project/Bus.cpp | 4 | ||||
-rw-r--r-- | Project/Bus.h | 4 | ||||
-rw-r--r-- | Project/ControlElement.cpp | 10 | ||||
-rw-r--r-- | Project/ControlElement.h | 14 | ||||
-rw-r--r-- | Project/Element.cpp | 132 | ||||
-rw-r--r-- | Project/Element.h | 534 | ||||
-rw-r--r-- | Project/Fault.cpp | 24 | ||||
-rw-r--r-- | Project/Fault.h | 6 | ||||
-rw-r--r-- | Project/GraphicalElement.cpp | 10 | ||||
-rw-r--r-- | Project/GraphicalElement.h | 14 | ||||
-rw-r--r-- | Project/Machines.cpp | 2 | ||||
-rw-r--r-- | Project/Machines.h | 4 | ||||
-rw-r--r-- | Project/MainFrame.cpp | 8 | ||||
-rw-r--r-- | Project/PowerElement.cpp | 141 | ||||
-rw-r--r-- | Project/PowerElement.h | 180 | ||||
-rw-r--r-- | Project/Project.mk | 62 | ||||
-rw-r--r-- | Project/Project.project | 38 | ||||
-rw-r--r-- | Project/Project.txt | 2 | ||||
-rw-r--r-- | Project/Shunt.cpp | 2 | ||||
-rw-r--r-- | Project/Shunt.h | 4 | ||||
-rw-r--r-- | Project/SwitchingForm.cpp | 4 | ||||
-rw-r--r-- | Project/SwitchingForm.h | 6 | ||||
-rw-r--r-- | Project/Text.cpp | 4 | ||||
-rw-r--r-- | Project/Text.h | 5 | ||||
-rw-r--r-- | Project/Workspace.cpp | 43 | ||||
-rw-r--r-- | Project/Workspace.h | 5 |
28 files changed, 979 insertions, 289 deletions
diff --git a/Project/Branch.cpp b/Project/Branch.cpp index e971411..326b7e0 100644 --- a/Project/Branch.cpp +++ b/Project/Branch.cpp @@ -1,7 +1,7 @@ #include "Branch.h" Branch::Branch() - : Element() + : PowerElement() { } Branch::~Branch() {} diff --git a/Project/Branch.h b/Project/Branch.h index ba7108a..461738f 100644 --- a/Project/Branch.h +++ b/Project/Branch.h @@ -1,10 +1,10 @@ #ifndef BRANCH_H #define BRANCH_H -#include "Element.h" +#include "PowerElement.h" #include "Bus.h" -class Branch : public Element +class Branch : public PowerElement { public: Branch(); diff --git a/Project/Bus.cpp b/Project/Bus.cpp index 4a375ae..9d0de98 100644 --- a/Project/Bus.cpp +++ b/Project/Bus.cpp @@ -1,11 +1,11 @@ #include "Bus.h" Bus::Bus() - : Element() + : PowerElement() { } Bus::Bus(wxPoint2DDouble position) - : Element() + : PowerElement() { m_width = 100.0; m_height = 5.0; diff --git a/Project/Bus.h b/Project/Bus.h index c7f66ef..2522be3 100644 --- a/Project/Bus.h +++ b/Project/Bus.h @@ -2,7 +2,7 @@ #define BUS_H #include "BusForm.h" -#include "Element.h" +#include "PowerElement.h" struct BusElectricalData { int number = 0; @@ -39,7 +39,7 @@ struct BusElectricalData { double stabFaultReactance = 0.0; }; -class Bus : public Element +class Bus : public PowerElement { public: Bus(); diff --git a/Project/ControlElement.cpp b/Project/ControlElement.cpp new file mode 100644 index 0000000..d12f9cf --- /dev/null +++ b/Project/ControlElement.cpp @@ -0,0 +1,10 @@ +#include "ControlElement.h" + +ControlElement::ControlElement() : Element() +{ +} + +ControlElement::~ControlElement() +{ +} + diff --git a/Project/ControlElement.h b/Project/ControlElement.h new file mode 100644 index 0000000..69f9d83 --- /dev/null +++ b/Project/ControlElement.h @@ -0,0 +1,14 @@ +#ifndef CONTROLELEMENT_H +#define CONTROLELEMENT_H + +#include "Element.h" + +class ControlElement : public Element +{ +public: + ControlElement(); + ~ControlElement(); + +}; + +#endif // CONTROLELEMENT_H diff --git a/Project/Element.cpp b/Project/Element.cpp index 53eaa26..fa08905 100644 --- a/Project/Element.cpp +++ b/Project/Element.cpp @@ -1,15 +1,6 @@ #include "Element.h" -Element::Element() -{ - m_busColour.SetRGBA(0.0, 0.3, 1.0, 1.0); - m_onlineElementColour.SetRGBA(0.2, 0.2, 0.2, 1.0); - m_offlineElementColour.SetRGBA(0.5, 0.5, 0.5, 1.0); - m_closedSwitchColour.SetRGBA(0.0, 0.4, 0.0, 1.0); - m_openedSwitchColour.SetRGBA(1.0, 0.1, 0.1, 1.0); - m_selectionColour.SetRGBA(0.0, 0.5, 1.0, 0.5); - m_powerFlowArrowColour.SetRGBA(1.0, 0.51, 0.0, 1.0); -} +Element::Element() {} Element::~Element() {} @@ -111,26 +102,6 @@ void Element::StartMove(wxPoint2DDouble position) } void Element::Move(wxPoint2DDouble position) { SetPosition(m_movePos + position - m_moveStartPt); } -wxPoint2DDouble Element::GetSwitchPoint(Element* parent, wxPoint2DDouble parentPoint, wxPoint2DDouble secondPoint) const -{ - double swLineSize = 25.0; - wxPoint2DDouble swPoint = wxPoint2DDouble(parentPoint.m_x, parentPoint.m_y - swLineSize); - - // Rotate the second point (to compare). - double angle = parent->GetAngle(); - - secondPoint = wxPoint2DDouble(std::cos(wxDegToRad(-angle)) * (secondPoint.m_x - parentPoint.m_x) - - std::sin(wxDegToRad(-angle)) * (secondPoint.m_y - parentPoint.m_y) + parentPoint.m_x, - std::sin(wxDegToRad(-angle)) * (secondPoint.m_x - parentPoint.m_x) + - std::cos(wxDegToRad(-angle)) * (secondPoint.m_y - parentPoint.m_y) + parentPoint.m_y); - - // Rotate - if(secondPoint.m_y > parentPoint.m_y) angle -= 180.0; - return wxPoint2DDouble(std::cos(wxDegToRad(angle)) * (swPoint.m_x - parentPoint.m_x) - - std::sin(wxDegToRad(angle)) * (swPoint.m_y - parentPoint.m_y) + parentPoint.m_x, - std::sin(wxDegToRad(angle)) * (swPoint.m_x - parentPoint.m_x) + - std::cos(wxDegToRad(angle)) * (swPoint.m_y - parentPoint.m_y) + parentPoint.m_y); -} wxPoint2DDouble Element::WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX, double offsetY) const { @@ -241,53 +212,6 @@ bool Element::RotatedRectanglesIntersects(wxRect2DDouble rect1, return true; } -void Element::UpdateSwitches() -{ - // General method, to one switch only. - 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); -} - -void Element::DrawSwitches() const -{ - int i = 0; - for(auto it = m_parentList.begin(); it != m_parentList.end(); it++) { - Element* parent = *it; - if(parent) { - if(m_online) { - glColor4dv(m_closedSwitchColour.GetRGBA()); - } else { - glColor4dv(m_openedSwitchColour.GetRGBA()); - } - - glPushMatrix(); - glTranslated(m_switchRect[i].GetPosition().m_x + m_switchSize / 2.0, - m_switchRect[i].GetPosition().m_y + m_switchSize / 2.0, 0.0); - glRotated(parent->GetAngle(), 0.0, 0.0, 1.0); - glTranslated(-m_switchRect[i].GetPosition().m_x - m_switchSize / 2.0, - -m_switchRect[i].GetPosition().m_y - m_switchSize / 2.0, 0.0); - - DrawRectangle(m_switchRect[i].GetPosition() + wxPoint2DDouble(m_switchSize / 2.0, m_switchSize / 2.0), - m_switchSize, m_switchSize); - - glPopMatrix(); - } - i++; - } -} - -bool Element::SwitchesContains(wxPoint2DDouble position) const -{ - for(int i = 0; i < (int)m_switchRect.size(); i++) { - if(m_parentList[i]) { - if(m_switchRect[i].Contains(position)) return true; - } - } - return false; -} - void Element::SetOnline(bool online) { // Check if any parent is null. @@ -395,60 +319,6 @@ wxString Element::StringFromDouble(double value, int minDecimal) return formatedStr; } -void Element::CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges) -{ - double arrowRate = 100.0; // One arrow to each "arrowRate" distance in pixels. - - if(edges.size() < 2) return; - - // Clear all power flow points - for(int i = 0; i < (int)m_powerFlowArrow.size(); i++) m_powerFlowArrow[i].clear(); - m_powerFlowArrow.clear(); - - for(int i = 1; i < (int)edges.size(); i++) { - wxPoint2DDouble pt1 = edges[i - 1]; - wxPoint2DDouble pt2 = edges[i]; - - double angle = std::atan2(pt2.m_y - pt1.m_y, pt2.m_x - pt1.m_x); - - wxPoint2DDouble rotPt2( - std::cos(-angle) * (pt2.m_x - pt1.m_x) - std::sin(-angle) * (pt2.m_y - pt1.m_y) + pt1.m_x, - std::sin(-angle) * (pt2.m_x - pt1.m_x) + std::cos(-angle) * (pt2.m_y - pt1.m_y) + pt1.m_y); - - int numArrows = std::abs(pt1.m_x - rotPt2.m_x) / arrowRate; - if(numArrows == 0) numArrows = 1; - - for(int i = 0; i < numArrows; i++) { - wxPoint2DDouble arrowCenter(pt1.m_x + ((rotPt2.m_x - pt1.m_x) / double(numArrows + 1)) * double(i + 1), - pt1.m_y + ((rotPt2.m_y - pt1.m_y) / double(numArrows + 1)) * double(i + 1)); - - std::vector<wxPoint2DDouble> triPts; - triPts.push_back(arrowCenter + wxPoint2DDouble(5.0, 0.0)); - triPts.push_back(arrowCenter + wxPoint2DDouble(-5.0, 5.0)); - triPts.push_back(arrowCenter + wxPoint2DDouble(-5.0, -5.0)); - - // Rotate back. - for(int i = 0; i < 3; i++) { - triPts[i] = wxPoint2DDouble( - std::cos(angle) * (triPts[i].m_x - pt1.m_x) - std::sin(angle) * (triPts[i].m_y - pt1.m_y) + pt1.m_x, - std::sin(angle) * (triPts[i].m_x - pt1.m_x) + std::cos(angle) * (triPts[i].m_y - pt1.m_y) + - pt1.m_y); - } - m_powerFlowArrow.push_back(triPts); - } - } -} - -void Element::DrawPowerFlowPts() const -{ - if(m_online) { - glColor4dv(m_powerFlowArrowColour.GetRGBA()); - for(int i = 0; i < (int)m_powerFlowArrow.size(); i++) { - DrawTriangle(m_powerFlowArrow[i]); - } - } -} - void Element::ReplaceParent(Element* oldParent, Element* newParent) { for(int i = 0; i < (int)m_parentList.size(); i++) { diff --git a/Project/Element.h b/Project/Element.h index 01fef43..8a9f56f 100644 --- a/Project/Element.h +++ b/Project/Element.h @@ -11,76 +11,75 @@ #include <wx/log.h> +/** + * @enum PickboxID + * @brief ID of the pickbox. +*/ enum PickboxID { - ID_PB_NONE = 0, - ID_PB_RIGHT, - ID_PB_LEFT, - ID_PB_RIGHT_BOTTOM, - ID_PB_RIGHT_TOP, - ID_PB_LEFT_BOTTOM, - ID_PB_LEFT_TOP + ID_PB_NONE = 0, /**< No pickbox */ + ID_PB_RIGHT, /**< Right pickbox */ + ID_PB_LEFT, /**< Left pickbox */ + ID_PB_RIGHT_BOTTOM, /**< Right-bottom pickbox */ + ID_PB_RIGHT_TOP, /**< Right-top pickbox */ + ID_PB_LEFT_BOTTOM, /**< Left-bottom pickbox */ + ID_PB_LEFT_TOP /**< Left-top pickbox */ }; +/** + * @enum ContextMenuID + * @brief ID of contex menu itens. +*/ enum ContextMenuID { - ID_EDIT_ELEMENT = 0, - - ID_LINE_ADD_NODE, - ID_LINE_REMOVE_NODE, - - ID_ROTATE_CLOCK, - ID_ROTATE_COUNTERCLOCK, - ID_DELETE -}; - -enum ElectricalUnit { - UNIT_PU = 0, - UNIT_V, - UNIT_kV, - UNIT_A, - UNIT_kA, - UNIT_W, - UNIT_kW, - UNIT_MW, - UNIT_VA, - UNIT_kVA, - UNIT_MVA, - UNIT_VAr, - UNIT_kVAr, - UNIT_MVAr, - UNIT_OHM, - UNIT_OHM_km, - UNIT_S, - UNIT_S_km, - UNIT_DEGREE, - UNIT_RADIAN -}; - -enum FaultData { - FAULT_THREEPHASE = 0, - FAULT_2LINE, - FAULT_2LINE_GROUND, - FAULT_LINE_GROUND, - FAULT_LINE_A, - FAULT_LINE_B, - FAULT_LINE_C -}; - -enum SwitchingType { SW_INSERT = 0, SW_REMOVE }; - -enum PowerFlowDirection { PF_NONE = 0, PF_TO_BUS, PF_TO_ELEMENT, PF_BUS1_TO_BUS2, PF_BUS2_TO_BUS1 }; - -struct SwitchingData { - std::vector<SwitchingType> swType; - std::vector<double> swTime; + ID_EDIT_ELEMENT = 0, /**< Edit element */ + ID_LINE_ADD_NODE, /**< Add node on power lines */ + ID_LINE_REMOVE_NODE, /**< Remove power line node */ + ID_ROTATE_CLOCK, /**< Rotate the element clockwise */ + ID_ROTATE_COUNTERCLOCK, /**< Rotate the element counter-clockwise */ + ID_DELETE /**< Delete the element */ }; +/** + * @class OpenGLColour + * @author Thales Lima Oliveira + * @date 18/01/2017 + * @file Element.h + * @brief Class to manage color of OpenGL. + */ class OpenGLColour { public: + /** + * @brief Default construnctor. Use SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha). + */ OpenGLColour(); + + /** + * @brief Constructor with RGBA input. The colour values must be between 0.0 and 1.0. + * @param red Red colour value. + * @param green Green colour value. + * @param blue Blue colcour value. + * @param alpha Apha channel value. + */ OpenGLColour(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); + + /** + * @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. + * @param green Green colour value. + * @param blue Blue colcour value. + * @param alpha Apha channel value. + */ void SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); + + /** + * @brief Get colour in RGBA. + * @return RGBA colour. + */ const GLdouble* GetRGBA() const { return rgba; } protected: GLdouble rgba[4]; @@ -89,82 +88,362 @@ protected: class Element { public: + /** + * @brief Constructor. + */ Element(); + + /** + * @brief Destructor. + */ virtual ~Element(); - // Setters + /** + * @brief Set if the element are being dragged. + * @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. + */ void SetPosition(const wxPoint2DDouble position); + + /** + * @brief Set element selection + * @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. + */ void SetOnline(bool online = true); + + /** + * @brief Set the list of points that connect the element to the bus. + * @param pointList List of points. + */ virtual void SetPointList(std::vector<wxPoint2DDouble> pointList) { m_pointList = pointList; } - // Getters + + /** + * @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; } - // Pure-virtuals methods + + /** + * @brief Add a parent to the element. The parent must be a bus. The element basic points are calculated in this + * method, so apply this when the element is being inserted. + * @param parent Element parent. + * @param position Node position in the parent. + */ virtual bool AddParent(Element* parent, wxPoint2DDouble position) = 0; + + /** + * @brief Checks if the element contains a position. + * @param position Position to be checked. + */ virtual bool Contains(wxPoint2DDouble position) const = 0; + + /** + * @brief Check if the element's rect intersects other rect. + * @param rect Rect to check intersection. + */ virtual bool Intersects(wxRect2DDouble rect) const = 0; - // General methods + /** + * @brief Get a the element copy. + * @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. + */ virtual void AddChild(Element* child); + + /** + * @brief Remove a child from the list. + * @param child Child to remove. + */ virtual void RemoveChild(Element* child); + + /** + * @brief Replace a child from the list. + * @param oldChild Old child. + * @param newChild New child. + */ virtual void ReplaceChild(Element* oldChild, Element* newChild); + + /** + * @brief Get the tip text. + * @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. + */ virtual void StartMove(wxPoint2DDouble position); + + /** + * @brief Move the element other position. + * @param position Position that the element will be moved. Use StartMove(wxPoint2DDouble position) before start + * moving. + */ virtual void Move(wxPoint2DDouble position); + + /** + * @brief Move a node. StartMove(wxPoint2DDouble position) before start moving. + * @param parent Node's parent. + * @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. + * @param parent Node parent. + * @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. + * @param newParent New parent. + */ virtual void ReplaceParent(Element* oldParent, Element* newParent); - virtual void RotateNode(Element* parent, bool clockwise = true) {} - virtual wxPoint2DDouble - GetSwitchPoint(Element* parent, wxPoint2DDouble parentPoint, wxPoint2DDouble secondPoint) const; - virtual bool SwitchesContains(wxPoint2DDouble position) const; - virtual void UpdateSwitches(); - virtual void DrawSwitches() const; - virtual void CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges); - virtual void DrawPowerFlowPts() const; + /** + * @brief Rotate a node. + * @param parent Node's parent. + * @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. + * @param position Position to be checked. + * @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. + * @param scale System scale + * @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; + + /** + * @brief Convert a generic position to screen position. + * @param position Position to be converted. + * @param translation System translation. + * @param scale System scale. + * @param offsetX Offset in X axis. + * @param offsetY Offset in Y axis. + */ virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble position, wxPoint2DDouble translation, double scale, double offsetX = 0.0, double offsetY = 0.0) const; virtual bool + + /** + * @brief Check if two roteted rectangles intersect. + * @param rect1 First rect. + * @param rect2 Second rect. + * @param angle1 Rotation algle of first rectangle. + * @param angle2 Rotation angle of second rectangle. + */ RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const; + /** + * @brief Draw a circle. + * @param position Circle position. + * @param radius Circle radius + * @param numSegments Num of segments of the circle. + * @param mode OpenGl primitive. + */ virtual void DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode = GL_LINE_LOOP) const; virtual void DrawArc(wxPoint2DDouble position, double radius, @@ -172,35 +451,117 @@ public: double finalAngle, int numSegments, GLenum mode = GL_LINE_LOOP) const; + + /** + * @brief Draw rectangle. + * @param position Rectangle position. + * @param width Rectangle width. + * @param height Rectangle height. + * @param mode OpenGl primitive. + */ virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode = GL_QUADS) const; + + /** + * @brief Draw rectangle. + * @param points Rectangle vertices. + * @param mode OpenGl primitive. + */ virtual void DrawRectangle(wxPoint2DDouble* points, GLenum mode = GL_QUADS) const; + + /** + * @brief Draw a triangle. + * @param points Triangle vertices. + * @param mode OpenGl primitive. + */ virtual void DrawTriangle(std::vector<wxPoint2DDouble> points, GLenum mode = GL_TRIANGLES) const; + + /** + * @brief Draw a point. + * @param position Point position. + * @param size Point size. + */ virtual void DrawPoint(wxPoint2DDouble position, double size) const; + + /** + * @brief Draw line. + * @param points Line vertices. + * @param mode OpenGl primitive. + */ virtual void DrawLine(std::vector<wxPoint2DDouble> points, GLenum mode = GL_LINE_STRIP) const; + + /** + * @brief Draw pickbox. + * @param position Pickbox position. + */ virtual void DrawPickbox(wxPoint2DDouble position) const; + + /** + * @brief Rotate a point as element position being the origin. + * @param pointToRotate Point that will be rotated. + * @param angle Angle of rotation. + * @param degrees True if the angle is in degrees, false if radians. + */ virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees = true) const; + /** + * @brief Get the parent list. + * @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; } + + //virtual wxPoint2DDouble GetMoveStartPosition() const { return m_moveStartPt; } + //virtual wxPoint2DDouble GetMovePosition() const { return m_movePos; } + + /** + * @brief Calculate the element boundaries. + * @param leftUp Top-left position of the element. + * @param rightBottom Bottom-right position of the element. + */ virtual void CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const; + /** + * @brief Insert general itens to context menu. + * @param menu Menu that will be inserted the general itens. + */ virtual void GeneralMenuItens(wxMenu& menu); + /** + * @brief Show element data form + * @param parent Form parent + * @param element Element that will be edited. + * @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. + * @param strValue String value to be converted. + * @param value Double value converted. + * @param errorMsg Error message. + */ bool DoubleFromString(wxWindow* parent, wxString strValue, double& value, wxString errorMsg); + + /** + * @brief Convert a string to int. Show a error message if the conversion fail. + * @param parent Message box parent. + * @param strValue String value to be converted. + * @param value Int value converted. + * @param errorMsg Error message. + */ bool IntFromString(wxWindow* parent, wxString strValue, int& value, wxString errorMsg); - // Electrical only methods - virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit) - { - } - virtual void SetSwitchingData(SwitchingData data) { m_swData = data; } - virtual SwitchingData GetSwitchingData() { return m_swData; } - virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection) { m_pfDirection = pfDirection; } - virtual PowerFlowDirection GetPowerFlowDirection() const { return m_pfDirection; } - // Static methods + /** + * @brief Convert a double value to string. + * @param value Value to be converted. + * @param minDecimal Minimum number of decimal places. + */ static wxString StringFromDouble(double value, int minDecimal = 1); protected: @@ -217,19 +578,8 @@ protected: double m_rotationAngle = 45.0; double m_switchSize = 10.0; - OpenGLColour m_busColour; - OpenGLColour m_onlineElementColour; - OpenGLColour m_offlineElementColour; - OpenGLColour m_closedSwitchColour; - OpenGLColour m_openedSwitchColour; - OpenGLColour m_selectionColour; - OpenGLColour m_powerFlowArrowColour; - std::vector<wxRect2DDouble> m_switchRect; - std::vector<std::vector<wxPoint2DDouble> > m_powerFlowArrow; - PowerFlowDirection m_pfDirection = PF_NONE; - bool m_selected = false; bool m_dragging = false; bool m_showPickbox = false; @@ -244,8 +594,6 @@ protected: wxPoint2DDouble m_movePos; bool m_online = true; - - SwitchingData m_swData; }; #endif // ELEMENT_H diff --git a/Project/Fault.cpp b/Project/Fault.cpp index 77ff6de..725a3ec 100644 --- a/Project/Fault.cpp +++ b/Project/Fault.cpp @@ -371,3 +371,27 @@ void Fault::UpdateElementsFault(double systemPowerBase) } } } + +bool Fault::RunSCPowerCalcutation(double systemPowerBase) +{ + // Get adimittance matrix. + std::vector<std::vector<std::complex<double> > > yBusPos; + GetYBus(yBusPos, systemPowerBase, POSITIVE_SEQ, true); + + // Calculate the impedance matrix. + if(!InvertMatrix(yBusPos, m_zBusPos)) { + m_errorMsg = _("Fail to invert the positive sequence admittance matrix."); + return false; + } + + // Set the SC power. + for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) { + Bus* bus = *it; + auto data = bus->GetEletricalData(); + int n = data.number; + data.scPower = 1.0 / std::abs(m_zBusPos[n][n]); + bus->SetElectricalData(data); + } + + return true; +} diff --git a/Project/Fault.h b/Project/Fault.h index c3caef7..c72c3f4 100644 --- a/Project/Fault.h +++ b/Project/Fault.h @@ -36,6 +36,12 @@ public: virtual bool RunFaultCalculation(double systemPowerBase); /** + * @brief Calculate the short-circuit power of the system. Return true if was possible the calculation. + * @param systemPowerBase System base of power. + */ + virtual bool RunSCPowerCalcutation(double systemPowerBase); + + /** * @brief Update the data of the elements. * @param systemPowerBase System base of power. */ diff --git a/Project/GraphicalElement.cpp b/Project/GraphicalElement.cpp new file mode 100644 index 0000000..87a5302 --- /dev/null +++ b/Project/GraphicalElement.cpp @@ -0,0 +1,10 @@ +#include "GraphicalElement.h" + +GraphicalElement::GraphicalElement() : Element() +{ +} + +GraphicalElement::~GraphicalElement() +{ +} + diff --git a/Project/GraphicalElement.h b/Project/GraphicalElement.h new file mode 100644 index 0000000..86ca30d --- /dev/null +++ b/Project/GraphicalElement.h @@ -0,0 +1,14 @@ +#ifndef GRAPHICALELEMENT_H +#define GRAPHICALELEMENT_H + +#include "Element.h" + +class GraphicalElement : public Element +{ +public: + GraphicalElement(); + ~GraphicalElement(); + +}; + +#endif // GRAPHICALELEMENT_H diff --git a/Project/Machines.cpp b/Project/Machines.cpp index 6016df8..dd93bf1 100644 --- a/Project/Machines.cpp +++ b/Project/Machines.cpp @@ -1,7 +1,7 @@ #include "Machines.h" Machines::Machines() - : Element() + : PowerElement() { } Machines::~Machines() {} diff --git a/Project/Machines.h b/Project/Machines.h index cecd78b..8efcab6 100644 --- a/Project/Machines.h +++ b/Project/Machines.h @@ -1,9 +1,9 @@ #ifndef MACHINES_H #define MACHINES_H -#include "Element.h" +#include "PowerElement.h" -class Machines : public Element +class Machines : public PowerElement { public: Machines(); diff --git a/Project/MainFrame.cpp b/Project/MainFrame.cpp index 254c081..bb180a3 100644 --- a/Project/MainFrame.cpp +++ b/Project/MainFrame.cpp @@ -249,7 +249,13 @@ void MainFrame::OnProjectSettingsClick(wxRibbonButtonBarEvent& event) {} void MainFrame::OnRedoClick(wxRibbonButtonBarEvent& event) {} void MainFrame::OnResetVoltagesClick(wxRibbonButtonBarEvent& event) {} void MainFrame::OnRunStabilityClick(wxRibbonButtonBarEvent& event) {} -void MainFrame::OnSCPowerClick(wxRibbonButtonBarEvent& event) {} +void MainFrame::OnSCPowerClick(wxRibbonButtonBarEvent& event) +{ + Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage()); + if(workspace) { + workspace->RunSCPower(); + } +} void MainFrame::OnSaveAsClick(wxRibbonButtonBarEvent& event) { Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage()); diff --git a/Project/PowerElement.cpp b/Project/PowerElement.cpp new file mode 100644 index 0000000..06fb4aa --- /dev/null +++ b/Project/PowerElement.cpp @@ -0,0 +1,141 @@ +#include "PowerElement.h" + +PowerElement::PowerElement() + : Element() +{ + m_busColour.SetRGBA(0.0, 0.3, 1.0, 1.0); + m_onlineElementColour.SetRGBA(0.2, 0.2, 0.2, 1.0); + m_offlineElementColour.SetRGBA(0.5, 0.5, 0.5, 1.0); + m_closedSwitchColour.SetRGBA(0.0, 0.4, 0.0, 1.0); + m_openedSwitchColour.SetRGBA(1.0, 0.1, 0.1, 1.0); + m_selectionColour.SetRGBA(0.0, 0.5, 1.0, 0.5); + m_powerFlowArrowColour.SetRGBA(1.0, 0.51, 0.0, 1.0); +} + +PowerElement::~PowerElement() {} + +void PowerElement::SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit) +{ +} + +wxPoint2DDouble PowerElement::GetSwitchPoint(Element* parent, wxPoint2DDouble parentPoint, wxPoint2DDouble secondPoint) const +{ + double swLineSize = 25.0; + wxPoint2DDouble swPoint = wxPoint2DDouble(parentPoint.m_x, parentPoint.m_y - swLineSize); + + // Rotate the second point (to compare). + double angle = parent->GetAngle(); + + secondPoint = wxPoint2DDouble(std::cos(wxDegToRad(-angle)) * (secondPoint.m_x - parentPoint.m_x) - + std::sin(wxDegToRad(-angle)) * (secondPoint.m_y - parentPoint.m_y) + parentPoint.m_x, + std::sin(wxDegToRad(-angle)) * (secondPoint.m_x - parentPoint.m_x) + + std::cos(wxDegToRad(-angle)) * (secondPoint.m_y - parentPoint.m_y) + parentPoint.m_y); + + // Rotate + if(secondPoint.m_y > parentPoint.m_y) angle -= 180.0; + return wxPoint2DDouble(std::cos(wxDegToRad(angle)) * (swPoint.m_x - parentPoint.m_x) - + std::sin(wxDegToRad(angle)) * (swPoint.m_y - parentPoint.m_y) + parentPoint.m_x, + std::sin(wxDegToRad(angle)) * (swPoint.m_x - parentPoint.m_x) + + std::cos(wxDegToRad(angle)) * (swPoint.m_y - parentPoint.m_y) + parentPoint.m_y); +} + +bool PowerElement::SwitchesContains(wxPoint2DDouble position) const +{ + for(int i = 0; i < (int)m_switchRect.size(); i++) { + if(m_parentList[i]) { + if(m_switchRect[i].Contains(position)) return true; + } + } + return false; +} + +void PowerElement::UpdateSwitches() +{ + // General method, to one switch only. + 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); +} + +void PowerElement::DrawSwitches() const +{ + int i = 0; + for(auto it = m_parentList.begin(); it != m_parentList.end(); it++) { + Element* parent = *it; + if(parent) { + if(m_online) { + glColor4dv(m_closedSwitchColour.GetRGBA()); + } else { + glColor4dv(m_openedSwitchColour.GetRGBA()); + } + + glPushMatrix(); + glTranslated(m_switchRect[i].GetPosition().m_x + m_switchSize / 2.0, + m_switchRect[i].GetPosition().m_y + m_switchSize / 2.0, 0.0); + glRotated(parent->GetAngle(), 0.0, 0.0, 1.0); + glTranslated(-m_switchRect[i].GetPosition().m_x - m_switchSize / 2.0, + -m_switchRect[i].GetPosition().m_y - m_switchSize / 2.0, 0.0); + + DrawRectangle(m_switchRect[i].GetPosition() + wxPoint2DDouble(m_switchSize / 2.0, m_switchSize / 2.0), + m_switchSize, m_switchSize); + + glPopMatrix(); + } + i++; + } +} + +void PowerElement::CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges) +{ + double arrowRate = 100.0; // One arrow to each "arrowRate" distance in pixels. + + if(edges.size() < 2) return; + + // Clear all power flow points + for(int i = 0; i < (int)m_powerFlowArrow.size(); i++) m_powerFlowArrow[i].clear(); + m_powerFlowArrow.clear(); + + for(int i = 1; i < (int)edges.size(); i++) { + wxPoint2DDouble pt1 = edges[i - 1]; + wxPoint2DDouble pt2 = edges[i]; + + double angle = std::atan2(pt2.m_y - pt1.m_y, pt2.m_x - pt1.m_x); + + wxPoint2DDouble rotPt2( + std::cos(-angle) * (pt2.m_x - pt1.m_x) - std::sin(-angle) * (pt2.m_y - pt1.m_y) + pt1.m_x, + std::sin(-angle) * (pt2.m_x - pt1.m_x) + std::cos(-angle) * (pt2.m_y - pt1.m_y) + pt1.m_y); + + int numArrows = std::abs(pt1.m_x - rotPt2.m_x) / arrowRate; + if(numArrows == 0) numArrows = 1; + + for(int i = 0; i < numArrows; i++) { + wxPoint2DDouble arrowCenter(pt1.m_x + ((rotPt2.m_x - pt1.m_x) / double(numArrows + 1)) * double(i + 1), + pt1.m_y + ((rotPt2.m_y - pt1.m_y) / double(numArrows + 1)) * double(i + 1)); + + std::vector<wxPoint2DDouble> triPts; + triPts.push_back(arrowCenter + wxPoint2DDouble(5.0, 0.0)); + triPts.push_back(arrowCenter + wxPoint2DDouble(-5.0, 5.0)); + triPts.push_back(arrowCenter + wxPoint2DDouble(-5.0, -5.0)); + + // Rotate back. + for(int i = 0; i < 3; i++) { + triPts[i] = wxPoint2DDouble( + std::cos(angle) * (triPts[i].m_x - pt1.m_x) - std::sin(angle) * (triPts[i].m_y - pt1.m_y) + pt1.m_x, + std::sin(angle) * (triPts[i].m_x - pt1.m_x) + std::cos(angle) * (triPts[i].m_y - pt1.m_y) + + pt1.m_y); + } + m_powerFlowArrow.push_back(triPts); + } + } +} + +void PowerElement::DrawPowerFlowPts() const +{ + if(m_online) { + glColor4dv(m_powerFlowArrowColour.GetRGBA()); + for(int i = 0; i < (int)m_powerFlowArrow.size(); i++) { + DrawTriangle(m_powerFlowArrow[i]); + } + } +} diff --git a/Project/PowerElement.h b/Project/PowerElement.h new file mode 100644 index 0000000..c8108b7 --- /dev/null +++ b/Project/PowerElement.h @@ -0,0 +1,180 @@ +#ifndef POWERELEMENT_H +#define POWERELEMENT_H + +#include "Element.h" + +/** + * @enum ElectricalUnit + * @brief Electrical units. +*/ +enum ElectricalUnit { + UNIT_PU = 0, /**< Per unit (p.u.) */ + UNIT_V, /**< Volt */ + UNIT_kV, /**< Kilovolts */ + UNIT_A, /**< Ampere */ + UNIT_kA, /**< Kiloampere */ + UNIT_W, /**< Watts */ + UNIT_kW, /**< Kilowatts */ + UNIT_MW, /**< Megawatts */ + UNIT_VA, /**< Volt-ampere */ + UNIT_kVA, /**< Kilovolt-ampere */ + UNIT_MVA, /**< Megavolt-ampere */ + UNIT_VAr, /**< Volt-ampere reactive */ + UNIT_kVAr, /**< Kilovolt-ampere reactive */ + UNIT_MVAr, /**< Megavolt-ampere reactive */ + UNIT_OHM, /**< Ohm */ + UNIT_OHM_km, /**< Ohm/km */ + UNIT_S, /**< Siemens */ + UNIT_S_km, /**< Siemens/km */ + UNIT_DEGREE, /**< Degree */ + UNIT_RADIAN /**< Radian */ +}; + +/** + * @enum FaultData + * @brief Information about fault (type and location). +*/ +enum FaultData { + FAULT_THREEPHASE = 0, /**< Three-phase fault */ + FAULT_2LINE, /**< Line-to-line fault */ + FAULT_2LINE_GROUND, /**< Double line-to-ground fault */ + FAULT_LINE_GROUND, /**< Line-to-ground fault */ + FAULT_LINE_A, /**< Fault on phase A or phase AB */ + FAULT_LINE_B, /**< Fault on phase B or phase BC */ + FAULT_LINE_C /**< Fault on phase C or phase CA */ +}; + +/** + * @enum SwitchingType + * @brief Type of switching. +*/ +enum SwitchingType { + SW_INSERT = 0, /**< Insert element */ + SW_REMOVE /**< Remove element */ +}; + +/** + * @enum PowerFlowDirection + * @brief Direction of power flow arrows. +*/ +enum PowerFlowDirection { + PF_NONE = 0, /**< No direction (no arrows printed) */ + PF_TO_BUS, /**< Element to bus */ + PF_TO_ELEMENT, /**< Bus to element */ + PF_BUS1_TO_BUS2, /**< First bus to secont bus (branch elements) */ + PF_BUS2_TO_BUS1 /**< Second bus to first bus (branch elements) */ +}; + +/** + * @class SwitchingData + * @author Thales Lima Oliveira + * @date 18/01/2017 + * @file PowerElement.h + * @brief Switching data of power elements. + */ +struct SwitchingData { + std::vector<SwitchingType> swType; /**< Type of switching */ + std::vector<double> swTime; /**< Time of switching */ +}; + +/** + * @class PowerElement + * @author Thales Lima Oliveira + * @date 18/01/2017 + * @file PowerElement.h + * @brief Base class of power elements. + */ +class PowerElement : public Element +{ +public: + /** + * @brief Constructor + */ + PowerElement(); + /** + * @brief Destructor. + */ + ~PowerElement(); + + /** + * @brief Get the correct switch position. + * @param parent Bus with switch. + * @param parentPoint Position of node on parent. + * @param secondPoint Next point in element. + */ + virtual wxPoint2DDouble + GetSwitchPoint(Element* parent, wxPoint2DDouble parentPoint, wxPoint2DDouble secondPoint) const; + + /** + * @brief Check if switch contains position. + * @param position position to be checked. + */ + virtual bool SwitchesContains(wxPoint2DDouble position) const; + + /** + * @brief Update the switch position. + */ + virtual void UpdateSwitches(); + + /** + * @brief Draw switch. + */ + virtual void DrawSwitches() const; + + /** + * @brief Calculate the points of the power flow arrows. + * @param edges Points of the element that arrows point. + */ + virtual void CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges); + + /** + * @brief Draw power flow arrows. + */ + virtual void DrawPowerFlowPts() const; + + /** + * @brief Set nominal voltage of the element. + * @param nominalVoltage Value of the nominal voltage. + * @param nominalVoltageUnit Unit of the nominal voltage. + */ + virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit); + + /** + * @brief Set the switching data of the element. + * @param data Switching data. + */ + virtual void SetSwitchingData(SwitchingData data) { m_swData = data; } + + /** + * @brief Returns the switching data of the element. + * @return Element switching data. + */ + virtual SwitchingData GetSwitchingData() { return m_swData; } + + /** + * @brief Set the direction of the power flow. + * @param pfDirection Power flow direction. + */ + virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection) { m_pfDirection = pfDirection; } + + /** + * @brief Return the direction of the power flow. + * @return Power flow direction. + */ + virtual PowerFlowDirection GetPowerFlowDirection() const { return m_pfDirection; } + +protected: + SwitchingData m_swData; + std::vector<std::vector<wxPoint2DDouble> > m_powerFlowArrow; + PowerFlowDirection m_pfDirection = PF_NONE; + + OpenGLColour m_busColour; + OpenGLColour m_onlineElementColour; + OpenGLColour m_offlineElementColour; + OpenGLColour m_closedSwitchColour; + OpenGLColour m_openedSwitchColour; + OpenGLColour m_selectionColour; + OpenGLColour m_powerFlowArrowColour; +}; + +#endif // POWERELEMENT_H diff --git a/Project/Project.mk b/Project/Project.mk index bdb44b1..8c2c0bc 100644 --- a/Project/Project.mk +++ b/Project/Project.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=Thales -Date :=10/01/2017 +Date :=18/01/2017 CodeLitePath :="C:/Program Files/CodeLite" LinkerName :=C:/TDM-GCC-64/bin/g++.exe SharedObjectLinkerName :=C:/TDM-GCC-64/bin/g++.exe -shared -fPIC @@ -64,11 +64,11 @@ AS := C:/TDM-GCC-64/bin/as.exe CodeLiteDir:=C:\Program Files\CodeLite WXWIN:=C:\wxWidgets-3.1.0 WXCFG:=gcc_dll\mswu -Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/win_resources.rc$(ObjectSuffix) $(IntermediateDirectory)/Text.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElementDataObject.cpp$(ObjectSuffix) $(IntermediateDirectory)/ArtMetro.cpp$(ObjectSuffix) $(IntermediateDirectory)/wxGLString.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrame.cpp$(ObjectSuffix) $(IntermediateDirectory)/Workspace.cpp$(ObjectSuffix) $(IntermediateDirectory)/FileHanding.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrameBitmaps.cpp$(ObjectSuffix) \ +Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/win_resources.rc$(ObjectSuffix) $(IntermediateDirectory)/ElementDataObject.cpp$(ObjectSuffix) $(IntermediateDirectory)/Element.cpp$(ObjectSuffix) $(IntermediateDirectory)/ArtMetro.cpp$(ObjectSuffix) $(IntermediateDirectory)/wxGLString.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrame.cpp$(ObjectSuffix) $(IntermediateDirectory)/Workspace.cpp$(ObjectSuffix) $(IntermediateDirectory)/FileHanding.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrameBitmaps.cpp$(ObjectSuffix) \ $(IntermediateDirectory)/WorkspaceBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/BusFormBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElementFormBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrameBase.cpp$(ObjectSuffix) $(IntermediateDirectory)/WorkspaceBase.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElementForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/Bus.cpp$(ObjectSuffix) $(IntermediateDirectory)/Line.cpp$(ObjectSuffix) $(IntermediateDirectory)/Transformer.cpp$(ObjectSuffix) $(IntermediateDirectory)/Machines.cpp$(ObjectSuffix) \ - $(IntermediateDirectory)/SyncGenerator.cpp$(ObjectSuffix) $(IntermediateDirectory)/IndMotor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Branch.cpp$(ObjectSuffix) $(IntermediateDirectory)/SyncMotor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Shunt.cpp$(ObjectSuffix) $(IntermediateDirectory)/Load.cpp$(ObjectSuffix) $(IntermediateDirectory)/Inductor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Capacitor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Element.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElectricCalculation.cpp$(ObjectSuffix) \ - $(IntermediateDirectory)/PowerFlow.cpp$(ObjectSuffix) $(IntermediateDirectory)/Fault.cpp$(ObjectSuffix) $(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/GeneratorStabForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/LineForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/SwitchingForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/TransformerForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/LoadForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/ReactiveShuntElementForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/IndMotorForm.cpp$(ObjectSuffix) \ - $(IntermediateDirectory)/SyncMachineForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/TextForm.cpp$(ObjectSuffix) + $(IntermediateDirectory)/SyncGenerator.cpp$(ObjectSuffix) $(IntermediateDirectory)/IndMotor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Branch.cpp$(ObjectSuffix) $(IntermediateDirectory)/SyncMotor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Shunt.cpp$(ObjectSuffix) $(IntermediateDirectory)/Load.cpp$(ObjectSuffix) $(IntermediateDirectory)/Inductor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Capacitor.cpp$(ObjectSuffix) $(IntermediateDirectory)/PowerElement.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElectricCalculation.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/PowerFlow.cpp$(ObjectSuffix) $(IntermediateDirectory)/Fault.cpp$(ObjectSuffix) $(IntermediateDirectory)/Text.cpp$(ObjectSuffix) $(IntermediateDirectory)/GraphicalElement.cpp$(ObjectSuffix) $(IntermediateDirectory)/ControlElement.cpp$(ObjectSuffix) $(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/GeneratorStabForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/LineForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/SwitchingForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/TransformerForm.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/LoadForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/ReactiveShuntElementForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/IndMotorForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/SyncMachineForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/TextForm.cpp$(ObjectSuffix) @@ -109,14 +109,6 @@ $(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp $(IntermediateDirectory)/win_resources.rc$(ObjectSuffix): win_resources.rc $(RcCompilerName) -i "C:/Users/Thales/Documents/GitHub/PSP/Project/win_resources.rc" $(RcCmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/win_resources.rc$(ObjectSuffix) $(RcIncludePath) -$(IntermediateDirectory)/Text.cpp$(ObjectSuffix): Text.cpp $(IntermediateDirectory)/Text.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/Text.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Text.cpp$(ObjectSuffix) $(IncludePath) -$(IntermediateDirectory)/Text.cpp$(DependSuffix): Text.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Text.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Text.cpp$(DependSuffix) -MM Text.cpp - -$(IntermediateDirectory)/Text.cpp$(PreprocessSuffix): Text.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Text.cpp$(PreprocessSuffix) Text.cpp - $(IntermediateDirectory)/ElementDataObject.cpp$(ObjectSuffix): ElementDataObject.cpp $(IntermediateDirectory)/ElementDataObject.cpp$(DependSuffix) $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/ElementDataObject.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ElementDataObject.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/ElementDataObject.cpp$(DependSuffix): ElementDataObject.cpp @@ -125,6 +117,14 @@ $(IntermediateDirectory)/ElementDataObject.cpp$(DependSuffix): ElementDataObject $(IntermediateDirectory)/ElementDataObject.cpp$(PreprocessSuffix): ElementDataObject.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ElementDataObject.cpp$(PreprocessSuffix) ElementDataObject.cpp +$(IntermediateDirectory)/Element.cpp$(ObjectSuffix): Element.cpp $(IntermediateDirectory)/Element.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/Element.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Element.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Element.cpp$(DependSuffix): Element.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Element.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Element.cpp$(DependSuffix) -MM Element.cpp + +$(IntermediateDirectory)/Element.cpp$(PreprocessSuffix): Element.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Element.cpp$(PreprocessSuffix) Element.cpp + $(IntermediateDirectory)/ArtMetro.cpp$(ObjectSuffix): ArtMetro.cpp $(IntermediateDirectory)/ArtMetro.cpp$(DependSuffix) $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/ArtMetro.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ArtMetro.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/ArtMetro.cpp$(DependSuffix): ArtMetro.cpp @@ -317,13 +317,13 @@ $(IntermediateDirectory)/Capacitor.cpp$(DependSuffix): Capacitor.cpp $(IntermediateDirectory)/Capacitor.cpp$(PreprocessSuffix): Capacitor.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Capacitor.cpp$(PreprocessSuffix) Capacitor.cpp -$(IntermediateDirectory)/Element.cpp$(ObjectSuffix): Element.cpp $(IntermediateDirectory)/Element.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/Element.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Element.cpp$(ObjectSuffix) $(IncludePath) -$(IntermediateDirectory)/Element.cpp$(DependSuffix): Element.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Element.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Element.cpp$(DependSuffix) -MM Element.cpp +$(IntermediateDirectory)/PowerElement.cpp$(ObjectSuffix): PowerElement.cpp $(IntermediateDirectory)/PowerElement.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/PowerElement.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PowerElement.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PowerElement.cpp$(DependSuffix): PowerElement.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PowerElement.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PowerElement.cpp$(DependSuffix) -MM PowerElement.cpp -$(IntermediateDirectory)/Element.cpp$(PreprocessSuffix): Element.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Element.cpp$(PreprocessSuffix) Element.cpp +$(IntermediateDirectory)/PowerElement.cpp$(PreprocessSuffix): PowerElement.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PowerElement.cpp$(PreprocessSuffix) PowerElement.cpp $(IntermediateDirectory)/ElectricCalculation.cpp$(ObjectSuffix): ElectricCalculation.cpp $(IntermediateDirectory)/ElectricCalculation.cpp$(DependSuffix) $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/ElectricCalculation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ElectricCalculation.cpp$(ObjectSuffix) $(IncludePath) @@ -349,6 +349,30 @@ $(IntermediateDirectory)/Fault.cpp$(DependSuffix): Fault.cpp $(IntermediateDirectory)/Fault.cpp$(PreprocessSuffix): Fault.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Fault.cpp$(PreprocessSuffix) Fault.cpp +$(IntermediateDirectory)/Text.cpp$(ObjectSuffix): Text.cpp $(IntermediateDirectory)/Text.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/Text.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Text.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Text.cpp$(DependSuffix): Text.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Text.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Text.cpp$(DependSuffix) -MM Text.cpp + +$(IntermediateDirectory)/Text.cpp$(PreprocessSuffix): Text.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Text.cpp$(PreprocessSuffix) Text.cpp + +$(IntermediateDirectory)/GraphicalElement.cpp$(ObjectSuffix): GraphicalElement.cpp $(IntermediateDirectory)/GraphicalElement.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/GraphicalElement.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/GraphicalElement.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/GraphicalElement.cpp$(DependSuffix): GraphicalElement.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/GraphicalElement.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/GraphicalElement.cpp$(DependSuffix) -MM GraphicalElement.cpp + +$(IntermediateDirectory)/GraphicalElement.cpp$(PreprocessSuffix): GraphicalElement.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/GraphicalElement.cpp$(PreprocessSuffix) GraphicalElement.cpp + +$(IntermediateDirectory)/ControlElement.cpp$(ObjectSuffix): ControlElement.cpp $(IntermediateDirectory)/ControlElement.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/ControlElement.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ControlElement.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ControlElement.cpp$(DependSuffix): ControlElement.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ControlElement.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ControlElement.cpp$(DependSuffix) -MM ControlElement.cpp + +$(IntermediateDirectory)/ControlElement.cpp$(PreprocessSuffix): ControlElement.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ControlElement.cpp$(PreprocessSuffix) ControlElement.cpp + $(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix): BusForm.cpp $(IntermediateDirectory)/BusForm.cpp$(DependSuffix) $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/BusForm.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/BusForm.cpp$(DependSuffix): BusForm.cpp diff --git a/Project/Project.project b/Project/Project.project index 7e8c41f..38e449f 100644 --- a/Project/Project.project +++ b/Project/Project.project @@ -10,7 +10,7 @@ <Dependencies/> <VirtualDirectory Name="src"> <VirtualDirectory Name="model"> - <VirtualDirectory Name="electrical"> + <VirtualDirectory Name="power element"> <File Name="Bus.cpp"/> <File Name="Line.cpp"/> <File Name="Transformer.cpp"/> @@ -23,15 +23,22 @@ <File Name="Load.cpp"/> <File Name="Inductor.cpp"/> <File Name="Capacitor.cpp"/> - <File Name="Element.cpp"/> + <File Name="PowerElement.cpp"/> </VirtualDirectory> <VirtualDirectory Name="calculations"> <File Name="ElectricCalculation.cpp"/> <File Name="PowerFlow.cpp"/> <File Name="Fault.cpp"/> </VirtualDirectory> - <File Name="Text.cpp"/> <File Name="ElementDataObject.cpp"/> + <VirtualDirectory Name="graphical element"> + <File Name="Text.cpp"/> + <File Name="GraphicalElement.cpp"/> + </VirtualDirectory> + <File Name="Element.cpp"/> + <VirtualDirectory Name="control element"> + <File Name="ControlElement.cpp"/> + </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="view"> <File Name="ArtMetro.cpp"/> @@ -40,7 +47,7 @@ <VirtualDirectory Name="controller"> <File Name="MainFrame.cpp"/> <File Name="Workspace.cpp"/> - <VirtualDirectory Name="element forms"> + <VirtualDirectory Name="power element form"> <File Name="BusForm.cpp"/> <File Name="GeneratorStabForm.cpp"/> <File Name="LineForm.cpp"/> @@ -50,15 +57,17 @@ <File Name="ReactiveShuntElementForm.cpp"/> <File Name="IndMotorForm.cpp"/> <File Name="SyncMachineForm.cpp"/> - <File Name="TextForm.cpp"/> </VirtualDirectory> <File Name="FileHanding.cpp"/> + <VirtualDirectory Name="graphical element form"> + <File Name="TextForm.cpp"/> + </VirtualDirectory> </VirtualDirectory> <File Name="main.cpp"/> </VirtualDirectory> <VirtualDirectory Name="include"> <VirtualDirectory Name="model"> - <VirtualDirectory Name="electrical"> + <VirtualDirectory Name="power element"> <File Name="Bus.h"/> <File Name="Line.h"/> <File Name="Transformer.h"/> @@ -71,14 +80,13 @@ <File Name="Load.h"/> <File Name="Inductor.h"/> <File Name="Capacitor.h"/> - <File Name="Element.h"/> + <File Name="PowerElement.h"/> </VirtualDirectory> <VirtualDirectory Name="calculations"> <File Name="ElectricCalculation.h"/> <File Name="PowerFlow.h"/> <File Name="Fault.h"/> </VirtualDirectory> - <File Name="Text.h"/> <VirtualDirectory Name="rapidXML"> <File Name="rapidXML/rapidxml.hpp"/> <File Name="rapidXML/rapidxml_iterators.hpp"/> @@ -86,6 +94,14 @@ <File Name="rapidXML/rapidxml_utils.hpp"/> </VirtualDirectory> <File Name="ElementDataObject.h"/> + <File Name="Element.h"/> + <VirtualDirectory Name="graphical element"> + <File Name="Text.h"/> + <File Name="GraphicalElement.h"/> + </VirtualDirectory> + <VirtualDirectory Name="control element"> + <File Name="ControlElement.h"/> + </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="view"> <File Name="ArtMetro.h"/> @@ -94,7 +110,7 @@ <VirtualDirectory Name="controller"> <File Name="MainFrame.h"/> <File Name="Workspace.h"/> - <VirtualDirectory Name="element forms"> + <VirtualDirectory Name="power element form"> <File Name="BusForm.h"/> <File Name="GeneratorStabForm.h"/> <File Name="LineForm.h"/> @@ -104,9 +120,11 @@ <File Name="ReactiveShuntElementForm.h"/> <File Name="IndMotorForm.h"/> <File Name="SyncMachineForm.h"/> - <File Name="TextForm.h"/> </VirtualDirectory> <File Name="FileHanding.h"/> + <VirtualDirectory Name="graphical element form"> + <File Name="TextForm.h"/> + </VirtualDirectory> </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="resources"> diff --git a/Project/Project.txt b/Project/Project.txt index 59652ad..86d63a5 100644 --- a/Project/Project.txt +++ b/Project/Project.txt @@ -1 +1 @@ -./Release/main.cpp.o ./Release/win_resources.rc.o ./Release/Text.cpp.o ./Release/ElementDataObject.cpp.o ./Release/ArtMetro.cpp.o ./Release/wxGLString.cpp.o ./Release/MainFrame.cpp.o ./Release/Workspace.cpp.o ./Release/FileHanding.cpp.o ./Release/MainFrameBitmaps.cpp.o ./Release/WorkspaceBitmaps.cpp.o ./Release/BusFormBitmaps.cpp.o ./Release/ElementFormBitmaps.cpp.o ./Release/MainFrameBase.cpp.o ./Release/WorkspaceBase.cpp.o ./Release/ElementForm.cpp.o ./Release/Bus.cpp.o ./Release/Line.cpp.o ./Release/Transformer.cpp.o ./Release/Machines.cpp.o ./Release/SyncGenerator.cpp.o ./Release/IndMotor.cpp.o ./Release/Branch.cpp.o ./Release/SyncMotor.cpp.o ./Release/Shunt.cpp.o ./Release/Load.cpp.o ./Release/Inductor.cpp.o ./Release/Capacitor.cpp.o ./Release/Element.cpp.o ./Release/ElectricCalculation.cpp.o ./Release/PowerFlow.cpp.o ./Release/Fault.cpp.o ./Release/BusForm.cpp.o ./Release/GeneratorStabForm.cpp.o ./Release/LineForm.cpp.o ./Release/SwitchingForm.cpp.o ./Release/TransformerForm.cpp.o ./Release/LoadForm.cpp.o ./Release/ReactiveShuntElementForm.cpp.o ./Release/IndMotorForm.cpp.o ./Release/SyncMachineForm.cpp.o ./Release/TextForm.cpp.o +./Release/main.cpp.o ./Release/win_resources.rc.o ./Release/ElementDataObject.cpp.o ./Release/Element.cpp.o ./Release/ArtMetro.cpp.o ./Release/wxGLString.cpp.o ./Release/MainFrame.cpp.o ./Release/Workspace.cpp.o ./Release/FileHanding.cpp.o ./Release/MainFrameBitmaps.cpp.o ./Release/WorkspaceBitmaps.cpp.o ./Release/BusFormBitmaps.cpp.o ./Release/ElementFormBitmaps.cpp.o ./Release/MainFrameBase.cpp.o ./Release/WorkspaceBase.cpp.o ./Release/ElementForm.cpp.o ./Release/Bus.cpp.o ./Release/Line.cpp.o ./Release/Transformer.cpp.o ./Release/Machines.cpp.o ./Release/SyncGenerator.cpp.o ./Release/IndMotor.cpp.o ./Release/Branch.cpp.o ./Release/SyncMotor.cpp.o ./Release/Shunt.cpp.o ./Release/Load.cpp.o ./Release/Inductor.cpp.o ./Release/Capacitor.cpp.o ./Release/PowerElement.cpp.o ./Release/ElectricCalculation.cpp.o ./Release/PowerFlow.cpp.o ./Release/Fault.cpp.o ./Release/Text.cpp.o ./Release/GraphicalElement.cpp.o ./Release/ControlElement.cpp.o ./Release/BusForm.cpp.o ./Release/GeneratorStabForm.cpp.o ./Release/LineForm.cpp.o ./Release/SwitchingForm.cpp.o ./Release/TransformerForm.cpp.o ./Release/LoadForm.cpp.o ./Release/ReactiveShuntElementForm.cpp.o ./Release/IndMotorForm.cpp.o ./Release/SyncMachineForm.cpp.o ./Release/TextForm.cpp.o diff --git a/Project/Shunt.cpp b/Project/Shunt.cpp index 0cd5736..a0caab7 100644 --- a/Project/Shunt.cpp +++ b/Project/Shunt.cpp @@ -1,6 +1,6 @@ #include "Shunt.h" -Shunt::Shunt() : Element() {} +Shunt::Shunt() : PowerElement() {} Shunt::~Shunt() {} void Shunt::UpdateSwitchesPosition() { diff --git a/Project/Shunt.h b/Project/Shunt.h index f68df4b..15b8efb 100644 --- a/Project/Shunt.h +++ b/Project/Shunt.h @@ -1,10 +1,10 @@ #ifndef SHUNT_H #define SHUNT_H -#include "Element.h" +#include "PowerElement.h" #include "Bus.h" -class Shunt : public Element +class Shunt : public PowerElement { public: Shunt(); diff --git a/Project/SwitchingForm.cpp b/Project/SwitchingForm.cpp index 2a48783..061b0a5 100644 --- a/Project/SwitchingForm.cpp +++ b/Project/SwitchingForm.cpp @@ -1,5 +1,5 @@ #include "SwitchingForm.h" -#include "Element.h" +#include "PowerElement.h" SwitchingForm::SwitchingForm(wxWindow* parent) : SwitchingFormBase(parent) { @@ -10,7 +10,7 @@ SwitchingForm::SwitchingForm(wxWindow* parent) : SwitchingFormBase(parent) Layout(); } -SwitchingForm::SwitchingForm(wxWindow* parent, Element* element) : SwitchingFormBase(parent) +SwitchingForm::SwitchingForm(wxWindow* parent, PowerElement* element) : SwitchingFormBase(parent) { m_listCtrlSwitchings->AppendColumn(_("Type")); m_listCtrlSwitchings->AppendColumn(_("Time (s)")); diff --git a/Project/SwitchingForm.h b/Project/SwitchingForm.h index 5a4aa51..cf39701 100644 --- a/Project/SwitchingForm.h +++ b/Project/SwitchingForm.h @@ -3,13 +3,13 @@ #include "ElementForm.h" -class Element; +class PowerElement; class SwitchingForm : public SwitchingFormBase { public: SwitchingForm(wxWindow* parent); - SwitchingForm(wxWindow* parent, Element* element); + SwitchingForm(wxWindow* parent, PowerElement* element); virtual ~SwitchingForm(); protected: virtual void OnDownButtonClick(wxCommandEvent& event); @@ -23,6 +23,6 @@ protected: int m_maxID = 0; - Element* m_element = NULL; + PowerElement* m_element = NULL; }; #endif // SWITCHINGFORM_H diff --git a/Project/Text.cpp b/Project/Text.cpp index 8c76956..588e9a1 100644 --- a/Project/Text.cpp +++ b/Project/Text.cpp @@ -13,12 +13,12 @@ #include "Capacitor.h" Text::Text() - : Element() + : GraphicalElement() { SetText(m_text); } Text::Text(wxPoint2DDouble position) - : Element() + : GraphicalElement() { m_position = position; SetText(m_text); diff --git a/Project/Text.h b/Project/Text.h index 019f765..062032c 100644 --- a/Project/Text.h +++ b/Project/Text.h @@ -1,7 +1,8 @@ #ifndef TEXT_H #define TEXT_H -#include "Element.h" +#include "GraphicalElement.h" +#include "PowerElement.h" #include "wxGLString.h" class TextForm; @@ -44,7 +45,7 @@ enum DataType { DATA_PF_CURRENT }; -class Text : public Element +class Text : public GraphicalElement { public: Text(); diff --git a/Project/Workspace.cpp b/Project/Workspace.cpp index d09efad..7f9cce4 100644 --- a/Project/Workspace.cpp +++ b/Project/Workspace.cpp @@ -203,7 +203,7 @@ void Workspace::OnLeftClickDown(wxMouseEvent& event) } else { bool clickPickbox = false; for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) { - Element* element = *it; + PowerElement* element = *it; element->ResetPickboxes(); // Reset pickbox state. // Set movement initial position (not necessarily will be moved). @@ -277,7 +277,7 @@ void Workspace::OnLeftDoubleClick(wxMouseEvent& event) bool redraw = false; for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) { - Element* element = *it; + PowerElement* element = *it; // Click in an element. if(element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) { @@ -332,7 +332,7 @@ void Workspace::OnLeftDoubleClick(wxMouseEvent& event) for(auto it = m_textList.begin(); it != m_textList.end(); ++it) { Text* text = *it; if(text->Contains(m_camera->ScreenToWorld(event.GetPosition()))) { - text->ShowForm(this, m_elementList); + text->ShowForm(this, GetElementList()); redraw = true; } } @@ -1075,7 +1075,7 @@ void Workspace::Fit() { wxPoint2DDouble leftUpCorner(0, 0); wxPoint2DDouble rightDownCorner(0, 0); - std::vector<Element*> elementList = m_elementList; + std::vector<Element*> elementList = GetElementList(); for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) { elementList.push_back(*it); } @@ -1134,7 +1134,7 @@ void Workspace::ValidateBusesVoltages(Element* initialBus) void Workspace::ValidateElementsVoltages() { for(auto it = m_elementList.begin(); it != m_elementList.end(); it++) { - Element* child = *it; + PowerElement* child = *it; std::vector<double> nominalVoltage; std::vector<ElectricalUnit> nominalVoltageUnit; @@ -1151,7 +1151,7 @@ void Workspace::ValidateElementsVoltages() bool Workspace::RunPowerFlow() { - PowerFlow pf(m_elementList); + PowerFlow pf(GetElementList()); bool result = pf.RunGaussSeidel(); if(!result) { wxMessageDialog msgDialog(this, pf.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR); @@ -1234,7 +1234,7 @@ bool Workspace::Paste() if(copy) { pastedElements.push_back(copy); pastedBusList.push_back(static_cast<Bus*>(copy)); - m_elementList.push_back(copy); + m_elementList.push_back(static_cast<PowerElement*>(copy)); } } @@ -1277,7 +1277,7 @@ bool Workspace::Paste() } pastedElements.push_back(copy); - m_elementList.push_back(copy); + m_elementList.push_back(static_cast<PowerElement*>(copy)); } } } @@ -1392,7 +1392,8 @@ void Workspace::SetTextList(std::vector<Text*> textList) void Workspace::SetElementList(std::vector<Element*> elementList) { m_elementList.clear(); - for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) m_elementList.push_back(*it); + for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) + m_elementList.push_back(static_cast<PowerElement*>(*it)); } void Workspace::OnIdle(wxIdleEvent& event) @@ -1417,7 +1418,7 @@ std::vector<Element*> Workspace::GetAllElements() const bool Workspace::RunFault() { - Fault fault(m_elementList); + Fault fault(GetElementList()); bool result = fault.RunFaultCalculation(100e6); if(!result) { wxMessageDialog msgDialog(this, fault.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR); @@ -1429,3 +1430,25 @@ bool Workspace::RunFault() return result; } + +std::vector<Element*> Workspace::GetElementList() const +{ + std::vector<Element*> elementList; + for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) elementList.push_back(*it); + return elementList; +} + +bool Workspace::RunSCPower() +{ + Fault fault(GetElementList()); + bool result = fault.RunSCPowerCalcutation(100e6); + if(!result) { + wxMessageDialog msgDialog(this, fault.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR); + msgDialog.ShowModal(); + } + + UpdateTextElements(); + Redraw(); + + return result; +} diff --git a/Project/Workspace.h b/Project/Workspace.h index f138410..3b03220 100644 --- a/Project/Workspace.h +++ b/Project/Workspace.h @@ -68,7 +68,7 @@ public: ~Workspace(); wxString GetName() const { return m_name; } - std::vector<Element*> GetElementList() const { return m_elementList; } + std::vector<Element*> GetElementList() const; std::vector<Text*> GetTextList() const { return m_textList; } std::vector<Element*> GetAllElements() const; WorkspaceMode GetWorkspaceMode() const { return m_mode; } @@ -105,6 +105,7 @@ public: bool RunPowerFlow(); bool RunFault(); + bool RunSCPower(); protected: virtual void OnIdle(wxIdleEvent& event); @@ -132,7 +133,7 @@ protected: WorkspaceMode m_mode = MODE_EDIT; - std::vector<Element*> m_elementList; + std::vector<PowerElement*> m_elementList; int m_elementNumber[NUM_ELEMENTS]; std::vector<Text*> m_textList; |