From 412ddd0fa4a6e32651619897c8606d4cbaaa1ffa Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Thu, 4 May 2017 17:03:19 -0300 Subject: Control solver class created Just the basics methods implemented --- Project/ControlElementSolver.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Project/ControlElementSolver.h (limited to 'Project/ControlElementSolver.h') diff --git a/Project/ControlElementSolver.h b/Project/ControlElementSolver.h new file mode 100644 index 0000000..47838d7 --- /dev/null +++ b/Project/ControlElementSolver.h @@ -0,0 +1,41 @@ +#ifndef CONTROLELEMENTSOLVER_H +#define CONTROLELEMENTSOLVER_H + +#include // NULL definition +#include + +class ControlElementContainer; +class ControlEditor; +class ConnectionLine; +class Constant; +class Exponential; +class Gain; +class IOControl; +class Limiter; +class Multiplier; +class RateLimiter; +class Sum; +class TransferFunction; + +class ControlElementSolver +{ + public: + ControlElementSolver() {} + ControlElementSolver(ControlEditor* controlEditor, double timeStep = 1e-3, bool startAllZero = false, double input = 0.0); + ~ControlElementSolver() {} + + virtual void InitializeValues(double input); + virtual void SolveNextStep(double input); + virtual std::vector GetSolutions() { return m_solutions; } + virtual double GetLastSolution() {return m_solutions[m_solutions.size() - 1];} + + protected: + ControlElementContainer* m_ctrlContainer = NULL; + double m_timeStep; + std::vector m_solutions; + + IOControl* m_inputControl = NULL; + IOControl* m_outputControl = NULL; +}; + +#endif // CONTROLELEMENTSOLVER_H -- cgit From 74d795cb074b6ae9aa93bcfacee8995d7e6d5945 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Sat, 6 May 2017 18:28:23 -0300 Subject: Streight control solver implemented Buggy, running 2x... Why?? --- Project/ControlElementSolver.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'Project/ControlElementSolver.h') diff --git a/Project/ControlElementSolver.h b/Project/ControlElementSolver.h index 47838d7..9ca6e02 100644 --- a/Project/ControlElementSolver.h +++ b/Project/ControlElementSolver.h @@ -1,7 +1,7 @@ #ifndef CONTROLELEMENTSOLVER_H #define CONTROLELEMENTSOLVER_H -#include // NULL definition +#include // NULL definition #include class ControlElementContainer; @@ -21,19 +21,23 @@ class ControlElementSolver { public: ControlElementSolver() {} - ControlElementSolver(ControlEditor* controlEditor, double timeStep = 1e-3, bool startAllZero = false, double input = 0.0); + ControlElementSolver(ControlEditor* controlEditor, + double timeStep = 1e-3, + bool startAllZero = false, + double input = 0.0); ~ControlElementSolver() {} - virtual void InitializeValues(double input); virtual void SolveNextStep(double input); virtual std::vector GetSolutions() { return m_solutions; } - virtual double GetLastSolution() {return m_solutions[m_solutions.size() - 1];} - + virtual double GetLastSolution() { return m_solutions[m_solutions.size() - 1]; } protected: + void FillAllConnectedChildren(ConnectionLine* parent); + ConnectionLine* SolveNextElement(ConnectionLine* currentLine); + ControlElementContainer* m_ctrlContainer = NULL; double m_timeStep; std::vector m_solutions; - + IOControl* m_inputControl = NULL; IOControl* m_outputControl = NULL; }; -- cgit From 9fb33a91aa22fbce6d0b74529e07af9f7781b916 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Mon, 8 May 2017 21:43:17 -0300 Subject: Secondary branch, TF and limiter solution much work, such results --- Project/ControlElementSolver.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Project/ControlElementSolver.h') diff --git a/Project/ControlElementSolver.h b/Project/ControlElementSolver.h index 9ca6e02..e51c40d 100644 --- a/Project/ControlElementSolver.h +++ b/Project/ControlElementSolver.h @@ -23,10 +23,11 @@ class ControlElementSolver ControlElementSolver() {} ControlElementSolver(ControlEditor* controlEditor, double timeStep = 1e-3, + double integrationError = 1e-3, bool startAllZero = false, double input = 0.0); ~ControlElementSolver() {} - virtual void InitializeValues(double input); + virtual void InitializeValues(double input, bool startAllZero); virtual void SolveNextStep(double input); virtual std::vector GetSolutions() { return m_solutions; } virtual double GetLastSolution() { return m_solutions[m_solutions.size() - 1]; } @@ -36,6 +37,7 @@ class ControlElementSolver ControlElementContainer* m_ctrlContainer = NULL; double m_timeStep; + double m_integrationError; std::vector m_solutions; IOControl* m_inputControl = NULL; -- cgit From 6cf253651521f0cdaf3a80f8ae58e9917fe2ec57 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Thu, 11 May 2017 17:07:11 -0300 Subject: Initialization implemented --- Project/ControlElementSolver.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Project/ControlElementSolver.h') diff --git a/Project/ControlElementSolver.h b/Project/ControlElementSolver.h index e51c40d..6d0ad3f 100644 --- a/Project/ControlElementSolver.h +++ b/Project/ControlElementSolver.h @@ -27,10 +27,11 @@ class ControlElementSolver bool startAllZero = false, double input = 0.0); ~ControlElementSolver() {} - virtual void InitializeValues(double input, bool startAllZero); + virtual bool InitializeValues(double input, bool startAllZero); virtual void SolveNextStep(double input); virtual std::vector GetSolutions() { return m_solutions; } virtual double GetLastSolution() { return m_solutions[m_solutions.size() - 1]; } + virtual bool IsOK() const { return m_isOK; } protected: void FillAllConnectedChildren(ConnectionLine* parent); ConnectionLine* SolveNextElement(ConnectionLine* currentLine); @@ -39,6 +40,7 @@ class ControlElementSolver double m_timeStep; double m_integrationError; std::vector m_solutions; + bool m_isOK = false; IOControl* m_inputControl = NULL; IOControl* m_outputControl = NULL; -- cgit