Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
SyncMotor Class Reference

Synchronous motor (synchronous compensator) power element. More...

#include <SyncMotor.h>

Inheritance diagram for SyncMotor:
Collaboration diagram for SyncMotor:

Public Member Functions

 SyncMotor (wxString name)
 
virtual ElementGetCopy ()
 Get a the element copy.
 
virtual void DrawDCSymbol (wxGraphicsContext *gc) const
 
virtual void DrawDCSymbol (wxDC &dc) const
 
virtual bool GetContextMenu (wxMenu &menu)
 Get the element contex menu.
 
virtual wxString GetTipText () const
 Get the tip text.
 
virtual SyncMotorElectricalData GetElectricalData ()
 
virtual SyncMotorElectricalData GetPUElectricalData (double systemPowerBase)
 
virtual void SetNominalVoltage (std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
 Set nominal voltage of the element.
 
virtual void SetElectricalData (SyncMotorElectricalData electricalData)
 
virtual bool ShowForm (wxWindow *parent, Element *element)
 Show element data form.
 
virtual rapidxml::xml_node * SaveElement (rapidxml::xml_document<> &doc, rapidxml::xml_node<> *elementListNode)
 
virtual bool OpenElement (rapidxml::xml_node<> *elementNode, std::vector< Element * > parentList)
 
- Public Member Functions inherited from Machines
virtual bool AddParent (Element *parent, wxPoint2DDouble position)
 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. The element basic points are calculated in this method, so apply this when the element is being inserted.
 
virtual bool Contains (wxPoint2DDouble position) const
 Checks if the element contains a position.
 
virtual void DrawDC (wxPoint2DDouble translation, double scale, wxGraphicsContext *gc) const
 Draw the element using GDI+.
 
virtual void DrawDC (wxPoint2DDouble translation, double scale, wxDC &dc) const
 Draw the element using wxDC.
 
virtual bool Intersects (wxRect2DDouble rect) const
 Check if the element's rect intersects other rect.
 
virtual void Move (wxPoint2DDouble position)
 Move the element other position.
 
virtual void MoveNode (Element *element, wxPoint2DDouble position)
 Move a node. StartMove(wxPoint2DDouble position) before start moving.
 
virtual void StartMove (wxPoint2DDouble position)
 Update the element attributes related to the movement.
 
virtual void RotateNode (Element *parent, bool clockwise=true)
 Rotate a node.
 
virtual void RemoveParent (Element *parent)
 Remove a parent.
 
virtual bool NodeContains (wxPoint2DDouble position)
 Check if a node contains a point. If contains, set the attributes related to node movement.
 
virtual bool SetNodeParent (Element *parent)
 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.
 
virtual void UpdateNodes ()
 Update the nodes according to the parents. If a parent is removed, use this method.
 
virtual void Rotate (bool clockwise=true)
 Rotate the element.
 
virtual void SetPowerFlowDirection (PowerFlowDirection pfDirection)
 Set the direction of the power flow.
 
- Public Member Functions inherited from PowerElement
 PowerElement ()
 Constructor.
 
virtual ~PowerElement ()
 Destructor.
 
virtual wxPoint2DDouble GetSwitchPoint (Element *parent, wxPoint2DDouble parentPoint, wxPoint2DDouble secondPoint) const
 Get the correct switch position.
 
virtual bool SwitchesContains (wxPoint2DDouble position) const
 Check if switch contains position.
 
virtual void UpdateSwitches ()
 Update the switch position.
 
virtual void DrawDCSwitches (wxGraphicsContext *gc) const
 Draw switch.
 
virtual void DrawDCSwitches (wxDC &dc) const
 
virtual void CalculatePowerFlowPts (std::vector< wxPoint2DDouble > edges)
 Calculate the points of the power flow arrows.
 
virtual void DrawDCPowerFlowPts (wxGraphicsContext *gc) const
 Draw power flow arrows.
 
virtual void DrawDCPowerFlowPts (wxDC &dc) const
 
virtual void SetSwitchingData (SwitchingData data)
 Set the switching data of the element.
 
virtual SwitchingData GetSwitchingData ()
 Returns the switching data of the element.
 
virtual PowerFlowDirection GetPowerFlowDirection () const
 Return the direction of the power flow.
 
virtual bool GetPlotData (ElementPlotData &plotData, PlotStudy study=PlotStudy::STABILITY)
 Fill the plot data.
 
virtual bool HaveDynamicEvent () const
 Check if the power element have dynamic event.
 
virtual void SetDynamicEvent (bool dynEvent=true)
 Set if the power element have dynamic event.
 
virtual double GetValueFromUnit (double value, ElectricalUnit valueUnit)
 
virtual void SaveCADProperties (rapidxml::xml_document<> &doc, rapidxml::xml_node<> *elementNode)
 
virtual void SaveSwitchingData (rapidxml::xml_document<> &doc, rapidxml::xml_node<> *electricalNode)
 
virtual bool OpenCADProperties (rapidxml::xml_node<> *elementNode, std::vector< Element * > parentList)
 
virtual bool OpenSwitchingData (rapidxml::xml_node<> *electricalNode)
 
- Public Member Functions inherited from Element
 Element ()
 Constructor.
 
virtual ~Element ()
 Destructor.
 
void SetDragging (bool dragging=true)
 Set if the element are being dragged.
 
void SetHeight (double height)
 Set element height.
 
void SetPosition (const wxPoint2DDouble position)
 Set the element position and update the rectangle.
 
void SetSelected (bool selected=true)
 Set element selection.
 
void SetWidth (double width)
 Set element width.
 
void SetAngle (double angle)
 Set element angle.
 
void ShowPickbox (bool showPickbox=true)
 Set if the pickbox is shown.
 
void SetBorderSize (double borderSize)
 Set the size of the border (shown in selected elements).
 
bool SetOnline (bool online=true)
 Set if the element is online or offline.
 
virtual void SetPointList (std::vector< wxPoint2DDouble > pointList)
 Set the list of points that connect the element to the bus.
 
ElementType GetElementType ()
 
wxRect2DDouble GetRect () const
 Get the element rectangle.
 
wxPoint2DDouble GetPosition () const
 Get the element position.
 
bool IsDragging () const
 Checks if the element is being dragged.
 
double GetHeight () const
 Get the element height.
 
bool IsSelected () const
 Checks if the element is selected.
 
double GetWidth () const
 Get the element width.
 
double GetAngle () const
 Get the element angle.
 
double GetRotationAngle () const
 Get the angle of rotation.
 
bool IsPickboxShown () const
 Checks if the pickbox is shown.
 
bool IsOnline () const
 Checks if the element is online or offline.
 
virtual std::vector< wxPoint2DDouble > GetPointList () const
 Get the list of points that connect the element to bus.
 
virtual void AddParent (Element *parent)
 Add a parent to the element.
 
virtual void SetID (int id)
 Set the element ID.
 
virtual int GetID () const
 Get the element ID.
 
virtual void AddChild (Element *child)
 Add a child to the child list.
 
virtual void RemoveChild (Element *child)
 Remove a child from the list.
 
virtual void ReplaceChild (Element *oldChild, Element *newChild)
 Replace a child from the list.
 
virtual void AddPoint (wxPoint2DDouble point)
 Add point to the list of points that connect the element to the bus.
 
void SetParent (Element *parent, int num)
 
void SetChild (Element *child, int num)
 
virtual void ReplaceParent (Element *oldParent, Element *newParent)
 Replace a parent.
 
virtual bool PickboxContains (wxPoint2DDouble position)
 Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be calculated.
 
virtual void MovePickbox (wxPoint2DDouble position)
 Move the pickbox.
 
virtual wxCursor GetBestPickboxCursor () const
 Get the best cursor to shown to the user when the mouse is above a pickbox.
 
virtual void ResetPickboxes ()
 Remove the pickboxes.
 
virtual void ResetNodes ()
 Remove the active nodes.
 
virtual wxPoint2DDouble WorldToScreen (wxPoint2DDouble translation, double scale, double offsetX=0.0, double offsetY=0.0) const
 Convert the element position to screen position.
 
virtual wxPoint2DDouble WorldToScreen (wxPoint2DDouble position, wxPoint2DDouble translation, double scale, double offsetX=0.0, double offsetY=0.0) const
 Convert a generic position to screen position.
 
virtual bool RotatedRectanglesIntersects (wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const
 Check if two roteted rectangles intersect.
 
virtual void DrawDCRectangle (wxPoint2DDouble position, double width, double height, double angle, wxDC &dc) const
 Draw a circle.
 
virtual void DrawDCRoundedRectRotated (wxDC &dc, const wxPoint2DDouble &center, double width, double height, double radius, double angleDeg, int arcSegments=8) const
 
virtual void DrawDCCircle (wxPoint2DDouble position, double radius, int numSegments, wxGraphicsContext *gc) const
 Draw a circle using device context.
 
virtual void DrawDCCircle (wxPoint2DDouble position, double radius, wxDC &dc) const
 
virtual void DrawDCArc (wxPoint2DDouble position, double radius, double initAngle, double finalAngle, int numSegments, wxGraphicsContext *gc) const
 
virtual void DrawDCArc (wxPoint2DDouble position, double radius, double initAngle, double finalAngle, wxDC &dc) const
 
virtual void DrawDCTriangle (std::vector< wxPoint2DDouble > points, wxGraphicsContext *gc) const
 Draw rectangle.
 
virtual void DrawDCTriangle (std::vector< wxPoint > points, wxDC &dc) const
 
virtual void DrawDCPickbox (wxPoint2DDouble position, wxGraphicsContext *gc) const
 Draw a point.
 
virtual wxPoint2DDouble RotateAtPosition (wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
 Rotate a point as element position being the origin.
 
virtual wxPoint2DDouble RotateLocal (wxPoint2DDouble local, double angleDeg) const
 
virtual wxPoint RotateAround (const wxPoint2DDouble &p, const wxPoint2DDouble &center, double angleDeg) const
 
virtual std::vector< Element * > GetParentList () const
 Get the parent list.
 
virtual std::vector< Element * > GetChildList () const
 Get the Child list.
 
virtual void CalculateBoundaries (wxPoint2DDouble &leftUp, wxPoint2DDouble &rightBottom) const
 Calculate the element boundaries.
 
virtual void GeneralMenuItens (wxMenu &menu)
 Insert general itens to context menu.
 
virtual double PointToLineDistance (wxPoint2DDouble point, int *segmentNumber=nullptr) const
 Calculate the distance between a line (formed by point list) and a point.
 
bool IsInserted () const
 Check if the element is properly inserted in the workspace.
 
void SetInserted (bool inserted=true)
 Set if the element is properly inserted in the workspace.
 
virtual bool OpenElement (rapidxml::xml_node<> *elementNode)
 
void SaveCADProperties (rapidxml::xml_document<> &doc, rapidxml::xml_node<> *elementNode)
 
bool OpenCADProperties (rapidxml::xml_node<> *elementNode)
 

Protected Attributes

SyncMotorElectricalData m_electricalData
 
- Protected Attributes inherited from PowerElement
SwitchingData m_swData
 
std::vector< std::vector< wxPoint2DDouble > > m_powerFlowArrow
 
PowerFlowDirection m_pfDirection = PowerFlowDirection::PF_NONE
 
wxColour m_busColour
 
wxColour m_onlineElementColour
 
wxColour m_offlineElementColour
 
wxColour m_closedSwitchColour
 
wxColour m_openedSwitchColour
 
wxColour m_powerFlowArrowColour
 
wxColour m_dynamicEventColour
 
bool m_dynEvent = false
 
- Protected Attributes inherited from Element
ElementType m_elementType = ElementType::TYPE_NONE
 
int m_elementID = 0
 
std::vector< Element * > m_parentList
 
std::vector< Element * > m_childList
 
wxRect2DDouble m_rect
 
wxPoint2DDouble m_position
 
double m_width = 0.0
 
double m_height = 0.0
 
double m_angle = 0.0
 
double m_borderSize = 2.0
 
double m_rotationAngle = 45.0
 
double m_switchSize = 10.0
 
std::vector< wxRect2DDouble > m_switchRect
 
bool m_selected = false
 
bool m_dragging = false
 
bool m_showPickbox = false
 
bool m_inserted = false
 
int m_activePickboxID = ID_PB_NONE
 
int m_activeNodeID = 0
 
std::vector< wxPoint2DDouble > m_pointList
 
std::vector< wxPoint2DDouble > m_movePts
 
wxPoint2DDouble m_moveStartPt
 
wxPoint2DDouble m_movePos
 
bool m_online = true
 
wxColour m_selectionColour
 

Additional Inherited Members

- Public Types inherited from Machines
enum  SyncMachineModel {
  SM_MODEL_1 = 0 , SM_MODEL_2 , SM_MODEL_3 , SM_MODEL_4 ,
  SM_MODEL_5
}
 
- Static Public Member Functions inherited from Element
static bool DoubleFromString (wxWindow *parent, wxString strValue, double &value, wxString errorMsg)
 Get a double value from a string. Show a error message if the conversion fail.
 
static bool IntFromString (wxWindow *parent, wxString strValue, int &value, wxString errorMsg)
 Convert a string to int. Show a error message if the conversion fail.
 
static wxString StringFromDouble (double value, int minDecimal=1, int maxDecimals=13)
 Convert a double value to string.
 
- Protected Member Functions inherited from Machines
void UpdateSwitchesPosition ()
 
void UpdatePowerFlowArrowsPosition ()
 

Detailed Description

Synchronous motor (synchronous compensator) power element.

Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
Date
06/10/2017

Definition at line 134 of file SyncMotor.h.

Constructor & Destructor Documentation

◆ SyncMotor() [1/2]

SyncMotor::SyncMotor ( )

Definition at line 21 of file SyncMotor.cpp.

21 : Machines()
22{
23 m_elementType = TYPE_SYNC_MOTOR;
24}
Abstract class for rotary machines power elements.
Definition Machines.h:34

◆ SyncMotor() [2/2]

SyncMotor::SyncMotor ( wxString  name)

Definition at line 26 of file SyncMotor.cpp.

26 : Machines()
27{
28 m_elementType = TYPE_SYNC_MOTOR;
29 m_electricalData.name = name;
30}

◆ ~SyncMotor()

SyncMotor::~SyncMotor ( )

Definition at line 32 of file SyncMotor.cpp.

32{}

Member Function Documentation

◆ DrawDCSymbol() [1/2]

void SyncMotor::DrawDCSymbol ( wxDC &  dc) const
virtual

Reimplemented from Machines.

Definition at line 40 of file SyncMotor.cpp.

41{
42 DrawDCArc(m_position, 12, 30, 330, dc);
43}

◆ DrawDCSymbol() [2/2]

void SyncMotor::DrawDCSymbol ( wxGraphicsContext *  gc) const
virtual

Reimplemented from Machines.

Definition at line 35 of file SyncMotor.cpp.

36{
37 DrawDCArc(m_position, 12, 30, 330, 10, gc);
38}

◆ GetContextMenu()

bool SyncMotor::GetContextMenu ( wxMenu &  menu)
virtual

Get the element contex menu.

Parameters
menumenu that will be inserted the element itens.
Returns
True if was possible to build the menu, false otherwise.

Reimplemented from Element.

Definition at line 45 of file SyncMotor.cpp.

46{
47 menu.Append(ID_EDIT_ELEMENT, _("Edit Synchronous Condenser"));
48
49 wxMenu* textMenu = new wxMenu();
50
51 textMenu->Append(ID_TXT_NAME, _("Name"));
52 textMenu->Append(ID_TXT_ACTIVE_POWER, _("Active power"));
53 textMenu->Append(ID_TXT_REACTIVE_POWER, _("Reactive power"));
54 textMenu->SetClientData(menu.GetClientData());
55 menu.AppendSubMenu(textMenu, _("Add text"));
56
57 GeneralMenuItens(menu);
58
59 return true;
60}
@ ID_EDIT_ELEMENT
Definition Element.h:75
virtual void GeneralMenuItens(wxMenu &menu)
Insert general itens to context menu.
Definition Element.cpp:457
Here is the call graph for this function:

◆ GetCopy()

Element * SyncMotor::GetCopy ( )
virtual

Get a the element copy.

Returns
Copy of the element.

Reimplemented from Element.

Definition at line 154 of file SyncMotor.cpp.

155{
156 SyncMotor* copy = new SyncMotor();
157 *copy = *this;
158 return copy;
159}
Synchronous motor (synchronous compensator) power element.
Definition SyncMotor.h:135

◆ GetElectricalData()

virtual SyncMotorElectricalData SyncMotor::GetElectricalData ( )
inlinevirtual

Definition at line 147 of file SyncMotor.h.

147{ return m_electricalData; }

◆ GetPUElectricalData()

SyncMotorElectricalData SyncMotor::GetPUElectricalData ( double  systemPowerBase)
virtual

Definition at line 73 of file SyncMotor.cpp.

74{
75 SyncMotorElectricalData data = m_electricalData;
76 double machineBasePower = 1.0;
77 if (data.useMachineBase) { machineBasePower = GetValueFromUnit(data.nominalPower, data.nominalPowerUnit); }
78
79 // Active power
80 double activePower = GetValueFromUnit(data.activePower, data.activePowerUnit);
81 if (!m_online) activePower = 0.0;
82 if (data.activePowerUnit == ElectricalUnit::UNIT_PU) {
83 if (data.useMachineBase) data.activePower = (activePower * machineBasePower) / systemPowerBase;
84 }
85 else {
86 data.activePower = activePower / systemPowerBase;
87 }
88 data.activePowerUnit = ElectricalUnit::UNIT_PU;
89
90 // Reactive power
91 double reactivePower = GetValueFromUnit(data.reactivePower, data.reactivePowerUnit);
92 if (!m_online) reactivePower = 0.0;
93 if (data.reactivePowerUnit == ElectricalUnit::UNIT_PU) {
94 if (data.useMachineBase) data.reactivePower = (reactivePower * machineBasePower) / systemPowerBase;
95 }
96 else {
97 data.reactivePower = reactivePower / systemPowerBase;
98 }
99 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
100
101 // Max reactive power
102 double maxReactive = GetValueFromUnit(data.maxReactive, data.maxReactiveUnit);
103 if (data.maxReactiveUnit == ElectricalUnit::UNIT_PU) {
104 if (data.useMachineBase) data.maxReactive = (maxReactive * machineBasePower) / systemPowerBase;
105 }
106 else {
107 data.maxReactive = maxReactive / systemPowerBase;
108 }
109 data.maxReactiveUnit = ElectricalUnit::UNIT_PU;
110
111 // Min reactive power
112 double minReactive = GetValueFromUnit(data.minReactive, data.minReactiveUnit);
113 if (data.minReactiveUnit == ElectricalUnit::UNIT_PU) {
114 if (data.useMachineBase) data.minReactive = (minReactive * machineBasePower) / systemPowerBase;
115 }
116 else {
117 data.minReactive = minReactive / systemPowerBase;
118 }
119 data.minReactiveUnit = ElectricalUnit::UNIT_PU;
120
121 double baseVoltage = GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
122 double systemBaseImpedance = (baseVoltage * baseVoltage) / systemPowerBase;
123 double machineBaseImpedance = (baseVoltage * baseVoltage) / machineBasePower;
124
125 // Fault data
126 if (data.useMachineBase) {
127 data.positiveResistance = (data.positiveResistance * machineBaseImpedance) / systemBaseImpedance;
128 data.positiveReactance = (data.positiveReactance * machineBaseImpedance) / systemBaseImpedance;
129 data.negativeResistance = (data.negativeResistance * machineBaseImpedance) / systemBaseImpedance;
130 data.negativeReactance = (data.negativeReactance * machineBaseImpedance) / systemBaseImpedance;
131 data.zeroResistance = (data.zeroResistance * machineBaseImpedance) / systemBaseImpedance;
132 data.zeroReactance = (data.zeroReactance * machineBaseImpedance) / systemBaseImpedance;
133 data.groundResistance = (data.groundResistance * machineBaseImpedance) / systemBaseImpedance;
134 data.groundReactance = (data.groundReactance * machineBaseImpedance) / systemBaseImpedance;
135 }
136
137 if (!m_online) {
138 data.faultCurrent[0] = std::complex<double>(0, 0);
139 data.faultCurrent[1] = std::complex<double>(0, 0);
140 data.faultCurrent[2] = std::complex<double>(0, 0);
141 }
142
143 return data;
144}

◆ GetTipText()

wxString SyncMotor::GetTipText ( ) const
virtual

Get the tip text.

Returns
Tip text.

Reimplemented from Element.

Definition at line 161 of file SyncMotor.cpp.

162{
163 wxString tipText = m_electricalData.name;
164 tipText += "\n";
165 double activePower = m_electricalData.activePower;
166 if (!m_online) activePower = 0.0;
167 tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
168 switch (m_electricalData.activePowerUnit) {
170 tipText += _(" p.u.");
171 } break;
173 tipText += _(" W");
174 } break;
176 tipText += _(" kW");
177 } break;
179 tipText += _(" MW");
180 } break;
181 default:
182 break;
183 }
184 double reactivePower = m_electricalData.reactivePower;
185 if (!m_online) reactivePower = 0.0;
186 tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
187 switch (m_electricalData.reactivePowerUnit) {
189 tipText += _(" p.u.");
190 } break;
192 tipText += _(" var");
193 } break;
195 tipText += _(" kvar");
196 } break;
198 tipText += _(" Mvar");
199 } break;
200 default:
201 break;
202 }
203
204 return tipText;
205}

◆ OpenElement()

bool SyncMotor::OpenElement ( rapidxml::xml_node<> *  elementNode,
std::vector< Element * >  parentList 
)
virtual

Reimplemented from PowerElement.

Definition at line 264 of file SyncMotor.cpp.

265{
266 if (!OpenCADProperties(elementNode, parentList)) return false;
267
268 auto electricalProp = elementNode->first_node("ElectricalProperties");
269 if (!electricalProp) return false;
270
271 SetOnline(XMLParser::GetNodeValueInt(electricalProp, "IsOnline"));
272 m_electricalData.name = electricalProp->first_node("Name")->value();
273 m_electricalData.nominalPower = XMLParser::GetNodeValueDouble(electricalProp, "NominalPower");
274 m_electricalData.nominalPowerUnit =
275 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "NominalPower", "UnitID"));
276 m_electricalData.activePower = XMLParser::GetNodeValueDouble(electricalProp, "ActivePower");
277 m_electricalData.activePowerUnit =
278 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "ActivePower", "UnitID"));
279 m_electricalData.reactivePower = XMLParser::GetNodeValueDouble(electricalProp, "ReactivePower");
280 m_electricalData.reactivePowerUnit =
281 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID"));
282 m_electricalData.haveMaxReactive = XMLParser::GetNodeValueInt(electricalProp, "HaveMaxReactive");
283 m_electricalData.maxReactive = XMLParser::GetNodeValueDouble(electricalProp, "MaxReactive");
284 m_electricalData.maxReactiveUnit =
285 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "MaxReactive", "UnitID"));
286 m_electricalData.haveMinReactive = XMLParser::GetNodeValueInt(electricalProp, "HaveMinReactive");
287 m_electricalData.minReactive = XMLParser::GetNodeValueDouble(electricalProp, "MinReactive");
288 m_electricalData.minReactiveUnit =
289 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "MinReactive", "UnitID"));
290 m_electricalData.useMachineBase = XMLParser::GetNodeValueInt(electricalProp, "UseMachineBase");
291
292 auto fault = electricalProp->first_node("Fault");
293 if (!fault) return false;
294 m_electricalData.positiveResistance = XMLParser::GetNodeValueDouble(fault, "PositiveResistance");
295 m_electricalData.positiveReactance = XMLParser::GetNodeValueDouble(fault, "PositiveReactance");
296 m_electricalData.negativeResistance = XMLParser::GetNodeValueDouble(fault, "NegativeResistance");
297 m_electricalData.negativeReactance = XMLParser::GetNodeValueDouble(fault, "NegativeReactance");
298 m_electricalData.zeroResistance = XMLParser::GetNodeValueDouble(fault, "ZeroResistance");
299 m_electricalData.zeroReactance = XMLParser::GetNodeValueDouble(fault, "ZeroReactance");
300 m_electricalData.groundResistance = XMLParser::GetNodeValueDouble(fault, "GroundResistance");
301 m_electricalData.groundReactance = XMLParser::GetNodeValueDouble(fault, "GroundReactance");
302 m_electricalData.groundNeutral = XMLParser::GetNodeValueInt(fault, "GroundNeutral");
303
304 m_inserted = true;
305
306 return true;
307}
ElectricalUnit
Electrical units.
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition Element.cpp:447

◆ SaveElement()

rapidxml::xml_node * SyncMotor::SaveElement ( rapidxml::xml_document<> &  doc,
rapidxml::xml_node<> *  elementListNode 
)
virtual

Reimplemented from Element.

Definition at line 207 of file SyncMotor.cpp.

208{
209 auto elementNode = XMLParser::AppendNode(doc, elementListNode, "SyncMotor");
210 XMLParser::SetNodeAttribute(doc, elementNode, "ID", m_elementID);
211
212 SaveCADProperties(doc, elementNode);
213
214 auto electricalProp = XMLParser::AppendNode(doc, elementNode, "ElectricalProperties");
215 auto isOnline = XMLParser::AppendNode(doc, electricalProp, "IsOnline");
216 XMLParser::SetNodeValue(doc, isOnline, m_online);
217 auto name = XMLParser::AppendNode(doc, electricalProp, "Name");
218 XMLParser::SetNodeValue(doc, name, m_electricalData.name);
219 auto nominalPower = XMLParser::AppendNode(doc, electricalProp, "NominalPower");
220 XMLParser::SetNodeValue(doc, nominalPower, m_electricalData.nominalPower);
221 XMLParser::SetNodeAttribute(doc, nominalPower, "UnitID", static_cast<int>(m_electricalData.nominalPowerUnit));
222 auto activePower = XMLParser::AppendNode(doc, electricalProp, "ActivePower");
223 XMLParser::SetNodeValue(doc, activePower, m_electricalData.activePower);
224 XMLParser::SetNodeAttribute(doc, activePower, "UnitID", static_cast<int>(m_electricalData.activePowerUnit));
225 auto reactivePower = XMLParser::AppendNode(doc, electricalProp, "ReactivePower");
226 XMLParser::SetNodeValue(doc, reactivePower, m_electricalData.reactivePower);
227 XMLParser::SetNodeAttribute(doc, reactivePower, "UnitID", static_cast<int>(m_electricalData.reactivePowerUnit));
228 auto haveMaxReactive = XMLParser::AppendNode(doc, electricalProp, "HaveMaxReactive");
229 XMLParser::SetNodeValue(doc, haveMaxReactive, m_electricalData.haveMaxReactive);
230 auto maxReactive = XMLParser::AppendNode(doc, electricalProp, "MaxReactive");
231 XMLParser::SetNodeValue(doc, maxReactive, m_electricalData.maxReactive);
232 XMLParser::SetNodeAttribute(doc, maxReactive, "UnitID", static_cast<int>(m_electricalData.maxReactiveUnit));
233 auto haveMinReactive = XMLParser::AppendNode(doc, electricalProp, "HaveMinReactive");
234 XMLParser::SetNodeValue(doc, haveMinReactive, m_electricalData.haveMinReactive);
235 auto minReactive = XMLParser::AppendNode(doc, electricalProp, "MinReactive");
236 XMLParser::SetNodeValue(doc, minReactive, m_electricalData.minReactive);
237 XMLParser::SetNodeAttribute(doc, minReactive, "UnitID", static_cast<int>(m_electricalData.minReactiveUnit));
238 auto useMachineBase = XMLParser::AppendNode(doc, electricalProp, "UseMachineBase");
239 XMLParser::SetNodeValue(doc, useMachineBase, m_electricalData.useMachineBase);
240
241 auto fault = XMLParser::AppendNode(doc, electricalProp, "Fault");
242 auto positiveResistance = XMLParser::AppendNode(doc, fault, "PositiveResistance");
243 XMLParser::SetNodeValue(doc, positiveResistance, m_electricalData.positiveResistance);
244 auto positiveReactance = XMLParser::AppendNode(doc, fault, "PositiveReactance");
245 XMLParser::SetNodeValue(doc, positiveReactance, m_electricalData.positiveReactance);
246 auto negativeResistance = XMLParser::AppendNode(doc, fault, "NegativeResistance");
247 XMLParser::SetNodeValue(doc, negativeResistance, m_electricalData.negativeResistance);
248 auto negativeReactance = XMLParser::AppendNode(doc, fault, "NegativeReactance");
249 XMLParser::SetNodeValue(doc, negativeReactance, m_electricalData.negativeReactance);
250 auto zeroResistance = XMLParser::AppendNode(doc, fault, "ZeroResistance");
251 XMLParser::SetNodeValue(doc, zeroResistance, m_electricalData.zeroResistance);
252 auto zeroReactance = XMLParser::AppendNode(doc, fault, "ZeroReactance");
253 XMLParser::SetNodeValue(doc, zeroReactance, m_electricalData.zeroReactance);
254 auto groundResistance = XMLParser::AppendNode(doc, fault, "GroundResistance");
255 XMLParser::SetNodeValue(doc, groundResistance, m_electricalData.groundResistance);
256 auto groundReactance = XMLParser::AppendNode(doc, fault, "GroundReactance");
257 XMLParser::SetNodeValue(doc, groundReactance, m_electricalData.groundReactance);
258 auto groundNeutral = XMLParser::AppendNode(doc, fault, "GroundNeutral");
259 XMLParser::SetNodeValue(doc, groundNeutral, m_electricalData.groundNeutral);
260
261 return elementNode;
262}

◆ SetElectricalData()

virtual void SyncMotor::SetElectricalData ( SyncMotorElectricalData  electricalData)
inlinevirtual

Definition at line 150 of file SyncMotor.h.

150{ m_electricalData = electricalData; }

◆ SetNominalVoltage()

void SyncMotor::SetNominalVoltage ( std::vector< double >  nominalVoltage,
std::vector< ElectricalUnit nominalVoltageUnit 
)
virtual

Set nominal voltage of the element.

Parameters
nominalVoltageValue of the nominal voltage.
nominalVoltageUnitUnit of the nominal voltage.

Reimplemented from PowerElement.

Definition at line 146 of file SyncMotor.cpp.

147{
148 if (nominalVoltage.size() > 0) {
149 m_electricalData.nominalVoltage = nominalVoltage[0];
150 m_electricalData.nominalVoltageUnit = nominalVoltageUnit[0];
151 }
152}

◆ ShowForm()

bool SyncMotor::ShowForm ( wxWindow *  parent,
Element element 
)
virtual

Show element data form.

Parameters
parentForm parent
elementElement that will be edited.
Returns
True if the form is shown, false otherwise.

Reimplemented from Element.

Definition at line 62 of file SyncMotor.cpp.

63{
64 SyncMachineForm syncMotorForm(parent, this);
65 syncMotorForm.SetTitle(_("Synchronous Condenser"));
66 syncMotorForm.CenterOnParent();
67 if (syncMotorForm.ShowModal() == wxID_OK) {
68 return true;
69 }
70 return false;
71}
Form to edit the synchronous machine power data.

Member Data Documentation

◆ m_electricalData

SyncMotorElectricalData SyncMotor::m_electricalData
protected

Definition at line 157 of file SyncMotor.h.


The documentation for this class was generated from the following files: