You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.6 KiB
C
75 lines
1.6 KiB
C
7 months ago
|
/*
|
||
|
* RelativeSignal.h
|
||
|
*
|
||
|
* Author: Aleksey Gerasimenko
|
||
|
* gerasimenko.aleksey.n@gmail.com
|
||
|
*/
|
||
|
|
||
|
#include <math.h>
|
||
|
#include <stdint.h>
|
||
|
|
||
|
|
||
|
#include "SYSCTRL/BaseComponent.h"
|
||
|
#include "SYSCTRL/HeadersFLTSYSLIB.h"
|
||
|
|
||
|
|
||
|
#ifndef SYSCTRL_RELATIVESIGNAL_H_
|
||
|
#define SYSCTRL_RELATIVESIGNAL_H_
|
||
|
|
||
|
namespace SYSCTRL
|
||
|
{
|
||
|
|
||
|
struct SignalRelativeSetup
|
||
|
{
|
||
|
float time_sample;
|
||
|
SignalRelativeSetup():
|
||
|
time_sample(-1.0)
|
||
|
{}
|
||
|
};//SignalRelativeSetup
|
||
|
|
||
|
|
||
|
struct SignalRelativeConfiguration
|
||
|
{
|
||
|
float limit_relative_high;
|
||
|
float limit_relative_low;
|
||
|
float minimal_amplitude_level;
|
||
|
FLTSYSLIB::AMPLF4OConfiguration amplitude_filter;
|
||
|
SignalRelativeConfiguration():
|
||
|
limit_relative_high(1.0),
|
||
|
limit_relative_low(-1.0),
|
||
|
minimal_amplitude_level(0.1),
|
||
|
amplitude_filter()
|
||
|
{}
|
||
|
};//SignalRelativeConfiguration
|
||
|
|
||
|
class SignalRelative: public BaseComponent
|
||
|
{
|
||
|
private:
|
||
|
float m_amplitude;
|
||
|
float m_relative;
|
||
|
private:
|
||
|
float m_limit_relative_high;
|
||
|
float m_limit_relative_low;
|
||
|
float m_minimal_amplitude_level;
|
||
|
private:
|
||
|
FLTSYSLIB::AMPLF4O m_ampl_filter;
|
||
|
public:
|
||
|
SignalRelative();
|
||
|
void setup(const SignalRelativeSetup& setup);
|
||
|
void configure(const SignalRelativeConfiguration& config);
|
||
|
public:
|
||
|
void reset();
|
||
|
void get_outputs(float& amplitude, float& relative);
|
||
|
public:
|
||
|
void execute(float reference);
|
||
|
private:
|
||
|
void (SignalRelative::*_execute)(float reference);
|
||
|
void _execute_undef(float reference);
|
||
|
void _execute_operational(float reference);
|
||
|
//
|
||
|
};//RelativeSignal
|
||
|
|
||
|
} /* namespace SYSCTRL */
|
||
|
|
||
|
#endif /* SYSCTRL_RELATIVESIGNAL_H_ */
|