# Flexible Simulation Platform for Generating Realistic Waveforms with Voltage Notches
## 6 Monte Carlo Simulation-Based Data Generation  
### Simulation Algorithm  
A Monte Carlo simulation approach is proposed for generating realistic synthetic waveforms of voltage notches in industrial LV networks. The algorithm, illustrated in  
\begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \multirow{2}{*}{**Statistical Metric**} & \multirow{2}{*}{**Group of Data**} & \multicolumn{6}{c}{**Features**} \\ \cline{3-8}  & & \(d_{com}\) (\%) & \(\Delta t_{com}\) (\%) & \(POW_{com}\) (\({}^{\circ}\)) & \(I_{1}\) (A) & Angle (\(I_{1}\)) (\({}^{\circ}\)) & \(I_{5}\) (A) \\ \hline \multirow{3}{*}{Mean} & Measurements & 37.32 & 301.60 & 53.70 & 199.11 & 98.74 & 41.81 \\  & Simulations & 36.74 & 262.90 & 53.70 & 204.87 & 102.94 & 42.13 \\  & Relative error (\%) & 1.55 & 12.83 & 0.00 & 2.89 & 4.25 & 0.76 \\ \hline \multirow{3}{*}{Range} & Measurements & 7.79 & 146.48 & 6.15 & 155.45 & 16.59 & 29.27 \\  & Simulations & 8.19 & 97.66 & 6.15 & 144.27 & 12.97 & 29.42 \\  & Relative error (\%) & 5.11 & 33.33 & 0.00 & 7.19 & 21.83 & 0.49 \\ \hline \hline \end{tabular}
\end{table}
Table 6: Statistical metrics comparing features from measurements with those from simulations.  
Figure 20: Correlation matrices of features extracted from field measurements (**left**) and simulations (**middle**) and normalized absolute error matrix (**right**).  
Figure 21, is based on the theoretical analysis of voltage notches, exploration of parameter interrelations, and validation with field measurements presented in previous sections.  
Key features of the algorithm include the following:  
1. Initialization: Fixed parameters are set, including the sampling frequency \(f_{sam}\), \(f_{s}\), \(U_{s}\), \(X/R\) ratio, \(\alpha_{min}\), \(d_{com,max}\), \(PF_{PCC,min}\), \(PF_{target,min}\), \(\Delta U_{PCC,max}\), \(Q_{cb,ratio,max}\), \(U_{rm,rated}\), \(f_{t}\), and the number of Monte Carlo simulations (\(N\)).
2. Scenario selection: The algorithm allows the simulation of different scenarios by enabling or disabling linear loads (\(LL_{on}\)) and the capacitor bank (\(CB_{on}\)). Moreover, the capacitor bank can be non-detuned or detuned according to \(Det_{on}\).  
Figure 21: Flow diagram of Monte Carlo simulation-based data generation.  
Random parameter generation: Several system parameters are randomly generated within defined ranges and/or according to a probability distribution, including the background voltage unbalance and distortion, \(S_{sc}\), \(S_{r}\), \(\alpha\), \(X_{com}\), \(L_{D}\), snubber circuit parameters (\(U_{rm}\), \(R_{sn}/R_{base}\) ratio), linear load parameters (\(S_{ll}\), \(PF_{ll}\)), and \(QF\).
4. Computed parameters: Several parameters are computed according to expressions in Section 3 using other parameters as inputs, as summarized in Table 7.
5. Constraint handling: The algorithm incorporates various constraints and recommendations, such as \(PF_{PCC,min}\) and \(\Delta U_{PCC,max}\) limits, and \(Q_{cb}<Q_{cb,ratio,max}\cdot S_{sc}\).
6. Adaptive parameter determination: Key limit parameters are derived using linearly regressed functions obtained from simulations of scenarios 1-4 (Table 5), including the maximum \(S_{r}/S_{sc}\) ratio (\(S_{r,ratio,max}\)), maximum \((S_{r}+S_{ll})/S_{sc}\) ratio (\(S_{r,ratio,max}\)), and maximum firing angle \(\alpha_{max}\). This approach ensures that most simulation cases avoid constraint violations while maintaining flexibility. Thus, the simulations are not strictly bound to recommended limits, such as the suggested 0.015 ratio for \(S_{r}/S_{sc}\), as field measurements indicate that these limits are not universally adhered to in real-world scenarios.
7. Iteration and output: The simulation is repeated \(N\) times, storing output variables for each valid scenario.