Larus glider flight sensor system 3.9.2024
Software-In-The-Loop test and validation system
Loading...
Searching...
No Matches
differentiator.h
Go to the documentation of this file.
1/***********************************************************************/
25#ifndef DIFFERENTIATOR_H_
26#define DIFFERENTIATOR_H_
27
28#include "vector.h"
29
31template <class basetype, class datatype>
33 {
34public:
36 differentiator( basetype Tdiff, basetype Tsampling, const datatype& init_value = 0)
37 : time_constant( Tdiff / Tsampling),
38 old_value( init_value),
39 differentiation(),
40 output()
41 {};
42
44 datatype respond( const datatype & right)
45 {
46 output = (right-old_value) * time_constant;
47 old_value = right;
48 return output;
49 };
50
52 const datatype & get_value( void) const
53 {
54 return output;
55 };
56
58 datatype operator () ( void) const
59 {
60 return get_value();
61 };
62
63private:
65 basetype time_constant;
67 datatype old_value;
68 datatype differentiation;
69 datatype output;
70 };
71
72#endif /* DIFFERENTIATOR_H_ */
multi-dimensional integrator
datatype respond(const datatype &right)
update differentiator taking next input value
differentiator(basetype Tdiff, basetype Tsampling, const datatype &init_value=0)
constructor taking sampling-time and initial value
const datatype & get_value(void) const
returns current output
datatype operator()(void) const
cast to vector<size> returns current output
linear algebra implementation