summaryrefslogtreecommitdiffstats
path: root/Project/ControlSystemTest.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-09-04 20:05:30 -0300
committerGitHub <noreply@github.com>2017-09-04 20:05:30 -0300
commit926af7f34aaf5aebdbac0cbc550ed75647874258 (patch)
tree4df26f8c631aeeeed6e5c9e8aab87c4c663bd30f /Project/ControlSystemTest.cpp
parent17d1dd82ec065eff08546ef1fd2a188ce77471b2 (diff)
parent6f3421c4150e49af026432a2a2be0171d741ad03 (diff)
downloadPSP.git-926af7f34aaf5aebdbac0cbc550ed75647874258.tar.gz
PSP.git-926af7f34aaf5aebdbac0cbc550ed75647874258.tar.xz
PSP.git-926af7f34aaf5aebdbac0cbc550ed75647874258.zip
Merge pull request #33 from Thales1330/wip/electromechanical-calc
Wip electromechanical calc
Diffstat (limited to 'Project/ControlSystemTest.cpp')
-rw-r--r--Project/ControlSystemTest.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/Project/ControlSystemTest.cpp b/Project/ControlSystemTest.cpp
new file mode 100644
index 0000000..ed1ea39
--- /dev/null
+++ b/Project/ControlSystemTest.cpp
@@ -0,0 +1,70 @@
+#include "ControlSystemTest.h"
+#include "ControlEditor.h"
+
+ControlSystemTest::ControlSystemTest(ControlEditor* parent,
+ int* inputType,
+ double* startTime,
+ double* slope,
+ double* timeStep,
+ double* simTime)
+ : ControlSystemTestBase(parent)
+{
+ SetSize(GetBestSize());
+
+ m_inputType = inputType;
+ m_startTime = startTime;
+ m_slope = slope;
+ m_timeStep = timeStep;
+ m_simTime = simTime;
+
+ m_choiceInput->SetSelection(*m_inputType);
+ m_textCtrlStartTime->SetValue(wxString::FromDouble(*m_startTime));
+ m_textCtrlSlope->SetValue(wxString::FromDouble(*m_slope));
+ m_textCtrlTimeStep->SetValue(wxString::FromDouble(*m_timeStep));
+ m_textCtrlSimTime->SetValue(wxString::FromDouble(*m_simTime));
+}
+
+ControlSystemTest::~ControlSystemTest() {}
+void ControlSystemTest::OnRunButtonClick(wxCommandEvent& event)
+{
+ int inputType;
+ double startTime, slope, timeStep, simTime;
+
+ inputType = m_choiceInput->GetSelection();
+
+ if(!m_textCtrlStartTime->GetValue().ToDouble(&startTime)) {
+ wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Start time\"."), _("Error"),
+ wxOK | wxCENTRE | wxICON_ERROR);
+ msgDialog.ShowModal();
+ return;
+ }
+
+ if(!m_textCtrlSlope->GetValue().ToDouble(&slope)) {
+ wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Slope\"."), _("Error"),
+ wxOK | wxCENTRE | wxICON_ERROR);
+ msgDialog.ShowModal();
+ return;
+ }
+
+ if(!m_textCtrlTimeStep->GetValue().ToDouble(&timeStep)) {
+ wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Time step\"."), _("Error"),
+ wxOK | wxCENTRE | wxICON_ERROR);
+ msgDialog.ShowModal();
+ return;
+ }
+
+ if(!m_textCtrlSimTime->GetValue().ToDouble(&simTime)) {
+ wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Simulation time\"."), _("Error"),
+ wxOK | wxCENTRE | wxICON_ERROR);
+ msgDialog.ShowModal();
+ return;
+ }
+
+ *m_inputType = inputType;
+ *m_startTime = startTime;
+ *m_slope = slope;
+ *m_timeStep = timeStep;
+ *m_simTime = simTime;
+
+ EndModal(wxID_OK);
+}