Ejemplo n.º 1
0
        /// <summary>
        /// Returns the related feature for a corresponding relationship number
        /// <returns></returns>
        /// <summary>
        private IGTKeyObjects GetRelatedFeatures()
        {
            try
            {
                IGTKeyObjects configuredKeyObjects = GTClassFactory.Create <IGTKeyObjects>();

                using (IGTRelationshipService relService = GTClassFactory.Create <IGTRelationshipService>())
                {
                    relService.DataContext   = DataContext;
                    relService.ActiveFeature = ActiveFeature;
                    IGTKeyObjects relatedFeatures = relService.GetRelatedFeatures(RNO);

                    if (ProcessingMode.Equals(GTRelationshipGeometryProcessingModeConstants.gtrgiValidation))
                    {
                        foreach (IGTKeyObject item in relatedFeatures)
                        {
                            if (IsFeatureConfiguredInRelationshipGeomtery(item.FNO))
                            {
                                if ((ActiveFeature.FNO == 16 && (item.FNO == 17 || item.FNO == 18)) || ((ActiveFeature.FNO == 17 || ActiveFeature.FNO == 18) && item.FNO == 16))
                                {
                                    continue;
                                }
                                else
                                {
                                    configuredKeyObjects.Add(item);
                                }
                            }
                        }
                    }
                    else
                    {
                        configuredKeyObjects = relatedFeatures;
                    }
                    return(configuredKeyObjects);
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets voltage attributes when establishing connectivity,based on the voltage attributes corresponding to the connected nodes.
        /// <summary>
        /// <param name="p_errorPriority">Error Priority</param>
        private void SetAffectedRelatedNodeVoltages(string p_errorPriority = null)
        {
            Recordset activeConnectivityRS  = null;
            Recordset relatedConnectivityRS = null;
            short     connectivityCNO       = 11;

            try
            {
                activeConnectivityRS = ActiveFeature.Components.GetComponent(connectivityCNO).Recordset;

                foreach (IGTKeyObject relatedFeature in GetRelatedFeatures())
                {
                    relatedConnectivityRS = relatedFeature.Components.GetComponent(connectivityCNO).Recordset;

                    if (activeConnectivityRS != null && relatedConnectivityRS != null)
                    {
                        if (!(activeConnectivityRS.EOF && activeConnectivityRS.BOF) && !(relatedConnectivityRS.EOF && relatedConnectivityRS.BOF))
                        {
                            activeConnectivityRS.MoveFirst();
                            relatedConnectivityRS.MoveFirst();

                            if (activeConnectivityRS.Fields["NODE_1_ID"].Value != DBNull.Value && (activeConnectivityRS.Fields["NODE_1_ID"].Value.Equals(relatedConnectivityRS.Fields["NODE_1_ID"].Value)))
                            {
                                SetAffectedRelatedValues(Convert.ToString(activeConnectivityRS.Fields["VOLT_1_Q"].Value), Convert.ToString(relatedConnectivityRS.Fields["VOLT_1_Q"].Value), Convert.ToString(activeConnectivityRS.Fields["PP_VOLT_1_Q"].Value), Convert.ToString(relatedConnectivityRS.Fields["PP_VOLT_1_Q"].Value), "VOLT_2_Q", "PP_VOLT_2_Q");

                                if (!ProcessingMode.Equals(GTRelationshipGeometryProcessingModeConstants.gtrgiValidation))
                                {
                                    if (!String.IsNullOrEmpty(m_sActualRelatedVoltage))
                                    {
                                        activeConnectivityRS.Fields["VOLT_1_Q"].Value = m_sActualRelatedVoltage;
                                    }
                                    if (!String.IsNullOrEmpty(m_sProposedRelatedVoltage))
                                    {
                                        activeConnectivityRS.Fields["PP_VOLT_1_Q"].Value = m_sProposedRelatedVoltage;
                                    }
                                }
                            }
                            else if (activeConnectivityRS.Fields["NODE_2_ID"].Value != DBNull.Value && (activeConnectivityRS.Fields["NODE_2_ID"].Value.Equals(relatedConnectivityRS.Fields["NODE_2_ID"].Value)))
                            {
                                SetAffectedRelatedValues(Convert.ToString(activeConnectivityRS.Fields["VOLT_2_Q"].Value), Convert.ToString(relatedConnectivityRS.Fields["VOLT_2_Q"].Value), Convert.ToString(activeConnectivityRS.Fields["PP_VOLT_2_Q"].Value), Convert.ToString(relatedConnectivityRS.Fields["PP_VOLT_2_Q"].Value), "VOLT_1_Q", "PP_VOLT_1_Q");

                                if (!ProcessingMode.Equals(GTRelationshipGeometryProcessingModeConstants.gtrgiValidation))
                                {
                                    if (!String.IsNullOrEmpty(m_sActualRelatedVoltage))
                                    {
                                        activeConnectivityRS.Fields["VOLT_2_Q"].Value = m_sActualRelatedVoltage;
                                    }
                                    if (!String.IsNullOrEmpty(m_sProposedRelatedVoltage))
                                    {
                                        activeConnectivityRS.Fields["PP_VOLT_2_Q"].Value = m_sProposedRelatedVoltage;
                                    }
                                }
                            }
                            else if (activeConnectivityRS.Fields["NODE_1_ID"].Value != DBNull.Value && (activeConnectivityRS.Fields["NODE_1_ID"].Value.Equals(relatedConnectivityRS.Fields["NODE_2_ID"].Value)))
                            {
                                SetAffectedRelatedValues(Convert.ToString(activeConnectivityRS.Fields["VOLT_1_Q"].Value), Convert.ToString(relatedConnectivityRS.Fields["VOLT_2_Q"].Value), Convert.ToString(activeConnectivityRS.Fields["PP_VOLT_1_Q"].Value), Convert.ToString(relatedConnectivityRS.Fields["PP_VOLT_2_Q"].Value), "VOLT_2_Q", "PP_VOLT_2_Q");

                                if (!ProcessingMode.Equals(GTRelationshipGeometryProcessingModeConstants.gtrgiValidation))
                                {
                                    if (!String.IsNullOrEmpty(m_sActualRelatedVoltage))
                                    {
                                        activeConnectivityRS.Fields["VOLT_1_Q"].Value = m_sActualRelatedVoltage;
                                    }
                                    if (!String.IsNullOrEmpty(m_sProposedRelatedVoltage))
                                    {
                                        activeConnectivityRS.Fields["PP_VOLT_1_Q"].Value = m_sProposedRelatedVoltage;
                                    }
                                }
                            }
                            else if (activeConnectivityRS.Fields["NODE_2_ID"].Value != DBNull.Value && (activeConnectivityRS.Fields["NODE_2_ID"].Value.Equals(relatedConnectivityRS.Fields["NODE_1_ID"].Value)))
                            {
                                SetAffectedRelatedValues(Convert.ToString(activeConnectivityRS.Fields["VOLT_2_Q"].Value), Convert.ToString(relatedConnectivityRS.Fields["VOLT_1_Q"].Value), Convert.ToString(activeConnectivityRS.Fields["PP_VOLT_2_Q"].Value), Convert.ToString(relatedConnectivityRS.Fields["PP_VOLT_1_Q"].Value), "VOLT_1_Q", "PP_VOLT_1_Q");

                                if (!ProcessingMode.Equals(GTRelationshipGeometryProcessingModeConstants.gtrgiValidation))
                                {
                                    if (!String.IsNullOrEmpty(m_sActualRelatedVoltage))
                                    {
                                        activeConnectivityRS.Fields["VOLT_2_Q"].Value = m_sActualRelatedVoltage;
                                    }
                                    if (!String.IsNullOrEmpty(m_sProposedRelatedVoltage))
                                    {
                                        activeConnectivityRS.Fields["PP_VOLT_2_Q"].Value = m_sProposedRelatedVoltage;
                                    }
                                }
                            }
                        }
                    }
                    if (ProcessingMode.Equals(GTRelationshipGeometryProcessingModeConstants.gtrgiValidation))
                    {
                        ValidateVoltages(p_errorPriority);
                    }
                    else
                    {
                        CopyAffectedRelatedNodeVoltages();
                    }
                }
            }
            catch
            {
                throw;
            }
        }