An ensemble based data mining model for contingency analysis of power system under STLO

In a large, interconnected power system, contingency analysis is a useful tool for pinpointing the potential consequences of post-event scenarios on the system's safety. In this work, the Newton-Raphson technique is applied to every single outage of a transmission line to compute the load flows. For the static security classification of the power system, the line voltage stability performance index (LVSI) is used. There are three levels of static security of power system namely: non-critical (the least severe), semi-critically insecure (the next lowest severe), and critical (the next highest severe). The various data mining techniques such as decision trees, bagging-based ensemble methods, and boosting-based ensemble methods were applied to assess the severity of the line under various loading and contingency conditions. Test systems based on the IEEE 30 bus system were used with the proposed machine learning classifiers. The experimental results proved that bagging based ensemble method provided better accuracy compared to the decision tree and the AdaBoost ensemble method for predicting the power system security assessment. The bagging-based ensemble method has a predictive accuracy of 85% and an AUC of 0.94.


INTRODUCTION
A key part of power system security is keeping an eye on and evaluating the different possible problems that could happen in the system and then choosing the worst-case scenarios from those evaluations.For reliability in a power grid, it's essential that there be no interruptions in the flow of electricity and no drops in load.In order to accomplish this, security analysis is carried out in order to establish various control mechanisms that ensure the avoidance and survival of emergency situations while also operating the system at the lowest feasible cost.In an emergency situation, the power system is said to be in a state of emergency when a predetermined limit of the system is violated.The occurrence of these limits being exceeded is due to activities occurring in the power system.In today's sophisticated energy management systems, contingency analysis plays a crucial role.The study of contingency analysis entails doing efficient calculations of system performance from a set of simplified system settings in order to estimate system stability immediately after outages are experienced.The calculation of the performance index determines the severity of the contingencies mentioned in [1].Contingencies are commonly described as potentially dangerous disruptions that occur while a power system is operating in its steady-state functioning described in [2].In order to do a  ISSN: 2252-8792 Int J Appl Power Eng, Vol. 12, No. 4, December 2023: 349-358 350 contingency analysis, it is necessary to compute entire load flow estimates following each and every probable outage event, including outages occurring on multiple transmission lines and generators as described in [3].Consequently, the list of possible contingency scenarios becomes extremely long, and the process becomes extremely time-consuming.In order to mitigate this problem, automatic contingency screening is being adopted.This method locates and ranks the power system's worst-case possibilities, as presented in [4].In order to screen out the contingencies, they are ranked according to their performance indexes, with higher values indicating greater seriousness, as presented in [5].With increasing uncertainty, it's hard to plan transmission systems in this setting.Obviously, the most significant causes of uncertainty in transmission system planning are load demand growth and unscheduled exchanges with neighbouring systems, which are compensated by incorporating the suitable flexible AC transmission system (FACTS) devices discussed in [6]- [8].However, in the present day, due to the unbundling of electrical firms, there is a lot of uncertainty over the functioning of existing generation plants, the decommissioning of generation units, and the location of future power plants in [9].In addition, numerous approaches to adjusting transmission planning functions should be explored due to the diversity in the energy markets as a result of the varying economic, political, social, and regulatory settings.The evolution of transmission power flows, the volume of power imported and exported, and the size and location of new power plants are all factors that must be taken into account by transmission planning functions in order to be successful, as described in [10].In order to evaluate the power flow analysis, the contingency study needs to be carried out for the various scenarios.In this study, the huge amount of data collected through the rigorous simulation needs to be processed and pre-processed to convert it into the useful information mentioned in [11].Power systems contingencies can utilise big data analytics to make the most of the massive volumes of data they generate.This data can then be used to leverage the optimisation processes that are already taking place in power grids.The application of big data techniques will result in an increase in the overall efficiency of the electric power network, as mentioned in [12].
Electric utilities are undergoing a technological revolution that includes the implementation of twoway communications networks, information technologies, and distributed intelligent devices to improve distribution system monitoring and control [13].A utility's information systems will have to store and manage more information as a result of these developments.There can be a substantial amount of information produced by AMI/AMR, SCADA, simulation results, and other intelligent devices.One frequent approach is to simply amass as much information as possible and figure out what to do with it later.There is a direct correlation between the growth in data volumes and the demand for more complex and expensive IT systems and personnel.Though complete data collection is possible, it is unlikely that it would be kept or organised in such a way that it would be useful in the long run.Big data analytics has been widely employed to address most of the challenges in the power system, proving it to be a good and promising instrument for dealing with massive volumes of data [14].
Big data mining in the power sector and analysis of early detection of contingencies in the power sector can help plan for significant savings.This effort to save money on hardware would be possible since mining would reduce the computational complexity of the contingency analysis.A data transformation strategy is required for data mining in order to reduce the dimensionality of the data used in the mining process [15].A hybrid approach to data transformation, combining data cleaning with principal component analysis, as discussed in [14].Data mining performance indicators have few empirical studies.This study examined how data mining classification algorithms perform with larger inputs.The multi-layer perceptron (MLP), neural network, and nave bayes were tested with varied simulated data amounts, as discussed in [10].Data classification is an essential part of the data mining process.It involves the extraction of models describing classes and the prediction of the appropriate class for individual data instances, as discussed in [16].Multiple established classifiers can be used nowadays.Weka Explorer is used to apply various classification trees (decision stump, hoeffding tree, J48, LMT, random forest, and REP tree) to a variety of datasets discussed in [14].A representative set of attributes to build a classification model is a central topic in machine learning.Machine learning's attribute selection difficulty is well known [17].It offers probabilistic categorization and performs well on benchmarks.Attribute selection involves choosing a small group of features or attributes to predict target labels well.Attribute selection decreases the computational complexity of learning and prediction systems and saves on useless feature measurements.Attribute selection for machine learning uses regression analysis with forward selection, backward elimination, and quick reduction.AIC is used to evaluate proposed techniques [18].Power system modelling and simulation have developed along with the expansion of power grids and the development of computational methods discussed in [19].Data mining simplifies contingency analysis by using the mined data to classify contingency levels using the multi-class support vector machine (MCSVM) and multi-class relevance vector machine (MCRVM) discussed in [20].Big data analysis helps remove faulty data from the system and transmit contingency data to the planning power engineer, as presented in [21].The visualisation techniques are used to highlight the impact of features on outage occurrence, and association rule mining is An ensemble based data mining model for contingency analysis of power system … (Ravi V. Angadi)

351
used to uncover factors connected to each outage type as well as each other [22].According to the presented survey, there has been sufficient work done in the areas of modelling and analysis, contingency ranking, critical bus ranking, and the incorporation of voltage collapse phenomena, as well as the development of FACTS device models.In the meantime, it has been noted that contingency condition prediction using data mining techniques is a focus area and can more accurately predict the severity of the system than traditional severity ranking methods.This article has eight sections: i) Section 2 explains contingency analysis; ii) Section 3 calculates the line voltage stability index; iii) Section 4 discusses 4 proposed frameworks for contingency analysis; iv) Section 5 experimental results and discussion; and v) The section 6 concludes.

CONTINGENCY ANALYSIS
Both the active power flow limit and the reactive power limit, which has a substantial impact on the bus voltage, are subject to change during a transmission line contingency, making it crucial to predict both the power flow and the bus voltages in the aftermath of the event.Since a key part of any contingency analysis is running simulations of each potential scenario against the baseline model of the power grid, there are three significant challenges associated with this type of analysis.The primary challenge is the intricacy of creating a reliable model of the power grid.Secondly, the energy management system spends an inordinate amount of time computing the power flow and bus voltages, which is a problem because of the difficulty involved.Thirdly, it is reasonable to divide the online sensitivity analysis into three parts: defining the sensitivity, selecting the appropriate sensitivity measures, and evaluating the results.The definition of a contingency includes all the potential problems that could arise in a power system, as well as the steps taken to compile a list of solutions to those problems.The term "contingency selection" refers to the method of narrowing down a list of potential disasters by choosing only the most desperate scenarios that result in severe violations of safety constraints like maximum power flow and bus voltage.This system employs index calculations to rank the seriousness of potential events.The ranking of the contingency cases is determined by the outcomes of these index computations [1].Next, the effect of the possible disruption is figured out, and the controls or security measures that need to be in place to stop more damage are put in place.Choosing which potential events will cause a breach in operational constraints is called "contingency selection."The performance Indices are a type of severity index that is then used to select the potential outcomes.Offline, these indices are computed using standard power flow algorithms for specific scenarios.The results are used to rank the contingencies, with the one having the highest PI value coming in first.The analysis is then performed, beginning with the highestranked contingency and continuing until no catastrophic contingencies remain.

LINE VOLTAGE STABILITY INDEX
In order to do a contingency analysis, the conventional alternating current flow solution provides active and reactive power flows as well as bus voltage magnitudes.The power system's line importance as well as its contingency ranking technique has been established.The ranking is accomplished through the application of a voltage stability index that is based on the results of the severity calculation.The NR method is utilized in order obtain the load flow solutions to study voltage stability index making use of each scenario of contingency load and to investigate NR [11].The Figure 1 shows single line diagram of two bus system.

PROPOSED FRAMEWORK FOR CONTINGENCY ANALYSIS
The proposed framework for a contingency study is a structured approach to assessing and preparing for potential future events or situations that may disrupt normal operations or plans.It provides a systematic methodology for identifying risks, evaluating their potential impact, and developing strategies to mitigate or manage them effectively.The proposed framework for the contingency analysis of the power system model includes various stages such as data collection, data processing, training the machine learning model, and prediction of contingencies based on the training model, as given in Figure 2.

Data collection
Power systems are being operated in a stressed condition mainly due to the ever-increasing load demand, depleting energy resources, and environmental constraints on transmission line expansion.The system stability is one of the major concerns for the power engineers to operate the system in its rated capacity.In order to overcome some of these problems and to enhance the system performance in many power systems the flexible AC transmission system (FACTS) devices are being used [8].The system studies with respect to the contingencies are to be revaluated due to the connection of FACTS devices in the system.In the analysis of contingency study, the following data were considered: i) System data such as bus number, bus code, voltage magnitude, angle in degree, load in MW, and MVAr, generators data like MW, MVAr, Qmin and Qmax, injected MVAr; and ii) Line data such as line number, resistance and reactance of the line, half line charges, transformer details.In this case IEEE 30 bus system is considered as case study and the data sets are generated under various operating line outages of the power system network.As the simulations results in huge data and to enable the system planner to arrive at the useful information from this huge data.

Data preprocessing
One of the significant steps for data mining is data preprocessing, which transforms the collected raw data into a form suitable for training the data mining models.Label encoding is one such pre-processing step, which converts the labels of an attribute that are in human readable form in the given data set, into numbers [18].The data mining methods will later decide on how to operate on these numbers by converting them into machine-readable form.Table 1 shows how label encoding transforms the attribute namely 'severity condition' in this work from human-readable form into numbers.Table 1.Label encoding of "severity condition" Labels before encoding Critical Semi-critical Non-critical Numbers after encoding 0 1 2

Training the machine learning models 4.3.1. Decision tree
Decision trees are frequently used in data mining applications for predicting a target variable which is discrete or continuous in nature.The internal/core nodes of a decision tree stand for the qualities/attribute test conditions being tested, the branches for the results of those tests, and the leaf nodes (terminal nodes) for the target labels [23].In order to learn a tree, the source set must be partitioned into subsets with values for the attributes serving as the dividers.This method (called recursive partitioning) is applied to each newly derived subgroup.Each node provides an opportunity to partition the prediction into subsets whose members share a common value for the target variable [19].The decision on whether to divide a subgroup further or not is based on the traditional impurity measures such as entropy and Gini index from information theory.The entropy of a set S, with n samples and n_c number of distinct values of the target class is given by (1).
Where   is the probability of the i th class in S.
Int J Appl Power Eng ISSN: 2252-8792  An ensemble based data mining model for contingency analysis of power system … (Ravi V. Angadi)

353
For a data set with two distinct values of the target class, entropy of a group/partition will be the maximum value, which indicates the decision about the target for this group is totally unclear.Hence the decision tree induction algorithm splits this group further into smaller and pure partitions based on another attribute test condition [24].On the other hand, if the entropy of the set is the minimum, zero, the algorithm ends in a clear decision about the target variable.Algorithms for pruning the decision trees also help to avoid training over fitted and under fitted models.Apart from this, pruning also helps to speed up the inference and reduces the storage size of the models.

Bagging based ensemble method
In spite of being simple to train and use in inference, decision trees suffer from the problem of instability.Small variations in the training data, will generate a completely different decision tree.This problem is mitigated by training multiple decision trees in an ensemble learner, where the features, and samples are sampled randomly with replacement and used for training the ensemble learners.The training and testing phase of the ensemble technique namely bagging given in Figures 3 and 4

AdaBoost method
This class of ensemble methods also create multiple data sets   from the original data set D where i=1 to k, no. of base learners.However, unlike bagging, the base learners are trained in a sequential manner and the samples are also assigned weights at the end of each iteration.First a base learner is trained using  1 which is created using sampling with replacement from D. This base learner is used to predict the class of the training instances.All samples that are wrongly predicted by this learner increase in weight and those that are correctly predicted will decrease in weights.The next data set  2 is created for the next learner using sampling with replacement on the newly assigned weights of samples.Same process is repeated until all k base learners are trained.Updating the weights of the samples at the end of each round will make the wrongly predicted samples become more and more prevalent in subsequent iterations.The prediction error rate of each base learner is also used to perform weighted majority voting of the final ensemble output  * for each test data.One of the commonly used boosting based ensemble technique is the AdaBoost method.The pseudocode of the AdaBoost algorithm is given in Table 2. Step 3.For each record in the test set T, find its predicted output

Table 2. The pseudocode of the AdaBoost algorithm
where y is the set of all class labels

Performance metrics for predictive accuracy
The performance of these classifiers are measured based on the various metrics based on the confusion matrix such as predictive accuracy, precision, F1 score.Table 3 summarizes the various metrics used for evaluating the performance of the trained classifiers where , , , and  are the true positives, true negatives, false positives, and false negatives respectively [25].
Receiver operating characteristics curve (ROC) is another metric used for evaluating the performance of the classifier.It is a plot between the true positive rate and false positive rate of the classifier.The area under the receiver operating characteristics curve (AUC) of the classifier is calculated using the trapezoidal rule.It is a value between 0 to 1 and for an ideal classifier it is exactly 1.

EXPERIMENTAL RESULTS AND DISCUSSION
The IEEE 30 bus system is considered for the system study.This system is consists of 1-slack buses, 5-generator buses, 24 load buses, and 41 transmission lines.The total active load on the system is 283.400MW and the total reactive power on the system is 126.20 MVAr.In this case load flow analysis is carried on base load condition without any line outage and without incorporating unified power flow controller (UPFC) to the system.Power flow solution is achieved by using the newton-raphson method.The maximum power mismatch is considered as 7.54898×10^-07, the system is converged at 4th iteration and the time taken for the computing is 1.2406×10^-04.The Total active power loss in the system is 17.5985 MW and the total reactive power loss in the system is 22.2444 MVAr.The transmission lines are classified into three categories like critical, semi-critical, and non critical by estimating the line voltage stability severity index.The MATLAB software was used to carry out the simulation work and generated data and applied the proposed frame work as mentioned in the section four.The sample data of line voltage stability index is shown in the Table 4.
The data from the simulations with MATLAB were converted to a structured format with line number, compensator, and load condition and Lmn value as independent variables and severity condition as dependent variable.Table 5 shows the first 10 samples of this structured data.Values of 'compensator' are either 'with UPFC' or 'without UPFC'.Values of the 'severity condition' are either 'critical', 'semi critical' or 'non critical'.These two variables 'compensator' and 'severity condition' are pre-processed using the label encoding technique in scikit-learn library.The preprocessed data set is shown in Table 6.The decision tree classifier for predicting the severity condition was trained with the pre-processed data set using 'entropy' Int J Appl Power Eng ISSN: 2252-8792  An ensemble based data mining model for contingency analysis of power system … (Ravi V. Angadi)

355
as the splitting criteria of a node.The bagging based ensemble method was trained on the pre-processed data set using classification and regression trees (CART) as the base learners and 100 such base learners.The Boosting based ensemble method was trained on the pre-processed data set and Figure 5 shows the confusion matrices of the three classifiers namely decision tree, bagging and AdaBoosting classifier respectively.

CONCLUSIONS
The outcomes of the simulation yield a sizable dataset with a variety of attributes to assess the contingency analysis.The contingency prediction has been carried based on the different classification methods from a data mining perspective.The decision tree classifier, bagging classifier, and AdaBoost classifier classification methods are employed and have given accurate predicted results compared to the manual classification.The decision tree classifier predicted the severity condition with 75% of accuracy, the bagging classifier predicted severity condition of with 85% of accuracy and the AdaBoost classifier is predicted the severity condition with 67% of accuracy based on the trained data set for different load conditions and contingency conditions.The severity of the line/ was predicted as critical, semi critical or non-critical by the trained models.The bagging classifier was found to perform well compared to other two classifiers.

Figure 1 .
Figure 1.Single line representation of two bus system

Figure 2 .
Figure 2. Data mining process applied to contingency study of power system

Figure 3 .
Figure 3. Training phase of bagging Figure 4. Testing phase of bagging

2 . 2 . 2 . 4 .
AdaBoosting (D, n, k, T): Input: D-the training data set, n-the no. of samples and k---the no. of base learners, T---the test data set Output: an ensemble of decision trees Begin Step 1. Initialize the weight of all training samples as 1/n.Step 2. Repeat the following steps for i=1 to k 2.1.Create the bootstrap sample Bi for the base learner Ci  ISSN: 2252-8792 Int J Appl Power Eng, Vol. 12, No. 4, December 2023: 349-358354 For all samples in D, find the predicted output by this learner Ci 2.3.Calculate the error rate of this learner as Calculate the weight of this classifier as αi=(½) ln〖(1 − )/〗 2.5.Increase the weight of wrongly predicted samples and decrease the weight of correctly predicted samples.

Figure 5 .
Figure 5. Confusion matrix of the trained classifiers These experimental results have shown that the performance of the classifiers in predicting the severity condition is more with the ensemble-based method namely bagging with classification and regression trees as the base learners.The bagging-based ensemble models provide scope for training the base learners in parallel and hence speed up the training phase for prediction.

Figure 6 .Figure 8 .
Figure 6.ROC curve for the decision tree-based severity prediction model

Table 3 .
Various performance metrics

Table 4 .
Sample simulation data of line voltage stability index for different contingencies

Table 5 .
Sample data before preprocessing

Table 6 .
Sample pre-processed data set

Table 7 .
The performance comparison of decision tree, bagging, and AdaBoost classifier