Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
SyncMotor.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 SYNCMOTOR_H
19#define SYNCMOTOR_H
20
21#include "Machines.h"
22
23class SyncMachineForm;
24
26 // General
27 wxString name = "";
28 double nominalPower = 100.0;
30 double nominalVoltage = 13.8;
31 ElectricalUnit nominalVoltageUnit = ElectricalUnit::UNIT_kV;
32 double activePower = 100.0;
34 double reactivePower = 0.0;
35 ElectricalUnit reactivePowerUnit = ElectricalUnit::UNIT_Mvar;
36 bool haveMaxReactive = false;
37 double maxReactive = 9999.0;
39 bool haveMinReactive = false;
40 double minReactive = -9999.0;
42 bool useMachineBase = true;
43
44 // Fault
45 double positiveResistance = 0.0;
46 double positiveReactance = 1.0;
47 double negativeResistance = 0.0;
48 double negativeReactance = 1.0;
49 double zeroResistance = 0.0;
50 double zeroReactance = 1.0;
51 double groundResistance = 0.0;
52 double groundReactance = 0.0;
53 bool groundNeutral = true;
54 // p.u. fault data
55 std::complex<double> faultCurrent[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
56 std::complex<double>(0.0, 0.0)};
57
58 // Stability
59 bool plotSyncMachine = false;
60 double inertia = 1.0;
61 double damping = 0.0;
62 bool useAVR = false;
63 bool useSpeedGovernor = false;
64
65 double armResistance = 0.0;
66 double potierReactance = 0.0;
67 double satFactor = 0.0;
68
69 double syncXd = 0.0;
70 double syncXq = 0.0;
71 double transXd = 1.0;
72 double transXq = 0.0;
73 double transTd0 = 0.0;
74 double transTq0 = 0.0;
75 double subXd = 0.0;
76 double subXq = 0.0;
77 double subTd0 = 0.0;
78 double subTq0 = 0.0;
79
80 // Machine state variables
81 std::complex<double> terminalVoltage;
82 std::vector<std::complex<double> > terminalVoltageVector;
83 std::complex<double> electricalPower;
84 std::vector<std::complex<double> > electricalPowerVector;
85 double pm;
86 std::vector<double> mechanicalPowerVector;
87 double speed;
88 std::vector<double> freqVector;
89 double fieldVoltage;
90 std::vector<double> fieldVoltageVector;
91 double delta;
92 std::vector<double> deltaVector;
93
94 double initialFieldVoltage;
95
96 // Internal machine variables
97 double tranEq;
98 double tranEd;
99 double subEq;
100 double subEd;
101 double pe;
102
103 // Variables to extrapolate
104 double oldId;
105 double oldIq;
106 double oldPe;
107
108 // Integration constants
109 IntegrationConstant icSpeed;
110 IntegrationConstant icDelta;
111 IntegrationConstant icTranEq;
112 IntegrationConstant icTranEd;
113 IntegrationConstant icSubEq;
114 IntegrationConstant icSubEd;
115
116 // Control
117 ControlElementContainer* avr = nullptr;
118 ControlElementContainer* speedGov = nullptr;
119
120 // Control solvers
121 ControlElementSolver* avrSolver = nullptr;
122 ControlElementSolver* speedGovSolver = nullptr;
123
124 Machines::SyncMachineModel model = Machines::SM_MODEL_1;
125};
126
134class SyncMotor : public Machines
135{
136 public:
137 SyncMotor();
138 SyncMotor(wxString name);
139 ~SyncMotor();
140
141 virtual Element* GetCopy();
142 //virtual void DrawSymbol() const;
143 virtual void DrawDCSymbol(wxGraphicsContext* gc) const;
144 virtual void DrawDCSymbol(wxDC& dc) const;
145 virtual bool GetContextMenu(wxMenu& menu);
146 virtual wxString GetTipText() const;
147 virtual SyncMotorElectricalData GetElectricalData() { return m_electricalData; }
148 virtual SyncMotorElectricalData GetPUElectricalData(double systemPowerBase);
149 virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
150 virtual void SetElectricalData(SyncMotorElectricalData electricalData) { m_electricalData = electricalData; }
151 virtual bool ShowForm(wxWindow* parent, Element* element);
152
153 virtual rapidxml::xml_node<>* SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode);
154 virtual bool OpenElement(rapidxml::xml_node<>* elementNode, std::vector<Element*> parentList);
155
156 protected:
157 SyncMotorElectricalData m_electricalData;
158};
159
160#endif // SYNCMOTOR_H
ElectricalUnit
Electrical units.
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
Solves in the time the control system. Can solve the control system directly from a ControlEditor or ...
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Definition Element.h:112
Abstract class for rotary machines power elements.
Definition Machines.h:34
Form to edit the synchronous machine power data.
Synchronous motor (synchronous compensator) power element.
Definition SyncMotor.h:135
virtual Element * GetCopy()
Get a the element copy.
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
virtual wxString GetTipText() const
Get the tip text.
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition SyncMotor.cpp:62
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition SyncMotor.cpp:45
Integration constants to calculate dynamic elements through trapezoidal integration method.