4#define _USE_MATH_DEFINES
15float _signal_operation::samplingRate_diff = stof(
settings.
get_setting(
"signal",
"samplingRate_diff"));
16float _signal_operation::freq_diff_accuracy = stof(
settings.
get_setting(
"signal",
"freq_diff"));
44 std::cerr <<
"CANT WORK WITH THESE TWO SIGNALS __FAR_SAMPLING_RATES";
45 lastOperationSuccess =
false;
52 unsigned int base_sig1_idx = 0;
53 unsigned int base_sig2_idx = 0;
54 unsigned int resultant_sig_idx = 0;
78 for(base_sig1_idx; base_sig1.
getValue(base_sig1_idx,
_time) < time_start; base_sig1_idx++);
79 for(base_sig2_idx; base_sig1.
getValue(base_sig2_idx,
_time) < time_start; base_sig2_idx++);
93 for(resultant_sig_idx; ;resultant_sig_idx++){
95 double resultant_time = time_start + resultant_sig_idx*avg_samplingTime;
97 bool base_sig1_inDomain =
false;
98 bool base_sig2_inDomain =
false;
108 if(!base_sig1_inDomain && !base_sig2_inDomain){
112 if(base_sig1_inDomain){
116 if(base_sig2_inDomain){
121 resultant.
putValue(resultant_time, resultant_sig_idx,
_time);
123 lastOperationSuccess =
true;
135 std::cerr <<
"CANT WORK WITH THESE TWO SIGNALS __FAR_SAMPLING_RATES";
136 lastOperationSuccess =
false;
143 unsigned int base_sig1_idx = 0;
144 unsigned int base_sig2_idx = 0;
145 unsigned int resultant_sig_idx = 0;
169 for(base_sig1_idx; base_sig1.
getValue(base_sig1_idx,
_time) < time_start; base_sig1_idx++);
170 for(base_sig2_idx; base_sig1.
getValue(base_sig2_idx,
_time) < time_start; base_sig2_idx++);
184 for(resultant_sig_idx; ;resultant_sig_idx++){
186 double resultant_time = time_start + resultant_sig_idx*avg_samplingTime;
188 bool base_sig1_inDomain =
false;
189 bool base_sig2_inDomain =
false;
198 if((!base_sig1_inDomain && !base_sig2_inDomain)){
202 if(base_sig1_inDomain){
206 if(base_sig2_inDomain){
213 resultant.
putValue(resultant_time, resultant_sig_idx,
_time);
220 lastOperationSuccess =
true;
234 double avgPhaseDiff = 0;
242 std::cerr <<
"CANT WORK WITH THESE TWO SIGNALS __FAR_SAMPLING_RATES" << endl;
243 lastOperationSuccess =
false;
247 std::cerr <<
"CANT WORK WITH THESE TWO SIGNALS __FAR_FREQUENCIES_" << endl;
248 lastOperationSuccess =
false;
257 while(reference_time <= time_start){
261 double sum_phaseDiff = 0;
270 avgPhaseDiff = sum_phaseDiff/idx;
308 double sampling_time = avg_sample_time;
309 if(sampling_time == -1){
314 sampling_time = avg_sample_time;
317 double last_output = 0;
318 double filter_parameter = sampling_time/( ( 1/ (2*M_PI*cutOff_freq) ) - sampling_time );
324 double output = (1 - filter_parameter)*last_output + filter_parameter*input;
327 last_output = output;
342 unsigned int idx = 0;
343 unsigned int idx_start = 0;
344 unsigned int idx_end = 0;
350 std::vector<double> temp_row;
string get_setting(string class_name, string setting)
signal add(signal &base_sig1, signal &base_sig2, int mode=INTERSECT)
bool subsignal_time_based(signal &base_sig, signal &sub_sig, double time_start, double time_end)
create subSignal from bigger ones based on time boundaries
double phase_diff(signal &base_sig1, signal &base_sig2)
calculates phase difference based on maximas and minimas times
signal multiply(signal &base_sig1, signal &base_sig2, int mode=INTERSECT)
void firstO_lowPass_filter(signal &base_sig, signal &resultant, double cutOff_freq, int order=1, double avg_sample_time=-1)
first order IIR(INFINITE IMPULSE RESPONSE) low pass filter output = (1 - filter_parameter)*last_out...
static void refreshSettings()
bool sub_table(dataTable &subTable, int rowStart, int rowEnd, int columnStart, int columnEnd)
EXTRACT A SUBSET OF THE BIGGER TABLE.
unsigned int get_row_num()
signal class the parent class for every other signal or any form of time-sorted (time,...
const maximas_minimas * get_valMaximas() const
get value peaks in the signal
const bool isTimeAnalysed()
check if the signal was analysed in the time domain
const _analytics * get_analytics() const
get analytics of the time_domain analysed signal
void putValue(double val, int row, int col)
easy abstracted values insersion
bool analyse()
generalized huge analysis in the time domain fetches basic data
double getValue(int row, int col)
easy abstracted values extraction
struct signal::_analytics analytics
wrap the core folder / include base helper methods and macros used accross the program
double constrain(double _rad)
bool isNear(double v1, double v2, double acc)
bool isInDomain(double start, double end, double current)
_signal_operation signal_operation_global
this file includes the basic signal_operation class responsible for doing any required manipulation o...
double avg_sample_time
average sampling time of the signal
double base_frequency
base frequency of the signal
unsigned int samples_num
number of samples that the signal holds
double timeStart
the start time of the signal
double periodic_time
periodic_time of the signal
double timeEnd
the time end of the signal
std::vector< double > time