From f995850b38916b38718b84f4b82948479a81855a Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Mon, 22 May 2017 20:17:41 -0300 Subject: Events implemented Effects on adimittance matrix and elements: ->Fault on bus; ->Generation/Load switching; ->Branch switching. --- Project/BusForm.cpp | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'Project/BusForm.cpp') diff --git a/Project/BusForm.cpp b/Project/BusForm.cpp index d7d622e..98ec0da 100644 --- a/Project/BusForm.cpp +++ b/Project/BusForm.cpp @@ -9,21 +9,21 @@ BusForm::BusForm(wxWindow* parent, Bus* bus) m_parent = parent; m_bus = bus; - m_textCtrlName->SetValue(bus->GetEletricalData().name); - m_textCtrlNomVoltage->SetValue(bus->StringFromDouble(bus->GetEletricalData().nominalVoltage)); + m_textCtrlName->SetValue(bus->GetElectricalData().name); + m_textCtrlNomVoltage->SetValue(bus->StringFromDouble(bus->GetElectricalData().nominalVoltage)); - if(bus->GetEletricalData().nominalVoltageUnit == UNIT_V) + if(bus->GetElectricalData().nominalVoltageUnit == UNIT_V) m_choiceNomVoltage->SetSelection(0); else m_choiceNomVoltage->SetSelection(1); - m_checkBoxCtrlVoltage->SetValue(bus->GetEletricalData().isVoltageControlled); - m_textCtrlCtrlVoltage->SetValue(bus->StringFromDouble(bus->GetEletricalData().controlledVoltage)); - m_choiceCtrlVoltage->SetSelection(bus->GetEletricalData().controlledVoltageUnitChoice); - m_checkBoxSlackBus->SetValue(bus->GetEletricalData().slackBus); + m_checkBoxCtrlVoltage->SetValue(bus->GetElectricalData().isVoltageControlled); + m_textCtrlCtrlVoltage->SetValue(bus->StringFromDouble(bus->GetElectricalData().controlledVoltage)); + m_choiceCtrlVoltage->SetSelection(bus->GetElectricalData().controlledVoltageUnitChoice); + m_checkBoxSlackBus->SetValue(bus->GetElectricalData().slackBus); - m_checkBoxFault->SetValue(bus->GetEletricalData().hasFault); - switch(bus->GetEletricalData().faultType) { + m_checkBoxFault->SetValue(bus->GetElectricalData().hasFault); + switch(bus->GetElectricalData().faultType) { case FAULT_THREEPHASE: { m_choiceFaultType->SetSelection(0); } break; @@ -39,7 +39,7 @@ BusForm::BusForm(wxWindow* parent, Bus* bus) default: break; } - switch(bus->GetEletricalData().faultLocation) { + switch(bus->GetElectricalData().faultLocation) { case FAULT_LINE_A: { m_choiceFaultPlace->SetSelection(0); } break; @@ -52,26 +52,26 @@ BusForm::BusForm(wxWindow* parent, Bus* bus) default: break; } - m_textCtrlFaultResistance->SetValue(bus->StringFromDouble(bus->GetEletricalData().faultResistance)); - m_textCtrlFaultReactance->SetValue(bus->StringFromDouble(bus->GetEletricalData().faultReactance)); - - m_checkBoxPlotData->SetValue(bus->GetEletricalData().plotBus); - m_checkBoxStabFault->SetValue(bus->GetEletricalData().stabHasFault); - m_textCtrlStabFaultTime->SetValue(bus->StringFromDouble(bus->GetEletricalData().stabFaultTime)); - m_textCtrlStabFaultLength->SetValue(bus->StringFromDouble(bus->GetEletricalData().stabFaultLength)); - m_textCtrlStabFaultResistance->SetValue(bus->StringFromDouble(bus->GetEletricalData().stabFaultResistance)); - m_textCtrlStabFaultReactance->SetValue(bus->StringFromDouble(bus->GetEletricalData().stabFaultReactance)); - - EnableCtrlVoltageFields(bus->GetEletricalData().isVoltageControlled); - EnableFaultFields(bus->GetEletricalData().hasFault); - EnableStabFaultFields(bus->GetEletricalData().stabHasFault); + m_textCtrlFaultResistance->SetValue(bus->StringFromDouble(bus->GetElectricalData().faultResistance)); + m_textCtrlFaultReactance->SetValue(bus->StringFromDouble(bus->GetElectricalData().faultReactance)); + + m_checkBoxPlotData->SetValue(bus->GetElectricalData().plotBus); + m_checkBoxStabFault->SetValue(bus->GetElectricalData().stabHasFault); + m_textCtrlStabFaultTime->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultTime)); + m_textCtrlStabFaultLength->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultLength)); + m_textCtrlStabFaultResistance->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultResistance)); + m_textCtrlStabFaultReactance->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultReactance)); + + EnableCtrlVoltageFields(bus->GetElectricalData().isVoltageControlled); + EnableFaultFields(bus->GetElectricalData().hasFault); + EnableStabFaultFields(bus->GetElectricalData().stabHasFault); } BusForm::~BusForm() {} void BusForm::OnButtonCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } void BusForm::OnButtonOKClick(wxCommandEvent& event) { - BusElectricalData data = m_bus->GetEletricalData(); + 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\"."))) -- cgit From 516cdb72d3ff99a1ee786d3ea24c9b579272fe76 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Wed, 30 Aug 2017 20:42:27 -0300 Subject: COI (center of inertia) implemented See Milano's book p. 342 --- Project/BusForm.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'Project/BusForm.cpp') 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")); -- cgit