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.7 KiB
C

/*
* SignalDecompose.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_SIGNALDECOMPOSE_H_
#define SYSCTRL_SIGNALDECOMPOSE_H_
namespace SYSCTRL
{
struct SignalDecomposeStructure
{
float projection_active;
float projection_reactive;
void reset()
{
projection_active = FP_ZERO;
projection_reactive = FP_ZERO;
}
SignalDecomposeStructure():
projection_active(FP_ZERO),
projection_reactive(FP_ZERO)
{}
};//
struct SignalDecomposeConfiguration
{
FLTSYSLIB::FilterForthConfiguration projection_filter;
SignalDecomposeConfiguration():
projection_filter()
{}
};//SignalDecomposeConfiguration
class SignalDecompose
{
private:
float m_time_sample;
private:
float m_projection_active;
float m_projection_reactive;
FLTSYSLIB::FilterForth m_projection_filter_active;
FLTSYSLIB::FilterForth m_projection_filter_reactive;
public:
SignalDecompose();
void setup(float time_sample);
void configure(const SignalDecomposeConfiguration& config);
public:
void reset();
void get_outputs(float& projection_active, float& projection_reactive);
public:
void execute(float reference, float ort_cos, float ort_sin);
private:
void (SignalDecompose::*_execute)(float reference, float ort_cos, float ort_sin);
void _execute_undef(float reference, float ort_cos, float ort_sin);
void _execute_operational(float reference, float ort_cos, float ort_sin);
//
};//SignalDecompose
} /* namespace SYSCTRL */
#endif /* SYSCTRL_SIGNALDECOMPOSE_H_ */