diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-05-13 16:15:22 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-13 16:15:22 -0300 |
commit | 17d1dd82ec065eff08546ef1fd2a188ce77471b2 (patch) | |
tree | 811c788656f71692ccb0b038215dab7a87c2c0dc /Project/ControlElementSolver.h | |
parent | fe4776d88169c048e06c142d81bfd42651c63d1d (diff) | |
parent | d44c3a76943c90cfcbf336961d9ba3516a1c80dc (diff) | |
download | PSP.git-17d1dd82ec065eff08546ef1fd2a188ce77471b2.tar.gz PSP.git-17d1dd82ec065eff08546ef1fd2a188ce77471b2.tar.xz PSP.git-17d1dd82ec065eff08546ef1fd2a188ce77471b2.zip |
Merge pull request #32 from Thales1330/wip/controller-solver
Wip controller solver
Diffstat (limited to 'Project/ControlElementSolver.h')
-rw-r--r-- | Project/ControlElementSolver.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Project/ControlElementSolver.h b/Project/ControlElementSolver.h new file mode 100644 index 0000000..6d0ad3f --- /dev/null +++ b/Project/ControlElementSolver.h @@ -0,0 +1,49 @@ +#ifndef CONTROLELEMENTSOLVER_H +#define CONTROLELEMENTSOLVER_H + +#include <stddef.h> // NULL definition +#include <vector> + +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, + double integrationError = 1e-3, + bool startAllZero = false, + double input = 0.0); + ~ControlElementSolver() {} + virtual bool InitializeValues(double input, bool startAllZero); + virtual void SolveNextStep(double input); + virtual std::vector<double> 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); + + ControlElementContainer* m_ctrlContainer = NULL; + double m_timeStep; + double m_integrationError; + std::vector<double> m_solutions; + bool m_isOK = false; + + IOControl* m_inputControl = NULL; + IOControl* m_outputControl = NULL; +}; + +#endif // CONTROLELEMENTSOLVER_H |