Power System Platform  2026w23a-beta
Loading...
Searching...
No Matches
GeneratorStabForm Class Reference

Form to edit the synchronous generator data for electromechanical studies. More...

#include <GeneratorStabForm.h>

Inheritance diagram for GeneratorStabForm:
Collaboration diagram for GeneratorStabForm:

Public Member Functions

 GeneratorStabForm (wxWindow *parent, SyncGenerator *syncGenerator, Workspace *workspace)
 

Protected Member Functions

virtual void UseAVRClick (wxCommandEvent &event)
 
virtual void UseSGClick (wxCommandEvent &event)
 
virtual void OnCancelButtonClick (wxCommandEvent &event)
 
virtual void OnEditAVRButtonClick (wxCommandEvent &event)
 
virtual void OnOKButtonClick (wxCommandEvent &event)
 
virtual void OnSpeedGovernorButtonClick (wxCommandEvent &event)
 
virtual void OnSwitchingButtonClick (wxCommandEvent &event)
 
virtual bool ValidateData ()
 

Protected Attributes

SyncGeneratorm_syncGenerator = nullptr
 
wxWindow * m_parent = nullptr
 
Workspacem_workspace = nullptr
 

Detailed Description

Form to edit the synchronous generator data for electromechanical studies.

Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
Date
05/10/2017

Definition at line 39 of file GeneratorStabForm.h.

Constructor & Destructor Documentation

◆ GeneratorStabForm()

GeneratorStabForm::GeneratorStabForm ( wxWindow *  parent,
SyncGenerator syncGenerator,
Workspace workspace 
)

Definition at line 30 of file GeneratorStabForm.cpp.

31 : GeneratorStabFormBase(parent), m_parent(parent), m_syncGenerator(syncGenerator), m_workspace(workspace)
32{
33 SetSize(GetBestSize());
34 //m_syncGenerator = syncGenerator;
35 //m_parent = parent;
36 //m_sharedGLContext = sharedGLContext;
37
38 SyncGeneratorElectricalData data = syncGenerator->GetElectricalData();
39
40 m_checkBoxPlotSyncMachine->SetValue(data.plotSyncMachine);
41
42 m_textCtrlInertia->SetValue(SyncGenerator::StringFromDouble(data.inertia));
43 m_textCtrlDamping->SetValue(SyncGenerator::StringFromDouble(data.damping));
44
45 m_checkBoxUseAVR->SetValue(data.useAVR);
46 m_buttonEditAVR->Enable(data.useAVR);
47
48 m_checkBoxUseSG->SetValue(data.useSpeedGovernor);
49 m_buttonEditSG->Enable(data.useSpeedGovernor);
50
51 m_textCtrlRa->SetValue(SyncGenerator::StringFromDouble(data.armResistance));
52 m_textCtrlXp->SetValue(SyncGenerator::StringFromDouble(data.potierReactance));
53 m_textCtrlSat->SetValue(SyncGenerator::StringFromDouble(data.satFactor));
54 m_textCtrlOCFreq->SetValue(SyncGenerator::StringFromDouble(data.ocFrequency));
55
56 m_textCtrlSyncXd->SetValue(SyncGenerator::StringFromDouble(data.syncXd));
57 m_textCtrlSyncXq->SetValue(SyncGenerator::StringFromDouble(data.syncXq));
58
59 m_textCtrlTranXd->SetValue(SyncGenerator::StringFromDouble(data.transXd));
60 m_textCtrlTranXq->SetValue(SyncGenerator::StringFromDouble(data.transXq));
61 m_textCtrlTranTd0->SetValue(SyncGenerator::StringFromDouble(data.transTd0));
62 m_textCtrlTranTq0->SetValue(SyncGenerator::StringFromDouble(data.transTq0));
63
64 m_textCtrlSubXd->SetValue(SyncGenerator::StringFromDouble(data.subXd));
65 m_textCtrlSubXq->SetValue(SyncGenerator::StringFromDouble(data.subXq));
66 m_textCtrlSubTd0->SetValue(SyncGenerator::StringFromDouble(data.subTd0));
67 m_textCtrlSubTq0->SetValue(SyncGenerator::StringFromDouble(data.subTq0));
68}
static wxString StringFromDouble(double value, int minDecimal=1, int maxDecimals=13)
Convert a double value to string.
Definition Element.cpp:466

◆ ~GeneratorStabForm()

GeneratorStabForm::~GeneratorStabForm ( )
virtual

Definition at line 70 of file GeneratorStabForm.cpp.

71{
72}

Member Function Documentation

◆ OnCancelButtonClick()

void GeneratorStabForm::OnCancelButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 73 of file GeneratorStabForm.cpp.

74{
75 EndModal(wxID_CANCEL);
76}

◆ OnEditAVRButtonClick()

void GeneratorStabForm::OnEditAVRButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 77 of file GeneratorStabForm.cpp.

78{
79 if (ValidateData()) {
80 SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
81 if (!data.avr) {
82 data.avr = new ControlElementContainer();
83 m_syncGenerator->SetElectricalData(data);
84 }
85
86 int ioFlags = IOControl::IN_TERMINAL_VOLTAGE | IOControl::IN_ACTIVE_POWER |
87 IOControl::IN_REACTIVE_POWER | IOControl::IN_INITIAL_TERMINAL_VOLTAGE | IOControl::IN_VELOCITY |
88 IOControl::IN_INITIAL_VELOCITY | IOControl::IN_DELTA_VELOCITY | IOControl::IN_DELTA_ACTIVE_POWER |
89 IOControl::OUT_FIELD_VOLTAGE;
90 auto& ceManager = m_workspace->GetControlEditorManager();
91 ceManager.Open(data.avr, static_cast<int>(m_workspace->GetProperties()->GetGeneralPropertiesData().plotLib), ioFlags);
92
93#ifdef __WXGTK__
94 EndModal(wxID_OK);
95#endif
96 }
97}
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...

◆ OnOKButtonClick()

void GeneratorStabForm::OnOKButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 99 of file GeneratorStabForm.cpp.

100{
101 if (ValidateData())
102 EndModal(wxID_OK);
103}

◆ OnSpeedGovernorButtonClick()

void GeneratorStabForm::OnSpeedGovernorButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 105 of file GeneratorStabForm.cpp.

106{
107 if (ValidateData()) {
108 SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
109 if (!data.speedGov) {
110 data.speedGov = new ControlElementContainer();
111 m_syncGenerator->SetElectricalData(data);
112 }
113
114 int ioFlags = IOControl::IN_VELOCITY | IOControl::IN_ACTIVE_POWER | IOControl::IN_REACTIVE_POWER |
115 IOControl::IN_INITIAL_VELOCITY | IOControl::IN_INITIAL_MEC_POWER | IOControl::OUT_MEC_POWER;
116 auto& ceManager = m_workspace->GetControlEditorManager();
117 ceManager.Open(data.speedGov, static_cast<int>(m_workspace->GetProperties()->GetGeneralPropertiesData().plotLib), ioFlags);
118
119#ifdef __WXGTK__
120 EndModal(wxID_OK);
121#endif
122 }
123}

◆ OnSwitchingButtonClick()

void GeneratorStabForm::OnSwitchingButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 125 of file GeneratorStabForm.cpp.

126{
127 if (ValidateData()) {
128 SwitchingForm swForm(m_parent, m_syncGenerator);
129 swForm.SetTitle(_("Synchronous generator: Switching"));
130 swForm.ShowModal();
131 EndModal(wxID_OK);
132 }
133}
Form to edit the switching data of power elements for electromechanical transient studies.

◆ UseAVRClick()

void GeneratorStabForm::UseAVRClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 212 of file GeneratorStabForm.cpp.

213{
214 m_buttonEditAVR->Enable(m_checkBoxUseAVR->GetValue());
215}

◆ UseSGClick()

void GeneratorStabForm::UseSGClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 216 of file GeneratorStabForm.cpp.

217{
218 m_buttonEditSG->Enable(m_checkBoxUseSG->GetValue());
219}

◆ ValidateData()

bool GeneratorStabForm::ValidateData ( )
protectedvirtual

Definition at line 135 of file GeneratorStabForm.cpp.

136{
137 SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
138
139 data.plotSyncMachine = m_checkBoxPlotSyncMachine->GetValue();
140
141 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlInertia->GetValue(), data.inertia,
142 _("Value entered incorrectly in the field \"Inertia\".")))
143 return false;
144
145 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlDamping->GetValue(), data.damping,
146 _("Value entered incorrectly in the field \"Damping factor\".")))
147 return false;
148
149 data.useAVR = m_checkBoxUseAVR->GetValue();
150 data.useSpeedGovernor = m_checkBoxUseSG->GetValue();
151
152 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlRa->GetValue(), data.armResistance,
153 _("Value entered incorrectly in the field \"Armature resistance\".")))
154 return false;
155
156 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlXp->GetValue(), data.potierReactance,
157 _("Value entered incorrectly in the field \"Potier reactance\".")))
158 return false;
159
160 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlSat->GetValue(), data.satFactor,
161 _("Value entered incorrectly in the field \"Saturation factor\".")))
162 return false;
163
164 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlOCFreq->GetValue(), data.ocFrequency,
165 _("Value entered incorrectly in the field \"Open-circuit frequency\".")))
166 return false;
167
168 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlSyncXd->GetValue(), data.syncXd,
169 _("Value entered incorrectly in the field \"Synchronous direct-axis reactance\".")))
170 return false;
171
172 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlSyncXq->GetValue(), data.syncXq,
173 _("Value entered incorrectly in the field \"Synchronous quadrature-axis reactance\".")))
174 return false;
175
176 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlTranXd->GetValue(), data.transXd,
177 _("Value entered incorrectly in the field \"Transitory direct-axis reactance\".")))
178 return false;
179
180 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlTranXq->GetValue(), data.transXq,
181 _("Value entered incorrectly in the field \"Transitory quadrature-axis reactance\".")))
182 return false;
183
184 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlTranTd0->GetValue(), data.transTd0,
185 _("Value entered incorrectly in the field \"Transitory direct-axis time constant\".")))
186 return false;
187
188 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlTranTq0->GetValue(), data.transTq0,
189 _("Value entered incorrectly in the field \"Transitory quadrature-axis time constant\".")))
190 return false;
191
192 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlSubXd->GetValue(), data.subXd,
193 _("Value entered incorrectly in the field \"Subtransitory direct-axis reactance\".")))
194 return false;
195
196 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlSubXq->GetValue(), data.subXq,
197 _("Value entered incorrectly in the field \"Subtransitory quadrature-axis reactance\".")))
198 return false;
199
200 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlSubTd0->GetValue(), data.subTd0,
201 _("Value entered incorrectly in the field \"Subtransitory direct-axis time constant\".")))
202 return false;
203
204 if (!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlSubTq0->GetValue(), data.subTq0,
205 _("Value entered incorrectly in the field \"Subtransitory quadrature-axis time constant\".")))
206 return false;
207
208 m_syncGenerator->SetElectricalData(data);
209
210 return true;
211}
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.
Definition Element.cpp:438

Member Data Documentation

◆ m_parent

wxWindow* GeneratorStabForm::m_parent = nullptr
protected

Definition at line 58 of file GeneratorStabForm.h.

◆ m_syncGenerator

SyncGenerator* GeneratorStabForm::m_syncGenerator = nullptr
protected

Definition at line 57 of file GeneratorStabForm.h.

◆ m_workspace

Workspace* GeneratorStabForm::m_workspace = nullptr
protected

Definition at line 59 of file GeneratorStabForm.h.


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