Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
Load.cpp
1/*
2 * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#include "Load.h"
19
20Load::Load() : Shunt()
21{
22 m_elementType = TYPE_LOAD;
23}
24
25Load::Load(wxString name) : Shunt()
26{
27 m_elementType = TYPE_LOAD;
28 m_electricalData.name = name;
29}
30
31Load::~Load() {}
32
33bool Load::AddParent(Element* parent, wxPoint2DDouble position)
34{
35 if (parent) {
36 m_parentList.push_back(parent);
37 parent->AddChild(this);
38 wxPoint2DDouble parentPt =
39 parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
40 parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
41 parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
42
43 m_position = parentPt + wxPoint2DDouble(0.0, 100.0); // Shifts the position to the down of the bus.
44 m_width = m_height = 20.0;
45 m_rect = wxRect2DDouble(m_position.m_x - 10.0, m_position.m_y - 10.0, m_width, m_height);
46
47 m_pointList.push_back(parentPt);
48 m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
49 m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -20.0));
50 m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -10.0));
51
52 m_triangPts.push_back(wxPoint2DDouble(-m_width / 2.0, -m_height / 2.0));
53 m_triangPts.push_back(wxPoint2DDouble(m_width / 2.0, -m_height / 2.0));
54 m_triangPts.push_back(wxPoint2DDouble(0.0, m_height / 2.0));
55
56 m_inserted = true;
57
58 wxRect2DDouble genRect(0, 0, 0, 0);
59 m_switchRect.push_back(genRect); // Push a general rectangle.
62 UpdatePowerFlowArrowsPosition();
63
64 return true;
65 }
66 return false;
67}
68
69//void Load::Draw(wxPoint2DDouble translation, double scale) const
70//{
71// OpenGLColour elementColour;
72// if (m_online) {
73// if (m_dynEvent)
74// elementColour = m_dynamicEventColour;
75// else
76// elementColour = m_onlineElementColour;
77// }
78// else
79// elementColour = m_offlineElementColour;
80//
81// if (m_inserted) {
82// // Draw Selection (layer 1).
83// if (m_selected) {
84// glLineWidth(1.5 + m_borderSize * 2.0);
85// glColor4dv(m_selectionColour.GetRGBA());
86// std::vector<wxPoint2DDouble> selTriangPts;
87// selTriangPts.push_back(m_triangPts[0] + m_position +
88// wxPoint2DDouble(-m_borderSize / scale, -m_borderSize / scale));
89// selTriangPts.push_back(m_triangPts[1] + m_position +
90// wxPoint2DDouble(m_borderSize / scale, -m_borderSize / scale));
91// selTriangPts.push_back(m_triangPts[2] + m_position + wxPoint2DDouble(0.0, m_borderSize / scale));
92//
93// glPushMatrix();
94// glTranslated(m_position.m_x, m_position.m_y, 0.0);
95// glRotated(m_angle, 0.0, 0.0, 1.0);
96// glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
97// DrawTriangle(selTriangPts);
98// glPopMatrix();
99//
100// DrawLine(m_pointList);
101//
102// // Draw node selection.
103// DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
104// }
105//
106// // Draw Load (layer 2).
107// glLineWidth(1.5);
108//
109// // Draw node.
110// glColor4dv(elementColour.GetRGBA());
111// DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
112//
113// DrawLine(m_pointList);
114//
115// DrawSwitches();
116// DrawPowerFlowPts();
117//
118// std::vector<wxPoint2DDouble> triangPts;
119// for (int i = 0; i < 3; i++) { triangPts.push_back(m_triangPts[i] + m_position); }
120// glPushMatrix();
121// glTranslated(m_position.m_x, m_position.m_y, 0.0);
122// glRotated(m_angle, 0.0, 0.0, 1.0);
123// glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
124// glColor4dv(elementColour.GetRGBA());
125// DrawTriangle(triangPts);
126// glPopMatrix();
127// }
128//}
129
130void Load::DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext* gc) const
131{
132 wxColour elementColour;
133 if (m_online) {
134 if (m_dynEvent)
135 elementColour = m_dynamicEventColour;
136 else
137 elementColour = m_onlineElementColour;
138 }
139 else
140 elementColour = m_offlineElementColour;
141
142 if (m_inserted) {
143 // Draw Selection (layer 1).
144 if (m_selected) {
145 gc->SetPen(wxPen(m_selectionColour, 2 + m_borderSize * 2.0));
146 gc->SetBrush(*wxTRANSPARENT_BRUSH);
147
148 gc->StrokeLines(m_pointList.size(), &m_pointList[0]);
149
150 gc->SetPen(*wxTRANSPARENT_PEN);
151 gc->SetBrush(wxBrush(m_selectionColour));
152
153 std::vector<wxPoint2DDouble> selTriangPts;
154 selTriangPts.push_back(m_triangPts[0] + m_position +
155 wxPoint2DDouble(-m_borderSize / scale, -m_borderSize / scale));
156 selTriangPts.push_back(m_triangPts[1] + m_position +
157 wxPoint2DDouble(m_borderSize / scale, -m_borderSize / scale));
158 selTriangPts.push_back(m_triangPts[2] + m_position + wxPoint2DDouble(0.0, m_borderSize / scale));
159
160 // Push the current matrix on stack.
161 gc->PushState();
162 // Rotate the matrix around the object position.
163 gc->Translate(m_position.m_x, m_position.m_y);
164 gc->Rotate(wxDegToRad(m_angle));
165 gc->Translate(-m_position.m_x, -m_position.m_y);
166 DrawDCTriangle(selTriangPts, gc);
167 gc->PopState();
168
169 // Draw node selection.
170 DrawDCCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, gc);
171 }
172
173 // Draw Load (layer 2).
174 gc->SetPen(wxPen(elementColour, 2));
175 gc->SetBrush(*wxTRANSPARENT_BRUSH);
176 gc->StrokeLines(m_pointList.size(), &m_pointList[0]);
177
178 // Draw node.
179 gc->SetPen(*wxTRANSPARENT_PEN);
180 gc->SetBrush(wxBrush(elementColour));
181 DrawDCCircle(m_pointList[0], 5.0, 10, gc);
182
183 DrawDCSwitches(gc);
185
186 std::vector<wxPoint2DDouble> triangPts;
187 for (int i = 0; i < 3; i++) { triangPts.push_back(m_triangPts[i] + m_position); }
188 gc->PushState();
189 gc->Translate(m_position.m_x, m_position.m_y);
190 gc->Rotate(wxDegToRad(m_angle));
191 gc->Translate(-m_position.m_x, -m_position.m_y);
192 gc->SetPen(*wxTRANSPARENT_PEN);
193 gc->SetBrush(wxBrush(elementColour));
194 DrawDCTriangle(triangPts, gc);
195 gc->PopState();
196 }
197}
198
199void Load::DrawDC(wxPoint2DDouble translation, double scale, wxDC& dc) const
200{
201 wxColour elementColour;
202 if (m_online) {
203 if (m_dynEvent)
204 elementColour = m_dynamicEventColour;
205 else
206 elementColour = m_onlineElementColour;
207 }
208 else
209 elementColour = m_offlineElementColour;
210
211 std::vector<wxPoint> pointListInt;
212 for (auto& pt : m_pointList) {
213 pointListInt.emplace_back(static_cast<int>(pt.m_x), static_cast<int>(pt.m_y));
214 }
215 wxPoint pos = wxPoint(static_cast<int>(m_position.m_x), static_cast<int>(m_position.m_y));
216
217 if (m_inserted) {
218 // Draw Selection (layer 1).
219 if (m_selected) {
220 dc.SetPen(wxPen(m_selectionColour, 2 + m_borderSize * 2.0));
221 dc.SetBrush(*wxTRANSPARENT_BRUSH);
222
223 dc.DrawLines(pointListInt.size(), &pointListInt[0]);
224
225 dc.SetPen(*wxTRANSPARENT_PEN);
226 dc.SetBrush(wxBrush(m_selectionColour));
227
228 wxPoint2DDouble p;
229 wxPoint selTriangPts[3];
230 p = m_triangPts[0] + m_position + wxPoint2DDouble(-m_borderSize / scale, -m_borderSize / scale);
231 selTriangPts[0] = RotateAround(p, m_position, m_angle);
232 p = m_triangPts[1] + m_position + wxPoint2DDouble(m_borderSize / scale, -m_borderSize / scale);
233 selTriangPts[1] = RotateAround(p, m_position, m_angle);
234 p = m_triangPts[2] + m_position + wxPoint2DDouble(0.0, m_borderSize / scale);
235 selTriangPts[2] = RotateAround(p, m_position, m_angle);
236
237 dc.DrawPolygon(3, selTriangPts);
238
239 // Draw node selection.
240 DrawDCCircle(m_pointList[0], 5.0 + m_borderSize / scale, dc);
241 }
242
243 // Draw Load (layer 2).
244 dc.SetPen(wxPen(elementColour, 2));
245 dc.SetBrush(*wxTRANSPARENT_BRUSH);
246 dc.DrawLines(pointListInt.size(), &pointListInt[0]);
247
248 // Draw node.
249 dc.SetPen(*wxTRANSPARENT_PEN);
250 dc.SetBrush(wxBrush(elementColour));
251 DrawDCCircle(m_pointList[0], 5.0, dc);
252
253 DrawDCSwitches(dc);
255
256 wxPoint2DDouble p;
257 wxPoint triangPts[3];
258
259 //std::vector<wxPoint2DDouble> triangPts;
260 for (int i = 0; i < 3; i++) {
261 p = m_triangPts[i] + m_position;
262 triangPts[i] = RotateAround(p, m_position, m_angle);
263 }
264 dc.SetPen(*wxTRANSPARENT_PEN);
265 dc.SetBrush(wxBrush(elementColour));
266 dc.DrawPolygon(3, triangPts);
267 }
268}
269
270void Load::Rotate(bool clockwise)
271{
272 double rotAngle = m_rotationAngle;
273 if (!clockwise) rotAngle = -m_rotationAngle;
274
275 m_angle += rotAngle;
276 if (m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
277 m_pointList[2] = RotateAtPosition(m_pointList[2], rotAngle);
278 m_pointList[3] = RotateAtPosition(m_pointList[3], rotAngle);
279 UpdateSwitchesPosition();
280 UpdatePowerFlowArrowsPosition();
281}
282
283bool Load::GetContextMenu(wxMenu& menu)
284{
285 menu.Append(ID_EDIT_ELEMENT, _("Edit Load"));
286
287 wxMenu* textMenu = new wxMenu();
288
289 textMenu->Append(ID_TXT_NAME, _("Name"));
290 textMenu->Append(ID_TXT_ACTIVE_POWER, _("Active power"));
291 textMenu->Append(ID_TXT_REACTIVE_POWER, _("Reactive power"));
292 textMenu->SetClientData(menu.GetClientData());
293
294
295 menu.AppendSubMenu(textMenu, _("Add text"));
296
297 GeneralMenuItens(menu);
298 return true;
299}
300
301bool Load::ShowForm(wxWindow* parent, Element* element)
302{
303 LoadForm loadForm(parent, this);
304 loadForm.CenterOnParent();
305 if (loadForm.ShowModal() == wxID_OK) {
306 return true;
307 }
308 return false;
309}
310
311LoadElectricalData Load::GetPUElectricalData(double systemPowerBase)
312{
313 LoadElectricalData data = m_electricalData;
314 switch (data.activePowerUnit) {
316 data.activePower = data.activePower / systemPowerBase;
317 data.activePowerUnit = ElectricalUnit::UNIT_PU;
318 } break;
320 data.activePower = (data.activePower * 1e3) / systemPowerBase;
321 data.activePowerUnit = ElectricalUnit::UNIT_PU;
322 } break;
324 data.activePower = (data.activePower * 1e6) / systemPowerBase;
325 data.activePowerUnit = ElectricalUnit::UNIT_PU;
326 } break;
327 default:
328 break;
329 }
330 switch (data.reactivePowerUnit) {
332 data.reactivePower = data.reactivePower / systemPowerBase;
333 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
334 } break;
336 data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
337 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
338 } break;
340 data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
341 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
342 } break;
343 default:
344 break;
345 }
346
347 return data;
348}
349
351{
352 Load* copy = new Load();
353 *copy = *this;
354 return copy;
355}
356
357wxString Load::GetTipText() const
358{
359 wxString tipText = m_electricalData.name;
360
361 // TODO: Avoid power calculation.
362 double activePower = m_electricalData.activePower;
363 double reactivePower = m_electricalData.reactivePower;
364 if (!m_online) {
365 activePower = 0.0;
366 reactivePower = 0.0;
367 }
368 if (m_online && m_electricalData.loadType == CONST_IMPEDANCE) {
369 std::complex<double> v = static_cast<Bus*>(m_parentList[0])->GetElectricalData().voltage;
370 reactivePower *= std::pow(std::abs(v), 2);
371 activePower *= std::pow(std::abs(v), 2);
372 }
373 tipText += "\n";
374 tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
375 switch (m_electricalData.activePowerUnit) {
377 tipText += _(" p.u.");
378 } break;
380 tipText += _(" W");
381 } break;
383 tipText += _(" kW");
384 } break;
386 tipText += _(" MW");
387 } break;
388 default:
389 break;
390 }
391 tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
392 switch (m_electricalData.reactivePowerUnit) {
394 tipText += _(" p.u.");
395 } break;
397 tipText += _(" var");
398 } break;
400 tipText += _(" kvar");
401 } break;
403 tipText += _(" Mvar");
404 } break;
405 default:
406 break;
407 }
408
409 return tipText;
410}
411
413{
414 if (!m_electricalData.plotLoad) return false;
415 plotData.SetName(m_electricalData.name);
416 plotData.SetCurveType(ElementPlotData::CurveType::CT_LOAD);
417
418 std::vector<double> absVoltage, activePower, reactivePower, current;
419 for (unsigned int i = 0; i < m_electricalData.voltageVector.size(); ++i) {
420 absVoltage.push_back(std::abs(m_electricalData.voltageVector[i]));
421 activePower.push_back(std::real(m_electricalData.electricalPowerVector[i]));
422 reactivePower.push_back(std::imag(m_electricalData.electricalPowerVector[i]));
423 current.push_back(std::abs(std::complex<double>(activePower[i], -reactivePower[i]) /
424 std::conj(m_electricalData.voltageVector[i])));
425 }
426
427 plotData.AddData(absVoltage, _("Voltage"));
428 plotData.AddData(activePower, _("Active power"));
429 plotData.AddData(reactivePower, _("Reactive power"));
430 plotData.AddData(current, _("Current"));
431
432 return true;
433}
434
435rapidxml::xml_node<>* Load::SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode)
436{
437 auto elementNode = XMLParser::AppendNode(doc, elementListNode, "Load");
438 XMLParser::SetNodeAttribute(doc, elementNode, "ID", m_elementID);
439
440 SaveCADProperties(doc, elementNode);
441
442 auto electricalProp = XMLParser::AppendNode(doc, elementNode, "ElectricalProperties");
443 auto isOnline = XMLParser::AppendNode(doc, electricalProp, "IsOnline");
444 XMLParser::SetNodeValue(doc, isOnline, m_online);
445 auto name = XMLParser::AppendNode(doc, electricalProp, "Name");
446 XMLParser::SetNodeValue(doc, name, m_electricalData.name);
447 auto activePower = XMLParser::AppendNode(doc, electricalProp, "ActivePower");
448 XMLParser::SetNodeValue(doc, activePower, m_electricalData.activePower);
449 XMLParser::SetNodeAttribute(doc, activePower, "UnitID", static_cast<int>(m_electricalData.activePowerUnit));
450 auto reactivePower = XMLParser::AppendNode(doc, electricalProp, "ReactivePower");
451 XMLParser::SetNodeValue(doc, reactivePower, m_electricalData.reactivePower);
452 XMLParser::SetNodeAttribute(doc, reactivePower, "UnitID", static_cast<int>(m_electricalData.reactivePowerUnit));
453 auto loadType = XMLParser::AppendNode(doc, electricalProp, "LoadType");
454 XMLParser::SetNodeValue(doc, loadType, m_electricalData.loadType);
455
456 auto stability = XMLParser::AppendNode(doc, electricalProp, "Stability");
457 auto plotLoad = XMLParser::AppendNode(doc, stability, "PlotLoad");
458 XMLParser::SetNodeValue(doc, plotLoad, m_electricalData.plotLoad);
459 auto useCompLoad = XMLParser::AppendNode(doc, stability, "UseCompositeLoad");
460 XMLParser::SetNodeValue(doc, useCompLoad, m_electricalData.useCompLoad);
461 auto activePowerCompl = XMLParser::AppendNode(doc, stability, "ActivePowerComposition");
462 auto pzl = XMLParser::AppendNode(doc, activePowerCompl, "ConstantImpedance");
463 XMLParser::SetNodeValue(doc, pzl, m_electricalData.constImpedanceActive);
464 auto pil = XMLParser::AppendNode(doc, activePowerCompl, "ConstantCurrent");
465 XMLParser::SetNodeValue(doc, pil, m_electricalData.constCurrentActive);
466 auto ppl = XMLParser::AppendNode(doc, activePowerCompl, "ConstantPower");
467 XMLParser::SetNodeValue(doc, ppl, m_electricalData.constPowerActive);
468 auto reactivePowerCompl = XMLParser::AppendNode(doc, stability, "ReactivePowerComposition");
469 auto qzl = XMLParser::AppendNode(doc, reactivePowerCompl, "ConstantImpedance");
470 XMLParser::SetNodeValue(doc, qzl, m_electricalData.constImpedanceReactive);
471 auto qil = XMLParser::AppendNode(doc, reactivePowerCompl, "ConstantCurrent");
472 XMLParser::SetNodeValue(doc, qil, m_electricalData.constCurrentReactive);
473 auto qpl = XMLParser::AppendNode(doc, reactivePowerCompl, "ConstantPower");
474 XMLParser::SetNodeValue(doc, qpl, m_electricalData.constPowerReactive);
475
476 SaveSwitchingData(doc, electricalProp);
477
478 return elementNode;
479}
480
481bool Load::OpenElement(rapidxml::xml_node<>* elementNode, std::vector<Element*> parentList)
482{
483 if (!OpenCADProperties(elementNode, parentList)) return false;
484 // The load have to insert the points that define his triangle
485 m_triangPts.push_back(wxPoint2DDouble(-m_width / 2.0, -m_height / 2.0));
486 m_triangPts.push_back(wxPoint2DDouble(m_width / 2.0, -m_height / 2.0));
487 m_triangPts.push_back(wxPoint2DDouble(0.0, m_height / 2.0));
488
489 auto electricalProp = elementNode->first_node("ElectricalProperties");
490 if (!electricalProp) return false;
491
492 SetOnline(XMLParser::GetNodeValueInt(electricalProp, "IsOnline"));
493 m_electricalData.name = electricalProp->first_node("Name")->value();
494 m_electricalData.activePower = XMLParser::GetNodeValueDouble(electricalProp, "ActivePower");
495 m_electricalData.activePowerUnit =
496 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "ActivePower", "UnitID"));
497 m_electricalData.reactivePower = XMLParser::GetNodeValueDouble(electricalProp, "ReactivePower");
498 m_electricalData.reactivePowerUnit =
499 static_cast<ElectricalUnit>(XMLParser::GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID"));
500 m_electricalData.loadType = static_cast<LoadType>(XMLParser::GetNodeValueInt(electricalProp, "LoadType"));
501 // Stability
502 auto stability = electricalProp->first_node("Stability");
503 if (stability) {
504 m_electricalData.plotLoad = XMLParser::GetNodeValueInt(stability, "PlotLoad");
505 m_electricalData.useCompLoad = XMLParser::GetNodeValueInt(stability, "UseCompositeLoad");
506 auto activePowerComp = stability->first_node("ActivePowerComposition");
507 m_electricalData.constImpedanceActive = XMLParser::GetNodeValueDouble(activePowerComp, "ConstantImpedance");
508 m_electricalData.constCurrentActive = XMLParser::GetNodeValueDouble(activePowerComp, "ConstantCurrent");
509 m_electricalData.constPowerActive = XMLParser::GetNodeValueDouble(activePowerComp, "ConstantPower");
510 auto reactivePowerComp = stability->first_node("ReactivePowerComposition");
511 m_electricalData.constImpedanceReactive = XMLParser::GetNodeValueDouble(reactivePowerComp, "ConstantImpedance");
512 m_electricalData.constCurrentReactive = XMLParser::GetNodeValueDouble(reactivePowerComp, "ConstantCurrent");
513 m_electricalData.constPowerReactive = XMLParser::GetNodeValueDouble(reactivePowerComp, "ConstantPower");
514 }
515
516 if (!OpenSwitchingData(electricalProp)) return false;
517 if (m_swData.swTime.size() != 0) SetDynamicEvent(true);
518
519 m_inserted = true;
520
521 return true;
522}
@ ID_EDIT_ELEMENT
Definition Element.h:75
ElectricalUnit
Electrical units.
PlotStudy
Node for power elements. All others power elements are connected through this.
Definition Bus.h:86
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Definition Element.h:112
virtual void GeneralMenuItens(wxMenu &menu)
Insert general itens to context menu.
Definition Element.cpp:457
wxPoint2DDouble GetPosition() const
Get the element position.
Definition Element.h:186
double GetAngle() const
Get the element angle.
Definition Element.h:211
virtual void DrawDCTriangle(std::vector< wxPoint2DDouble > points, wxGraphicsContext *gc) const
Draw rectangle.
Definition Element.cpp:237
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition Element.cpp:292
virtual void AddChild(Element *child)
Add a child to the child list.
Definition Element.cpp:566
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition Element.cpp:447
virtual void DrawDCCircle(wxPoint2DDouble position, double radius, int numSegments, wxGraphicsContext *gc) const
Draw a circle using device context.
Definition Element.cpp:177
Form to edit the load power data.
Definition LoadForm.h:33
Loas shunt power element.
Definition Load.h:74
virtual wxString GetTipText() const
Get the tip text.
Definition Load.cpp:357
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition Load.cpp:283
virtual Element * GetCopy()
Get a the element copy.
Definition Load.cpp:350
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition Load.cpp:270
virtual bool GetPlotData(ElementPlotData &plotData, PlotStudy study=PlotStudy::STABILITY)
Fill the plot data.
Definition Load.cpp:412
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition Load.cpp:301
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,...
Definition Load.cpp:33
virtual void DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext *gc) const
Draw the element using GDI+.
Definition Load.cpp:130
virtual void SetDynamicEvent(bool dynEvent=true)
Set if the power element have dynamic event.
virtual void DrawDCSwitches(wxGraphicsContext *gc) const
Draw switch.
virtual void UpdateSwitches()
Update the switch position.
virtual void DrawDCPowerFlowPts(wxGraphicsContext *gc) const
Draw power flow arrows.
virtual wxPoint2DDouble GetSwitchPoint(Element *parent, wxPoint2DDouble parentPoint, wxPoint2DDouble secondPoint) const
Get the correct switch position.
Abstract class for shunt power elements.
Definition Shunt.h:32
std::vector< double > swTime