Power System Platform  2026w11a-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, wxWindow *workspace=nullptr)
 Show element data form.
 
virtual IndMotorElectricalData GetElectricalData ()
 
virtual IndMotorElectricalDataGetElectricalDataRef ()
 
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 349 of file IndMotor.cpp.

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

◆ 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:388
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 141 of file IndMotor.cpp.

142{
143 IndMotor* copy = new IndMotor();
144 *copy = *this;
145 return copy;
146}
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; }

◆ GetElectricalDataRef()

virtual IndMotorElectricalData & IndMotor::GetElectricalDataRef ( )
inlinevirtual

Definition at line 133 of file IndMotor.h.

133{ 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 298 of file IndMotor.cpp.

299{
300 if (!m_electricalData.plotIndMachine) return false;
301 plotData.SetName(m_electricalData.name);
302 plotData.SetCurveType(ElementPlotData::CurveType::CT_IND_MOTOR);
303
304 plotData.AddData(m_electricalData.terminalVoltageVector, _("Terminal voltage"));
305 plotData.AddData(m_electricalData.activePowerVector, _("Active power"));
306 plotData.AddData(m_electricalData.reactivePowerVector, _("Reactive power"));
307 plotData.AddData(m_electricalData.currentVector, _("Current"));
308 plotData.AddData(m_electricalData.electricalTorqueVector, _("Electrical torque"));
309 plotData.AddData(m_electricalData.mechanicalTorqueVector, _("Mechanical torque"));
310 plotData.AddData(m_electricalData.velocityVector, _("Speed"));
311 plotData.AddData(m_electricalData.slipVector, _("Slip"));
312 return true;
313}

◆ GetPUElectricalData()

IndMotorElectricalData IndMotor::GetPUElectricalData ( double  systemPowerBase)
virtual

Definition at line 94 of file IndMotor.cpp.

95{
96 //IndMotorElectricalData data
98 data.name = m_electricalData.name;
99 data.activePower = m_electricalData.activePower;
100 data.activePowerUnit = m_electricalData.activePowerUnit;
101 data.reactivePower = m_electricalData.reactivePower;
102 data.reactivePowerUnit = m_electricalData.reactivePowerUnit;
103
104
105 switch (data.activePowerUnit) {
107 data.activePower = data.activePower / systemPowerBase;
108 data.activePowerUnit = ElectricalUnit::UNIT_PU;
109 } break;
111 data.activePower = (data.activePower * 1e3) / systemPowerBase;
112 data.activePowerUnit = ElectricalUnit::UNIT_PU;
113 } break;
115 data.activePower = (data.activePower * 1e6) / systemPowerBase;
116 data.activePowerUnit = ElectricalUnit::UNIT_PU;
117 } break;
118 default:
119 break;
120 }
121 switch (data.reactivePowerUnit) {
123 data.reactivePower = data.reactivePower / systemPowerBase;
124 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
125 } break;
127 data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
128 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
129 } break;
131 data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
132 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
133 } break;
134 default:
135 break;
136 }
137
138 return data;
139}

◆ GetTipText()

wxString IndMotor::GetTipText ( ) const
virtual

Get the tip text.

Returns
Tip text.

Reimplemented from Element.

Definition at line 148 of file IndMotor.cpp.

149{
150 wxString tipText = m_electricalData.name;
151 tipText += "\n";
152 double activePower = m_electricalData.activePower;
153 if (!m_online) activePower = 0.0;
154 tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
155 switch (m_electricalData.activePowerUnit) {
157 tipText += _(" p.u.");
158 } break;
160 tipText += _(" W");
161 } break;
163 tipText += _(" kW");
164 } break;
166 tipText += _(" MW");
167 } break;
168 default:
169 break;
170 }
171 double reactivePower = m_electricalData.reactivePower;
172 if (!m_online) reactivePower = 0.0;
173 tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
174 switch (m_electricalData.reactivePowerUnit) {
176 tipText += _(" p.u.");
177 } break;
179 tipText += _(" var");
180 } break;
182 tipText += _(" kvar");
183 } break;
185 tipText += _(" Mvar");
186 } break;
187 default:
188 break;
189 }
190
191 return tipText;
192}

◆ InitPowerFlowMotor()

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

Definition at line 315 of file IndMotor.cpp.

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

◆ OpenElement()

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

Reimplemented from PowerElement.

Definition at line 253 of file IndMotor.cpp.

254{
255 if (!OpenCADProperties(elementNode, parentList)) return false;
256
257 auto electricalProp = elementNode->first_node("ElectricalProperties");
258 if (!electricalProp) return false;
259
260 // Element properties
261 SetOnline(XMLParser::GetNodeValueInt(electricalProp, "IsOnline"));
262 m_electricalData.name = electricalProp->first_node("Name")->value();
263 m_electricalData.ratedPower = XMLParser::GetNodeValueDouble(electricalProp, "RatedPower");
264 m_electricalData.ratedPowerUnit =
265 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "RatedPower", "UnitID"));
266 m_electricalData.activePower = XMLParser::GetNodeValueDouble(electricalProp, "ActivePower");
267 m_electricalData.activePowerUnit =
268 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "ActivePower", "UnitID"));
269 m_electricalData.reactivePower = XMLParser::GetNodeValueDouble(electricalProp, "ReactivePower");
270 m_electricalData.reactivePowerUnit =
271 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID"));
272 m_electricalData.useMachinePowerAsBase = XMLParser::GetNodeValueInt(electricalProp, "UseMachineBase");
273
274 // Stability
275 auto stability = electricalProp->first_node("Stability");
276 m_electricalData.plotIndMachine = XMLParser::GetNodeValueInt(stability, "PlotIndMachine");
277 m_electricalData.inertia = XMLParser::GetNodeValueDouble(stability, "Inertia");
278 m_electricalData.r1 = XMLParser::GetNodeValueDouble(stability, "StatorResistence");
279 m_electricalData.x1 = XMLParser::GetNodeValueDouble(stability, "StatorReactance");
280 m_electricalData.r2 = XMLParser::GetNodeValueDouble(stability, "RotorResistence");
281 m_electricalData.x2 = XMLParser::GetNodeValueDouble(stability, "RotorReactance");
282 m_electricalData.xm = XMLParser::GetNodeValueDouble(stability, "MagnetizingReactance");
283 m_electricalData.useKf = XMLParser::GetNodeValueInt(stability, "UseCageFactor");
284 m_electricalData.kf = XMLParser::GetNodeValueDouble(stability, "CageFactor");
285 auto loadChar = stability->first_node("LoadCharacteristic");
286 m_electricalData.aw = XMLParser::GetNodeValueDouble(loadChar, "Constant");
287 m_electricalData.bw = XMLParser::GetNodeValueDouble(loadChar, "Linear");
288 m_electricalData.cw = XMLParser::GetNodeValueDouble(loadChar, "Quadratic");
289
290 if (!OpenSwitchingData(electricalProp)) return false;
291 if (m_swData.swTime.size() != 0) SetDynamicEvent(true);
292
293 m_inserted = true;
294
295 return true;
296}
ElectricalUnit
Electrical units.
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition Element.cpp:378
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 194 of file IndMotor.cpp.

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

◆ SetElectricalData()

virtual void IndMotor::SetElectricalData ( IndMotorElectricalData  electricalData)
inlinevirtual

Definition at line 135 of file IndMotor.h.

135{ m_electricalData = electricalData; }

◆ ShowForm()

bool IndMotor::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 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 145 of file IndMotor.h.


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