20#include "../elements/powerElement/Capacitor.h"
21#include "../elements/powerElement/Inductor.h"
23ReactiveShuntElementForm::ReactiveShuntElementForm(wxWindow* parent,
Capacitor* capacitor)
24 : ReactiveShuntElementFormBase(parent)
26 SetSize(GetBestSize());
29 m_textCtrlName->SetValue(data.name);
32 switch(data.reactivePowerUnit) {
34 m_choiceReactivePower->SetSelection(0);
37 m_choiceReactivePower->SetSelection(1);
40 m_choiceReactivePower->SetSelection(2);
43 m_choiceReactivePower->SetSelection(3);
50 m_capacitor = capacitor;
53ReactiveShuntElementForm::ReactiveShuntElementForm(wxWindow* parent,
Inductor* inductor)
54 : ReactiveShuntElementFormBase(parent)
58 m_textCtrlName->SetValue(data.name);
61 switch(data.reactivePowerUnit) {
63 m_choiceReactivePower->SetSelection(0);
66 m_choiceReactivePower->SetSelection(1);
69 m_choiceReactivePower->SetSelection(2);
72 m_choiceReactivePower->SetSelection(3);
79 m_inductor = inductor;
82ReactiveShuntElementForm::~ReactiveShuntElementForm() {}
83void ReactiveShuntElementForm::OnOKButtonClick(wxCommandEvent& event)
85 if(ValidateData()) EndModal(wxID_OK);
88void ReactiveShuntElementForm::OnStabilityButtonClick(wxCommandEvent& event)
93 swForm.SetTitle(_(
"Capacitor: Switching"));
95 }
else if(m_inductor) {
97 swForm.SetTitle(_(
"Inductor: Switching"));
105bool ReactiveShuntElementForm::ValidateData()
110 data.name = m_textCtrlName->GetValue();
112 if(!m_capacitor->
DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
113 _(
"Value entered incorrectly in the field \"Reactive power\".")))
115 switch(m_choiceReactivePower->GetSelection()) {
130 m_capacitor->SetElectricalData(data);
131 }
else if(m_inductor) {
134 data.name = m_textCtrlName->GetValue();
136 if(!m_inductor->
DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
137 _(
"Value entered incorrectly in the field \"Reactive power\".")))
139 switch(m_choiceReactivePower->GetSelection()) {
154 m_inductor->SetElectricalData(data);
Shunt capactior power element.
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.
static wxString StringFromDouble(double value, int minDecimal=1, int maxDecimals=13)
Convert a double value to string.
Inductor shunt power element.