summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThales1330 <thaleslima.ufu@gmail.com>2017-01-18 17:15:35 -0200
committerThales1330 <thaleslima.ufu@gmail.com>2017-01-18 17:15:35 -0200
commit46115e4326fc679fe6f1f2c32164b95420e689eb (patch)
treec5c60bad223bd8e3c97252b31ab8ed2b5e3e2a25
parent44a7475053ea042bfca9cd31998ddb5b16910688 (diff)
downloadPSP.git-46115e4326fc679fe6f1f2c32164b95420e689eb.tar.gz
PSP.git-46115e4326fc679fe6f1f2c32164b95420e689eb.tar.xz
PSP.git-46115e4326fc679fe6f1f2c32164b95420e689eb.zip
Some doc, class restruct and SC power implemented
-rw-r--r--Project/Element.cpp11
-rw-r--r--Project/Element.h473
-rw-r--r--Project/Fault.cpp24
-rw-r--r--Project/Fault.h6
-rw-r--r--Project/MainFrame.cpp8
-rw-r--r--Project/PowerElement.cpp7
-rw-r--r--Project/PowerElement.h8
-rw-r--r--Project/Workspace.cpp15
-rw-r--r--Project/Workspace.h1
9 files changed, 511 insertions, 42 deletions
diff --git a/Project/Element.cpp b/Project/Element.cpp
index 76afab2..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() {}
diff --git a/Project/Element.h b/Project/Element.h
index 124e1a0..8a9f56f 100644
--- a/Project/Element.h
+++ b/Project/Element.h
@@ -11,34 +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
+ 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];
@@ -47,74 +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);
+
+ /**
+ * @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,
@@ -122,27 +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);
- bool IntFromString(wxWindow* parent, wxString strValue, int& value, wxString errorMsg);
- // Static methods
+ /**
+ * @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);
+
+ /**
+ * @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:
@@ -159,14 +578,6 @@ 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;
bool m_selected = false;
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/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
index 2847130..06fb4aa 100644
--- a/Project/PowerElement.cpp
+++ b/Project/PowerElement.cpp
@@ -3,6 +3,13 @@
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() {}
diff --git a/Project/PowerElement.h b/Project/PowerElement.h
index eccaaf5..c8108b7 100644
--- a/Project/PowerElement.h
+++ b/Project/PowerElement.h
@@ -167,6 +167,14 @@ 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/Workspace.cpp b/Project/Workspace.cpp
index d055377..7f9cce4 100644
--- a/Project/Workspace.cpp
+++ b/Project/Workspace.cpp
@@ -1437,3 +1437,18 @@ std::vector<Element*> Workspace::GetElementList() const
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 2efdbad..3b03220 100644
--- a/Project/Workspace.h
+++ b/Project/Workspace.h
@@ -105,6 +105,7 @@ public:
bool RunPowerFlow();
bool RunFault();
+ bool RunSCPower();
protected:
virtual void OnIdle(wxIdleEvent& event);