comment code
This commit is contained in:
parent
74c683321e
commit
4ce18420ac
|
@ -60,6 +60,13 @@ struct DTWvollist
|
||||||
struct DTWfreqlist *dtwhead = NULL;
|
struct DTWfreqlist *dtwhead = NULL;
|
||||||
struct DTWvollist *dtwheadvol = NULL;
|
struct DTWvollist *dtwheadvol = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief It is used to check event detection using Dynamic Time Warping using frequency
|
||||||
|
* called in data_vis.c
|
||||||
|
*
|
||||||
|
* @param df data frame
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
int DTWfreqDistance(struct data_frame *df)
|
int DTWfreqDistance(struct data_frame *df)
|
||||||
{
|
{
|
||||||
if (dtwhead == NULL)
|
if (dtwhead == NULL)
|
||||||
|
@ -186,6 +193,13 @@ int DTWfreqDistance(struct data_frame *df)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief It is used to check event detection using Dynamic Time Warping using voltage
|
||||||
|
* called in data_vis.c
|
||||||
|
*
|
||||||
|
* @param df data frame
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
int DTWvolDistance(struct data_frame *df)
|
int DTWvolDistance(struct data_frame *df)
|
||||||
{
|
{
|
||||||
if (dtwheadvol == NULL)
|
if (dtwheadvol == NULL)
|
||||||
|
@ -342,6 +356,13 @@ int DTWvolDistance(struct data_frame *df)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief It is used to check event detection using Dynamic Time Warping using frequency and voltage
|
||||||
|
* called in data_vis.c
|
||||||
|
*
|
||||||
|
* @param df data frame
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
int DTWfreqvolDistance(struct data_frame *df)
|
int DTWfreqvolDistance(struct data_frame *df)
|
||||||
{
|
{
|
||||||
return DTWfreqDistance(df) && DTWfreqvolDistance(df);
|
return DTWfreqDistance(df) && DTWfreqvolDistance(df);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Copyright (C) 2022-2023 Kedar V. Khandeparkar
|
* Copyright (C) 2022-2023 Kedar V. Khandeparkar
|
||||||
* Copyright (C) 2022-2023 Pavan Kumar V Patil
|
* Copyright (C) 2022-2023 Pavan Kumar V Patil
|
||||||
* Copyright (C) 2022-2023 Karthik Murakonda
|
* Copyright (C) 2022-2023 Karthik Murakonda
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "Event_detect.h"
|
#include "Event_detect.h"
|
||||||
|
|
||||||
|
/*Used in maintaining Nodes for all PMUS*/
|
||||||
struct freqlist
|
struct freqlist
|
||||||
{
|
{
|
||||||
int idcode;
|
int idcode;
|
||||||
|
@ -44,6 +45,7 @@ struct freqlist
|
||||||
struct freqlist *next;
|
struct freqlist *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*Used in maintaining Nodes for all PMUS*/
|
||||||
struct vollist
|
struct vollist
|
||||||
{
|
{
|
||||||
int idcode;
|
int idcode;
|
||||||
|
@ -55,6 +57,13 @@ struct vollist
|
||||||
struct freqlist *head = NULL;
|
struct freqlist *head = NULL;
|
||||||
struct vollist *headvol = NULL;
|
struct vollist *headvol = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief It is used to check event detection using Basic appraoch using freq
|
||||||
|
* called in data_vis.c
|
||||||
|
*
|
||||||
|
* @param df data frame
|
||||||
|
* @return gboolean
|
||||||
|
*/
|
||||||
gboolean attack_detect_freq(struct data_frame *df)
|
gboolean attack_detect_freq(struct data_frame *df)
|
||||||
{
|
{
|
||||||
if (head == NULL)
|
if (head == NULL)
|
||||||
|
@ -124,6 +133,13 @@ gboolean attack_detect_freq(struct data_frame *df)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief It is used to check event detection using Basic appraoch using voltage
|
||||||
|
* called in data_vis.c
|
||||||
|
*
|
||||||
|
* @param df data frame
|
||||||
|
* @return gboolean
|
||||||
|
*/
|
||||||
gboolean attack_detect_vol(struct data_frame *df)
|
gboolean attack_detect_vol(struct data_frame *df)
|
||||||
{
|
{
|
||||||
float CURR_vol;
|
float CURR_vol;
|
||||||
|
@ -223,9 +239,14 @@ gboolean attack_detect_vol(struct data_frame *df)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief It is used to check event detection using Basic appraoch using voltage and frequency
|
||||||
|
* called in data_vis.c
|
||||||
|
*
|
||||||
|
* @param df data frame
|
||||||
|
* @return gboolean
|
||||||
|
*/
|
||||||
gboolean attack_detect_freq_vol(struct data_frame *df)
|
gboolean attack_detect_freq_vol(struct data_frame *df)
|
||||||
{
|
{
|
||||||
return attack_detect_freq(df) && attack_detect_vol(df);
|
return attack_detect_freq(df) && attack_detect_vol(df);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pavan changes */
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Copyright (C) 2022-2023 Kedar V. Khandeparkar
|
* Copyright (C) 2022-2023 Kedar V. Khandeparkar
|
||||||
* Copyright (C) 2022-2023 Pavan Kumar V Patil
|
* Copyright (C) 2022-2023 Pavan Kumar V Patil
|
||||||
* Copyright (C) 2022-2023 Karthik Murakonda
|
* Copyright (C) 2022-2023 Karthik Murakonda
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
@ -50,6 +50,13 @@ struct kmeans1
|
||||||
|
|
||||||
struct kmeans1 *headk = NULL;
|
struct kmeans1 *headk = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief It is used to check event detection using Kmeans clustering using frequency
|
||||||
|
* called in data_vis.c
|
||||||
|
*
|
||||||
|
* @param df data frame
|
||||||
|
* @return gboolean
|
||||||
|
*/
|
||||||
gboolean kmeans(struct data_frame *df)
|
gboolean kmeans(struct data_frame *df)
|
||||||
{
|
{
|
||||||
if (headk == NULL)
|
if (headk == NULL)
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/*Used for storing points*/
|
||||||
struct Point
|
struct Point
|
||||||
{
|
{
|
||||||
long double x, y; // coordinates
|
long double x, y; // coordinates
|
||||||
|
@ -43,6 +44,7 @@ struct Point
|
||||||
long double minDist; // default infinite dist to nearest cluster
|
long double minDist; // default infinite dist to nearest cluster
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*used for storing centroid of clusters formed*/
|
||||||
struct centroid
|
struct centroid
|
||||||
{
|
{
|
||||||
long double x, y;
|
long double x, y;
|
||||||
|
@ -50,6 +52,7 @@ struct centroid
|
||||||
unsigned long long int count;
|
unsigned long long int count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*used to maintain nodes for all PMUs*/
|
||||||
struct Kmeans2
|
struct Kmeans2
|
||||||
{
|
{
|
||||||
int idcode;
|
int idcode;
|
||||||
|
@ -64,11 +67,23 @@ struct Kmeans2
|
||||||
|
|
||||||
struct Kmeans2 *head_of_kmeans2 = NULL;
|
struct Kmeans2 *head_of_kmeans2 = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief It finds data between point A and B
|
||||||
|
*
|
||||||
|
* @param A,B
|
||||||
|
* @return long double
|
||||||
|
*/
|
||||||
long double distance(struct Point *A, struct Point *B)
|
long double distance(struct Point *A, struct Point *B)
|
||||||
{
|
{
|
||||||
return (((A->x - B->x) * (A->x - B->x)) + ((A->y - B->y) * (A->y - B->y)));
|
return (((A->x - B->x) * (A->x - B->x)) + ((A->y - B->y) * (A->y - B->y)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief It finds data between centroid A and point B
|
||||||
|
*
|
||||||
|
* @param A,B
|
||||||
|
* @return long double
|
||||||
|
*/
|
||||||
long double distance2(struct centroid *A, struct Point *B)
|
long double distance2(struct centroid *A, struct Point *B)
|
||||||
{
|
{
|
||||||
return (((A->x - B->x) * (A->x - B->x)) + ((A->y - B->y) * (A->y - B->y)));
|
return (((A->x - B->x) * (A->x - B->x)) + ((A->y - B->y) * (A->y - B->y)));
|
||||||
|
@ -109,6 +124,13 @@ int *getRandoms(int lower, int upper, int count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief It is used to check event detection using Kmeans clustering using voltage and frequency
|
||||||
|
* called in data_vis.c
|
||||||
|
*
|
||||||
|
* @param df data frame
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
bool Kmeans2(struct data_frame *df)
|
bool Kmeans2(struct data_frame *df)
|
||||||
{
|
{
|
||||||
if (head_of_kmeans2 == NULL)
|
if (head_of_kmeans2 == NULL)
|
||||||
|
|
Loading…
Reference in New Issue