Fast Dynamic Voltage Security Margin Estimation: Concept and Development

: This study develops a machine learning-based method for a fast estimation of the dynamic voltage security margin (DVSM). The DVSM can incorporate the dynamic system response following a disturbance and it generally provides a better measure of security than the more commonly used static voltage security margin (VSM). Using the concept of transient P - V curves, this study first establishes and visualises the circumstances when the DVSM is to prefer the static VSM. To overcome the computational difficulties in estimating the DVSM, this study proposes a method based on training two separate neural networks on a data set composed of combinations of different operating conditions and contingency scenarios generated using time-domain simulations. The trained neural networks are used to improve the search algorithm and significantly increase the computational efficiency in estimating the DVSM. The machine learning-based approach is thus applied to support the estimation of the DVSM, while the actual margin is validated using time-domain simulations. The proposed method was tested on the Nordic32 test system and the number of time-domain simulations was possible to reduce with ∼ 70%, allowing system operators to perform the estimations in near real-time.


Introduction
Voltage instability is a key factor that limits the operation and transmission capacity of a power system [1]. An operation close to the physical limits enables an economic and efficient utilisation of the system, but may also make it more vulnerable to disturbances. The voltage security margin (VSM), also referred to as the postcontingency loadability limit, is estimated by system operators to evaluate the loadability margin of a post-contingency configuration of the system [2,3]. The VSM is generally estimated by static assessments of the system where the stability limit up to the system critical point is traced [4,5].
To handle the relatively computationally intensive process of estimating the VSM for large systems, machine learning (ML) has been proposed to transfer the majority of the computations from an online to an offline state. The algorithms are trained to correlate and learn the statistical patterns relating to the VSM with a certain operating condition in the system. Various learning techniques have been proposed, such as neural networks (NNs) [6][7][8], decision trees (DTs) [9,10], and linear and local regression [11,12].
Electric power systems are, however, becoming increasingly complex, with thousands of dynamic components such as nonlinear loads, converter-based generators, and other power electronic devices [13,14]. The dynamic response following a contingency cannot be captured using static assessments, and studies have indicated that these might be insufficient when estimating the actual security margin [3,15]. To ensure that the system is also dynamically secure, system operators often use an approach called dynamic security assessment (DSA). DSA includes time-domain analysis to test the power system's dynamic response after a set of contingencies to ensure its ability to reach a stable post-disturbance operating point [2]. The ML-based methods have also become increasingly popular in DSA due to the capability of providing system operators with tools to assess the dynamic security of the system in real-time. Examples of DSA methods based on ML are found in [14,[16][17][18][19], where mainly various NN or DT methods are utilised.
A drawback of DSA is that it only provides system operators with information about whether the current operating condition is dynamically secure. An alternative measure of the margin to security is the dynamic voltage security margin (DVSM). The DVSM, also referred to as the secure operating limit, is the margin to the most stressed pre-contingency operating point that can still withstand a set of credible contingencies [3,13]. The concept of DVSM has received comparatively little interest in the literature, likely due to the practical difficulties in estimating the margin. DVSM estimation is computationally demanding, where multiple time-domain simulations are required to trace the security limit for a range of different contingencies. Despite recent progress in highperformance computing, it is generally not feasible to perform such estimations for large power systems in the time frame required by system operators.
To reduce the computation time, an approach using quasisteady-state (QSS) simulations was proposed in [3]. In [20], the method was further developed and a combination of QSS and timedomain simulations was proposed to include the impact of shortterm effects. Although this approach reduces the computational effort compared to a full time-domain simulation, it may still prove too slow for many real-time applications. In [21][22][23][24], different ML approaches based on NNs were proposed to allow real-time estimation of the DVSM. These ML-based approaches are promising in the sense that they, when properly trained, have the capability of providing an instantaneous estimation of the DVSM. However, the lack of robustness and the uncertainty when handling operating conditions not included in the training of the algorithms may deter system operators to implement them.
Although the concept of a DVSM is not new, the circumstances under which it is preferred to the conventional VSM are still somewhat undefined. Furthermore, existing methods to estimate the DVSM suffer from either being too time-consuming or lacking robustness in the case of the ML-based methods. As blackouts and other major failures are related to extremely high costs, it may thus be difficult to convince system operators to implement these MLbased methods. In this paper, we address the issues mentioned above by clearly establishing a general framework and providing a methodology for a robust near-real-time estimation of the DVSM. The main contributions are the following: to allow better interpretation of the two measures. The aim is to summarise previous findings and to establish under which circumstances a dynamic security margin is preferred to a static margin. • A methodology for fast and robust computing of the DVSM is proposed and tested. The method is based on using NNs to provide both a qualified estimate of the actual DVSM and to determine the dimensioning contingency in the system with respect to the DVSM. The estimated values are used as a starting point for the estimation of the actual DVSM, aimed to improve the search algorithm and significantly reduce the computation time. The ML approach is thus proposed to support the estimation of the DVSM, while the actual margin is always validated using actual time-domain simulations.
The DVSM can easily be generalised to also include other stability related phenomena, such as rotor angle stability or inter-area oscillations. In these applications, the more general term of a secure operating limit can preferably be adopted. However, in this paper, we choose to specifically analyse the limit to voltage instability and the difference to the commonly used static VSM, and thus the more specific term of DVSM is adopted. The remaining of the paper is organised as follows. In Section 2, the difference between static and dynamic voltage security is illustrated and discussed using the concept of transient P -V curves. In Section 3, a methodology for fast estimation of the DVSM is developed and aspects for efficient computing are proposed. In Section 4, results and discussion are presented, followed by concluding remarks in Section 5.

Static versus dynamic voltage security
In this section, the difference between static and dynamic voltage security is developed and the concept of transient P -V curves is adopted to illustrate when the DVSM is preferred to the conventional VSM. A small test system's dynamic response following a disturbance is used in the analysis.

Simple system model
In the following examples, the impact of load dynamics and the voltage control devices (e.g. excitation control for synchronous generators and synchronous condensers) are mainly taken into account in the analysis. The small 2-bus test system in Fig. 1 is used in the analysis. It consists of a controlled sending end voltage (E∠0), supplied by a voltage source through a reactance X f . A complex load (P + jQ) is fed through a number of lines represented by inductances with the total reactance of X t .
A popular method in static voltage stability analysis is to use P - V curves, where the receiving end voltage is plotted with respect to an increasing active load transfer in the system. In the following figures in this section, P - V curves for the case when E = 1.05 pu, X t = 0.4 pu, and a fully active power load are illustrated. The reactance X f is initially neglected, but will be introduced in Section 2.4. An additional P -V curve is plotted in each figure for a N − 1 case when one line has been disconnected (increasing X t to 0.5 pu). Assuming lossless transmission, the curves are developed using the classic voltage equation, given below [2]: where the upper part of each P -V curve corresponds to the solution of (1) with the plus sign, while the lower part of each curve corresponds to the solution with the minus sign. The voltage instability mechanism is mainly driven by loads, and the impact of load modelling in voltage stability analysis is imperative [2]. The power consumption of loads is affected by the system voltages, and different load models are often used to characterise this relationship. A traditional model is the exponential load model, which is given below: where P 0 and Q 0 are the active and reactive power consumed when the voltage V is equal to the reference voltage V 0 , given that z = 1. z is a dimensionless and independent variable indicating the actual loading of the system [2]. The voltage dependency is modelled by the α and β parameters, where α = β = {0, 1, 2} represents constant power (MVA), constant current, and constant impedance characteristics, respectively.

Estimation of VSM and DVSM
The estimation methods for the VSM and the DVSM are illustrated in Fig. 2 using the developed P -V curves. The security margin is defined as the change in loading from an initial operating condition (OC) to the N − 1 critical point. It should be noted that in real applications, the system loading is generally stopped before the N − 1 critical point due to other stopping criteria such as too low system voltages. However, for better illustration purposes, the former limit is used. In static VSM estimation, the initial post-contingency operating point is found by first introducing a contingency on the initial OC, which is followed by solving the resulting power flow study. This is illustrated in Fig. 2 by moving along the arrow 1′. The stability limit is then traced along the solution path by iteratively increasing the system stress until the critical point is reached, moving along the arrow 2′. What is known as continuation power flow methods are preferably used to avoid convergence problems close to the critical point [4,5]. The loading between the pre-contingency operating point and the N − 1 critical point constitutes the VSM.
The steps of estimating the DVSM are conceptually different from the VSM, where instead, the dynamic security of the system is being tested with an increasing stress level in the system, illustrated by the arrow 1 in Fig. 2 [3]. For every new precontingency OC (an increase in system stress), a time-domain simulation is initiated where the system response following a disturbance is studied. The simulation runs until the system stabilises or becomes unstable. The final pre-contingency OC that  is tested and still provide a stable post-contingency operating point is illustrated by moving along the curved arrow 2 in Fig. 2. The loading between the initial OC and the last pre-contingency OC that can still handle a dimensioning contingency without causing a voltage collapse, represents the DVSM.
In should be noted, that while the VSM and the DVSM are illustrated to be the same in Fig. 2, this is generally not the case. The difference between the methods is further discussed in the following sections.

Load response after a disturbance
Load dynamics plays an essential role in voltage instability phenomena [2]. In static VSM estimation, loads are often recognised to maintain a constant MVA characteristic [25]. This assumption is often true from a long-term system perspective, but does not necessarily mean that the loads themselves behave as constant MVA loads. Equipment and control mechanisms such as load tap changers (LTCs) and voltage regulators will restore load voltages following a disturbance, resulting in recovered load levels even for loads with constant impedance characteristics [26]. However, even though loads are considered to have long-term MVA characteristics, they do not necessarily behave as static MVA loads following a disturbance. Assuming a sudden voltage change, the loads will initially change according to their instantaneous characteristics, for instance a mix of constant impedance and constant current load [26]. Then, they will adjust their impedance or the drawn current to restore the load to their original level.
This load restoration event following a disturbance, tripping of a line in the system, is illustrated in Fig. 3. The initial OC is located at A. Instantly after a disturbance, the load is assumed to have constant impedance characteristics, which results in a change in operating point from A to B. Load dynamics then restores the load, moving the operating point from B to C. The load is thus fully restored to the same initial load level as in point A.

Transient P -V curves and fast load dynamics
In [27], it was shown that if the system starts at a stable equilibrium and is slowly stressed towards the critical point without encountering oscillations or other limit-induced events (e.g. reactive power limits for generators), the static equations are sufficient to locate the exact critical point experienced by the dynamic system. However, the majority of voltage collapse incidents experienced so far have resulted from large disturbances, typically by the loss of generation or transmission capacity [3]. In static VSM estimation, the transient state of such events can be neglected using the assumptions (i) that loads to do not behave as constant MVA loads just after a disturbance, and (ii) that load dynamics acts significantly slower compared to the voltage control dynamics of, for instance, excitation system of generators and synchronous condensers [26]. Hence, the transient impact of voltage control dynamics can be neglected and the assumptions developed in [27] would still be valid.
However, load dynamics of induction motors and power electronic loads, such as chargers for electric vehicles, are inherently fast. For these components, the load is often restored in a time frame within a second, similar to that of most excitation systems [2,28], causing the assumptions used in conventional VSM estimation to falter. In [26], a concept called transient P -V curves was adopted to visualise the dynamic impact of voltage control on the static P -V curves. In this paper, we use the same approach when the difference between then VSM and the DVSM is illustrated. The transient P -V curves can be obtained by modelling and taking into account the dynamic impact of having the voltage source in Fig. 1 behind the reactance X f . The assumption used in conventional VSM estimation, that excitation control instantly will restore E to its pre-contingency value after a disturbance, will thus no longer be true. Instead, E will initially be affected by events in the system but is controlled back to its nominal value by excitation control of the voltage source. As the main purpose here is to provide a principal understanding of the concept, the transient P -V curves in the following figures are hypothetical. Similarly, the curves illustrating the fast load restoration dynamics from a constant impedance load to a constant power load are drawn to allow a better understanding of the concept.
In Fig. 4, the dynamic response following a disturbance is illustrated for a secure initial OC. The transient P -V curves and the load restoration curves are illustrated using different shades of grey, where a lighter shade indicates closer in time to the disturbance. The time just after a disturbance is indicated by t 1 , while t 3 relates to the time when all short-term dynamics have already taken place. The load is assumed to have long-term constant MVA characteristics, but just after a disturbance, the load will initially change to a constant impedance characteristic. Then, by fast load restoration, the load is quickly restored to a constant MVA characteristic.
The initial OC is found in point A. Just after a disturbance (at t 1 ), the bus voltages drop caused by a larger current being transmitted through the remaining lines. The reactive power losses increase in the system, and a larger current is being transmitted through the reactance X f found in Fig. 1. The larger current causes the voltage E to drop initially, resulting in the P -V curve being shifted to the left (the lightly shaded P -V curve). As a result of the initial load characteristics and the shifted P -V curve, the operating point moves along the arrow to the operating point B. After the shifted operating point, two separate dynamic responses are initiated. The voltage control dynamics, here illustrating the excitation system response for a synchronous generator, is restoring the terminal voltage E to its nominal value. This causes the transient P -V curve to shift back towards the P -V curve for the static N − 1 case. Simultaneously, the fast load dynamics are restoring the load from the initial load characteristics back to a constant MVA characteristic. As an effect of the voltage control dynamics and the load restoration, the operating point moves along the arrows from B to C, then finally, from C to D. In this case, the system was found to be stable even after the disturbance with the new operating point D.
In Fig. 5, the same system is slightly more stressed, with a higher level of initial transferred power. Just after the contingency, the operating point moves along the arrow from A′ to B′, by same the reasoning as in the previous case. However, due to the fast load dynamics, there exists no intersection between the curves at t 2 , and without any emergency control actions, the system stability would be lost. The example in Fig. 5 illustrates a type of event that the DVSM could identify and take into account, which is not possible using a static VSM. It should be noted that the P -V curve for the N − 1 case and the load characteristic at t 3 still intersect in this case, indicating that a static VSM would still classify the initial OC as secure.

DVSM versus VSM
The analysis in the previous section showed that the DVSM is to prefer over static VSM in power systems with a large share of loads with fast restoration dynamics. Furthermore, the closer power systems are being operated to the limits of operation, the event illustrated in Fig. 5, the more likely it is that the system will become unstable during the transient state after a disturbance. However, the advantages of using DVSM are not limited solely to the short time instance after a larger disturbance has occurred in the system. The same type of events may occur significantly later in a voltage instability event, triggered by larger drops in system voltages from, for instance by activation of overexcitation limiters (OELs), or undervoltage tripping of generators. These types of events are generally referred to as short-term instability events induced by long-term dynamics [2]. It should be noted that methods based on QSS and combinations of QSS and time-domain simulations, as was suggested in [20], cannot deal with these types of events. A clear advantage of using the DVSM (which also applies for the methods based on QSS), is that in static VSM, the notion of time is fully ignored, and by that, the impact of, for instance, timer settings of OELs, LTCs, and switched reactive power components [15]. Furthermore, equipment such as air conditioners, induction motors, and undervoltage relays, may either stall or trip due to temporary low voltages, which is an effect that can better be taken into account in either time-domain simulations or QSS simulations.

Methodology for fast estimation of DVSM
In the previous section, the circumstances when the DVSM is preferred to the conventional VSM were presented. In this section, a methodology for a fast estimation of the DVSM is proposed to overcome the computational difficulties when estimating the margin. The method uses NNs to provide both an estimate of the actual DVSM at a specific OC, and to determine the dimensioning contingency for the system with respect to the DVSM. These estimated values are then used as starting points in a method called dual binary search to significantly reduce the required computational time in computing the actual DVSM.
The first step is the offline generation of OCs and estimations of the DVSM for a set of credible contingencies. It should be noted that the generation of a representative training set is a critical step in ML applications [29]. In this paper, a simplified approach is adopted to generate a data set with sufficient complexity to test the method. However, in actual applications, significantly more effort should be assigned to this step to ensure an efficient and accurate database generation. Generally, the training data would not be randomly generated but can be taken directly from either real or forecasted OCs in the system.
The method is tested on the Nordic32 test system with all data and models, as presented in [30]. After a representative training set has been generated, the training scheme of the two NNs is presented. Each step in the methodology is described in the following subsections.

Generation of training data
The training data for the NNs were generated using PSS®E34.2.0 with its in-built dynamic models [31]. In this paper, we have used full time-domain simulations, but the methodology could also be generalised for combinations of QSS and full time-domain simulations. The steps of generating the training data are illustrated in the flowchart in Fig. 6 and can be summarised as follows: 3.1.1 Choose initial operating conditions: All initial OCs were randomly generated around the secure operating point of the simulated Nordic32 system, denoted as 'operating point B' in [30]. The total load in the system for each initial OC was generated by multiplying all the active loads randomly from the same uniform distribution (80% of the original load as a lower limit, 95% of the original load as upper limit). Then, each individual load was varied by again multiplying the now updated load value with a random variable generated from a new uniform distribution (this time with 80% as the lower limit, and 120% as the upper limit). The power factor of all loads was kept constant. The total change in loading was then randomly distributed among all the generators in the system. The generated initial OCs were first solved using a conventional full Newton-Raphson load flow solution, which served as a starting point for the dynamical simulation. In the case the system was not found feasible, the initial OC was re-initialised.

Increase system stress and solve load flow:
The system stress was then increased for the secure initial OC by increasing the power transfer between the two areas 'North' and 'Central'. The increased system stress was achieved by increasing the loads in the 'Central' area with a total of ΔP 1 = 200 MW, while simultaneously increasing the generation in the 'North' area with the same amount. The power factors of each load were again kept at the initial values. The distribution of the added load and generation was based on the initial load or the rated capacity of each generator. Thus, a bus with a larger initial load, or a generator with a higher rated capacity, received a larger share of the increased load and generation. All generation that could not be supplied by the regular generators were distributed to the slack bus generator in the system, g20, see Fig. 7. After the loads and the generation were updated, the load flow was reiterated, which then served as a starting point for the time-domain simulations. To avoid numerical and stability issues when increasing the system stress of the static system, the system

Run time-domain simulation and test for security:
A time-domain simulation was then initialised for the first contingency. In the relatively small Nordic32 test system, the same single contingency was found to be dimensioning for almost all different initial OCs. To test the possibilities of using a NN to classify the dimensioning contingency, two different contingencies were handpicked as they were found to be dimensioning for different OCs. The tested contingency type was a three-phased fault on a transmission line during 0.1 s, followed by a tripping of the faulted line, which was kept tripped during the remaining time of the simulation. The lines between the buses '4031-4041' and '4032-4044', connecting the 'North' and 'Central' areas, were used, see Fig. 7 for a reference.
Each dynamic simulation ran for a total of 500 s, but was in the case of a major voltage collapse stopped in advance. The simulation time was chosen to ensure that the system either fully stabilised or collapsed. It should be noted that the required simulation time is dependent on the power system in consideration, and it is likely that different simulation times would be required in actual implementations of the algorithm. The system was considered secure if, at the end of each simulation, all transmission bus voltages were above 0.90 pu.

Re-iterate and test other contingencies:
In case the system was found secure for the tested contingency, the system stress was increased again with ΔP 1 , followed by another security test. In case the system was not found secure, the previously added system stress was halved, and the process was re-initialised. This process of iteratively updating the system stress and testing for security continued until the increase in system stress was below a precision value of ϵ = 5 MW. The DVSM was then computed by taking the difference in system loading between the initial OC and the secure system with the highest level of system stress.
Once the DVSM for the first contingency was computed, the same procedure was repeated for the second contingency. To save computational time, the estimated DVSM for the first contingency was used as a starting point for the estimation of the second contingency. If the system at that level of system stress was found secure for the second contingency, the simulation was stopped.
Otherwise, the search algorithm continued until a new smaller value of the DVSM was found.

Sampling the input values and target values:
An input vector x consisting of measurements of all bus voltage magnitudes and angles, and active and reactive power flows were sampled from each one of the initial OCs. The choice of which input values to include in the training was based on the results in [8], which found that bus voltage magnitudes and angles were found to be the best combination of inputs when estimating the VSM using a NN. The active and reactive power flows were then added as additional inputs as this was found to increase the accuracy in the estimations even further.
Two target vectors y DVSM and y Cont were generated by sampling the DVSM for each case, and the contingency that was dimensioning for the specific case, respectively. The previously described steps were re-iterated until a sufficiently large training set was generated. Due to the random nature in which the training data was initialised and generated, some of the generated OCs were found to be correlated with very low DVSM values, despite being initialised with low system loading. To ensure that no anomalies were included in the training set, all OCs resulting in DVSM values below 150 MW was excluded from the training set.

Overview and design of the NNs
NNs have been successfully applied in a range of applications and their popularity have increased significantly in the last decades. NNs represents a class of ML algorithms which are inspired by the neurons in the human brain and its ability to classify and learn events from input data [32]. The strength of NNs lies in their capability of learning and approximating non-linear functions ( f ) from a set of input values (x), and a corresponding vector of target values (y).

Architecture:
The architecture of the two NNs used in this paper is presented in Fig. 8 and the specific details regarding the architecture and the training parameters of the two NNs are specified in Table 1. In the training phase, the two NNs takes the same vector of input values, which are forwarded to each of the hidden layers through a set of weights, illustrated by the lines connecting each of the neurons. The output of each neuron in the hidden layer is computed using a non-linear activation function on the sum of all the inputs, which is then forwarded to the output layers. The rectified linear activation function (RelU) was used as  the non-linear activation function for the two NNs. For the NN estimating the DVSM, the outputs are forwarded to a regression layer with a linear activation function. For the NN responsible for ranking the contingencies, the outputs are forwarded to a layer with a softmax activation used for classification. The softmax activation function is generally used for multi-class classification but generally works well also for binary classification, as is the case in this paper. The softmax activation function outputs a probability vector, where each class is given a certain probability. The probability vector can then be used to rank the contingencies in order of which most likely will become dimensioning.
In the training phase, the networks use the true target vectors y DVSM and y Cont , while during the test or prediction phase, the network estimates the DVSM and the ranked contingencies by generating the vectors ŷ DVSM and ŷ Cont for the current OC. The supervised training approach aims to update and learn the suitable values for the weights connecting each layer, implicitly modelling the non-linear relationship between the inputs and outputs.

Training:
Different data sets were used in training, validation, and testing of the method. The training data has the dimension (364 × 6000), where the dimension represents the number of inputs, and the total number of training cases, respectively. Each network was trained for a maximum number of epochs, where an epoch is finished when all the cases in the training set have been used to update the network parameters. To reduce overfitting on the data, ridge regression (also known as L2 regularisation) was used to ensure the data does not rely too heavily on any single feature. To further reduce overfitting, a technique called dropout was applied where a certain percentage of the connections between each layer were masked/dropped, to ensure that the model does not rely too heavily on certain connections. The mean squared error (MSE) was used as a metric for the NN estimating the DVSM, while the categorical crossentropy loss function was used for the NN classifying the dimensioning contingency. An adaptable algorithm for gradientbased optimisation, Adam, was used in training the network [33]. The learning rate (α) was the only parameter that was tuned for the algorithm; the remaining used the default values according to [33].
It should be noted that both the training parameters and the architecture of the two networks have been iteratively tuned to increase the regression and classification accuracy. A deeper architecture with more hidden layers was found to not increase the performance for the specific test case and training set size. Other hyperparameters and network architectures would likely have better performance for other test systems than the Nordic32. By increasing the training set size further and spending even more effort in tuning the networks, an even better accuracy could be achieved.

Fast DVSM estimation and dual binary search
In [3], a binary search method was proposed to estimate the DVSM. In this paper, we propose an alternative approach denoted as the dual binary search method, which should be able to increase the computational speed of the DVSM. The trained NNs in Fig. 8 take the same set of measurements and generates: (i) an estimated value of the DVSM, and (ii) an estimated ranked order of the contingencies that most probably will be dimensioning for the current OC. The estimated DVSM is used as a qualified estimate of the real DVSM, which is validated through actual time-domain simulations. The dual binary search method is then used to take advantage of the estimated DVSM and the dimensioning contingency to reduce the computational time when validating the real DVSM for the system.
The dual binary search method is illustrated for two cases in Fig. 9. Case 1 illustrates the estimation process for an overestimated value of the DVSM, while Case 2 illustrates the estimation process for an underestimated value of the DVSM. Black dots indicate secure operating points and white dots indicate unsecure operating points. The estimated DVSM is always the starting point for the search of the actual DVSM of the system. The system stress is increased to this point iteratively using the approach explained in Section 3.1.2 to avoid convergence problems.
Once the stressed static base case is found, a time-domain simulation is initiated for the highest-ranked contingency by the second NN, which is the contingency that most likely will be dimensioning for the DVSM. The initial estimated DVSM level is then tested for the chosen contingency. In case it is stable (respectively unstable), the system stress is increased (respectively decreased) with a certain value represented by ΔP 2 . We propose using a value of ΔP 2 equal to the MSE of the estimated values for the DVSM, which should represent a reasonable uncertainty and step size for the estimation. If the new operating point is found to be secure, the system stress is again increased with ΔP 2 . In case it is not found to be secure, the system stress is reduced by ΔP 2 /2. The dual binary search is then continued until a secure operating point is found and when the step size in system stress change is smaller than a specified precision level (ϵ). This level of system stress is then tested for the other contingencies, in ranked order, until all lower-ranked contingencies have been tested and found secure. For both, the cases illustrated in Fig. 9, this level of system stress for the second-ranked contingency was found to result in a secure operating point. A third and final ranked contingency is then tested, which for Case 1 in Fig. 9 is found to be unsecure. The system stress is thus reduced further for this case, resulting in a secure operating point, which then constitutes the dimensioning DVSM for the system. It should be noted that for Case 1, the contingency ranking was not perfect, with the result that an extra time-domain simulation was required.

Results and discussions
In this section, the results from the regression and classification of the test set for the two NNs are presented. The reduction in computational effort is compared and presented between the conventional tracing method and the proposed dual binary search method. Furthermore, the capability of the method to handle unplanned topology changes and to estimate the security margin after a disturbance is tested. Finally, practical applications and discussions related to DVSM estimation are presented.

Regression and classification accuracy
The prediction accuracy for the NN estimating the DVSM is presented in Fig. 10, where the estimated DVSM is plotted with respect to the real DVSM for the test set. The diagonal line indicates where the points should lie in case the estimated DVSM perfectly matches the real DVSM. Table 2 lists the mean and maximum errors of the estimations in percentage, as well as the MSE presented in MW. The results indicate that the NN is generally capable to accurately estimate the DVSM given an initial OC, with a mean error for the test set of 1.49%. The maximum estimation error was found to be 10.96%, while the MSE was estimated to 13.35 MW.
The classification accuracy of the NN used in ranking the dimensioning contingency is presented in Table 3 in the form of a confusion table. Each number in each row represents the instances of the real dimensioning contingencies, while each number in each column represents the instances of the predicted dimensioning contingencies. The conditional probabilities of correctly classifying the dimensioning contingency are presented in the column furthest to the right. Similarly, the conditional probabilities of a dimensioning contingency actually belonging to the predicted class are presented in the bottom row of the table. The total accuracy for the classification is presented in the rightmost corner of the table, and an accuracy of 91.3% was provided for the test set. Thus, in about nine instances of ten, the NN is capable of classifying which contingency that will be dimensioning for the DVSM for a specific OC. It should again be mentioned that it is possible that the estimation and classification results could be enhanced further by either increasing the training set size or by a more careful exploration of suitable hyperparameters for the training of the networks.

Computational efficiency
In this section, the computational efficiency is compared between the proposed fast dual binary search method and the more conventional tracing method that was used in generating the training set (see Section 3.1 for reference). The proposed fast dual binary search method, explained in Section 3.3, uses the estimated DVSM value and the dimensioning contingency as a starting point to validate the real DVSM. The computational efficiency is measured as the average number of time-domain simulations required in estimating the DVSM. The results of using the two different methods are presented in Table 4. The average number of time-domain simulations required in estimating the DVSM using the conventional tracing method was found to be 15.3, while the corresponding number using the proposed dual binary search method was 4.7. The reduction in the average number of timedomain simulations required was thus −69.2% when the proposed method was applied.
It should be noted that the exact comparison in computational efficiency between the two methods is of comparatively little interest, as it mainly applies to the specific test case used in this paper. For instance, it is probable that the computational savings are significantly higher in most real applications, where a larger range of contingencies may be dimensioning for the DVSM. Furthermore, in real applications where the range of the DVSM may be larger than what has been used in this paper, the conventional search algorithm would require significantly more time-domain simulations to find the true DVSM. Similarly, it is also possible to further enhance both the conventional search algorithm and the dual binary search algorithm by, for instance choosing more suitable values of ΔP 1 , or by increasing the precision value of ϵ. The most notable result is instead that the computational effort in estimating the DVSM can be reduced from requiring a large number of time-domain simulations, to only requiring a few. Although a few time-domain simulations would still take some time to compute for a real power system, it should be possible to provide sufficiently fast estimations of the DVSM to classify it as a 'near real-time' estimation.

Impact of sudden topology change
In any real application, the performance of a NN is dependent on its generalisation capability. This refers to the capability of the NN to generalise the learning from the actual training set to other, yet unseen, cases. In this section, we examine the performance of the NNs to generalise their estimations when subjected to test cases where unplanned topology changes have taken place. This also indirectly tests the capability of the method to estimate the security margin after the system has already undergone a disturbance. As    most power systems are operated securely with respect to N − 1, a single disturbance will likely not cause instability. However, following a disturbance, the system operator needs to ensure that the (post-contingency) system is again returned to a secure operation, so that if another contingency occurs (N − 1 − 1), the system can withstand that disturbance as well. If not, restorative control needs to be issued to ensure that the system yet again fulfils the N − 1 contingency criterion. For simplicity of notation, we will only refer to the case of unplanned topology change in the remaining part of this section.
In the following analysis, we only consider topology changes in the form of opened transmission lines. To ensure that the Nordic32 test system is still secure despite the topology changes, only topology changes in the 'North' region, see Fig. 7, were considered. Furthermore, only transmission lines between buses served by two parallel transmission lines were used in generating the test set with topology changes. A new test set of 400 cases was then generated in the same manner as explained in Section 3.1, with the difference that the topology changes were now added randomly.
Two different cases were then tested. For Case A, the NNs were trained on the previously developed training set and no unseen cases with topology changes were included in the training set. For Case B, the NNs were re-trained on a new training set where a few (100) training cases with topology changes had been included in the original training set. The exact same training procedure as before was used. The regression results for the two cases are presented in Fig. 11. Table 5 lists the mean error of the estimations in percentage for each case, as well as the MSE presented in MW. The result for Case 1 indicates that a sudden topology change will significantly affect the accuracy of the predictions. Although many cases were accurately predicted, the number of outliers increased significantly. The prediction accuracy was higher for Case B, even though only a very small number of cases with the topology changes were added to the training set. The classification accuracy of the NN used in ranking the dimensioning contingency was also affected significantly for the two cases, with a total classification accuracy of 55 and 78.5% for Case A and Case B, respectively.
The results highlight the importance of obtaining a representative training set and also taking into account the possibilities of unplanned topology changes. This would also allow system operators to better track the security margin after a disturbance has occurred. The results also showed that by the inclusion of even a very small set of training cases with various topology changes, the prediction accuracy could be increased significantly. Thus, in the event of an unplanned topology change in the system, the system operator could quickly generate a small training set on the new OC, and then retrain the NNs on the generated data. It should be noted that the proposed robust methodology of always validating the estimations of the NNs with actual time-domain simulations reduces the impact of these types of erroneous estimations. The main impact of a poor estimation of the DVSM will be that the time to validate it will increase.

Discussions and practical applications
The proposed method is aimed to be used as an online tool for system operators to estimate a power system's DVSM. The method does not necessarily have to replace conventional VSM estimation, but may instead be used as an additional source of information to system operators to provide better and more accurate estimates of the total transmission capacity in their systems.
Theoretically, the DVSM estimates by the NNs could be used directly to provide real-time estimates of the security margin. However, despite years of research, examples where these methods have been practically applied in system operators' monitoring and control systems are, to the authors' best knowledge, very few. From a system operator's view, an inferior method that always works is generally preferred to a superior method that, in some instances, does not. The proposed method in this paper is thus suggested to utilise the advantages of ML, while still ensuring that the method always provides good estimates regardless of the current OCs.
An important factor in any ML-based application is the size of the training set. The required training set size is highly dependent on the complexity of the underlying problem, here represented by the power system in consideration. The required size of the training data set depends on several factors, such as the range of different possible operating conditions, the number of possible dimensioning contingencies, and, ultimately, the accuracy requirement of the system operator.
NNs were chosen as they have been proven to be very powerful in applications for both regression and classification, especially when trained on large sets of data [32]. A common criticism against NNs is that while they can accurately approximate any nonlinear function, studying their structure will not give any insights on the function that is being approximated. However, since the proposed methodology use time-domain simulations to always validate the estimations provided by the NNs, the drawback of the lacking ability to interpret the estimations is of less significance.
The results in the previous section indicated that by using the proposed method, the number of required time-domain simulations to estimate the DVSM could be reduced to only a few, allowing system operators to estimate the DVSM in a time frame that could be defined as 'near real-time'. The update frequency of security margins will affect the required transmission reliability margins as the underlying system continuously change between the assessments. The actual estimation speed will still be affected by a range of different factors, such as the computational speed of the hardware being used, the size of the specific power system in consideration, or the required precision (i.e. the value of ϵ).
In this paper, measurements of bus voltage magnitudes and angles, as well as active and reactive power, have been assumed to be available, either directly from measurements or from state estimations of the system. However, to ensure that missing values and errors are filtered out, all measurements should preferably be preceded by a state estimator. To adapt to the evolving operating conditions and self-rectify any bad predictions, the two NNs should  be trained continuously during operation. Using approaches such as stochastic gradient descent, the NNs weight parameters can continuously be tuned to increase the robustness and accuracy.

Conclusions
This paper presents a framework and a methodology for fast estimation of the DVSM. The difference between the DVSM and the conventional static VSM has been illustrated using a concept called transient P -V curves, where the advantages of using the DVSM have been established. Specifically, the DVSM will become increasingly important in power systems with an increasing share of loads with fast load restoration dynamics and in systems that are operated close to the physical limits. Furthermore, a methodology for a fast estimation of the DVSM is proposed. The method uses a regression-based NN to provide a qualified guess of the actual DVSM. Moreover, a second NN is used to provide a classification of which contingency will be dimensioning for the system. The estimates from the NNs are used in a method called dual binary search, which is used to validate the actual DVSM using time-domain simulations. The ML-based approach is thus only proposed to support the estimation of the DVSM, while the actual DVSM is always validated through actual time-domain simulations. This two-step approach is proposed to overcome system operators' reluctance of using ML-based methods, while still allowing near real-time estimations of the DVSM.
The results presented in this paper are promising, and the trained NNs provided good estimations of both the DVSM and classifications for the dimensioning contingency. The accurate estimations used in combination with the proposed dual binary search method were found to successfully reduce the required number of time-domain simulations, which would allow system operators to overcome the main practical difficulties of estimating the DVSM.
In future research, the first step would be to test the developed method on a real power system to examine the capacity and limitations of the method. It would be highly relevant to examine if the proposed methodology is capable of increasing the computational efficiency sufficiently to allow system operators to use it in real-time monitoring and operation. Furthermore, generating a representative training set for a large power system is challenging. Thus, to examine the capability to generalise the learning from the actual training set to other, yet unseen, cases are of special interest. Finally, actual numerical comparisons between the DVSM and the VSM in real power systems would be of high interest, especially when considering high system penetration of loads with fast dynamic responses.

Acknowledgments
The work presented in this paper has been financially supported by Energimyndigheten (Swedish Energy Agency) and Svenska kraftnät (Swedish National Grid) within the SamspEL program with the project no. 44358-1.