comment code

This commit is contained in:
pavanvpatil 2022-11-18 15:47:30 +05:30
parent 74c683321e
commit 4ce18420ac
4 changed files with 76 additions and 5 deletions

View File

@ -60,6 +60,13 @@ struct DTWvollist
struct DTWfreqlist *dtwhead = 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)
{
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)
{
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)
{
return DTWfreqDistance(df) && DTWfreqvolDistance(df);

View File

@ -7,7 +7,7 @@
* Copyright (C) 2022-2023 Kedar V. Khandeparkar
* Copyright (C) 2022-2023 Pavan Kumar V Patil
* Copyright (C) 2022-2023 Karthik Murakonda
*
*
* 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
@ -36,6 +36,7 @@
#include "parser.h"
#include "Event_detect.h"
/*Used in maintaining Nodes for all PMUS*/
struct freqlist
{
int idcode;
@ -44,6 +45,7 @@ struct freqlist
struct freqlist *next;
};
/*Used in maintaining Nodes for all PMUS*/
struct vollist
{
int idcode;
@ -55,6 +57,13 @@ struct vollist
struct freqlist *head = 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)
{
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)
{
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)
{
return attack_detect_freq(df) && attack_detect_vol(df);
}
/* pavan changes */
}

View File

@ -7,7 +7,7 @@
* Copyright (C) 2022-2023 Kedar V. Khandeparkar
* Copyright (C) 2022-2023 Pavan Kumar V Patil
* Copyright (C) 2022-2023 Karthik Murakonda
*
*
* 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
@ -50,6 +50,13 @@ struct kmeans1
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)
{
if (headk == NULL)

View File

@ -36,6 +36,7 @@
#include <string.h>
#include <stdbool.h>
/*Used for storing points*/
struct Point
{
long double x, y; // coordinates
@ -43,6 +44,7 @@ struct Point
long double minDist; // default infinite dist to nearest cluster
};
/*used for storing centroid of clusters formed*/
struct centroid
{
long double x, y;
@ -50,6 +52,7 @@ struct centroid
unsigned long long int count;
};
/*used to maintain nodes for all PMUs*/
struct Kmeans2
{
int idcode;
@ -64,11 +67,23 @@ struct Kmeans2
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)
{
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)
{
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)
{
if (head_of_kmeans2 == NULL)