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

Induction motor power element. More...

#include <IndMotor.h>

Inheritance diagram for IndMotor:
Collaboration diagram for IndMotor:

Public Member Functions

 IndMotor (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 bool ShowForm (wxWindow *parent, Element *element)
 Show element data form.
 
virtual IndMotorElectricalData GetElectricalData ()
 
virtual IndMotorElectricalData GetPUElectricalData (double systemPowerBase)
 
virtual void SetElectricalData (IndMotorElectricalData electricalData)
 
virtual void InitPowerFlowMotor (double systemPowerBase, int busNumber)
 
virtual bool CalculateReactivePower (double voltage)
 
virtual bool GetPlotData (ElementPlotData &plotData, PlotStudy study=PlotStudy::STABILITY)
 Fill the plot data.
 
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 SetNominalVoltage (std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
 Set nominal voltage of the element.
 
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 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

IndMotorElectricalData 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

Induction motor power element.

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

Definition at line 118 of file IndMotor.h.

Constructor & Destructor Documentation

◆ IndMotor() [1/2]

IndMotor::IndMotor ( )

Definition at line 21 of file IndMotor.cpp.

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

◆ IndMotor() [2/2]

IndMotor::IndMotor ( wxString  name)

Definition at line 26 of file IndMotor.cpp.

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

◆ ~IndMotor()

IndMotor::~IndMotor ( )

Definition at line 32 of file IndMotor.cpp.

32{}

Member Function Documentation

◆ CalculateReactivePower()

bool IndMotor::CalculateReactivePower ( double  voltage)
virtual

Definition at line 342 of file IndMotor.cpp.

343{
344 double a = m_electricalData.p0 *
345 (m_electricalData.r1t * m_electricalData.r1t + m_electricalData.k3 * m_electricalData.k3) -
346 voltage * voltage * m_electricalData.r1t;
347 double b = 2.0 * m_electricalData.p0 *
348 (m_electricalData.r1t * m_electricalData.k2 + m_electricalData.k3 * m_electricalData.k4) -
349 voltage * voltage * (m_electricalData.k2 + m_electricalData.k1 * m_electricalData.k3);
350 double c =
351 m_electricalData.p0 * (m_electricalData.k2 * m_electricalData.k2 + m_electricalData.k4 * m_electricalData.k4) -
352 voltage * voltage * m_electricalData.k1 * m_electricalData.k4;
353 double d = (b * b - 4.0 * a * c);
354 if (d < 0.0) return false;
355 double r2_s = (-b + std::sqrt(d)) / (2.0 * a);
356
357 double qa = m_electricalData.k1 * (r2_s * m_electricalData.r1t - m_electricalData.x1t * m_electricalData.k1 -
358 m_electricalData.x2t * m_electricalData.xmt);
359 double qb =
360 r2_s * (r2_s * (m_electricalData.xmt + m_electricalData.x1t) + m_electricalData.r1t * m_electricalData.k1);
361 double qc = r2_s * m_electricalData.r1t - m_electricalData.x1t * m_electricalData.k1 -
362 m_electricalData.x2t * m_electricalData.xmt;
363 double qd = r2_s * (m_electricalData.xmt + m_electricalData.x1t) + m_electricalData.r1t * m_electricalData.k1;
364 m_electricalData.qValue = (-voltage * voltage * (qa - qb)) / (qc * qc + qd * qd);
365
366 return true;
367}

◆ DrawDCSymbol() [1/2]

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

Reimplemented from Machines.

Definition at line 56 of file IndMotor.cpp.

57{
58 wxPoint mPts[5];
59 wxPoint pos = wxPoint((int)m_position.m_x, (int)m_position.m_y);
60 mPts[0] = wxPoint(-10, 13) + pos;
61 mPts[1] = wxPoint(-10, -13) + pos;
62 mPts[2] = wxPoint(0, 2) + pos;
63 mPts[3] = wxPoint(10, -13) + pos;
64 mPts[4] = wxPoint(10, 13) + pos;
65 dc.DrawLines(5, mPts);
66}

◆ DrawDCSymbol() [2/2]

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

Reimplemented from Machines.

Definition at line 45 of file IndMotor.cpp.

46{
47 std::vector<wxPoint2DDouble> mPts;
48 mPts.push_back(wxPoint2DDouble(-10, 13) + m_position);
49 mPts.push_back(wxPoint2DDouble(-10, -13) + m_position);
50 mPts.push_back(wxPoint2DDouble(0, 2) + m_position);
51 mPts.push_back(wxPoint2DDouble(10, -13) + m_position);
52 mPts.push_back(wxPoint2DDouble(10, 13) + m_position);
53 gc->StrokeLines(mPts.size(), &mPts[0]);
54}

◆ GetContextMenu()

bool IndMotor::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 68 of file IndMotor.cpp.

69{
70 menu.Append(ID_EDIT_ELEMENT, _("Edit induction motor"));
71
72 wxMenu* textMenu = new wxMenu();
73
74 textMenu->Append(ID_TXT_NAME, _("Name"));
75 textMenu->Append(ID_TXT_ACTIVE_POWER, _("Active power"));
76 textMenu->Append(ID_TXT_REACTIVE_POWER, _("Reactive power"));
77 textMenu->SetClientData(menu.GetClientData());
78 menu.AppendSubMenu(textMenu, _("Add text"));
79
80 GeneralMenuItens(menu);
81 return true;
82}
@ 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 * IndMotor::GetCopy ( )
virtual

Get a the element copy.

Returns
Copy of the element.

Reimplemented from Element.

Definition at line 134 of file IndMotor.cpp.

135{
136 IndMotor* copy = new IndMotor();
137 *copy = *this;
138 return copy;
139}
Induction motor power element.
Definition IndMotor.h:119

◆ GetElectricalData()

virtual IndMotorElectricalData IndMotor::GetElectricalData ( )
inlinevirtual

Definition at line 132 of file IndMotor.h.

132{ return m_electricalData; }

◆ GetPlotData()

bool IndMotor::GetPlotData ( ElementPlotData plotData,
PlotStudy  study = PlotStudy::STABILITY 
)
virtual

Fill the plot data.

Parameters
plotDataPlot data to be filled.
Returns
true if the plot data was successfully filled, false otherwise.

Reimplemented from PowerElement.

Definition at line 291 of file IndMotor.cpp.

292{
293 if (!m_electricalData.plotIndMachine) return false;
294 plotData.SetName(m_electricalData.name);
295 plotData.SetCurveType(ElementPlotData::CurveType::CT_IND_MOTOR);
296
297 plotData.AddData(m_electricalData.terminalVoltageVector, _("Terminal voltage"));
298 plotData.AddData(m_electricalData.activePowerVector, _("Active power"));
299 plotData.AddData(m_electricalData.reactivePowerVector, _("Reactive power"));
300 plotData.AddData(m_electricalData.currentVector, _("Current"));
301 plotData.AddData(m_electricalData.electricalTorqueVector, _("Electrical torque"));
302 plotData.AddData(m_electricalData.mechanicalTorqueVector, _("Mechanical torque"));
303 plotData.AddData(m_electricalData.velocityVector, _("Speed"));
304 plotData.AddData(m_electricalData.slipVector, _("Slip"));
305 return true;
306}

◆ GetPUElectricalData()

IndMotorElectricalData IndMotor::GetPUElectricalData ( double  systemPowerBase)
virtual

Definition at line 94 of file IndMotor.cpp.

95{
96 IndMotorElectricalData data = m_electricalData;
97
98 switch (data.activePowerUnit) {
100 data.activePower = data.activePower / systemPowerBase;
101 data.activePowerUnit = ElectricalUnit::UNIT_PU;
102 } break;
104 data.activePower = (data.activePower * 1e3) / systemPowerBase;
105 data.activePowerUnit = ElectricalUnit::UNIT_PU;
106 } break;
108 data.activePower = (data.activePower * 1e6) / systemPowerBase;
109 data.activePowerUnit = ElectricalUnit::UNIT_PU;
110 } break;
111 default:
112 break;
113 }
114 switch (data.reactivePowerUnit) {
116 data.reactivePower = data.reactivePower / systemPowerBase;
117 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
118 } break;
120 data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
121 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
122 } break;
124 data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
125 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
126 } break;
127 default:
128 break;
129 }
130
131 return data;
132}

◆ GetTipText()

wxString IndMotor::GetTipText ( ) const
virtual

Get the tip text.

Returns
Tip text.

Reimplemented from Element.

Definition at line 141 of file IndMotor.cpp.

142{
143 wxString tipText = m_electricalData.name;
144 tipText += "\n";
145 double activePower = m_electricalData.activePower;
146 if (!m_online) activePower = 0.0;
147 tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
148 switch (m_electricalData.activePowerUnit) {
150 tipText += _(" p.u.");
151 } break;
153 tipText += _(" W");
154 } break;
156 tipText += _(" kW");
157 } break;
159 tipText += _(" MW");
160 } break;
161 default:
162 break;
163 }
164 double reactivePower = m_electricalData.reactivePower;
165 if (!m_online) reactivePower = 0.0;
166 tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
167 switch (m_electricalData.reactivePowerUnit) {
169 tipText += _(" p.u.");
170 } break;
172 tipText += _(" var");
173 } break;
175 tipText += _(" kvar");
176 } break;
178 tipText += _(" Mvar");
179 } break;
180 default:
181 break;
182 }
183
184 return tipText;
185}

◆ InitPowerFlowMotor()

void IndMotor::InitPowerFlowMotor ( double  systemPowerBase,
int  busNumber 
)
virtual

Definition at line 308 of file IndMotor.cpp.

309{
310 double k = 1.0; // Power base change factor.
311 if (m_electricalData.useMachinePowerAsBase) {
312 double oldBase = GetValueFromUnit(m_electricalData.ratedPower, m_electricalData.ratedPowerUnit);
313 k = systemPowerBase / oldBase;
314 }
315 // Calculate the induction machine transient constants at the machine base
316 m_electricalData.r1t = m_electricalData.r1 * k;
317 m_electricalData.r2t = m_electricalData.r2 * k;
318 m_electricalData.x1t = m_electricalData.x1 * k;
319 m_electricalData.x2t = m_electricalData.x2 * k;
320 m_electricalData.xmt = m_electricalData.xm * k;
321
322 m_electricalData.xt = m_electricalData.x1t +
323 (m_electricalData.x2t * m_electricalData.xmt) / (m_electricalData.x2t + m_electricalData.xmt);
324 m_electricalData.x0 = m_electricalData.x1t + m_electricalData.xmt;
325
326 double r1 = m_electricalData.r1t;
327 double r2 = m_electricalData.r2t;
328 if (m_electricalData.useKf) r2 *= (1.0 + m_electricalData.kf * m_electricalData.r2t);
329 double x1 = m_electricalData.x1t;
330 double x2 = m_electricalData.x2t;
331 double xm = m_electricalData.xmt;
332 m_electricalData.k1 = x2 + xm;
333 m_electricalData.k2 = -x1 * m_electricalData.k1 - x2 * xm;
334 m_electricalData.k3 = xm + x1;
335 m_electricalData.k4 = r1 * m_electricalData.k1;
336
337 auto puData = GetPUElectricalData(systemPowerBase);
338 m_electricalData.p0 = puData.activePower;
339 m_electricalData.busNum = busNumber;
340}

◆ OpenElement()

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

Reimplemented from PowerElement.

Definition at line 246 of file IndMotor.cpp.

247{
248 if (!OpenCADProperties(elementNode, parentList)) return false;
249
250 auto electricalProp = elementNode->first_node("ElectricalProperties");
251 if (!electricalProp) return false;
252
253 // Element properties
254 SetOnline(XMLParser::GetNodeValueInt(electricalProp, "IsOnline"));
255 m_electricalData.name = electricalProp->first_node("Name")->value();
256 m_electricalData.ratedPower = XMLParser::GetNodeValueDouble(electricalProp, "RatedPower");
257 m_electricalData.ratedPowerUnit =
258 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "RatedPower", "UnitID"));
259 m_electricalData.activePower = XMLParser::GetNodeValueDouble(electricalProp, "ActivePower");
260 m_electricalData.activePowerUnit =
261 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "ActivePower", "UnitID"));
262 m_electricalData.reactivePower = XMLParser::GetNodeValueDouble(electricalProp, "ReactivePower");
263 m_electricalData.reactivePowerUnit =
264 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID"));
265 m_electricalData.useMachinePowerAsBase = XMLParser::GetNodeValueInt(electricalProp, "UseMachineBase");
266
267 // Stability
268 auto stability = electricalProp->first_node("Stability");
269 m_electricalData.plotIndMachine = XMLParser::GetNodeValueInt(stability, "PlotIndMachine");
270 m_electricalData.inertia = XMLParser::GetNodeValueDouble(stability, "Inertia");
271 m_electricalData.r1 = XMLParser::GetNodeValueDouble(stability, "StatorResistence");
272 m_electricalData.x1 = XMLParser::GetNodeValueDouble(stability, "StatorReactance");
273 m_electricalData.r2 = XMLParser::GetNodeValueDouble(stability, "RotorResistence");
274 m_electricalData.x2 = XMLParser::GetNodeValueDouble(stability, "RotorReactance");
275 m_electricalData.xm = XMLParser::GetNodeValueDouble(stability, "MagnetizingReactance");
276 m_electricalData.useKf = XMLParser::GetNodeValueInt(stability, "UseCageFactor");
277 m_electricalData.kf = XMLParser::GetNodeValueDouble(stability, "CageFactor");
278 auto loadChar = stability->first_node("LoadCharacteristic");
279 m_electricalData.aw = XMLParser::GetNodeValueDouble(loadChar, "Constant");
280 m_electricalData.bw = XMLParser::GetNodeValueDouble(loadChar, "Linear");
281 m_electricalData.cw = XMLParser::GetNodeValueDouble(loadChar, "Quadratic");
282
283 if (!OpenSwitchingData(electricalProp)) return false;
284 if (m_swData.swTime.size() != 0) SetDynamicEvent(true);
285
286 m_inserted = true;
287
288 return true;
289}
ElectricalUnit
Electrical units.
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition Element.cpp:447
virtual void SetDynamicEvent(bool dynEvent=true)
Set if the power element have dynamic event.
std::vector< double > swTime

◆ SaveElement()

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

Reimplemented from Element.

Definition at line 187 of file IndMotor.cpp.

188{
189 auto elementNode = XMLParser::AppendNode(doc, elementListNode, "IndMotor");
190 XMLParser::SetNodeAttribute(doc, elementNode, "ID", m_elementID);
191
192 SaveCADProperties(doc, elementNode);
193
194 // Element properties
195 // General
196 auto electricalProp = XMLParser::AppendNode(doc, elementNode, "ElectricalProperties");
197 auto isOnline = XMLParser::AppendNode(doc, electricalProp, "IsOnline");
198 XMLParser::SetNodeValue(doc, isOnline, m_online);
199 auto name = XMLParser::AppendNode(doc, electricalProp, "Name");
200 XMLParser::SetNodeValue(doc, name, m_electricalData.name);
201 auto ratedPower = XMLParser::AppendNode(doc, electricalProp, "RatedPower");
202 XMLParser::SetNodeValue(doc, ratedPower, m_electricalData.ratedPower);
203 XMLParser::SetNodeAttribute(doc, ratedPower, "UnitID", static_cast<int>(m_electricalData.activePowerUnit));
204 auto activePower = XMLParser::AppendNode(doc, electricalProp, "ActivePower");
205 XMLParser::SetNodeValue(doc, activePower, m_electricalData.activePower);
206 XMLParser::SetNodeAttribute(doc, activePower, "UnitID", static_cast<int>(m_electricalData.activePowerUnit));
207 auto reactivePower = XMLParser::AppendNode(doc, electricalProp, "ReactivePower");
208 XMLParser::SetNodeValue(doc, reactivePower, m_electricalData.reactivePower);
209 XMLParser::SetNodeAttribute(doc, reactivePower, "UnitID", static_cast<int>(m_electricalData.reactivePowerUnit));
210 auto useMachineBase = XMLParser::AppendNode(doc, electricalProp, "UseMachineBase");
211 XMLParser::SetNodeValue(doc, useMachineBase, m_electricalData.useMachinePowerAsBase);
212
213 // Stability
214 auto stability = XMLParser::AppendNode(doc, electricalProp, "Stability");
215 auto plotMotor = XMLParser::AppendNode(doc, stability, "PlotIndMachine");
216 XMLParser::SetNodeValue(doc, plotMotor, m_electricalData.plotIndMachine);
217 auto inertia = XMLParser::AppendNode(doc, stability, "Inertia");
218 XMLParser::SetNodeValue(doc, inertia, m_electricalData.inertia);
219 auto r1 = XMLParser::AppendNode(doc, stability, "StatorResistence");
220 XMLParser::SetNodeValue(doc, r1, m_electricalData.r1);
221 auto x1 = XMLParser::AppendNode(doc, stability, "StatorReactance");
222 XMLParser::SetNodeValue(doc, x1, m_electricalData.x1);
223 auto r2 = XMLParser::AppendNode(doc, stability, "RotorResistence");
224 XMLParser::SetNodeValue(doc, r2, m_electricalData.r2);
225 auto x2 = XMLParser::AppendNode(doc, stability, "RotorReactance");
226 XMLParser::SetNodeValue(doc, x2, m_electricalData.x2);
227 auto xm = XMLParser::AppendNode(doc, stability, "MagnetizingReactance");
228 XMLParser::SetNodeValue(doc, xm, m_electricalData.xm);
229 auto useCageFactor = XMLParser::AppendNode(doc, stability, "UseCageFactor");
230 XMLParser::SetNodeValue(doc, useCageFactor, m_electricalData.useKf);
231 auto cageFactor = XMLParser::AppendNode(doc, stability, "CageFactor");
232 XMLParser::SetNodeValue(doc, cageFactor, m_electricalData.kf);
233 auto loadChar = XMLParser::AppendNode(doc, stability, "LoadCharacteristic");
234 auto aw = XMLParser::AppendNode(doc, loadChar, "Constant");
235 XMLParser::SetNodeValue(doc, aw, m_electricalData.aw);
236 auto bw = XMLParser::AppendNode(doc, loadChar, "Linear");
237 XMLParser::SetNodeValue(doc, bw, m_electricalData.bw);
238 auto cw = XMLParser::AppendNode(doc, loadChar, "Quadratic");
239 XMLParser::SetNodeValue(doc, cw, m_electricalData.cw);
240
241 SaveSwitchingData(doc, electricalProp);
242
243 return elementNode;
244}

◆ SetElectricalData()

virtual void IndMotor::SetElectricalData ( IndMotorElectricalData  electricalData)
inlinevirtual

Definition at line 134 of file IndMotor.h.

134{ m_electricalData = electricalData; }

◆ ShowForm()

bool IndMotor::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 84 of file IndMotor.cpp.

85{
86 IndMotorForm indMotorForm(parent, this);
87 indMotorForm.CentreOnParent();
88 if (indMotorForm.ShowModal() == wxID_OK) {
89 return true;
90 }
91 return false;
92}
Form to edit the induction motor power data.

Member Data Documentation

◆ m_electricalData

IndMotorElectricalData IndMotor::m_electricalData
protected

Definition at line 144 of file IndMotor.h.


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