Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
ReactiveShuntElementForm Class Reference

Form to edit the reactive shunt element power data. More...

#include <ReactiveShuntElementForm.h>

Inheritance diagram for ReactiveShuntElementForm:
Collaboration diagram for ReactiveShuntElementForm:

Public Member Functions

 ReactiveShuntElementForm (wxWindow *parent, Capacitor *capacitor)
 
 ReactiveShuntElementForm (wxWindow *parent, Inductor *inductor)
 
virtual bool ValidateData ()
 

Protected Member Functions

virtual void OnCancelButtonClick (wxCommandEvent &event)
 
virtual void OnOKButtonClick (wxCommandEvent &event)
 
virtual void OnStabilityButtonClick (wxCommandEvent &event)
 

Protected Attributes

wxWindow * m_parent
 
Capacitorm_capacitor = nullptr
 
Inductorm_inductor = nullptr
 

Detailed Description

Form to edit the reactive shunt element power data.

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

Definition at line 34 of file ReactiveShuntElementForm.h.

Constructor & Destructor Documentation

◆ ReactiveShuntElementForm() [1/2]

ReactiveShuntElementForm::ReactiveShuntElementForm ( wxWindow *  parent,
Capacitor capacitor 
)

Definition at line 23 of file ReactiveShuntElementForm.cpp.

24 : ReactiveShuntElementFormBase(parent)
25{
26 SetSize(GetBestSize());
27 CapacitorElectricalData data = capacitor->GetElectricalData();
28
29 m_textCtrlName->SetValue(data.name);
30
31 m_textCtrlReactivePower->SetValue(Capacitor::StringFromDouble(data.reactivePower));
32 switch(data.reactivePowerUnit) {
34 m_choiceReactivePower->SetSelection(0);
35 } break;
37 m_choiceReactivePower->SetSelection(1);
38 } break;
40 m_choiceReactivePower->SetSelection(2);
41 } break;
43 m_choiceReactivePower->SetSelection(3);
44 } break;
45 default:
46 break;
47 }
48
49 m_parent = parent;
50 m_capacitor = capacitor;
51}
static wxString StringFromDouble(double value, int minDecimal=1, int maxDecimals=13)
Convert a double value to string.
Definition Element.cpp:533

◆ ReactiveShuntElementForm() [2/2]

ReactiveShuntElementForm::ReactiveShuntElementForm ( wxWindow *  parent,
Inductor inductor 
)

Definition at line 53 of file ReactiveShuntElementForm.cpp.

54 : ReactiveShuntElementFormBase(parent)
55{
56 InductorElectricalData data = inductor->GetElectricalData();
57
58 m_textCtrlName->SetValue(data.name);
59
60 m_textCtrlReactivePower->SetValue(Inductor::StringFromDouble(data.reactivePower));
61 switch(data.reactivePowerUnit) {
63 m_choiceReactivePower->SetSelection(0);
64 } break;
66 m_choiceReactivePower->SetSelection(1);
67 } break;
69 m_choiceReactivePower->SetSelection(2);
70 } break;
72 m_choiceReactivePower->SetSelection(3);
73 } break;
74 default:
75 break;
76 }
77
78 m_parent = parent;
79 m_inductor = inductor;
80}

◆ ~ReactiveShuntElementForm()

ReactiveShuntElementForm::~ReactiveShuntElementForm ( )
virtual

Definition at line 82 of file ReactiveShuntElementForm.cpp.

82{}

Member Function Documentation

◆ OnCancelButtonClick()

virtual void ReactiveShuntElementForm::OnCancelButtonClick ( wxCommandEvent &  event)
inlineprotectedvirtual

Definition at line 43 of file ReactiveShuntElementForm.h.

43{ EndModal(wxID_CANCEL); }

◆ OnOKButtonClick()

void ReactiveShuntElementForm::OnOKButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 83 of file ReactiveShuntElementForm.cpp.

84{
85 if(ValidateData()) EndModal(wxID_OK);
86}

◆ OnStabilityButtonClick()

void ReactiveShuntElementForm::OnStabilityButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 88 of file ReactiveShuntElementForm.cpp.

89{
90 if(ValidateData()) {
91 if(m_capacitor) {
92 SwitchingForm swForm(m_parent, m_capacitor);
93 swForm.SetTitle(_("Capacitor: Switching"));
94 swForm.ShowModal();
95 } else if(m_inductor) {
96 SwitchingForm swForm(m_parent, m_inductor);
97 swForm.SetTitle(_("Inductor: Switching"));
98 swForm.ShowModal();
99 }
100
101 EndModal(wxID_OK);
102 }
103}
Form to edit the switching data of power elements for electromechanical transient studies.

◆ ValidateData()

bool ReactiveShuntElementForm::ValidateData ( )
virtual

Definition at line 105 of file ReactiveShuntElementForm.cpp.

106{
107 if(m_capacitor) {
109
110 data.name = m_textCtrlName->GetValue();
111
112 if(!m_capacitor->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
113 _("Value entered incorrectly in the field \"Reactive power\".")))
114 return false;
115 switch(m_choiceReactivePower->GetSelection()) {
116 case 0: {
117 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
118 } break;
119 case 1: {
120 data.reactivePowerUnit = ElectricalUnit::UNIT_var;
121 } break;
122 case 2: {
123 data.reactivePowerUnit = ElectricalUnit::UNIT_kvar;
124 } break;
125 case 3: {
126 data.reactivePowerUnit = ElectricalUnit::UNIT_Mvar;
127 } break;
128 }
129
130 m_capacitor->SetElectricalData(data);
131 } else if(m_inductor) {
133
134 data.name = m_textCtrlName->GetValue();
135
136 if(!m_inductor->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
137 _("Value entered incorrectly in the field \"Reactive power\".")))
138 return false;
139 switch(m_choiceReactivePower->GetSelection()) {
140 case 0: {
141 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
142 } break;
143 case 1: {
144 data.reactivePowerUnit = ElectricalUnit::UNIT_var;
145 } break;
146 case 2: {
147 data.reactivePowerUnit = ElectricalUnit::UNIT_kvar;
148 } break;
149 case 3: {
150 data.reactivePowerUnit = ElectricalUnit::UNIT_Mvar;
151 } break;
152 }
153
154 m_inductor->SetElectricalData(data);
155 }
156 return true;
157}
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:505

Member Data Documentation

◆ m_capacitor

Capacitor* ReactiveShuntElementForm::m_capacitor = nullptr
protected

Definition at line 48 of file ReactiveShuntElementForm.h.

◆ m_inductor

Inductor* ReactiveShuntElementForm::m_inductor = nullptr
protected

Definition at line 49 of file ReactiveShuntElementForm.h.

◆ m_parent

wxWindow* ReactiveShuntElementForm::m_parent
protected

Definition at line 47 of file ReactiveShuntElementForm.h.


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