23ReactiveShuntElementForm::ReactiveShuntElementForm(wxWindow* parent,
Capacitor* capacitor)
24 : ReactiveShuntElementFormBase(parent)
26 SetSize(GetBestSize());
29 m_textCtrlName->SetValue(data.name);
32 switch(data.reactivePowerUnit) {
33 case ElectricalUnit::UNIT_PU: {
34 m_choiceReactivePower->SetSelection(0);
36 case ElectricalUnit::UNIT_var: {
37 m_choiceReactivePower->SetSelection(1);
39 case ElectricalUnit::UNIT_kvar: {
40 m_choiceReactivePower->SetSelection(2);
42 case ElectricalUnit::UNIT_Mvar: {
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) {
62 case ElectricalUnit::UNIT_PU: {
63 m_choiceReactivePower->SetSelection(0);
65 case ElectricalUnit::UNIT_var: {
66 m_choiceReactivePower->SetSelection(1);
68 case ElectricalUnit::UNIT_kvar: {
69 m_choiceReactivePower->SetSelection(2);
71 case ElectricalUnit::UNIT_Mvar: {
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)
92 SwitchingForm swForm(m_parent, m_capacitor);
93 swForm.SetTitle(_(
"Capacitor: Switching"));
95 }
else if(m_inductor) {
96 SwitchingForm swForm(m_parent, m_inductor);
97 swForm.SetTitle(_(
"Inductor: Switching"));
105bool ReactiveShuntElementForm::ValidateData()
108 CapacitorElectricalData data;
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()) {
117 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
120 data.reactivePowerUnit = ElectricalUnit::UNIT_var;
123 data.reactivePowerUnit = ElectricalUnit::UNIT_kvar;
126 data.reactivePowerUnit = ElectricalUnit::UNIT_Mvar;
130 m_capacitor->SetElectricalData(data);
131 }
else if(m_inductor) {
132 InductorElectricalData data;
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()) {
141 data.reactivePowerUnit = ElectricalUnit::UNIT_PU;
144 data.reactivePowerUnit = ElectricalUnit::UNIT_var;
147 data.reactivePowerUnit = ElectricalUnit::UNIT_kvar;
150 data.reactivePowerUnit = ElectricalUnit::UNIT_Mvar;
154 m_inductor->SetElectricalData(data);
Shunt capactior power element.
static wxString StringFromDouble(double value, int minDecimal=1, int maxDecimals=13)
Convert a double value to string.
Inductor shunt power element.