ENERGY MONITOR 0.2
Loading...
Searching...
No Matches
signal Class Reference

signal class the parent class for every other signal or any form of time-sorted (time,value) vectors More...

#include <signal.h>

Inheritance diagram for signal:
_current _power _voltage source

Classes

struct  _analytics
 
struct  _subSignals
 
struct  maximas_minimas
 (time, value) representation of peaks and troughs of a signal More...
 
struct  pattern
 

Public Member Functions

const maximas_minimasget_valMaximas () const
 get value peaks in the signal
 
const maximas_minimasget_valMinimas () const
 get value troughs in the signal
 
const maximas_minimasget_dvBdtMaximas () const
 
const maximas_minimasget_dvBdtMinimas () const
 
const bool isTimeAnalysed ()
 check if the signal was analysed in the time domain
 
bool dataViable ()
 
bool loadData (std::string name, std::string fileLocation=settings.get_setting("signal","import_path"))
 load data from a file directly if it has the following format (time,value)
 
bool loadData (v_container _data)
 load data first two columns from a dataTable structure into this signal with order (time,value)
 
bool loadData (std::vector< double > time, std::vector< double > vals)
 load data from a time vector and a values vector
 
bool analyse ()
 generalized huge analysis in the time domain fetches basic data
 
bool pdf_export (std::string name, std::string file_address=settings.get_setting("signal","export_path"))
 export valuable signal report (images and text)//in the pdf format
 
bool exportSignal (std::string name, bool export_all=false, sig_exp expType=sig_exp::csv, std::string fileLocation=settings.get_setting("signal","export_path"))
 export the signal data to a specific file
 
bool importSignal (std::string name, std::string fileLocation=settings.get_setting("signal","import_path"))
 import a signal in the .sig binary format
 
void set_trigger_level (double v)
 sets the trigger level for the trigger level based frequency calculation
 
void set_hysteresis (double upThreshold, double lowThreshold)
 sets the hysteresis parameters for the hysteresis trigger frequency calculations
 
const _analyticsget_analytics () const
 get analytics of the time_domain analysed signal
 
const v_containerget_signal_data () const
 get any values in the signal data table
 
void make_subsignals (std::vector< pattern > &pattern, _subSignals &sig)
 a function that keeps generating subsignals based on the pattern provided that holds pattern start time and pattern endtime
 
_subSignalssubSignal_periodBased ()
 get the subSignals generated from this signal based on their periodic times pattern
 
_subSignalssubSignal_valueBased ()
 get the subSignals generated from this signal based on their rms for periods times pattern
 

Protected Types

enum  freq_calc_t { triggerLevel = 1 , peakNdtrough = 2 , triggerHysteresis = 3 }
 decide the frequency calculation type More...
 
enum class  pattern_type { periodic = 1 , transient = 2 }
 
using json = nlohmann::json
 

Protected Member Functions

void putValue (double val, int row, int col)
 easy abstracted values insersion
 
double getValue (int row, int col)
 easy abstracted values extraction
 
void refreshData ()
 refresh the dataTable that we use
 
double _dvBdt (double v1, double v2, double t1, double t2)
 
double _dv2Bdt2 (double v1, double v2, double v3, double t1, double t2)
 
double _vdt (double v1, double v2, double t1, double t2)
 
bool pre_analyze ()
 Makes variable data out of the time-value data such as slopes and areas wrt to time.
 
void interpolate ()
 INTERPOLATIONS FOR FIXING LOW SAMPLE SIGNALS/DIFFERENT SAMPLING RATES.
 
bool soft_analyze ()
 soft time tomain analysis
 
bool update_local_maximas_minimas ()
 EVALUATE MAXIMAS/MINIMAS using SLOPE DATA.
 
bool post_local_maximas_minimas ()
 filter local MAXIMAS and MINIMAS and update ptp data (only top maximas and lowest minimas)
 
bool frequency_peakNdtrough ()
 calculate frequency based on Local maximas and minimas and their times respectively
 
bool frequency_triggerLevel ()
 calculate frequency based on crossing trigger level times
 
bool frequency_triggerHysteresis ()
 calculate the base_frequency with hysteresis added for noise ignorance
 
bool deduce_baseFrequency ()
 deduce base frequency + angular + number of periods for the signal
 
bool deduce_avg_rms ()
 rms and avg based on integer number of signals analysis only
 
bool update_slope_maximas_minimas ()
 VALUES ANALYTICS THAT EVALUATE MAXIMAS_MINIMAS using SLOPE DATA.
 
bool period_pattern_analysis ()
 analyse regions of the signal basesd on their periodic times (connected similar periodic times = 1 continous signal) periodic time rapid change/phase shifts in a period = transients; connected transients are considered a singular non periodic signal;
 
bool pattern_analyze ()
 analyse changes in the signal and store any continous patterns detected for future interval Based signal analysis
 
std::vector< double[2]> forrierTransform (signal base_sig)
 

Protected Attributes

struct signal::_analytics analytics
 
double min_max_accuracy = stod(settings.get_setting("signal","min_max_accuracy"))
 
double maxima_diff_rounding = stod(settings.get_setting("signal","maxima_diff_rounding"))
 
double minima_diff_rounding = stod(settings.get_setting("signal","minima_diff_rounding"))
 
bool smaller_extremas_ignored = stoi(settings.get_setting("signal","smaller_extremas_ignored"))
 
double period_diff_accuracy = stod(settings.get_setting("signal","period_diff_accuracy"))
 
bool periodic_avg_rms = stoi(settings.get_setting("signal","periodic_avg&rms"))
 
int frequency_calc_type = stoi(settings.get_setting("signal","frequency_calc_type"))
 
v_container signal_data
 
maximas_minimas val_maximas
 
maximas_minimas val_minimas
 
maximas_minimas dvBdt_maximas
 
maximas_minimas dvBdt_minimas
 
std::vector< double > rising_trigger_times
 rising edges detected are stored here mainly used by trigger level frequency calculation and hysteresis frequency calculation
 
std::vector< double > falling_trigger_times
 rising edges detected are stored here mainly used by trigger level frequency calculation and hysteresis frequency calculation
 
std::vector< double > rising_periods
 rising edges detected are stored here mainly used by trigger level frequency calculation and hysteresis frequency calculation
 
std::vector< double > falling_periods
 rising edges detected are stored here mainly used by trigger level frequency calculation and hysteresis frequency calculation
 
std::vector< patternperiods_pattern
 
struct signal::_subSignals subSignals_period_based
 
struct signal::_subSignals subSignals_value_based
 
double _trigger_level = 0
 signal value for detecting edges and calculating frequency based on
 
double _hysteresis_high_threshold = 5
 
double _hysteresis_low_threshold = -5
 
int minimum_periodic_periodNum = stoi(settings.get_setting("signal", "minimum_periodic_periodNum") )
 
bool timeDomain_analysed = false
 
bool data_viable = false
 

Friends

class _signal_operation
 

Detailed Description

signal class the parent class for every other signal or any form of time-sorted (time,value) vectors

Definition at line 39 of file signal.h.

Member Typedef Documentation

◆ json

using signal::json = nlohmann::json
protected

Definition at line 126 of file signal.h.

Member Enumeration Documentation

◆ freq_calc_t

enum signal::freq_calc_t
protected

decide the frequency calculation type

Enumerator
triggerLevel 
peakNdtrough 
triggerHysteresis 

Definition at line 138 of file signal.h.

◆ pattern_type

enum class signal::pattern_type
strongprotected
Enumerator
periodic 
transient 

Definition at line 166 of file signal.h.

Member Function Documentation

◆ _dv2Bdt2()

double signal::_dv2Bdt2 ( double v1,
double v2,
double v3,
double t1,
double t2 )
protected

Definition at line 62 of file signal.cpp.

◆ _dvBdt()

double signal::_dvBdt ( double v1,
double v2,
double t1,
double t2 )
protected

Definition at line 57 of file signal.cpp.

◆ _vdt()

double signal::_vdt ( double v1,
double v2,
double t1,
double t2 )
protected

Definition at line 66 of file signal.cpp.

◆ analyse()

bool signal::analyse ( )

generalized huge analysis in the time domain fetches basic data

Returns
boolean for success of operation

Definition at line 674 of file signal.cpp.

◆ dataViable()

bool signal::dataViable ( )

Definition at line 52 of file signal.cpp.

◆ deduce_avg_rms()

bool signal::deduce_avg_rms ( )
protected

rms and avg based on integer number of signals analysis only

Definition at line 540 of file signal.cpp.

◆ deduce_baseFrequency()

bool signal::deduce_baseFrequency ( )
protected

deduce base frequency + angular + number of periods for the signal

Definition at line 521 of file signal.cpp.

◆ exportSignal()

bool signal::exportSignal ( std::string name,
bool export_all = false,
sig_exp expType = sig_exp::csv,
std::string fileLocation = settings.get_setting("signal","export_path") )

export the signal data to a specific file

Parameters
namethe name of the file to export to
export_allif true will export all time mapped signal data including areas and slopes if false only values and times get exported
expTypethe format to export the signal in Options (sig_exp::csv default) (sig_exp::sig compressed binary format representation of the signal)
fileLocationthe file location to export to default is export_path from config.json

Definition at line 725 of file signal.cpp.

◆ forrierTransform()

std::vector< double[2]> signal::forrierTransform ( signal base_sig)
protected

◆ frequency_peakNdtrough()

bool signal::frequency_peakNdtrough ( )
protected

calculate frequency based on Local maximas and minimas and their times respectively

Definition at line 349 of file signal.cpp.

◆ frequency_triggerHysteresis()

bool signal::frequency_triggerHysteresis ( )
protected

calculate the base_frequency with hysteresis added for noise ignorance

Definition at line 484 of file signal.cpp.

◆ frequency_triggerLevel()

bool signal::frequency_triggerLevel ( )
protected

calculate frequency based on crossing trigger level times

Definition at line 426 of file signal.cpp.

◆ get_analytics()

const signal::_analytics * signal::get_analytics ( ) const

get analytics of the time_domain analysed signal

Returns
analysis structure member of this signal as const

Definition at line 691 of file signal.cpp.

◆ get_dvBdtMaximas()

const maximas_minimas * signal::get_dvBdtMaximas ( ) const
inline

Definition at line 267 of file signal.h.

◆ get_dvBdtMinimas()

const maximas_minimas * signal::get_dvBdtMinimas ( ) const
inline

Definition at line 270 of file signal.h.

◆ get_signal_data()

const v_container * signal::get_signal_data ( ) const

get any values in the signal data table

Returns
dataTable holding signal_data as const

Definition at line 696 of file signal.cpp.

◆ get_valMaximas()

const maximas_minimas * signal::get_valMaximas ( ) const
inline

get value peaks in the signal

Returns
structure with time,value vector (maximas_minimas)

Definition at line 258 of file signal.h.

◆ get_valMinimas()

const maximas_minimas * signal::get_valMinimas ( ) const
inline

get value troughs in the signal

Returns
structure with time,value vector (maximas_minimas)

Definition at line 263 of file signal.h.

◆ getValue()

double signal::getValue ( int row,
int col )
inlineprotected

easy abstracted values extraction

Definition at line 118 of file signal.h.

◆ importSignal()

bool signal::importSignal ( std::string name,
std::string fileLocation = settings.get_setting("signal","import_path") )

import a signal in the .sig binary format

Parameters
namename of the file
fileLocationpath to the file default is import_path in config.json

Definition at line 776 of file signal.cpp.

◆ interpolate()

void signal::interpolate ( )
protected

INTERPOLATIONS FOR FIXING LOW SAMPLE SIGNALS/DIFFERENT SAMPLING RATES.

◆ isTimeAnalysed()

const bool signal::isTimeAnalysed ( )
inline

check if the signal was analysed in the time domain

Returns
true if it was analysed before

Definition at line 276 of file signal.h.

◆ loadData() [1/3]

bool signal::loadData ( std::string name,
std::string fileLocation = settings.get_setting("signal","import_path") )

load data from a file directly if it has the following format (time,value)

Parameters
namethe name of the file including the extension
fileLocationthe location or path to the file default argument is path from config.json file
Returns
boolean for success of operation

◆ loadData() [2/3]

bool signal::loadData ( std::vector< double > time,
std::vector< double > vals )

load data from a time vector and a values vector

Parameters
timethe time vector passed by value
valsthe values vector passed by value
Returns
boolean for success of operation

Definition at line 38 of file signal.cpp.

◆ loadData() [3/3]

bool signal::loadData ( v_container _data)

load data first two columns from a dataTable structure into this signal with order (time,value)

Parameters
_datathe dataTable that gets passed by value (seperate copy for signal data)
Returns
boolean for success of operation

Definition at line 32 of file signal.cpp.

◆ make_subsignals()

void signal::make_subsignals ( std::vector< pattern > & pattern,
_subSignals & sig )

a function that keeps generating subsignals based on the pattern provided that holds pattern start time and pattern endtime

Parameters
patternthe pattern vector provided for subsignals generation
sigthe vector of type signal to return subsignals in

Definition at line 701 of file signal.cpp.

◆ pattern_analyze()

bool signal::pattern_analyze ( )
protected

analyse changes in the signal and store any continous patterns detected for future interval Based signal analysis

Definition at line 663 of file signal.cpp.

◆ pdf_export()

bool signal::pdf_export ( std::string name,
std::string file_address = settings.get_setting("signal","export_path") )

export valuable signal report (images and text)//in the pdf format

Parameters
namethe name of the file to export to
file_addressthe file address to to export to
Returns
boolean for success of operation

Definition at line 842 of file signal.cpp.

◆ period_pattern_analysis()

bool signal::period_pattern_analysis ( )
protected

analyse regions of the signal basesd on their periodic times (connected similar periodic times = 1 continous signal) periodic time rapid change/phase shifts in a period = transients; connected transients are considered a singular non periodic signal;

Definition at line 591 of file signal.cpp.

◆ post_local_maximas_minimas()

bool signal::post_local_maximas_minimas ( )
protected

filter local MAXIMAS and MINIMAS and update ptp data (only top maximas and lowest minimas)

**BLOCK FOR UPDATING

Definition at line 245 of file signal.cpp.

◆ pre_analyze()

bool signal::pre_analyze ( )
protected

Makes variable data out of the time-value data such as slopes and areas wrt to time.

does pre analytic operation like getting slopes and _areas wrt and adds them to the datatable data

Returns
expected returns are the followin check for data viability (–time –values –first derivative –second derivative –integration) table

Definition at line 77 of file signal.cpp.

◆ putValue()

void signal::putValue ( double val,
int row,
int col )
inlineprotected

easy abstracted values insersion

Definition at line 114 of file signal.h.

◆ refreshData()

void signal::refreshData ( )
inlineprotected

refresh the dataTable that we use

Definition at line 122 of file signal.h.

◆ set_hysteresis()

void signal::set_hysteresis ( double upThreshold,
double lowThreshold )

sets the hysteresis parameters for the hysteresis trigger frequency calculations

Parameters
upThresholdupper threshold for the hysteresis block
lowThresholdlower threshold for the hysteresis block

Definition at line 837 of file signal.cpp.

◆ set_trigger_level()

void signal::set_trigger_level ( double v)

sets the trigger level for the trigger level based frequency calculation

Parameters
vvalue of the trigger level

Definition at line 831 of file signal.cpp.

◆ soft_analyze()

bool signal::soft_analyze ( )
protected

soft time tomain analysis

Returns
expected after successfull analysis the following –frequency detection , –local minimas/maximas : time map –periodic avg/rms (per_period) , peak to peak / dc offset data –interpolate data

Definition at line 573 of file signal.cpp.

◆ subSignal_periodBased()

signal::_subSignals * signal::subSignal_periodBased ( )

get the subSignals generated from this signal based on their periodic times pattern

Returns
a pointer to the subSignal structure

Definition at line 712 of file signal.cpp.

◆ subSignal_valueBased()

signal::_subSignals * signal::subSignal_valueBased ( )

get the subSignals generated from this signal based on their rms for periods times pattern

Returns
a pointer to the subSignal structure

Definition at line 717 of file signal.cpp.

◆ update_local_maximas_minimas()

bool signal::update_local_maximas_minimas ( )
protected

EVALUATE MAXIMAS/MINIMAS using SLOPE DATA.

Definition at line 153 of file signal.cpp.

◆ update_slope_maximas_minimas()

bool signal::update_slope_maximas_minimas ( )
protected

VALUES ANALYTICS THAT EVALUATE MAXIMAS_MINIMAS using SLOPE DATA.

Friends And Related Symbol Documentation

◆ _signal_operation

friend class _signal_operation
friend

Definition at line 42 of file signal.h.

Member Data Documentation

◆ _hysteresis_high_threshold

double signal::_hysteresis_high_threshold = 5
protected

Definition at line 194 of file signal.h.

◆ _hysteresis_low_threshold

double signal::_hysteresis_low_threshold = -5
protected

Definition at line 195 of file signal.h.

◆ _trigger_level

double signal::_trigger_level = 0
protected

signal value for detecting edges and calculating frequency based on

Definition at line 193 of file signal.h.

◆ analytics

struct signal::_analytics signal::analytics
protected

◆ data_viable

bool signal::data_viable = false
protected

Definition at line 251 of file signal.h.

◆ dvBdt_maximas

maximas_minimas signal::dvBdt_maximas
protected

Definition at line 154 of file signal.h.

◆ dvBdt_minimas

maximas_minimas signal::dvBdt_minimas
protected

Definition at line 155 of file signal.h.

◆ falling_periods

std::vector<double> signal::falling_periods
protected

rising edges detected are stored here mainly used by trigger level frequency calculation and hysteresis frequency calculation

Definition at line 163 of file signal.h.

◆ falling_trigger_times

std::vector<double> signal::falling_trigger_times
protected

rising edges detected are stored here mainly used by trigger level frequency calculation and hysteresis frequency calculation

Definition at line 159 of file signal.h.

◆ frequency_calc_type

int signal::frequency_calc_type = stoi(settings.get_setting("signal","frequency_calc_type"))
protected

Definition at line 134 of file signal.h.

◆ maxima_diff_rounding

double signal::maxima_diff_rounding = stod(settings.get_setting("signal","maxima_diff_rounding"))
protected

Definition at line 129 of file signal.h.

◆ min_max_accuracy

double signal::min_max_accuracy = stod(settings.get_setting("signal","min_max_accuracy"))
protected

Definition at line 128 of file signal.h.

◆ minima_diff_rounding

double signal::minima_diff_rounding = stod(settings.get_setting("signal","minima_diff_rounding"))
protected

Definition at line 130 of file signal.h.

◆ minimum_periodic_periodNum

int signal::minimum_periodic_periodNum = stoi(settings.get_setting("signal", "minimum_periodic_periodNum") )
protected

Definition at line 196 of file signal.h.

◆ period_diff_accuracy

double signal::period_diff_accuracy = stod(settings.get_setting("signal","period_diff_accuracy"))
protected

Definition at line 132 of file signal.h.

◆ periodic_avg_rms

bool signal::periodic_avg_rms = stoi(settings.get_setting("signal","periodic_avg&rms"))
protected

Definition at line 133 of file signal.h.

◆ periods_pattern

std::vector<pattern> signal::periods_pattern
protected

Definition at line 183 of file signal.h.

◆ rising_periods

std::vector<double> signal::rising_periods
protected

rising edges detected are stored here mainly used by trigger level frequency calculation and hysteresis frequency calculation

Definition at line 161 of file signal.h.

◆ rising_trigger_times

std::vector<double> signal::rising_trigger_times
protected

rising edges detected are stored here mainly used by trigger level frequency calculation and hysteresis frequency calculation

Definition at line 157 of file signal.h.

◆ signal_data

v_container signal::signal_data
protected

Definition at line 151 of file signal.h.

◆ smaller_extremas_ignored

bool signal::smaller_extremas_ignored = stoi(settings.get_setting("signal","smaller_extremas_ignored"))
protected

Definition at line 131 of file signal.h.

◆ subSignals_period_based

struct signal::_subSignals signal::subSignals_period_based
protected

◆ subSignals_value_based

struct signal::_subSignals signal::subSignals_value_based
protected

◆ timeDomain_analysed

bool signal::timeDomain_analysed = false
protected

Definition at line 250 of file signal.h.

◆ val_maximas

maximas_minimas signal::val_maximas
protected

Definition at line 152 of file signal.h.

◆ val_minimas

maximas_minimas signal::val_minimas
protected

Definition at line 153 of file signal.h.


The documentation for this class was generated from the following files: