diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-05-09 19:23:52 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-05-09 19:23:52 -0300 |
commit | 2ef7d2bdf1ca4a6b9ee207e4a43f3116f55c0274 (patch) | |
tree | 4b0a9fb363e6745bddf373057ac02a878893c483 /Project/ControlEditor.cpp | |
parent | 9fb33a91aa22fbce6d0b74529e07af9f7781b916 (diff) | |
download | PSP.git-2ef7d2bdf1ca4a6b9ee207e4a43f3116f55c0274.tar.gz PSP.git-2ef7d2bdf1ca4a6b9ee207e4a43f3116f55c0274.tar.xz PSP.git-2ef7d2bdf1ca4a6b9ee207e4a43f3116f55c0274.zip |
Several solutions implemented
Diffstat (limited to 'Project/ControlEditor.cpp')
-rw-r--r-- | Project/ControlEditor.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Project/ControlEditor.cpp b/Project/ControlEditor.cpp index b4976ad..ad2db78 100644 --- a/Project/ControlEditor.cpp +++ b/Project/ControlEditor.cpp @@ -623,29 +623,37 @@ void ControlEditor::OnKeyDown(wxKeyEvent& event) double integrationError = 1e-5; double simTime = 10.0; double printStep = 1e-2; + + double pulsePer = 1.0; ControlElementSolver solver(this, timeStep, integrationError, true, 0.0); double currentTime = 0.0; double printTime = 0.0; + double pulseTime = 0.0; std::vector<double> time; std::vector<double> solution; + std::vector<double> inputV; while(currentTime <= simTime) { double input = 0.0; - if(currentTime >= 1.0) input = 1.0; + if(pulseTime >= pulsePer * 2.0) pulseTime = 0.0; + if(pulseTime >= pulsePer) input = 1.0; solver.SolveNextStep(input); if(printTime >= printStep) { time.push_back(currentTime); solution.push_back(solver.GetLastSolution()); + inputV.push_back(input); printTime = 0.0; } printTime += timeStep; currentTime += timeStep; + pulseTime += timeStep; } std::vector<ElementPlotData> epdList; ElementPlotData curve1Data(_("TESTES"), ElementPlotData::CT_BUS); - curve1Data.AddData(solution, _("teste 1")); + curve1Data.AddData(inputV, _("Entrada")); + curve1Data.AddData(solution, _("Saida")); epdList.push_back(curve1Data); ChartView* cView = new ChartView(this, epdList, time); |