25 std::string user_input;
29 cout <<
"EXTRACTING DATA FROM THE FILE.........." << endl;
33 cout <<
"COLUMNS NUMBER OF CURRENT TABLE IS :::" << dataContainer.
get_col_num() << endl;
34 cout <<
"ROWS NUMBER OF CURRENT TABLE IS :::" << dataContainer.
get_row_num() << endl;
39 cout <<
"REARRANGING DATA.........." << endl;
40 std::vector<double> time;
42 std::vector<double> current;
44 std::vector<double> voltage;
52 currentTable.
sub_table(currentTable, 0, 500000, 0, 1);
58 voltageTable.
sub_table(voltageTable, 0, 500000, 0, 1);
65 voltage_input.
loadData(voltageTable);
66 current_input.
loadData(currentTable);
69 _power result_power =
_power(voltage_input,current_input);
73 cout <<
"ANALYSING UNFILTERED SIGNALS .....\n\n" << endl;
74 cout <<
"\n***********VOLTAGE ANALYSIS******\n" << endl;
77 cout <<
"----------------------------------" << endl;
78 cout <<
"SUBSIGNAL : " << i << endl;
79 cout <<
"----------------------------------" << endl;
82 cout <<
"\n***********CURRENT ANALYSIS******\n" << endl;
85 cout <<
"----------------------------------" << endl;
86 cout <<
"SUBSIGNAL : " << i << endl;
87 cout <<
"----------------------------------" << endl;
90 cout <<
"\n***********POWER ANALYSIS******\n" << endl;
93 cout <<
"----------------------------------" << endl;
94 cout <<
"SUBSIGNAL : " << i << endl;
95 cout <<
"----------------------------------" << endl;
100 cout <<
"POWER FACTOR :::" << result_power.
get_PF() << endl;
101 cout <<
"active :::" << result_power.
get_active() << endl;
102 cout <<
"apparent :::" << result_power.
get_apparent() << endl;
105 cout <<
"TYPE \"EXPORT\" TO EXPORT UNFILTERED else to pass" << endl;
108 if (user_input ==
"EXPORT") {
109 cout <<
"EXPORTING UNFILTERED .....\n\n" << endl;
117 cout <<
"Filtering .....\n\n" << endl;
122 result_power =
_power(voltage_input,current_input);
124 cout <<
"\n***********FILTERED VOLTAGE ANALYSIS******\n" << endl;
127 cout <<
"----------------------------------" << endl;
128 cout <<
"SUBSIGNAL : " << i << endl;
129 cout <<
"----------------------------------" << endl;
132 cout <<
"\n***********FILTERED CURRENT ANALYSIS******\n" << endl;
135 cout <<
"----------------------------------" << endl;
136 cout <<
"SUBSIGNAL : " << i << endl;
137 cout <<
"----------------------------------" << endl;
140 cout <<
"\n***********FILTERED POWER ANALYSIS******\n" << endl;
143 cout <<
"----------------------------------" << endl;
144 cout <<
"SUBSIGNAL : " << i << endl;
145 cout <<
"----------------------------------" << endl;
149 cout <<
"POWER FACTOR :::" << result_power.
get_PF() << endl;
150 cout <<
"active :::" << result_power.
get_active() << endl;
151 cout <<
"apparent :::" << result_power.
get_apparent() << endl;
153 cout <<
"TYPE \"EXPORT\" TO EXPORT FILTERED else to pass" << endl;
155 if (user_input ==
"EXPORT") {
156 cout <<
"EXPORTING FILTERED .....\n\n" << endl;
157 voltage_input.
exportSignal(
"voltage_output_filtered.csv");
158 current_input.
exportSignal(
"current_output_filtered.csv");
162 current_input.
pdf_export(
"current_input.pdf");
163 voltage_input.
pdf_export(
"voltage_input.pdf");
164 cout <<
"NOW SIMULATING THE APPLIANCE MODEL USING FILTERED CURRENT AND VOLTAGE.........." << endl;
167 cout <<
"SIMULATING APPLIANCE WITH FILTERED CURRENT&VOLTAGE .....\n\n" << endl;
170 for(
unsigned int step = 0; step < steps_number ; step++)modelAppliance.
readStep();
172 cout <<
"SIMULATION RESULTS\n\n" << endl;
185 energy = ((energy/1000)/ (3600) );
187 cout <<
"ENERGY COST :::" <<
tarrif_calc(energy) <<
" EGP" <<endl;
189 cout <<
"TYPE QUIT TO EXIT" << endl;
192 if (user_input ==
"QUIT")
break;
211 std::cout <<
"DATA VIABLE ::" << dummySignal->
dataViable() << endl;
double get_apparent() const
double get_active() const
double get_energy(double time_start, double time_end)
get the energy over the coarse of a certain time period
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...
double voltage_tripTime()
double current_tripTime()
bool insertColumn(unsigned int columnNumber, const std::vector< HELD_DATA > &putArray)
inserts a column in the table replacing existing if they exist or adds them
bool sub_table(dataTable &subTable, int rowStart, int rowEnd, int columnStart, int columnEnd)
EXTRACT A SUBSET OF THE BIGGER TABLE.
unsigned int get_col_num()
unsigned int get_row_num()
bool extractColumn(unsigned int columnNumber, std::vector< HELD_DATA > &returnArray)
Extracts a row from the dataTable in a vector.
signal class the parent class for every other signal or any form of time-sorted (time,...
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
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
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
_subSignals * subSignal_periodBased()
get the subSignals generated from this signal based on their periodic times pattern
void set_hysteresis(double upThreshold, double lowThreshold)
sets the hysteresis parameters for the hysteresis trigger frequency calculations
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 analyse()
generalized huge analysis in the time domain fetches basic data
std::string bool_to_string(int v)
double tarrif_calc(double energy_in_month)
calculate energy cost based on how much energy was consumed in a month according to egyptian tarrif
void analyticBlock(signal *dummySignal, bool show_peaks_troughs=false)
this file includes the base class "signal" for signals modeling and analysing thier time-domain / fre...
_signal_operation signal_operation_global
bool data_import(string file_address, dataTable< double > &data, int type)
a function that imports files with supported file formats
double avg_sample_time
average sampling time of the signal
double max_val
absolute maximum value
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 max_val_time
absolute maximum value time
double timeEnd
the time end of the signal
double rms
rms for the signal
double min_val_time
absolute minimum value time
double min_val
absolute minimum value
double avg
avg of the signal
std::vector< signal > subSignals