Exemple #1
0
        // Merges the dictionaries obtained by GetVoltageSensitivityToComplexPower.
        private static TwinKeyDictionary <String, String, VoltageSensitivityToPQDataSet> TwinKeyDictionaryMerge(TwinKeyDictionary <String, String, double> MagReal, TwinKeyDictionary <String, String, double> MagImag,
                                                                                                                TwinKeyDictionary <String, String, double> PhaseReal,
                                                                                                                TwinKeyDictionary <String, String, double> PhaseImag
                                                                                                                )
        {
            var newDictionary = new TwinKeyDictionary <String, String, VoltageSensitivityToPQDataSet>();

            foreach (var X in MagReal.MapX)
            {
                foreach (var Y in X.Value)
                {
                    var val = new VoltageSensitivityToPQDataSet();
                    val.dV_dP = Y.Value;
                    val.dV_dQ = MagImag.MapX[X.Key][Y.Key];
                    val.dd_dP = PhaseReal.MapX[X.Key][Y.Key];
                    val.dd_dQ = PhaseImag.MapX[X.Key][Y.Key];
                    newDictionary.Add(X.Key, Y.Key, val);
                }
            }
            return(newDictionary);
        }
        // Merges the dictionaries obtained by GetVoltageSensitivityToComplexPower.
        private static TwinKeyDictionary<String, String, VoltageSensitivityToPQDataSet> TwinKeyDictionaryMerge(TwinKeyDictionary<String,String,double> MagReal, TwinKeyDictionary<String,String,double> MagImag, 
TwinKeyDictionary<String,String,double> PhaseReal, 
TwinKeyDictionary<String,String,double> PhaseImag
)
        {
            var newDictionary = new TwinKeyDictionary<String, String, VoltageSensitivityToPQDataSet>();
            foreach(var X in MagReal.MapX)
                foreach (var Y in X.Value)
                {
                    var val = new VoltageSensitivityToPQDataSet();
                    val.dV_dP = Y.Value;
                    val.dV_dQ = MagImag.MapX[X.Key][Y.Key];
                    val.dd_dP = PhaseReal.MapX[X.Key][Y.Key];
                    val.dd_dQ = PhaseImag.MapX[X.Key][Y.Key];
                    newDictionary.Add(X.Key, Y.Key, val);
                }
            return newDictionary;
        }