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

Form to edit properties to test the control system created. More...

#include <ControlSystemTest.h>

Inheritance diagram for ControlSystemTest:
Collaboration diagram for ControlSystemTest:

Public Member Functions

 ControlSystemTest (ControlEditor *parent, std::vector< IOControl * > ioList, int *inputType, double *startTime, double *slope, double *timeStep, double *simTime)
 

Protected Member Functions

virtual void OnCancelButtonClick (wxCommandEvent &event)
 
virtual void OnRunButtonClick (wxCommandEvent &event)
 
virtual void OnInputSelected (wxCommandEvent &event)
 
virtual void OnPGValueChange (wxPropertyGridEvent &event)
 
virtual void UpdatePGValues ()
 

Protected Attributes

int * m_inputType = nullptr
 
double * m_timeStep = nullptr
 
double * m_simTime = nullptr
 

Detailed Description

Form to edit properties to test the control system created.

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

Definition at line 35 of file ControlSystemTest.h.

Constructor & Destructor Documentation

◆ ControlSystemTest()

ControlSystemTest::ControlSystemTest ( ControlEditor parent,
std::vector< IOControl * >  ioList,
int *  inputType,
double *  startTime,
double *  slope,
double *  timeStep,
double *  simTime 
)

Definition at line 21 of file ControlSystemTest.cpp.

28 : ControlSystemTestBase(parent)
29{
30 SetSize(GetBestSize());
31
32 for (auto* io : ioList) {
33 if (io->GetType() == Node::NodeType::NODE_OUT) {
34 m_choiceInput->Append(io->GetName(), io);
35 }
36 }
37
38 m_inputType = inputType;
39 //m_startTime = startTime;
40 //m_slope = slope;
41 m_timeStep = timeStep;
42 m_simTime = simTime;
43
44 m_choiceInput->SetSelection(*m_inputType);
45 //m_textCtrlStartTime->SetValue(wxString::FromDouble(*m_startTime));
46 //m_textCtrlSlope->SetValue(wxString::FromDouble(*m_slope));
47 m_textCtrlTimeStep->SetValue(wxString::FromDouble(*m_timeStep));
48 m_textCtrlSimTime->SetValue(wxString::FromDouble(*m_simTime));
49
50 UpdatePGValues();
51}

◆ ~ControlSystemTest()

ControlSystemTest::~ControlSystemTest ( )
virtual

Definition at line 53 of file ControlSystemTest.cpp.

53{}

Member Function Documentation

◆ OnCancelButtonClick()

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

Definition at line 48 of file ControlSystemTest.h.

48{ EndModal(wxID_CANCEL); }

◆ OnInputSelected()

void ControlSystemTest::OnInputSelected ( wxCommandEvent &  event)
protectedvirtual

Definition at line 98 of file ControlSystemTest.cpp.

99{
100 UpdatePGValues();
101}

◆ OnPGValueChange()

void ControlSystemTest::OnPGValueChange ( wxPropertyGridEvent &  event)
protectedvirtual

Definition at line 102 of file ControlSystemTest.cpp.

103{
104 IOControl* io = static_cast<IOControl*>(m_choiceInput->GetClientData(m_choiceInput->GetSelection()));
105 if (io == nullptr) return;
106
107 SimTestData simTestData = io->GetSimTestData();
108 if (event.GetProperty() == m_pgPropStartTime) {
109 simTestData.startTime = m_pgPropStartTime->GetValue();
110 }
111 else if (event.GetProperty() == m_pgPropInitialValue) {
112 simTestData.initialValue = m_pgPropInitialValue->GetValue();
113 }
114 else if (event.GetProperty() == m_pgPropSlope) {
115 simTestData.slope = m_pgPropSlope->GetValue();
116 }
117 else if (event.GetProperty() == m_pgPropInputType) {
118 simTestData.type = m_pgPropInputType->GetValue().GetInteger();
119 }
120 io->SetSimTestData(simTestData);
121}
Provides the communication with the power element.
Definition IOControl.h:43

◆ OnRunButtonClick()

void ControlSystemTest::OnRunButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 54 of file ControlSystemTest.cpp.

55{
56 int inputType;
57 double timeStep, simTime;
58
59 inputType = m_choiceInput->GetSelection();
60
61 //if (!m_textCtrlStartTime->GetValue().ToDouble(&startTime)) {
62 // wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Start time\"."), _("Error"),
63 // wxOK | wxCENTRE | wxICON_ERROR);
64 // msgDialog.ShowModal();
65 // return;
66 //}
67 //
68 //if (!m_textCtrlSlope->GetValue().ToDouble(&slope)) {
69 // wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Slope\"."), _("Error"),
70 // wxOK | wxCENTRE | wxICON_ERROR);
71 // msgDialog.ShowModal();
72 // return;
73 //}
74
75 if (!m_textCtrlTimeStep->GetValue().ToDouble(&timeStep)) {
76 wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Time step\"."), _("Error"),
77 wxOK | wxCENTRE | wxICON_ERROR);
78 msgDialog.ShowModal();
79 return;
80 }
81
82 if (!m_textCtrlSimTime->GetValue().ToDouble(&simTime)) {
83 wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Simulation time\"."), _("Error"),
84 wxOK | wxCENTRE | wxICON_ERROR);
85 msgDialog.ShowModal();
86 return;
87 }
88
89 *m_inputType = inputType;
90 //*m_startTime = startTime;
91 //*m_slope = slope;
92 *m_timeStep = timeStep;
93 *m_simTime = simTime;
94
95 EndModal(wxID_OK);
96}

◆ UpdatePGValues()

void ControlSystemTest::UpdatePGValues ( )
protectedvirtual

Definition at line 123 of file ControlSystemTest.cpp.

124{
125 IOControl* io = static_cast<IOControl*>(m_choiceInput->GetClientData(m_choiceInput->GetSelection()));
126 if (io != nullptr) {
127 SimTestData simTestData = io->GetSimTestData();
128 m_pgMgr->ChangePropertyValue(m_pgPropStartTime, wxString::FromDouble(simTestData.startTime));
129 m_pgMgr->ChangePropertyValue(m_pgPropInitialValue, wxString::FromDouble(simTestData.initialValue));
130 m_pgMgr->ChangePropertyValue(m_pgPropSlope, wxString::FromDouble(simTestData.slope));
131 m_pgMgr->ChangePropertyValue(m_pgPropInputType, simTestData.type);
132 }
133}

Member Data Documentation

◆ m_inputType

int* ControlSystemTest::m_inputType = nullptr
protected

Definition at line 53 of file ControlSystemTest.h.

◆ m_simTime

double* ControlSystemTest::m_simTime = nullptr
protected

Definition at line 57 of file ControlSystemTest.h.

◆ m_timeStep

double* ControlSystemTest::m_timeStep = nullptr
protected

Definition at line 56 of file ControlSystemTest.h.


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