コード例 #1
0
        /// <summary>
        ///  Method to process the Isolation Scenario feature.
        /// </summary>
        /// <param name="gtComps">IGTKeyObject of the Isolation Scenario feature</param>
        /// <param name="isolationScenarioType">Type of Isolation Scenario</param>
        /// <returns>Boolean indicating method execution status</returns>
        private bool ProcessIsoScenarioFeature(IGTKeyObject gtKO, IsolationScenarios isolationScenarioType)
        {
            try
            {
                IsoScenarioFeature activeFeature = new IsoScenarioFeature();
                activeFeature.GtKeyObject = gtKO;

                short numberofNodes = 0;
                GetNumberOfNodes(activeFeature.GtKeyObject, ref numberofNodes);

                activeFeature.RelatedFeaturesNode1 = GetRelatedFeatures(activeFeature.GtKeyObject, m_cRNO, "NODE1");

                if (numberofNodes == 2)
                {
                    activeFeature.RelatedFeaturesNode2 = GetRelatedFeatures(activeFeature.GtKeyObject, m_cRNO, "NODE2");
                }

                Recordset connRS = activeFeature.GtKeyObject.Components.GetComponent(11).Recordset;
                if (connRS.RecordCount > 0)
                {
                    connRS.MoveFirst();
                    activeFeature.Phase = connRS.Fields["PHASE_ALPHA"].Value.ToString();
                }

                Recordset commRS = activeFeature.GtKeyObject.Components.GetComponent(1).Recordset;
                if (commRS.RecordCount > 0)
                {
                    commRS.MoveFirst();
                    activeFeature.FeatureState = commRS.Fields["FEATURE_STATE_C"].Value.ToString();
                }

                IsoCommon isoCommon = new IsoCommon();
                isoCommon.ActiveFNO       = m_ActiveFNO;
                isoCommon.ActiveFID       = m_ActiveFID;
                isoCommon.InteractiveMode = m_InteractiveMode;
                isoCommon.DataContext     = m_GTDataContext;

                // ISOSINGLE
                if (isolationScenarioType == IsolationScenarios.ISOSINGLE)
                {
                    IProcessIsolationScenario isoSingle = new IsoSingleScenario(m_GTDataContext, activeFeature, isoCommon);
                    isoSingle.ValidateIsolationScenario();
                }
                // ISODUAL
                else if (isolationScenarioType == IsolationScenarios.ISODUAL)
                {
                    IProcessIsolationScenario isoDual = new IsoDualScenario(m_GTDataContext, activeFeature, isoCommon);
                    isoDual.ValidateIsolationScenario();
                }
                // ISOELBOW
                else if (isolationScenarioType == IsolationScenarios.ELBOW)
                {
                    IProcessIsolationScenario isoElbow = new ElbowScenario(m_GTDataContext, activeFeature, isoCommon);
                    isoElbow.ValidateIsolationScenario();
                }
                // ISOELBOW
                else if (isolationScenarioType == IsolationScenarios.BYPASS)
                {
                    IProcessIsolationScenario isoBypass = new ByPassScenario(m_GTDataContext, activeFeature, isoCommon);
                    isoBypass.ValidateIsolationScenario();
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw new Exception("Error from Isolation Scenario FI:ProcessIsoScenarioFeature: " + ex.Message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Validate
        /// </summary>
        /// <param name="ErrorPriorityArray"></param>
        /// <param name="ErrorMessageArray"></param>
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorPriorityArray = new string[1];
            ErrorMessageArray  = new string[1];

            GTValidationLogger gTValidationLogger = null;
            IGTComponent       comp = Components[ComponentName];
            int FID = 0;

            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Validate Isolation",
                    ValidationInterfaceType = "FI"
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Validate Isolation Entry", "N/A", "");
            }

            try
            {
                short activeFNO = Convert.ToInt16(Components[ComponentName].Recordset.Fields["G3E_FNO"].Value);

                bool isIsolationScenario = false;
                IsolationScenarios isolationScenarioType = IsolationScenarios.NULL;

                if (m_IsoScenarioFNOs.Contains(activeFNO))
                {
                    // Check if active feature is an Isolation Scenario feature.
                    if (CheckIsoScenarioFeature(m_gComps, activeFNO, ref isIsolationScenario, ref isolationScenarioType))
                    {
                        if (isIsolationScenario)
                        {
                            string errorPriority = Convert.ToString(Arguments.GetArgument(0));

                            string activeFeatureState = null;
                            string feedType           = null;
                            short  numberofNodes      = 0;

                            IGTKeyObject m_activeFeature = GTClassFactory.Create <IGTKeyObject>();
                            IGTKeyObject relativeFeature = GTClassFactory.Create <IGTKeyObject>();

                            IGTKeyObjects m_relatedNode1Features = null;
                            IGTKeyObjects m_relatedNode2Features = null;
                            Recordset     activeFeatureConnRS    = null;

                            List <IGTKeyObject> node1FeaturesLst = new List <IGTKeyObject>();
                            List <IGTKeyObject> node2FeaturesLst = new List <IGTKeyObject>();

                            m_activeFeature = DataContext.OpenFeature(Convert.ToInt16(Components[ComponentName].Recordset.Fields["G3E_FNO"].Value), Convert.ToInt32(Components[ComponentName].Recordset.Fields["G3E_FID"].Value));

                            GetNumberOfNodes(m_activeFeature, ref numberofNodes);

                            m_relatedNode1Features = GetRelatedFeatures(m_activeFeature, m_cRNO, "NODE1");

                            if (numberofNodes == 2)
                            {
                                m_relatedNode2Features = GetRelatedFeatures(m_activeFeature, m_cRNO, "NODE2");
                            }

                            activeFeatureConnRS = m_activeFeature.Components.GetComponent(m_cCNO).Recordset;

                            if (activeFeatureConnRS.RecordCount > 0)
                            {
                                activeFeatureConnRS.MoveFirst();

                                m_aNode1 = Convert.ToInt32(activeFeatureConnRS.Fields["NODE_1_ID"].Value == System.DBNull.Value ? 0 : activeFeatureConnRS.Fields["NODE_1_ID"].Value);
                                m_aNode2 = Convert.ToInt32(activeFeatureConnRS.Fields["NODE_2_ID"].Value == System.DBNull.Value ? 0 : activeFeatureConnRS.Fields["NODE_2_ID"].Value);

                                if (m_activeFeature.Components.GetComponent(1).Recordset != null && m_activeFeature.Components.GetComponent(1).Recordset.RecordCount > 0)
                                {
                                    m_activeFeature.Components.GetComponent(1).Recordset.MoveFirst();
                                    activeFeatureState = Convert.ToString(m_activeFeature.Components.GetComponent(1).Recordset.Fields["FEATURE_STATE_C"].Value);
                                }
                                if (m_activeFeature.FNO == 59 && m_activeFeature.Components.GetComponent(5901).Recordset != null && m_activeFeature.Components.GetComponent(5901).Recordset.RecordCount > 0)
                                {
                                    m_activeFeature.Components.GetComponent(5901).Recordset.MoveFirst();
                                    feedType = Convert.ToString(m_activeFeature.Components.GetComponent(5901).Recordset.Fields["FEED_TYPE"].Value);
                                }
                                else if (m_activeFeature.FNO == 60 && m_activeFeature.Components.GetComponent(6002).Recordset != null && m_activeFeature.Components.GetComponent(6002).Recordset.RecordCount > 0)
                                {
                                    m_activeFeature.Components.GetComponent(6002).Recordset.MoveFirst();
                                    feedType = Convert.ToString(m_activeFeature.Components.GetComponent(6002).Recordset.Fields["FEED_TYPE"].Value);
                                }
                            }

                            if (CheckFeatureState(activeFeatureState))
                            {
                                if (m_relatedNode1Features != null)
                                {
                                    foreach (IGTKeyObject feature in m_relatedNode1Features)
                                    {
                                        node1FeaturesLst.Add(feature);
                                    }
                                }

                                if (m_relatedNode2Features != null)
                                {
                                    foreach (IGTKeyObject feature in m_relatedNode2Features)
                                    {
                                        node2FeaturesLst.Add(feature);
                                    }
                                }

                                //ISODUAL
                                if (m_activeFeature.FNO == 34) //Autotransformer
                                {
                                    IProcessIsolationScenario isoDual = new IsoDualScenario(node1FeaturesLst.Where(a => a.FNO == 6).ToList(), node2FeaturesLst.Where(a => a.FNO == 6).ToList(), errorPriority);
                                    isoDual.ProcessIsolationScenario(out ErrorMessageArray[0], out ErrorPriorityArray[0]);
                                }

                                //ISOSINGLE
                                if (m_activeFeature.FNO == 4 || m_activeFeature.FNO == 12 || m_activeFeature.FNO == 59 || (m_activeFeature.FNO == 60 && feedType.ToUpper() == "RADIAL"))
                                {
                                    IProcessIsolationScenario isoSingle = new IsoSingleScenario(node1FeaturesLst.Where(a => a.FNO == 6).ToList(), node2FeaturesLst.Where(a => a.FNO == 6).ToList(), errorPriority);
                                    isoSingle.ProcessIsolationScenario(out ErrorMessageArray[0], out ErrorPriorityArray[0]);
                                }

                                //ISOSINGLE NETWORK FEATURES
                                if (m_activeFeature.FNO == 99 || m_activeFeature.FNO == 98)
                                {
                                    IProcessIsolationScenario isoSingle = new IsoSingleScenario(node1FeaturesLst.Where(a => a.FNO == 82).ToList(), node2FeaturesLst.Where(a => a.FNO == 82).ToList(), errorPriority);
                                    isoSingle.ProcessIsolationScenario(out ErrorMessageArray[0], out ErrorPriorityArray[0]);
                                }

                                //ELBOW need clarification
                                if (m_activeFeature.FNO == 5 || (m_activeFeature.FNO == 60 && feedType.ToUpper() == "LOOP"))
                                {
                                    IProcessIsolationScenario elbowScenario = new ElbowScenario(node1FeaturesLst.Where(a => a.FNO == 41).ToList(), node2FeaturesLst.Where(a => a.FNO == 41).ToList(), errorPriority);
                                    elbowScenario.ProcessIsolationScenario(out ErrorMessageArray[0], out ErrorPriorityArray[0]);
                                }

                                //BYPASS
                                if (m_activeFeature.FNO == 14 || m_activeFeature.FNO == 15 || m_activeFeature.FNO == 36)
                                {
                                    IProcessIsolationScenario byPassScenario = new ByPassScenario(node1FeaturesLst.Where(a => a.FNO == 40).ToList(), node2FeaturesLst.Where(a => a.FNO == 40).ToList(), errorPriority);
                                    byPassScenario.ProcessIsolationScenario(out ErrorMessageArray[0], out ErrorPriorityArray[0]);
                                }
                            }
                        }
                    }
                }
                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END ", "Validate Isolation Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error from Isolation Scenario FI: " + ex.Message);
            }
        }