Power System Platform  2026w11a-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, wxWindow *workspace=nullptr)
 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 23 of file SyncMotor.cpp.

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

◆ SyncMotor() [2/2]

SyncMotor::SyncMotor ( wxString  name)

Definition at line 28 of file SyncMotor.cpp.

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

◆ ~SyncMotor()

SyncMotor::~SyncMotor ( )

Definition at line 34 of file SyncMotor.cpp.

35{
36 if (m_electricalData.avr) delete m_electricalData.avr;
37 if (m_electricalData.speedGov) delete m_electricalData.speedGov;
38 if (m_electricalData.avrSolver) delete m_electricalData.avrSolver;
39 if (m_electricalData.speedGovSolver) delete m_electricalData.speedGovSolver;
40}

Member Function Documentation

◆ DrawDCSymbol() [1/2]

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

Reimplemented from Machines.

Definition at line 48 of file SyncMotor.cpp.

49{
50 DrawDCArc(m_position, 12, 30, 330, dc);
51}

◆ DrawDCSymbol() [2/2]

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

Reimplemented from Machines.

Definition at line 43 of file SyncMotor.cpp.

44{
45 DrawDCArc(m_position, 12, 30, 330, 10, gc);
46}

◆ 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 53 of file SyncMotor.cpp.

54{
55 menu.Append(ID_EDIT_ELEMENT, _("Edit Synchronous Condenser"));
56
57 wxMenu* textMenu = new wxMenu();
58
59 textMenu->Append(ID_TXT_NAME, _("Name"));
60 textMenu->Append(ID_TXT_ACTIVE_POWER, _("Active power"));
61 textMenu->Append(ID_TXT_REACTIVE_POWER, _("Reactive power"));
62 textMenu->SetClientData(menu.GetClientData());
63 menu.AppendSubMenu(textMenu, _("Add text"));
64
65 GeneralMenuItens(menu);
66
67 return true;
68}
@ ID_EDIT_ELEMENT
Definition Element.h:75
virtual void GeneralMenuItens(wxMenu &menu)
Insert general itens to context menu.
Definition Element.cpp:388
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 162 of file SyncMotor.cpp.

163{
164 auto copy = new SyncMotor(*this);
165
166 auto data = copy->GetElectricalData();
167 data.avrSolver = nullptr;
168 data.speedGovSolver = nullptr;
169
170 if (m_electricalData.avr) {
171 std::vector<std::shared_ptr<ConnectionLine>> cLineList;
172 std::vector<std::shared_ptr<ControlElement>> elementList;
173
174 m_electricalData.avr->GetContainerCopy(elementList, cLineList);
175
176 auto avrCopy = new ControlElementContainer();
177 avrCopy->FillContainer(elementList, cLineList);
178
179 data.avr = avrCopy;
180 }
181 else {
182 data.avr = nullptr;
183 }
184
185 if (m_electricalData.speedGov) {
186 std::vector<std::shared_ptr<ConnectionLine>> cLineList;
187 std::vector<std::shared_ptr<ControlElement>> elementList;
188
189 m_electricalData.speedGov->GetContainerCopy(elementList, cLineList);
190
191 auto speedGovCopy = new ControlElementContainer();
192 speedGovCopy->FillContainer(elementList, cLineList);
193
194 data.speedGov = speedGovCopy;
195 }
196 else {
197 data.speedGov = nullptr;
198 }
199
200 copy->SetElectricalData(data);
201
202 return copy;
203}
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
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 81 of file SyncMotor.cpp.

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

◆ GetTipText()

wxString SyncMotor::GetTipText ( ) const
virtual

Get the tip text.

Returns
Tip text.

Reimplemented from Element.

Definition at line 205 of file SyncMotor.cpp.

206{
207 wxString tipText = m_electricalData.name;
208 tipText += "\n";
209 double activePower = m_electricalData.activePower;
210 if (!m_online) activePower = 0.0;
211 tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
212 switch (m_electricalData.activePowerUnit) {
214 tipText += _(" p.u.");
215 } break;
217 tipText += _(" W");
218 } break;
220 tipText += _(" kW");
221 } break;
223 tipText += _(" MW");
224 } break;
225 default:
226 break;
227 }
228 double reactivePower = m_electricalData.reactivePower;
229 if (!m_online) reactivePower = 0.0;
230 tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
231 switch (m_electricalData.reactivePowerUnit) {
233 tipText += _(" p.u.");
234 } break;
236 tipText += _(" var");
237 } break;
239 tipText += _(" kvar");
240 } break;
242 tipText += _(" Mvar");
243 } break;
244 default:
245 break;
246 }
247
248 return tipText;
249}

◆ OpenElement()

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

Reimplemented from PowerElement.

Definition at line 308 of file SyncMotor.cpp.

309{
310 if (!OpenCADProperties(elementNode, parentList)) return false;
311
312 auto electricalProp = elementNode->first_node("ElectricalProperties");
313 if (!electricalProp) return false;
314
315 SetOnline(XMLParser::GetNodeValueInt(electricalProp, "IsOnline"));
316 m_electricalData.name = electricalProp->first_node("Name")->value();
317 m_electricalData.nominalPower = XMLParser::GetNodeValueDouble(electricalProp, "NominalPower");
318 m_electricalData.nominalPowerUnit =
319 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "NominalPower", "UnitID"));
320 m_electricalData.activePower = XMLParser::GetNodeValueDouble(electricalProp, "ActivePower");
321 m_electricalData.activePowerUnit =
322 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "ActivePower", "UnitID"));
323 m_electricalData.reactivePower = XMLParser::GetNodeValueDouble(electricalProp, "ReactivePower");
324 m_electricalData.reactivePowerUnit =
325 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID"));
326 m_electricalData.haveMaxReactive = XMLParser::GetNodeValueInt(electricalProp, "HaveMaxReactive");
327 m_electricalData.maxReactive = XMLParser::GetNodeValueDouble(electricalProp, "MaxReactive");
328 m_electricalData.maxReactiveUnit =
329 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "MaxReactive", "UnitID"));
330 m_electricalData.haveMinReactive = XMLParser::GetNodeValueInt(electricalProp, "HaveMinReactive");
331 m_electricalData.minReactive = XMLParser::GetNodeValueDouble(electricalProp, "MinReactive");
332 m_electricalData.minReactiveUnit =
333 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "MinReactive", "UnitID"));
334 m_electricalData.useMachineBase = XMLParser::GetNodeValueInt(electricalProp, "UseMachineBase");
335
336 auto fault = electricalProp->first_node("Fault");
337 if (!fault) return false;
338 m_electricalData.positiveResistance = XMLParser::GetNodeValueDouble(fault, "PositiveResistance");
339 m_electricalData.positiveReactance = XMLParser::GetNodeValueDouble(fault, "PositiveReactance");
340 m_electricalData.negativeResistance = XMLParser::GetNodeValueDouble(fault, "NegativeResistance");
341 m_electricalData.negativeReactance = XMLParser::GetNodeValueDouble(fault, "NegativeReactance");
342 m_electricalData.zeroResistance = XMLParser::GetNodeValueDouble(fault, "ZeroResistance");
343 m_electricalData.zeroReactance = XMLParser::GetNodeValueDouble(fault, "ZeroReactance");
344 m_electricalData.groundResistance = XMLParser::GetNodeValueDouble(fault, "GroundResistance");
345 m_electricalData.groundReactance = XMLParser::GetNodeValueDouble(fault, "GroundReactance");
346 m_electricalData.groundNeutral = XMLParser::GetNodeValueInt(fault, "GroundNeutral");
347
348 m_inserted = true;
349
350 return true;
351}
ElectricalUnit
Electrical units.
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition Element.cpp:378

◆ SaveElement()

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

Reimplemented from Element.

Definition at line 251 of file SyncMotor.cpp.

252{
253 auto elementNode = XMLParser::AppendNode(doc, elementListNode, "SyncMotor");
254 XMLParser::SetNodeAttribute(doc, elementNode, "ID", m_elementID);
255
256 SaveCADProperties(doc, elementNode);
257
258 auto electricalProp = XMLParser::AppendNode(doc, elementNode, "ElectricalProperties");
259 auto isOnline = XMLParser::AppendNode(doc, electricalProp, "IsOnline");
260 XMLParser::SetNodeValue(doc, isOnline, m_online);
261 auto name = XMLParser::AppendNode(doc, electricalProp, "Name");
262 XMLParser::SetNodeValue(doc, name, m_electricalData.name);
263 auto nominalPower = XMLParser::AppendNode(doc, electricalProp, "NominalPower");
264 XMLParser::SetNodeValue(doc, nominalPower, m_electricalData.nominalPower);
265 XMLParser::SetNodeAttribute(doc, nominalPower, "UnitID", static_cast<int>(m_electricalData.nominalPowerUnit));
266 auto activePower = XMLParser::AppendNode(doc, electricalProp, "ActivePower");
267 XMLParser::SetNodeValue(doc, activePower, m_electricalData.activePower);
268 XMLParser::SetNodeAttribute(doc, activePower, "UnitID", static_cast<int>(m_electricalData.activePowerUnit));
269 auto reactivePower = XMLParser::AppendNode(doc, electricalProp, "ReactivePower");
270 XMLParser::SetNodeValue(doc, reactivePower, m_electricalData.reactivePower);
271 XMLParser::SetNodeAttribute(doc, reactivePower, "UnitID", static_cast<int>(m_electricalData.reactivePowerUnit));
272 auto haveMaxReactive = XMLParser::AppendNode(doc, electricalProp, "HaveMaxReactive");
273 XMLParser::SetNodeValue(doc, haveMaxReactive, m_electricalData.haveMaxReactive);
274 auto maxReactive = XMLParser::AppendNode(doc, electricalProp, "MaxReactive");
275 XMLParser::SetNodeValue(doc, maxReactive, m_electricalData.maxReactive);
276 XMLParser::SetNodeAttribute(doc, maxReactive, "UnitID", static_cast<int>(m_electricalData.maxReactiveUnit));
277 auto haveMinReactive = XMLParser::AppendNode(doc, electricalProp, "HaveMinReactive");
278 XMLParser::SetNodeValue(doc, haveMinReactive, m_electricalData.haveMinReactive);
279 auto minReactive = XMLParser::AppendNode(doc, electricalProp, "MinReactive");
280 XMLParser::SetNodeValue(doc, minReactive, m_electricalData.minReactive);
281 XMLParser::SetNodeAttribute(doc, minReactive, "UnitID", static_cast<int>(m_electricalData.minReactiveUnit));
282 auto useMachineBase = XMLParser::AppendNode(doc, electricalProp, "UseMachineBase");
283 XMLParser::SetNodeValue(doc, useMachineBase, m_electricalData.useMachineBase);
284
285 auto fault = XMLParser::AppendNode(doc, electricalProp, "Fault");
286 auto positiveResistance = XMLParser::AppendNode(doc, fault, "PositiveResistance");
287 XMLParser::SetNodeValue(doc, positiveResistance, m_electricalData.positiveResistance);
288 auto positiveReactance = XMLParser::AppendNode(doc, fault, "PositiveReactance");
289 XMLParser::SetNodeValue(doc, positiveReactance, m_electricalData.positiveReactance);
290 auto negativeResistance = XMLParser::AppendNode(doc, fault, "NegativeResistance");
291 XMLParser::SetNodeValue(doc, negativeResistance, m_electricalData.negativeResistance);
292 auto negativeReactance = XMLParser::AppendNode(doc, fault, "NegativeReactance");
293 XMLParser::SetNodeValue(doc, negativeReactance, m_electricalData.negativeReactance);
294 auto zeroResistance = XMLParser::AppendNode(doc, fault, "ZeroResistance");
295 XMLParser::SetNodeValue(doc, zeroResistance, m_electricalData.zeroResistance);
296 auto zeroReactance = XMLParser::AppendNode(doc, fault, "ZeroReactance");
297 XMLParser::SetNodeValue(doc, zeroReactance, m_electricalData.zeroReactance);
298 auto groundResistance = XMLParser::AppendNode(doc, fault, "GroundResistance");
299 XMLParser::SetNodeValue(doc, groundResistance, m_electricalData.groundResistance);
300 auto groundReactance = XMLParser::AppendNode(doc, fault, "GroundReactance");
301 XMLParser::SetNodeValue(doc, groundReactance, m_electricalData.groundReactance);
302 auto groundNeutral = XMLParser::AppendNode(doc, fault, "GroundNeutral");
303 XMLParser::SetNodeValue(doc, groundNeutral, m_electricalData.groundNeutral);
304
305 return elementNode;
306}

◆ 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 154 of file SyncMotor.cpp.

155{
156 if (nominalVoltage.size() > 0) {
157 m_electricalData.nominalVoltage = nominalVoltage[0];
158 m_electricalData.nominalVoltageUnit = nominalVoltageUnit[0];
159 }
160}

◆ ShowForm()

bool SyncMotor::ShowForm ( wxWindow *  parent,
Element element,
wxWindow *  workspace = nullptr 
)
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 70 of file SyncMotor.cpp.

71{
72 SyncMachineForm syncMotorForm(parent, this);
73 syncMotorForm.SetTitle(_("Synchronous Condenser"));
74 syncMotorForm.CenterOnParent();
75 if (syncMotorForm.ShowModal() == wxID_OK) {
76 return true;
77 }
78 return false;
79}
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: