Power System Platform  2026w11a-beta
Loading...
Searching...
No Matches
FrequencyResponseForm Class Reference
Inheritance diagram for FrequencyResponseForm:
Collaboration diagram for FrequencyResponseForm:

Public Member Functions

 FrequencyResponseForm (wxWindow *parent)
 
 FrequencyResponseForm (wxWindow *parent, std::vector< Bus * > busList, int injCurrentBus, double initFreq, double endFreq, double stepFreq)
 
double GetEndFreq () const
 
double GetInitFreq () const
 
double GetStepFreq () const
 
int GetInjBusNumber ()
 

Protected Member Functions

virtual void OnCancelButtonClick (wxCommandEvent &event)
 
virtual void OnRunButtonClick (wxCommandEvent &event)
 

Protected Attributes

std::vector< Bus * > m_busList
 
wxWindow * m_parent
 
int m_injBusNumber = 0
 
double m_initFreq = 0.0
 
double m_endFreq = 1500.0
 
double m_stepFreq = 1.0
 

Detailed Description

Definition at line 7 of file FrequencyResponseForm.h.

Constructor & Destructor Documentation

◆ FrequencyResponseForm() [1/2]

FrequencyResponseForm::FrequencyResponseForm ( wxWindow *  parent)

Definition at line 4 of file FrequencyResponseForm.cpp.

4 : FrequencyResponseFormBase(parent)
5{
6 m_parent = parent;
7}

◆ FrequencyResponseForm() [2/2]

FrequencyResponseForm::FrequencyResponseForm ( wxWindow *  parent,
std::vector< Bus * >  busList,
int  injCurrentBus,
double  initFreq,
double  endFreq,
double  stepFreq 
)

Definition at line 9 of file FrequencyResponseForm.cpp.

15 : FrequencyResponseFormBase(parent)
16{
17 m_parent = parent;
18 m_busList = busList;
19
20 // Set buses numbers and fill the choicebox
21 int busNumber = 0;
22 for(auto itb = m_busList.begin(); itb != m_busList.end(); itb++) {
23 Bus* bus = *itb;
24 BusElectricalData data = bus->GetElectricalData();
25 data.number = busNumber;
26 bus->SetElectricalData(data);
27
28 m_choiceBus->Append(data.name);
29
30 busNumber++;
31 }
32
33 Bus dummyBus;
34
35 m_textCtrlInitFreq->SetValue(dummyBus.StringFromDouble(initFreq));
36 m_textCtrlFinalFreq->SetValue(dummyBus.StringFromDouble(endFreq));
37 m_textCtrlStepFreq->SetValue(dummyBus.StringFromDouble(stepFreq));
38 m_choiceBus->SetSelection(injCurrentBus);
39}
Node for power elements. All others power elements are connected through this.
Definition Bus.h:86
static wxString StringFromDouble(double value, int minDecimal=1, int maxDecimals=13)
Convert a double value to string.
Definition Element.cpp:461

◆ ~FrequencyResponseForm()

FrequencyResponseForm::~FrequencyResponseForm ( )
virtual

Definition at line 41 of file FrequencyResponseForm.cpp.

41{}

Member Function Documentation

◆ GetEndFreq()

double FrequencyResponseForm::GetEndFreq ( ) const
inline

Definition at line 19 of file FrequencyResponseForm.h.

19{ return m_endFreq; }

◆ GetInitFreq()

double FrequencyResponseForm::GetInitFreq ( ) const
inline

Definition at line 20 of file FrequencyResponseForm.h.

20{ return m_initFreq; }

◆ GetInjBusNumber()

int FrequencyResponseForm::GetInjBusNumber ( )
inline

Definition at line 22 of file FrequencyResponseForm.h.

22{ return m_injBusNumber; }

◆ GetStepFreq()

double FrequencyResponseForm::GetStepFreq ( ) const
inline

Definition at line 21 of file FrequencyResponseForm.h.

21{ return m_stepFreq; }

◆ OnCancelButtonClick()

void FrequencyResponseForm::OnCancelButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 43 of file FrequencyResponseForm.cpp.

43{ EndModal(wxID_CANCEL); }

◆ OnRunButtonClick()

void FrequencyResponseForm::OnRunButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 44 of file FrequencyResponseForm.cpp.

45{
46 Bus dummyBus;
47 if(!dummyBus.DoubleFromString(m_parent, m_textCtrlInitFreq->GetValue(), m_initFreq,
48 _("Value entered incorrectly in the field \"Initial frequency\".")))
49 return;
50 if(!dummyBus.DoubleFromString(m_parent, m_textCtrlFinalFreq->GetValue(), m_endFreq,
51 _("Value entered incorrectly in the field \"Final frequency\".")))
52 return;
53 if(!dummyBus.DoubleFromString(m_parent, m_textCtrlStepFreq->GetValue(), m_stepFreq,
54 _("Value entered incorrectly in the field \"Frequency step\".")))
55 return;
56 if(m_choiceBus->GetSelection() == -1) {
57 wxMessageDialog msgDialog(m_parent, _("Injected current not selected"), _("Error"),
58 wxOK | wxCENTRE | wxICON_ERROR);
59 msgDialog.ShowModal();
60 return;
61 }
62 m_injBusNumber = m_choiceBus->GetSelection();
63 EndModal(wxID_OK);
64}
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.
Definition Element.cpp:433

Member Data Documentation

◆ m_busList

std::vector<Bus*> FrequencyResponseForm::m_busList
protected

Definition at line 28 of file FrequencyResponseForm.h.

◆ m_endFreq

double FrequencyResponseForm::m_endFreq = 1500.0
protected

Definition at line 33 of file FrequencyResponseForm.h.

◆ m_initFreq

double FrequencyResponseForm::m_initFreq = 0.0
protected

Definition at line 32 of file FrequencyResponseForm.h.

◆ m_injBusNumber

int FrequencyResponseForm::m_injBusNumber = 0
protected

Definition at line 30 of file FrequencyResponseForm.h.

◆ m_parent

wxWindow* FrequencyResponseForm::m_parent
protected

Definition at line 29 of file FrequencyResponseForm.h.

◆ m_stepFreq

double FrequencyResponseForm::m_stepFreq = 1.0
protected

Definition at line 34 of file FrequencyResponseForm.h.


The documentation for this class was generated from the following files: