Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
Load.h
Go to the documentation of this file.
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#ifndef LOAD_H
19#define LOAD_H
20
21#include "../../forms/LoadForm.h"
22#include "Shunt.h"
23
24enum LoadType { CONST_POWER = 0, CONST_IMPEDANCE };
25
27 wxString name;
28 double activePower = 100.0;
30 double reactivePower = 0.0;
31 ElectricalUnit reactivePowerUnit = ElectricalUnit::UNIT_Mvar;
32 LoadType loadType = CONST_POWER;
33
34 // Stability
35 bool plotLoad = false;
36 // ZIP load
37 bool useCompLoad = false;
38 // The power injected on the "i" bus flollow the quadratic equation:
39 // -p(i) = pz0 * (v(i) / v0) ^ 2 + pi0 * (v(i) / v0) + pp0
40 double v0 = 1.0; // Initial load voltage from load flow in p.u.
41 double pz0 = 1.0; // Initial active power modelled as constant impedance from load flow in p.u.
42 double pi0 = 0.0; // Initial active power modelled as constant current from load flow in p.u.
43 double pp0 = 0.0; // Initial active power modelled as constant power from load flow in p.u.
44 double qz0 = 1.0; // Initial reactive power modelled as constant impedance from load flow in p.u.
45 double qi0 = 0.0; // Initial reactive power modelled as constant current from load flow in p.u.
46 double qp0 = 0.0; // Initial reactive power modelled as constant power from load flow in p.u.
47 double constImpedanceActive = 100.0; // Constant impedance portion of active power (%).
48 double constCurrentActive = 0.0; // Constant current portion of active power (%).
49 double constPowerActive = 0.0; // Constant power portion of active power (%).
50 double constImpedanceReactive = 100.0; // Constant impedance portion of reactive power (%).
51 double constCurrentReactive = 0.0; // Constant current portion of reactive power (%).
52 double constPowerReactive = 0.0; // Constant power portion of reactive power (%).
53 std::complex<double> y0; // Steady-state equivalent admittance calculated from power flow.
54 // Undervoltage (in p.u.) which the constant current portion will be modelled as constant impedance.
55 double constCurrentUV = 0.7;
56 // Undervoltage (in p.u.) which the constant power portion will be modelled as constant impedance.
57 double constPowerUV = 0.7;
58
59 // Load state variables
60 std::complex<double> voltage;
61 std::vector<std::complex<double> > voltageVector;
62 std::complex<double> electricalPower;
63 std::vector<std::complex<double> > electricalPowerVector;
64};
65
73class Load : public Shunt
74{
75 public:
76 Load();
77 Load(wxString name);
78 ~Load();
79
80 virtual Element* GetCopy();
81 virtual bool AddParent(Element* parent, wxPoint2DDouble position);
82 //virtual void Draw(wxPoint2DDouble translation, double scale) const;
83 virtual void DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext* gc) const;
84 virtual void DrawDC(wxPoint2DDouble translation, double scale, wxDC& dc) const;
85 virtual void Rotate(bool clockwise = true);
86 virtual bool GetContextMenu(wxMenu& menu);
87 virtual wxString GetTipText() const;
88 virtual bool ShowForm(wxWindow* parent, Element* element);
89 LoadElectricalData GetElectricalData() { return m_electricalData; }
90 LoadElectricalData GetPUElectricalData(double systemPowerBase);
91 void SetElectricalData(const LoadElectricalData& electricalData) { m_electricalData = electricalData; }
92 virtual bool GetPlotData(ElementPlotData& plotData, PlotStudy study = PlotStudy::STABILITY);
93
94 virtual rapidxml::xml_node<>* SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode);
95 virtual bool OpenElement(rapidxml::xml_node<>* elementNode, std::vector<Element*> parentList);
96
97 protected:
98 std::vector<wxPoint2DDouble> m_triangPts;
99 LoadElectricalData m_electricalData;
100};
101
102#endif // LOAD_H
ElectricalUnit
Electrical units.
PlotStudy
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Definition Element.h:112
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
Abstract class for shunt power elements.
Definition Shunt.h:32