diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-08-30 20:42:27 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-08-30 20:42:27 -0300 |
commit | 516cdb72d3ff99a1ee786d3ea24c9b579272fe76 (patch) | |
tree | 6017213d5e270f94c1063d11e793c196e3c969f8 /Project/BusForm.cpp | |
parent | 1fcb990bd02da945ac0204caaed6a9aa1f6a7d5f (diff) | |
download | PSP.git-516cdb72d3ff99a1ee786d3ea24c9b579272fe76.tar.gz PSP.git-516cdb72d3ff99a1ee786d3ea24c9b579272fe76.tar.xz PSP.git-516cdb72d3ff99a1ee786d3ea24c9b579272fe76.zip |
COI (center of inertia) implemented
See Milano's book p. 342
Diffstat (limited to 'Project/BusForm.cpp')
-rw-r--r-- | Project/BusForm.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/Project/BusForm.cpp b/Project/BusForm.cpp index 98ec0da..113dd24 100644 --- a/Project/BusForm.cpp +++ b/Project/BusForm.cpp @@ -1,8 +1,7 @@ #include "BusForm.h" #include "Bus.h" -BusForm::BusForm(wxWindow* parent, Bus* bus) - : BusFormBase(parent) +BusForm::BusForm(wxWindow* parent, Bus* bus) : BusFormBase(parent) { SetSize(GetBestSize()); @@ -74,13 +73,13 @@ void BusForm::OnButtonOKClick(wxCommandEvent& event) BusElectricalData data = m_bus->GetElectricalData(); data.name = m_textCtrlName->GetValue(); if(!m_bus->DoubleFromString(m_parent, m_textCtrlNomVoltage->GetValue(), data.nominalVoltage, - _("Value entered incorrectly in the field \"Rated voltage\"."))) + _("Value entered incorrectly in the field \"Rated voltage\"."))) return; data.nominalVoltageUnit = m_choiceNomVoltage->GetSelection() == 0 ? UNIT_V : UNIT_kV; data.isVoltageControlled = m_checkBoxCtrlVoltage->GetValue(); if(data.isVoltageControlled) { if(!m_bus->DoubleFromString(m_parent, m_textCtrlCtrlVoltage->GetValue(), data.controlledVoltage, - _("Value entered incorrectly in the field \"Controlled voltage\"."))) + _("Value entered incorrectly in the field \"Controlled voltage\"."))) return; data.controlledVoltageUnitChoice = m_choiceCtrlVoltage->GetSelection(); } @@ -115,34 +114,39 @@ void BusForm::OnButtonOKClick(wxCommandEvent& event) } if(!m_bus->DoubleFromString(m_parent, m_textCtrlFaultResistance->GetValue(), data.faultResistance, - _("Value entered incorrectly in the field \"Fault resistance\"."))) + _("Value entered incorrectly in the field \"Fault resistance\"."))) return; if(!m_bus->DoubleFromString(m_parent, m_textCtrlFaultReactance->GetValue(), data.faultReactance, - _("Value entered incorrectly in the field \"Fault reactance\"."))) + _("Value entered incorrectly in the field \"Fault reactance\"."))) return; data.plotBus = m_checkBoxPlotData->GetValue(); data.stabHasFault = m_checkBoxStabFault->GetValue(); if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultTime->GetValue(), data.stabFaultTime, - _("Value entered incorrectly in the field \"Time\"."))) + _("Value entered incorrectly in the field \"Time\"."))) return; if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultLength->GetValue(), data.stabFaultLength, - _("Value entered incorrectly in the field \"Fault lenght\"."))) + _("Value entered incorrectly in the field \"Fault lenght\"."))) return; if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultResistance->GetValue(), data.stabFaultResistance, - _("Value entered incorrectly in the field \"Fault resistence (stability)\"."))) + _("Value entered incorrectly in the field \"Fault resistence (stability)\"."))) return; if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultReactance->GetValue(), data.stabFaultReactance, - _("Value entered incorrectly in the field \"Fault reactance (stability)\"."))) + _("Value entered incorrectly in the field \"Fault reactance (stability)\"."))) return; m_bus->SetElectricalData(data); + if(data.stabHasFault) + m_bus->SetDynamicEvent(true); + else + m_bus->SetDynamicEvent(false); + EndModal(wxID_OK); } @@ -189,19 +193,19 @@ void BusForm::EnableStabFaultFields(bool enable) void BusForm::UpdateChoiceBoxes() { switch(m_choiceFaultType->GetSelection()) { - case 0: // three-phase + case 0: // three-phase { m_choiceFaultPlace->Enable(false); } break; - case 1: // line-to-line - case 2: // double line-to-line + case 1: // line-to-line + case 2: // double line-to-line { if(m_checkBoxFault->GetValue()) m_choiceFaultPlace->Enable(true); m_choiceFaultPlace->SetString(0, _("Lines AB")); m_choiceFaultPlace->SetString(1, _("Lines BC")); m_choiceFaultPlace->SetString(2, _("Lines CA")); } break; - case 3: // line-to-ground + case 3: // line-to-ground { if(m_checkBoxFault->GetValue()) m_choiceFaultPlace->Enable(true); m_choiceFaultPlace->SetString(0, _("Line A")); |