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}