ENERGY MONITOR 0.2
Loading...
Searching...
No Matches
operational_blocks.h
Go to the documentation of this file.
1#pragma once
2
3
4
6 bool state;
7 double low_threshold;
8 double high_threshold;
9
10 public:
11 hysteresis(double _low_threshold, double _high_threshold, bool _initial_state = false){
12 low_threshold = _low_threshold;
13 high_threshold = _high_threshold;
14 state = _initial_state;
15 };
16
17 bool update_state(double value){
18 if(value >= high_threshold){
19 state = true;
20 }else if(value <= low_threshold){
21 state = false;
22 }
23 return state;
24 }
25};
26
27
29 double start;
30
31 public:
32 timer_counter(double _start){
33 start = _start;
34 }
35 double get_count_duration(double termination){
36 return termination - start;
37 };
38};
bool update_state(double value)
hysteresis(double _low_threshold, double _high_threshold, bool _initial_state=false)
timer_counter(double _start)
double get_count_duration(double termination)