Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
IOControlForm Class Reference

Form to edit the input/output control data. More...

#include <IOControlForm.h>

Inheritance diagram for IOControlForm:
Collaboration diagram for IOControlForm:

Public Member Functions

 IOControlForm (wxWindow *parent, IOControl *ioControl)
 
virtual bool ValidateData ()
 

Protected Member Functions

virtual void OnInputChecked (wxCommandEvent &event)
 
virtual void OnOutputChecked (wxCommandEvent &event)
 
virtual void OnCancelButtonClick (wxCommandEvent &event)
 
virtual void OnOKButtonClick (wxCommandEvent &event)
 

Protected Attributes

wxWindow * m_parent
 
IOControlm_ioControl
 
std::vector< IOControl::IOFlags > m_inputFlags
 
std::vector< IOControl::IOFlags > m_outputFlags
 

Detailed Description

Form to edit the input/output control data.

Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
Date
05/10/2017

Definition at line 31 of file IOControlForm.h.

Constructor & Destructor Documentation

◆ IOControlForm()

IOControlForm::IOControlForm ( wxWindow *  parent,
IOControl ioControl 
)

Definition at line 20 of file IOControlForm.cpp.

20 : IOControlFormBase(parent)
21{
22 SetSize(GetBestSize());
23
24 m_parent = parent;
25 m_ioControl = ioControl;
26
27 m_textCtrlName->SetValue(m_ioControl->GetName());
28
29 int ioFlags = m_ioControl->GetIOFlags();
30 int inChoiceNumber = -1;
31 int outChoiceNumber = -1;
32
33 if (ioFlags & IOControl::IN_TERMINAL_VOLTAGE) {
34 m_choiceInput->Append(_("Terminal voltage"));
35 m_inputFlags.push_back(IOControl::IN_TERMINAL_VOLTAGE);
36 if (m_ioControl->GetValue() == IOControl::IN_TERMINAL_VOLTAGE) inChoiceNumber = (int)m_inputFlags.size() - 1;
37 }
38 if (ioFlags & IOControl::IN_VELOCITY) {
39 m_choiceInput->Append(_("Velocity"));
40 m_inputFlags.push_back(IOControl::IN_VELOCITY);
41 if (m_ioControl->GetValue() == IOControl::IN_VELOCITY) inChoiceNumber = (int)m_inputFlags.size() - 1;
42 }
43 if (ioFlags & IOControl::IN_ACTIVE_POWER) {
44 m_choiceInput->Append(_("Active power"));
45 m_inputFlags.push_back(IOControl::IN_ACTIVE_POWER);
46 if (m_ioControl->GetValue() == IOControl::IN_ACTIVE_POWER) inChoiceNumber = (int)m_inputFlags.size() - 1;
47 }
48 if (ioFlags & IOControl::IN_REACTIVE_POWER) {
49 m_choiceInput->Append(_("Reactive power"));
50 m_inputFlags.push_back(IOControl::IN_REACTIVE_POWER);
51 if (m_ioControl->GetValue() == IOControl::IN_REACTIVE_POWER) inChoiceNumber = (int)m_inputFlags.size() - 1;
52 }
53 if (ioFlags & IOControl::OUT_FIELD_VOLTAGE) {
54 m_choiceOutput->Append(_("Field voltage"));
55 m_outputFlags.push_back(IOControl::OUT_FIELD_VOLTAGE);
56 if (m_ioControl->GetValue() == IOControl::OUT_FIELD_VOLTAGE) outChoiceNumber = (int)m_outputFlags.size() - 1;
57 }
58 if (ioFlags & IOControl::OUT_MEC_POWER) {
59 m_choiceOutput->Append(_("Mechanical power"));
60 m_outputFlags.push_back(IOControl::OUT_MEC_POWER);
61 if (m_ioControl->GetValue() == IOControl::OUT_MEC_POWER) outChoiceNumber = (int)m_outputFlags.size() - 1;
62 }
63
64 if (ioFlags & IOControl::IN_INITIAL_MEC_POWER) {
65 m_choiceInput->Append(_("Initial mechanical power"));
66 m_inputFlags.push_back(IOControl::IN_INITIAL_MEC_POWER);
67 if (m_ioControl->GetValue() == IOControl::IN_INITIAL_MEC_POWER) inChoiceNumber = (int)m_inputFlags.size() - 1;
68 }
69
70 if (ioFlags & IOControl::IN_INITIAL_TERMINAL_VOLTAGE) {
71 m_choiceInput->Append(_("Initial terminal voltage"));
72 m_inputFlags.push_back(IOControl::IN_INITIAL_TERMINAL_VOLTAGE);
73 if (m_ioControl->GetValue() == IOControl::IN_INITIAL_TERMINAL_VOLTAGE)
74 inChoiceNumber = (int)m_inputFlags.size() - 1;
75 }
76
77 if (ioFlags & IOControl::IN_INITIAL_VELOCITY) {
78 m_choiceInput->Append(_("Initial velocity"));
79 m_inputFlags.push_back(IOControl::IN_INITIAL_VELOCITY);
80 if (m_ioControl->GetValue() == IOControl::IN_INITIAL_VELOCITY) inChoiceNumber = (int)m_inputFlags.size() - 1;
81 }
82
83 if (ioFlags & IOControl::IN_DELTA_VELOCITY) {
84 m_choiceInput->Append(_("Velocity variation"));
85 m_inputFlags.push_back(IOControl::IN_DELTA_VELOCITY);
86 if (m_ioControl->GetValue() == IOControl::IN_DELTA_VELOCITY) inChoiceNumber = (int)m_inputFlags.size() - 1;
87 }
88
89 if (ioFlags & IOControl::IN_DELTA_ACTIVE_POWER) {
90 m_choiceInput->Append(_("Active power variation"));
91 m_inputFlags.push_back(IOControl::IN_DELTA_ACTIVE_POWER);
92 if (m_ioControl->GetValue() == IOControl::IN_DELTA_ACTIVE_POWER) inChoiceNumber = (int)m_inputFlags.size() - 1;
93 }
94
95 if (inChoiceNumber != -1) {
96 m_choiceInput->SetSelection(inChoiceNumber);
97 m_checkBoxInput->SetValue(true);
98 m_checkBoxOutput->SetValue(false);
99 m_choiceOutput->Enable(false);
100 }
101 else {
102 m_choiceOutput->SetSelection(outChoiceNumber);
103 m_checkBoxInput->SetValue(false);
104 m_checkBoxOutput->SetValue(true);
105 m_choiceInput->Enable(false);
106 }
107}

◆ ~IOControlForm()

IOControlForm::~IOControlForm ( )
virtual

Definition at line 109 of file IOControlForm.cpp.

109{}

Member Function Documentation

◆ OnCancelButtonClick()

virtual void IOControlForm::OnCancelButtonClick ( wxCommandEvent &  event)
inlineprotectedvirtual

Definition at line 42 of file IOControlForm.h.

42{ EndModal(wxID_CANCEL); };

◆ OnInputChecked()

void IOControlForm::OnInputChecked ( wxCommandEvent &  event)
protectedvirtual

Definition at line 131 of file IOControlForm.cpp.

132{
133 m_checkBoxInput->SetValue(true);
134 m_checkBoxOutput->SetValue(false);
135 m_choiceOutput->Enable(false);
136 m_choiceInput->Enable(true);
137}

◆ OnOKButtonClick()

void IOControlForm::OnOKButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 110 of file IOControlForm.cpp.

111{
112 if (ValidateData()) EndModal(wxID_OK);
113}

◆ OnOutputChecked()

void IOControlForm::OnOutputChecked ( wxCommandEvent &  event)
protectedvirtual

Definition at line 139 of file IOControlForm.cpp.

140{
141 m_checkBoxOutput->SetValue(true);
142 m_checkBoxInput->SetValue(false);
143 m_choiceOutput->Enable(true);
144 m_choiceInput->Enable(false);
145}

◆ ValidateData()

bool IOControlForm::ValidateData ( )
virtual

Definition at line 115 of file IOControlForm.cpp.

116{
117 m_ioControl->SetName(m_textCtrlName->GetValue());
118
119 if (m_checkBoxInput->GetValue() && m_choiceInput->GetSelection() != -1) {
120 m_ioControl->SetValue(m_inputFlags[m_choiceInput->GetSelection()]);
121 return true;
122 }
123 else if (m_checkBoxOutput->GetValue() && m_choiceOutput->GetSelection() != -1) {
124 m_ioControl->SetValue(m_outputFlags[m_choiceOutput->GetSelection()]);
125 return true;
126 }
127
128 return false;
129}

Member Data Documentation

◆ m_inputFlags

std::vector<IOControl::IOFlags> IOControlForm::m_inputFlags
protected

Definition at line 48 of file IOControlForm.h.

◆ m_ioControl

IOControl* IOControlForm::m_ioControl
protected

Definition at line 46 of file IOControlForm.h.

◆ m_outputFlags

std::vector<IOControl::IOFlags> IOControlForm::m_outputFlags
protected

Definition at line 49 of file IOControlForm.h.

◆ m_parent

wxWindow* IOControlForm::m_parent
protected

Definition at line 45 of file IOControlForm.h.


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