Code comments
This commit is contained in:
		
							parent
							
								
									efdc4d6a6c
								
							
						
					
					
						commit
						bfa0b35d86
					
				| 
						 | 
					@ -1,9 +1,32 @@
 | 
				
			||||||
/* pavan changes */
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
#include <gtk/gtk.h>
 | 
					 * Attack_detect.h
 | 
				
			||||||
/* variables declared of attack_detect function */
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* function declared  */
 | 
					#include <gtk/gtk.h>
 | 
				
			||||||
gboolean attack_detect_freq(struct data_frame *df);
 | 
					gboolean attack_detect_freq(struct data_frame *df);
 | 
				
			||||||
gboolean attack_detect_vol(struct data_frame *df);
 | 
					gboolean attack_detect_vol(struct data_frame *df);
 | 
				
			||||||
gboolean attack_detect_freq_vol(struct data_frame *df);
 | 
					gboolean attack_detect_freq_vol(struct data_frame *df);
 | 
				
			||||||
/* pavan changes */
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,31 @@
 | 
				
			||||||
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * Dynamic_time_warping.h
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*pavan changes*/
 | 
					 | 
				
			||||||
int DTWfreqDistance(struct data_frame *df);
 | 
					int DTWfreqDistance(struct data_frame *df);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int DTWvolDistance(struct data_frame *df);
 | 
					int DTWvolDistance(struct data_frame *df);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,31 @@
 | 
				
			||||||
/*Pavan Changes*/
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * Kmeans.h
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gtk/gtk.h>
 | 
					#include <gtk/gtk.h>
 | 
				
			||||||
// intial variables
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//function declaration
 | 
					 | 
				
			||||||
gboolean kmeans(struct data_frame *df);
 | 
					gboolean kmeans(struct data_frame *df);
 | 
				
			||||||
 | 
					 | 
				
			||||||
/*Pavan Changes*/
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,31 @@
 | 
				
			||||||
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * Kmeans2.h
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int *getRandoms(int lower, int upper, int count);
 | 
					int *getRandoms(int lower, int upper, int count);
 | 
				
			||||||
long double distance(struct Point *A, struct Point *B);
 | 
					long double distance(struct Point *A, struct Point *B);
 | 
				
			||||||
bool Kmeans2(struct data_frame *df);
 | 
					bool Kmeans2(struct data_frame *df);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,37 @@
 | 
				
			||||||
#include<gtk/gtk.h>
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
#include<osm-gps-map.h>
 | 
					 * data_vis.h
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <gtk/gtk.h>
 | 
				
			||||||
 | 
					#include <osm-gps-map.h>
 | 
				
			||||||
#include "livechart.h"
 | 
					#include "livechart.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct{
 | 
					typedef struct
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
    OsmGpsMap *util_map;
 | 
					    OsmGpsMap *util_map;
 | 
				
			||||||
    GdkPixbuf *g_red_image;
 | 
					    GdkPixbuf *g_red_image;
 | 
				
			||||||
    GdkPixbuf *g_green_image;
 | 
					    GdkPixbuf *g_green_image;
 | 
				
			||||||
| 
						 | 
					@ -10,7 +39,8 @@ typedef struct{
 | 
				
			||||||
    int current_selection;
 | 
					    int current_selection;
 | 
				
			||||||
} myParameters;
 | 
					} myParameters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct vis_data{
 | 
					struct vis_data
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
    int id;
 | 
					    int id;
 | 
				
			||||||
    float lat;
 | 
					    float lat;
 | 
				
			||||||
    float lon;
 | 
					    float lon;
 | 
				
			||||||
| 
						 | 
					@ -25,4 +55,4 @@ struct vis_data{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct vis_data *vis_data_head;
 | 
					struct vis_data *vis_data_head;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gboolean update_vis(gpointer* pars);
 | 
					gboolean update_vis(gpointer *pars);
 | 
				
			||||||
| 
						 | 
					@ -1,11 +1,39 @@
 | 
				
			||||||
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * utility_tools.h
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include<gtk/gtk.h>
 | 
					#include <gtk/gtk.h>
 | 
				
			||||||
#include "osm-gps-map.h"
 | 
					#include "osm-gps-map.h"
 | 
				
			||||||
#include "livechart.h"
 | 
					#include "livechart.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Convenience macros for obtaining objects from UI file */
 | 
					/* Convenience macros for obtaining objects from UI file */
 | 
				
			||||||
#define CH_GET_OBJECT(builder, name, type, data) \
 | 
					#define CH_GET_OBJECT(builder, name, type, data) \
 | 
				
			||||||
		data->name = type(gtk_builder_get_object (builder, #name) )
 | 
						data->name = type(gtk_builder_get_object(builder, #name))
 | 
				
			||||||
#define CH_GET_WIDGET(builder, name, data) \
 | 
					#define CH_GET_WIDGET(builder, name, data) \
 | 
				
			||||||
	CH_GET_OBJECT(builder, name, GTK_WIDGET, data)
 | 
						CH_GET_OBJECT(builder, name, GTK_WIDGET, data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,10 +59,10 @@ struct _UtData
 | 
				
			||||||
	GtkContainer *graph_layoutdfreq;
 | 
						GtkContainer *graph_layoutdfreq;
 | 
				
			||||||
	GtkLabel *algo_label;
 | 
						GtkLabel *algo_label;
 | 
				
			||||||
	GtkLabel *dimm_label;
 | 
						GtkLabel *dimm_label;
 | 
				
			||||||
	GtkBox * ml_vol;
 | 
						GtkBox *ml_vol;
 | 
				
			||||||
	GtkBox * ml_freq;
 | 
						GtkBox *ml_freq;
 | 
				
			||||||
	GtkBox * ml_dfreq;
 | 
						GtkBox *ml_dfreq;
 | 
				
			||||||
	GtkBox * ml_ad;
 | 
						GtkBox *ml_ad;
 | 
				
			||||||
	GtkWidget *swvol;
 | 
						GtkWidget *swvol;
 | 
				
			||||||
	GtkWidget *swfreq;
 | 
						GtkWidget *swfreq;
 | 
				
			||||||
	GtkWidget *swdfreq;
 | 
						GtkWidget *swdfreq;
 | 
				
			||||||
| 
						 | 
					@ -53,6 +81,4 @@ int curr_measurement;
 | 
				
			||||||
int algorithm;
 | 
					int algorithm;
 | 
				
			||||||
int dimmension;
 | 
					int dimmension;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void utility_tools(GtkButton *but, gpointer udata);
 | 
					void utility_tools(GtkButton *but, gpointer udata);
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,31 @@
 | 
				
			||||||
/* pavan changes */
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * Attack_detect.c
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,31 @@
 | 
				
			||||||
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * Dynamic_time_warping.c
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "parser.h"
 | 
					#include "parser.h"
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <math.h>
 | 
					#include <math.h>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,30 @@
 | 
				
			||||||
/*Pavan Changes*/
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * Kmeans.c
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "parser.h"
 | 
					#include "parser.h"
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
| 
						 | 
					@ -99,5 +125,3 @@ gboolean kmeans(struct data_frame *df)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
/*Pavan Changes*/
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,31 @@
 | 
				
			||||||
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * Kmeans2.c
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "parser.h"
 | 
					#include "parser.h"
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,31 @@
 | 
				
			||||||
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * data_vis.c
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
| 
						 | 
					@ -16,68 +44,79 @@
 | 
				
			||||||
#include "utility_tools.h"
 | 
					#include "utility_tools.h"
 | 
				
			||||||
#include "Kmeans2.h"
 | 
					#include "Kmeans2.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
int loops = 0;
 | 
					int loops = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gboolean update_vis(gpointer* pars){
 | 
					gboolean update_vis(gpointer *pars)
 | 
				
			||||||
    int match=0,id, cfg_match=0;
 | 
					{
 | 
				
			||||||
    myParameters* parameters = (myParameters*) pars;
 | 
					    int match = 0, id, cfg_match = 0;
 | 
				
			||||||
    struct cfg_frame* temp_cfg;
 | 
					    myParameters *parameters = (myParameters *)pars;
 | 
				
			||||||
 | 
					    struct cfg_frame *temp_cfg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pthread_mutex_lock(&mutex_on_TSB);
 | 
					    pthread_mutex_lock(&mutex_on_TSB);
 | 
				
			||||||
    struct data_frame *df = TSB[MAXTSB-1].first_data_frame;
 | 
					    struct data_frame *df = TSB[MAXTSB - 1].first_data_frame;
 | 
				
			||||||
    struct Lower_Layer_Details *LLptr;
 | 
					    struct Lower_Layer_Details *LLptr;
 | 
				
			||||||
    struct vis_data *vis_ptr;
 | 
					    struct vis_data *vis_ptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (df == NULL){
 | 
					    if (df == NULL)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        pthread_mutex_unlock(&mutex_on_TSB);
 | 
					        pthread_mutex_unlock(&mutex_on_TSB);
 | 
				
			||||||
        return TRUE;
 | 
					        return TRUE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int i = 0, k = 0;
 | 
					    int i = 0, k = 0;
 | 
				
			||||||
    float freq,vol_magnitude,angle, dfreq;
 | 
					    float freq, vol_magnitude, angle, dfreq;
 | 
				
			||||||
    unsigned char freq_fmt, anal_fmt, phas_fmt, polar_fmt;
 | 
					    unsigned char freq_fmt, anal_fmt, phas_fmt, polar_fmt;
 | 
				
			||||||
    while (df!=NULL){
 | 
					    while (df != NULL)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        float lat;
 | 
					        float lat;
 | 
				
			||||||
        float lon;
 | 
					        float lon;
 | 
				
			||||||
        loops++;
 | 
					        loops++;
 | 
				
			||||||
        id = to_intconvertor(df->idcode);
 | 
					        id = to_intconvertor(df->idcode);
 | 
				
			||||||
        pthread_mutex_lock(&mutex_cfg);
 | 
					        pthread_mutex_lock(&mutex_cfg);
 | 
				
			||||||
        temp_cfg = cfgfirst;
 | 
					        temp_cfg = cfgfirst;
 | 
				
			||||||
        while(temp_cfg != NULL){
 | 
					        while (temp_cfg != NULL)
 | 
				
			||||||
            if(id == to_intconvertor(temp_cfg->idcode)){
 | 
					        {
 | 
				
			||||||
 | 
					            if (id == to_intconvertor(temp_cfg->idcode))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                cfg_match = 1;
 | 
					                cfg_match = 1;
 | 
				
			||||||
                freq_fmt = temp_cfg->pmu[0]->fmt->freq;
 | 
					                freq_fmt = temp_cfg->pmu[0]->fmt->freq;
 | 
				
			||||||
                anal_fmt = temp_cfg->pmu[0]->fmt->analog;
 | 
					                anal_fmt = temp_cfg->pmu[0]->fmt->analog;
 | 
				
			||||||
                phas_fmt = temp_cfg->pmu[0]->fmt->phasor;
 | 
					                phas_fmt = temp_cfg->pmu[0]->fmt->phasor;
 | 
				
			||||||
                polar_fmt = temp_cfg->pmu[0]->fmt->polar;
 | 
					                polar_fmt = temp_cfg->pmu[0]->fmt->polar;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            } else {
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                temp_cfg = temp_cfg->cfgnext;
 | 
					                temp_cfg = temp_cfg->cfgnext;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        pthread_mutex_unlock(&mutex_cfg);
 | 
					        pthread_mutex_unlock(&mutex_cfg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // get data from df.
 | 
					        // get data from df.
 | 
				
			||||||
        if(freq_fmt == '1'){
 | 
					        if (freq_fmt == '1')
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            freq = decode_ieee_single(df->dpmu[i]->freq);
 | 
					            freq = decode_ieee_single(df->dpmu[i]->freq);
 | 
				
			||||||
            printf("freq = %f\n",freq);
 | 
					            printf("freq = %f\n", freq);
 | 
				
			||||||
        }else{
 | 
					        }
 | 
				
			||||||
            freq = to_intconvertor(df->dpmu[i]->freq)*1e-3+50;
 | 
					        else
 | 
				
			||||||
            printf("freq = %f\n",freq);
 | 
					        {
 | 
				
			||||||
 | 
					            freq = to_intconvertor(df->dpmu[i]->freq) * 1e-3 + 50;
 | 
				
			||||||
 | 
					            printf("freq = %f\n", freq);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        unsigned char first2bytes[2];
 | 
					        unsigned char first2bytes[2];
 | 
				
			||||||
        strncpy(first2bytes, df->dpmu[i]->phasors[0], 2);
 | 
					        strncpy(first2bytes, df->dpmu[i]->phasors[0], 2);
 | 
				
			||||||
        unsigned char last2bytes[2];
 | 
					        unsigned char last2bytes[2];
 | 
				
			||||||
        strncpy(last2bytes, df->dpmu[i]->phasors[0]+2, 2);
 | 
					        strncpy(last2bytes, df->dpmu[i]->phasors[0] + 2, 2);
 | 
				
			||||||
        vol_magnitude = to_intconvertor(first2bytes);
 | 
					        vol_magnitude = to_intconvertor(first2bytes);
 | 
				
			||||||
        float imaginary = to_intconvertor(last2bytes);
 | 
					        float imaginary = to_intconvertor(last2bytes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        vis_ptr = vis_data_head;
 | 
					        vis_ptr = vis_data_head;
 | 
				
			||||||
        match = 0;
 | 
					        match = 0;
 | 
				
			||||||
        while(vis_ptr != NULL){
 | 
					        while (vis_ptr != NULL)
 | 
				
			||||||
            if(vis_ptr->id == id){
 | 
					        {
 | 
				
			||||||
 | 
					            if (vis_ptr->id == id)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                match = 1;
 | 
					                match = 1;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -91,79 +130,137 @@ gboolean update_vis(gpointer* pars){
 | 
				
			||||||
        live_chart_serie_add(vis_ptr->serie_vol, vol_magnitude);
 | 
					        live_chart_serie_add(vis_ptr->serie_vol, vol_magnitude);
 | 
				
			||||||
        live_chart_serie_add(vis_ptr->serie_dfreq, dfreq);
 | 
					        live_chart_serie_add(vis_ptr->serie_dfreq, dfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(match == 1 && cfg_match == 1){
 | 
					        if (match == 1 && cfg_match == 1)
 | 
				
			||||||
            if(vis_ptr->last_image != 0){
 | 
					        {
 | 
				
			||||||
 | 
					            if (vis_ptr->last_image != 0)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                osm_gps_map_image_remove(parameters->util_map, vis_ptr->last_image);
 | 
					                osm_gps_map_image_remove(parameters->util_map, vis_ptr->last_image);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if(curr_measurement == 0){
 | 
					            if (curr_measurement == 0)
 | 
				
			||||||
                if(vol_magnitude > 65600 || vol_magnitude < 65300){
 | 
					            {
 | 
				
			||||||
 | 
					                if (vol_magnitude > 65600 || vol_magnitude < 65300)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
					                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
                }else{
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
					                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }else if(curr_measurement == 1){
 | 
					 | 
				
			||||||
                if (freq > 50.3){
 | 
					 | 
				
			||||||
                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					 | 
				
			||||||
                }else{
 | 
					 | 
				
			||||||
                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            }else if(curr_measurement == 2){
 | 
					            else if (curr_measurement == 1)
 | 
				
			||||||
                if (dfreq < 0.5){
 | 
					            {
 | 
				
			||||||
                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					                if (freq > 50.3)
 | 
				
			||||||
                }else{
 | 
					                {
 | 
				
			||||||
                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }else if(curr_measurement == 3){
 | 
					                else
 | 
				
			||||||
                if(algorithm==0 && dimmension == 0){
 | 
					                {
 | 
				
			||||||
                    if (!attack_detect_freq(df)){
 | 
					                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					 | 
				
			||||||
                    }else{
 | 
					 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                }else if (algorithm==0 && dimmension == 1){
 | 
					 | 
				
			||||||
                    if (!attack_detect_vol(df)){
 | 
					 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					 | 
				
			||||||
                    }else{
 | 
					 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                }else if (algorithm==0 && dimmension == 2){
 | 
					            else if (curr_measurement == 2)
 | 
				
			||||||
                    if (!attack_detect_freq_vol(df)){
 | 
					            {
 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					                if (dfreq < 0.5)
 | 
				
			||||||
                    }else{
 | 
					                {
 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                }else if (algorithm==1 && dimmension == 0){
 | 
					                else
 | 
				
			||||||
                    if(!kmeans(df)){
 | 
					                {
 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
                    }else{
 | 
					 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                }else if (algorithm==1 && dimmension == 1){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                }else if (algorithm==1 && dimmension == 2){
 | 
					 | 
				
			||||||
                    if(!Kmeans2(df)){
 | 
					 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					 | 
				
			||||||
                    }else{
 | 
					 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                }else if (algorithm==2 && dimmension == 0){
 | 
					            else if (curr_measurement == 3)
 | 
				
			||||||
                    if(!DTWfreqDistance(df)){
 | 
					            {
 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					                if (algorithm == 0 && dimmension == 0)
 | 
				
			||||||
                    }else{
 | 
					                {
 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					                    if (!attack_detect_freq(df))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }else if (algorithm==2 && dimmension == 1){
 | 
					                    else
 | 
				
			||||||
                    if(!DTWvolDistance(df)){
 | 
					                    {
 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
                    }else{
 | 
					 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }else if (algorithm==2 && dimmension == 2){
 | 
					                }
 | 
				
			||||||
                    if(!DTWfreqvolDistance(df)){
 | 
					                else if (algorithm == 0 && dimmension == 1)
 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					                {
 | 
				
			||||||
                    }else{
 | 
					                    if (!attack_detect_vol(df))
 | 
				
			||||||
                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if (algorithm == 0 && dimmension == 2)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (!attack_detect_freq_vol(df))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if (algorithm == 1 && dimmension == 0)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (!kmeans(df))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if (algorithm == 1 && dimmension == 1)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if (algorithm == 1 && dimmension == 2)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (!Kmeans2(df))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if (algorithm == 2 && dimmension == 0)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (!DTWfreqDistance(df))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if (algorithm == 2 && dimmension == 1)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (!DTWvolDistance(df))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if (algorithm == 2 && dimmension == 2)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (!DTWfreqvolDistance(df))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -176,4 +273,3 @@ gboolean update_vis(gpointer* pars){
 | 
				
			||||||
    gtk_widget_queue_draw(GTK_WIDGET(parameters->util_map));
 | 
					    gtk_widget_queue_draw(GTK_WIDGET(parameters->util_map));
 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,31 @@
 | 
				
			||||||
 | 
					/* -----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * utility_tools.c
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iPDC - Phasor Data Concentrator
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Nitesh Pandit
 | 
				
			||||||
 | 
					 * Copyright (C) 2022-2023 Kedar V. Khandeparkar
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2
 | 
				
			||||||
 | 
					 * of the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Authors:
 | 
				
			||||||
 | 
					 *		M V Karthik <mvkarthik@gmail.com>
 | 
				
			||||||
 | 
					 *		Pavan Kumar V Patil <pavanvpatil01@gmail.com>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gtk/gtk.h>
 | 
					#include <gtk/gtk.h>
 | 
				
			||||||
#include "align_sort.h"
 | 
					#include "align_sort.h"
 | 
				
			||||||
#include "parser.h"
 | 
					#include "parser.h"
 | 
				
			||||||
| 
						 | 
					@ -14,11 +42,12 @@
 | 
				
			||||||
#define GREY_IMAGE "/usr/local/share/iPDC/grey.png"
 | 
					#define GREY_IMAGE "/usr/local/share/iPDC/grey.png"
 | 
				
			||||||
#define PINK_IMAGE "/usr/local/share/iPDC/pink.png"
 | 
					#define PINK_IMAGE "/usr/local/share/iPDC/pink.png"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GdkRGBA getIndexColor(int index)
 | 
				
			||||||
GdkRGBA getIndexColor(int index){
 | 
					{
 | 
				
			||||||
    GdkRGBA color;
 | 
					    GdkRGBA color;
 | 
				
			||||||
    // get the color from the index mathematically
 | 
					    // get the color from the index mathematically
 | 
				
			||||||
    switch(index){
 | 
					    switch (index)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
    case 0:
 | 
					    case 0:
 | 
				
			||||||
        color.red = 1.0;
 | 
					        color.red = 1.0;
 | 
				
			||||||
        color.green = 0.0;
 | 
					        color.green = 0.0;
 | 
				
			||||||
| 
						 | 
					@ -104,16 +133,15 @@ GdkRGBA getIndexColor(int index){
 | 
				
			||||||
        color.alpha = 1.0;
 | 
					        color.alpha = 1.0;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
            color.red = 0.0+0.1*index;
 | 
					        color.red = 0.0 + 0.1 * index;
 | 
				
			||||||
            color.green = 0.0+0.9*index;
 | 
					        color.green = 0.0 + 0.9 * index;
 | 
				
			||||||
            color.blue = 0.0+0.5*index;
 | 
					        color.blue = 0.0 + 0.5 * index;
 | 
				
			||||||
        color.alpha = 1.0;
 | 
					        color.alpha = 1.0;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return color;
 | 
					    return color;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
void on_window_destroy(GtkWidget *widget, gpointer data)
 | 
					void on_window_destroy(GtkWidget *widget, gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    g_source_remove(GPOINTER_TO_UINT(data));
 | 
					    g_source_remove(GPOINTER_TO_UINT(data));
 | 
				
			||||||
| 
						 | 
					@ -173,7 +201,6 @@ void on_frequency_clicked(GtkButton *but, gpointer udata)
 | 
				
			||||||
    gtk_widget_hide(utdata->graph_layoutdfreq);
 | 
					    gtk_widget_hide(utdata->graph_layoutdfreq);
 | 
				
			||||||
    gtk_widget_hide(utdata->graph_layoutvol);
 | 
					    gtk_widget_hide(utdata->graph_layoutvol);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    gtk_widget_hide(utdata->algorithm);
 | 
					    gtk_widget_hide(utdata->algorithm);
 | 
				
			||||||
    gtk_widget_hide(utdata->dimmension);
 | 
					    gtk_widget_hide(utdata->dimmension);
 | 
				
			||||||
    gtk_widget_hide(utdata->algo_label);
 | 
					    gtk_widget_hide(utdata->algo_label);
 | 
				
			||||||
| 
						 | 
					@ -207,7 +234,6 @@ void on_dfreq_clicked(GtkButton *but, gpointer udata)
 | 
				
			||||||
    gtk_widget_hide(utdata->swvol);
 | 
					    gtk_widget_hide(utdata->swvol);
 | 
				
			||||||
    gtk_widget_hide(utdata->swfreq);
 | 
					    gtk_widget_hide(utdata->swfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    gtk_widget_hide(utdata->algorithm);
 | 
					    gtk_widget_hide(utdata->algorithm);
 | 
				
			||||||
    gtk_widget_hide(utdata->dimmension);
 | 
					    gtk_widget_hide(utdata->dimmension);
 | 
				
			||||||
    gtk_widget_hide(utdata->algo_label);
 | 
					    gtk_widget_hide(utdata->algo_label);
 | 
				
			||||||
| 
						 | 
					@ -264,8 +290,6 @@ void set_dimm(GtkComboBox *combo, gpointer udata)
 | 
				
			||||||
    printf("dimmension = %d\n", dimmension);
 | 
					    printf("dimmension = %d\n", dimmension);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Initializes utility tools window.
 | 
					// Initializes utility tools window.
 | 
				
			||||||
void utility_tools(GtkButton *but, gpointer udata)
 | 
					void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -322,7 +346,6 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
    gtk_widget_set_visible(utdata->graph_layoutfreq, FALSE);
 | 
					    gtk_widget_set_visible(utdata->graph_layoutfreq, FALSE);
 | 
				
			||||||
    gtk_widget_set_visible(utdata->graph_layoutdfreq, FALSE);
 | 
					    gtk_widget_set_visible(utdata->graph_layoutdfreq, FALSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    g_signal_connect(utdata->voltage, "clicked", G_CALLBACK(on_voltage_clicked), NULL);
 | 
					    g_signal_connect(utdata->voltage, "clicked", G_CALLBACK(on_voltage_clicked), NULL);
 | 
				
			||||||
    g_signal_connect(utdata->frequency, "clicked", G_CALLBACK(on_frequency_clicked), NULL);
 | 
					    g_signal_connect(utdata->frequency, "clicked", G_CALLBACK(on_frequency_clicked), NULL);
 | 
				
			||||||
    g_signal_connect(utdata->dfreq, "clicked", G_CALLBACK(on_dfreq_clicked), NULL);
 | 
					    g_signal_connect(utdata->dfreq, "clicked", G_CALLBACK(on_dfreq_clicked), NULL);
 | 
				
			||||||
| 
						 | 
					@ -344,13 +367,12 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
    dimmension = 0;
 | 
					    dimmension = 0;
 | 
				
			||||||
    myParameters parameters = {utdata->util_map, g_red_image, g_green_image, g_grey_image, g_last_image};
 | 
					    myParameters parameters = {utdata->util_map, g_red_image, g_green_image, g_grey_image, g_last_image};
 | 
				
			||||||
    gpointer data = (gpointer)¶meters;
 | 
					    gpointer data = (gpointer)¶meters;
 | 
				
			||||||
    struct cfg_frame* temp_cfg = cfgfirst;
 | 
					    struct cfg_frame *temp_cfg = cfgfirst;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_set_size_request(GTK_WIDGET(utdata->util_map), 600, 500);
 | 
					    gtk_widget_set_size_request(GTK_WIDGET(utdata->util_map), 600, 500);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_container_add(utdata->map_layout, GTK_WIDGET(utdata->util_map));
 | 
					    gtk_container_add(utdata->map_layout, GTK_WIDGET(utdata->util_map));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    LiveChartConfig *config_vol = live_chart_config_new();
 | 
					    LiveChartConfig *config_vol = live_chart_config_new();
 | 
				
			||||||
    live_chart_yaxis_set_unit(config_vol->y_axis, "V");
 | 
					    live_chart_yaxis_set_unit(config_vol->y_axis, "V");
 | 
				
			||||||
    live_chart_xaxis_set_tick_interval(config_vol->x_axis, 20);
 | 
					    live_chart_xaxis_set_tick_interval(config_vol->x_axis, 20);
 | 
				
			||||||
| 
						 | 
					@ -369,7 +391,6 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    LiveChartChart *chart_freq = live_chart_chart_new(config_freq);
 | 
					    LiveChartChart *chart_freq = live_chart_chart_new(config_freq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    LiveChartConfig *config_dfreq = live_chart_config_new();
 | 
					    LiveChartConfig *config_dfreq = live_chart_config_new();
 | 
				
			||||||
    live_chart_yaxis_set_unit(config_dfreq->y_axis, "mHz");
 | 
					    live_chart_yaxis_set_unit(config_dfreq->y_axis, "mHz");
 | 
				
			||||||
    live_chart_xaxis_set_tick_interval(config_dfreq->x_axis, 20);
 | 
					    live_chart_xaxis_set_tick_interval(config_dfreq->x_axis, 20);
 | 
				
			||||||
| 
						 | 
					@ -381,7 +402,7 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct Lower_Layer_Details *llptr = LLfirst;
 | 
					    struct Lower_Layer_Details *llptr = LLfirst;
 | 
				
			||||||
    vis_data_head = (struct vis_data *)malloc(sizeof(struct vis_data));
 | 
					    vis_data_head = (struct vis_data *)malloc(sizeof(struct vis_data));
 | 
				
			||||||
    struct vis_data * temp_visptr = vis_data_head;
 | 
					    struct vis_data *temp_visptr = vis_data_head;
 | 
				
			||||||
    int index = 0;
 | 
					    int index = 0;
 | 
				
			||||||
    float centroid_latitude = 0;
 | 
					    float centroid_latitude = 0;
 | 
				
			||||||
    float centroid_longitude = 0;
 | 
					    float centroid_longitude = 0;
 | 
				
			||||||
| 
						 | 
					@ -396,12 +417,11 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
        // declare tooltip
 | 
					        // declare tooltip
 | 
				
			||||||
        gchar *tooltiptext;
 | 
					        gchar *tooltiptext;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        // iterate through the cfg frame and find the corresponding cfg frame
 | 
					        // iterate through the cfg frame and find the corresponding cfg frame
 | 
				
			||||||
        while (temp_cfg != NULL)
 | 
					        while (temp_cfg != NULL)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            tooltiptext = g_strdup_printf("unknown");
 | 
					            tooltiptext = g_strdup_printf("unknown");
 | 
				
			||||||
            if ( to_intconvertor(temp_cfg->idcode) == llptr->pmuid)
 | 
					            if (to_intconvertor(temp_cfg->idcode) == llptr->pmuid)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                // set the tooltip text
 | 
					                // set the tooltip text
 | 
				
			||||||
                tooltiptext = cfgfirst->pmu[0]->stn;
 | 
					                tooltiptext = cfgfirst->pmu[0]->stn;
 | 
				
			||||||
| 
						 | 
					@ -410,16 +430,16 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
            temp_cfg = temp_cfg->cfgnext;
 | 
					            temp_cfg = temp_cfg->cfgnext;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        temp_visptr->serie_freq = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
					        temp_visptr->serie_freq = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer *)live_chart_line_new(live_chart_values_new(10000)));
 | 
				
			||||||
        GdkRGBA color = getIndexColor(index);
 | 
					        GdkRGBA color = getIndexColor(index);
 | 
				
			||||||
        live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_freq), &color);
 | 
					        live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_freq), &color);
 | 
				
			||||||
        live_chart_chart_add_serie(chart_freq, temp_visptr->serie_freq);
 | 
					        live_chart_chart_add_serie(chart_freq, temp_visptr->serie_freq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        temp_visptr->serie_vol = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
					        temp_visptr->serie_vol = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer *)live_chart_line_new(live_chart_values_new(10000)));
 | 
				
			||||||
        live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_vol), &color);
 | 
					        live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_vol), &color);
 | 
				
			||||||
        live_chart_chart_add_serie(chart_vol, temp_visptr->serie_vol);
 | 
					        live_chart_chart_add_serie(chart_vol, temp_visptr->serie_vol);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        temp_visptr->serie_dfreq = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
					        temp_visptr->serie_dfreq = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer *)live_chart_line_new(live_chart_values_new(10000)));
 | 
				
			||||||
        live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_dfreq), &color);
 | 
					        live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_dfreq), &color);
 | 
				
			||||||
        live_chart_chart_add_serie(chart_dfreq, temp_visptr->serie_dfreq);
 | 
					        live_chart_chart_add_serie(chart_dfreq, temp_visptr->serie_dfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -453,10 +473,13 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
    temp_visptr->next = NULL;
 | 
					    temp_visptr->next = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    guint pid = g_timeout_add(20, (GSourceFunc)update_vis, data);
 | 
					    guint pid = g_timeout_add(20, (GSourceFunc)update_vis, data);
 | 
				
			||||||
    if(index>0){
 | 
					    if (index > 0)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        centroid_latitude /= (index);
 | 
					        centroid_latitude /= (index);
 | 
				
			||||||
        centroid_longitude /= (index);
 | 
					        centroid_longitude /= (index);
 | 
				
			||||||
    }else{
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        centroid_latitude = 15;
 | 
					        centroid_latitude = 15;
 | 
				
			||||||
        centroid_longitude = 74;
 | 
					        centroid_longitude = 74;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
		
		
			 Can't render this file because it is too large. 
		
	 | 
		Loading…
	
		Reference in New Issue