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