1#include "../elements/powerElement/Bus.h"
2#include "FrequencyResponseForm.h"
4FrequencyResponseForm::FrequencyResponseForm(wxWindow* parent) : FrequencyResponseFormBase(parent)
9FrequencyResponseForm::FrequencyResponseForm(wxWindow* parent,
10 std::vector<Bus*> busList,
15 : FrequencyResponseFormBase(parent)
22 for(
auto itb = m_busList.begin(); itb != m_busList.end(); itb++) {
25 data.number = busNumber;
26 bus->SetElectricalData(data);
28 m_choiceBus->Append(data.name);
38 m_choiceBus->SetSelection(injCurrentBus);
41FrequencyResponseForm::~FrequencyResponseForm() {}
43void FrequencyResponseForm::OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
44void FrequencyResponseForm::OnRunButtonClick(wxCommandEvent& event)
47 if(!dummyBus.
DoubleFromString(m_parent, m_textCtrlInitFreq->GetValue(), m_initFreq,
48 _(
"Value entered incorrectly in the field \"Initial frequency\".")))
50 if(!dummyBus.
DoubleFromString(m_parent, m_textCtrlFinalFreq->GetValue(), m_endFreq,
51 _(
"Value entered incorrectly in the field \"Final frequency\".")))
53 if(!dummyBus.
DoubleFromString(m_parent, m_textCtrlStepFreq->GetValue(), m_stepFreq,
54 _(
"Value entered incorrectly in the field \"Frequency step\".")))
56 if(m_choiceBus->GetSelection() == -1) {
57 wxMessageDialog msgDialog(m_parent, _(
"Injected current not selected"), _(
"Error"),
58 wxOK | wxCENTRE | wxICON_ERROR);
59 msgDialog.ShowModal();
62 m_injBusNumber = m_choiceBus->GetSelection();
Node for power elements. All others power elements are connected through this.
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.