Beispiel #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="element">The element containing the node</param>
        //  Revision History
        //  MM/DD/YY who Version Issue# Description
        //  -------- --- ------- ------ ---------------------------------------
        //  05/09/13 RCG 2.80.28 N/A    Created

        public PropertyNode(XElement element)
        {
            if (element != null && element.Name.LocalName == ELEMENT_NAME)
            {
                XNamespace NameSpace = element.GetDefaultNamespace();

                if (element.Attribute(ATTRIB_TYPE) != null)
                {
                    m_PropertyType = EnumDescriptionRetriever.ParseToEnum <PropertyNodeType>(element.Attribute(ATTRIB_TYPE).Value);
                }

                if (element.Attribute(ATTRIB_INDEX) != null)
                {
                    m_Index = sbyte.Parse(element.Attribute(ATTRIB_INDEX).Value);
                }

                m_Clients = new List <ClientNode>();

                foreach (XElement ClientElement in element.Descendants(NameSpace.GetName(ClientNode.ELEMENT_NAME)))
                {
                    m_Clients.Add(new ClientNode(ClientElement));
                }
            }
            else
            {
                throw new ArgumentException("Not a valid property element", "element");
            }
        }
        /// <summary>
        /// Returns a string representation of the exception
        /// </summary>
        /// <returns>The exception as a string</returns>
        //  Revision History
        //  MM/DD/YY who Version Issue# Description
        //  -------- --- ------- ------ ---------------------------------------
        //  02/06/12 RCG 2.70.64 N/A    Created

        public override string ToString()
        {
            string ExceptionString = this.GetType().ToString() + ": ";

            if (Message != null)
            {
                ExceptionString += Message + " ";
            }

            if (m_ExceptionResponse != null)
            {
                ExceptionString += "Exception Response. Service Error: " + EnumDescriptionRetriever.RetrieveDescription(m_ExceptionResponse.ServiceError)
                                   + " Stat Error: " + EnumDescriptionRetriever.RetrieveDescription(m_ExceptionResponse.StateError) + "\r\n";
            }

            if (m_ConfirmedServiceError != null)
            {
                ExceptionString += "Confirmed Service Error: " + m_ConfirmedServiceError.ServiceError.ToDescription();
            }

            if (InnerException != null)
            {
                ExceptionString += "Inner Exception: " + InnerException.ToString() + "\r\n";
            }

            ExceptionString += "Stack Trace: " + StackTrace;

            return(ExceptionString);
        }
        /// <summary>
        /// Returns a string representing the service type
        /// </summary>
        /// <param name="service"></param>
        /// <returns>Service Type</returns>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 05/01/09 RCG 2.20.03 N/A    Created

        private string GetServiceTypeDescription(ServiceTypes service)
        {
            string strServiceType;

            //Create the service type string
            switch (service)
            {
            case ServiceTypes.ThreeElem3Phase4WireWYE:
            case ServiceTypes.TwoAndHalfElem3Phase4WireWYE6S46S:
            case ServiceTypes.TwoElemNetwork:
            case ServiceTypes.ThreeElem3Phase4WireDelta:
            case ServiceTypes.TwoElem3Phase4WireWYE:
            case ServiceTypes.TwoElem3Phase3WireDelta:
            case ServiceTypes.TwoElem3Phase4WireDelta:
            case ServiceTypes.TwoElemSinglePhase:
            case ServiceTypes.OneElemSinglePhase3Wire:
            case ServiceTypes.OneElemSinglePhase2Wire:
            case ServiceTypes.TwoAndHalfElem3Phase4WireWYE9S:
            {
                strServiceType = EnumDescriptionRetriever.RetrieveDescription(service);
                break;
            }

            case ServiceTypes.AutoServiceSense:
            default:
            {
                // Since this is the value in use we want to show unknown if 255
                strServiceType = m_rmStrings.GetString("UNKNOWN");
                break;
            }
            }

            return(strServiceType);
        }
Beispiel #4
0
        /// <summary>
        /// Converts the date to a string
        /// </summary>
        /// <returns>The string representation of the date</returns>
        public override string ToString()
        {
            string strResult = "";

            if (IsSpecificDate)
            {
                strResult = SpecificDate.Value.ToString("G", CultureInfo.CurrentCulture);
            }
            else if (m_Year == YEAR_NOT_SPECIFIED && m_Month == COSEMMonth.NotSpecified && m_DayOfMonth == COSEMDayOfMonth.LastDay && m_DayOfWeek == COSEMDayOfWeek.NotSpecified)
            {
                strResult = COSEMResourceStrings.LastDayOfTheMonth;
            }
            else if (m_Year == YEAR_NOT_SPECIFIED && m_Month == COSEMMonth.NotSpecified && m_DayOfMonth == COSEMDayOfMonth.SecondToLastDay && m_DayOfWeek == COSEMDayOfWeek.NotSpecified)
            {
                strResult = COSEMResourceStrings.SecondToLastDayOfTheMonth;
            }
            else if (m_Year != YEAR_NOT_SPECIFIED && m_Month == COSEMMonth.NotSpecified && m_DayOfMonth == COSEMDayOfMonth.LastDay && m_DayOfWeek == COSEMDayOfWeek.NotSpecified)
            {
                strResult = COSEMResourceStrings.LasDayOfTheMonthInYear.Replace(YEAR, m_Year.ToString(CultureInfo.CurrentCulture));
            }
            else if (m_Year != YEAR_NOT_SPECIFIED && m_Month == COSEMMonth.NotSpecified && m_DayOfMonth == COSEMDayOfMonth.SecondToLastDay && m_DayOfWeek == COSEMDayOfWeek.NotSpecified)
            {
                strResult = COSEMResourceStrings.SecondToLastDayOfTheMonthInYear.Replace(YEAR, m_Year.ToString(CultureInfo.CurrentCulture));
            }
            else if (m_Year == YEAR_NOT_SPECIFIED && m_Month == COSEMMonth.NotSpecified && m_DayOfMonth == COSEMDayOfMonth.LastDay && m_DayOfWeek != COSEMDayOfWeek.NotSpecified)
            {
                strResult = COSEMResourceStrings.LastWeekdayOfTheMonth.Replace(WEEK_DAY, EnumDescriptionRetriever.RetrieveDescription(m_DayOfWeek));
            }
            else if (m_Year != YEAR_NOT_SPECIFIED && m_Month == COSEMMonth.NotSpecified && m_DayOfMonth == COSEMDayOfMonth.SecondToLastDay && m_DayOfWeek != COSEMDayOfWeek.NotSpecified)
            {
                strResult = COSEMResourceStrings.LastWeekdayOfTheMonthInYear.Replace(WEEK_DAY, EnumDescriptionRetriever.RetrieveDescription(m_DayOfWeek));
                strResult = strResult.Replace(YEAR, m_Year.ToString(CultureInfo.CurrentCulture));
            }
            else if (m_Year == YEAR_NOT_SPECIFIED && m_Month == COSEMMonth.NotSpecified && m_DayOfMonth != COSEMDayOfMonth.NotSpecified && m_DayOfWeek != COSEMDayOfWeek.NotSpecified)
            {
                strResult = COSEMResourceStrings.FirstWeekdayAfterDateInEveryMonth.Replace(WEEK_DAY, EnumDescriptionRetriever.RetrieveDescription(m_DayOfWeek));
                strResult = strResult.Replace(DATE, EnumDescriptionRetriever.RetrieveDescription(m_DayOfMonth));
            }
            else if (m_Year == YEAR_NOT_SPECIFIED && m_Month != COSEMMonth.NotSpecified && m_DayOfMonth != COSEMDayOfMonth.NotSpecified && m_DayOfWeek != COSEMDayOfWeek.NotSpecified)
            {
                strResult = COSEMResourceStrings.FirstWeekdayAfterDateInSpecificMonth.Replace(WEEK_DAY, EnumDescriptionRetriever.RetrieveDescription(m_DayOfWeek));
                strResult = strResult.Replace(DATE, EnumDescriptionRetriever.RetrieveDescription(m_DayOfMonth));
                strResult = strResult.Replace(MONTH, EnumDescriptionRetriever.RetrieveDescription(m_Month));
            }


            return(strResult);
        }
Beispiel #5
0
        /// <summary>
        /// Formats the contents of the Entry as a string
        /// </summary>
        /// <returns>The entry as a string</returns>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ ---------------------------------------------
        //  11/11/11 RCG 2.53.05        Created

        public override string ToString()
        {
            string EntryString = "";

            EntryString += "      Fatal Error Reset Type = " + EnumDescriptionRetriever.RetrieveDescription(ResetType) + "\r\n";
            EntryString += "      Fatal Error Subcode = " + SubCode.ToString(CultureInfo.InvariantCulture) + "\r\n";
            EntryString += "      Current Task ID = " + m_CurrentTaskID.ToString(CultureInfo.InvariantCulture) + "\r\n";
            EntryString += "      Reset State = " + m_ResetState.ToString(CultureInfo.InvariantCulture) + "\r\n";
            EntryString += "      Reset Time = " + ResetTime.ToString("G", CultureInfo.CurrentCulture) + "\r\n";

            for (int Index = 0; Index < m_CondensedRegistrationTable.Count(); Index++)
            {
                EntryString += "      Registration Table Data [" + Index.ToString(CultureInfo.InvariantCulture) + "]\r\n";
                EntryString += m_CondensedRegistrationTable[Index].ToString();
            }

            for (int Index = 0; Index < m_ResetErrors.Count(); Index++)
            {
                EntryString += "      ZigBee Error Log Entry [" + Index.ToString(CultureInfo.InvariantCulture) + "]\r\n";
                EntryString += m_ResetErrors[Index].ToString();
            }

            for (int Index = 0; Index < m_ResetEvents.Count(); Index++)
            {
                EntryString += "      ZigBee Event Log Entry [" + Index.ToString(CultureInfo.InvariantCulture) + "]\r\n";
                EntryString += m_ResetEvents[Index].ToString();
            }

            EntryString += "      Error Specific Data = ";

            foreach (byte CurrentByte in m_SpecificErrorData)
            {
                EntryString += CurrentByte.ToString("X2", CultureInfo.InvariantCulture) + " ";
            }

            EntryString += "\r\n";

            EntryString += "      Mini Core Dump\r\n";
            EntryString += m_MiniCoreDump.ToString();

            return(EntryString);
        }
        /// <summary>
        /// Translates the argument data to a readable string
        /// </summary>
        /// <returns>The argument data as a readable string</returns>
        //  Revision History
        //  MM/DD/YY who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  08/08/11 MMD                 Created
        //  08/18/11 MMD                Added code to read Argument and retrieve description
        //  08/19/11 AF  2.52.05        Removed "Source Type: " from the string returned

        public virtual string TranslateArgumentData()
        {
            MemoryStream     ArgumentStream = new MemoryStream(m_Argument);
            PSEMBinaryReader ArgumentReader = new PSEMBinaryReader(ArgumentStream);

            string strArgumentData = "";

            try
            {
                CENTRON_AMI.FWDLEventSourceType Attribute = (CENTRON_AMI.FWDLEventSourceType)ArgumentReader.ReadUInt32();

                strArgumentData = EnumDescriptionRetriever.RetrieveDescription(Attribute);
            }
            catch (Exception)
            {
                // If we can't read the data for some reason just go with what we have.
            }

            //Closing ArgumentReader also closes ArgumentStream
            ArgumentReader.Dispose();

            return(strArgumentData);
        }
Beispiel #7
0
        /// <summary>
        /// Parses the data for any APDU's
        /// </summary>
        //  Revision History
        //  MM/DD/YY who Version Issue# Description
        //  -------- --- ------- ------ ---------------------------------------
        //  02/04/12 RCG 2.70.63 N/A    Created

        private void ParseAPDUData()
        {
            try
            {
                lock (m_HighLevelDataBuffer)
                {
                    while (m_HighLevelDataBuffer.Count > 0)
                    {
                        // The first byte should be the APDU tag
                        xDLMSAPDU    NewAPDU         = xDLMSAPDU.Create((xDLMSTags)m_HighLevelDataBuffer[0]);
                        CipheredAPDU NewCipheredAPDU = NewAPDU as CipheredAPDU;

                        if (NewAPDU != null)
                        {
                            // Set up the security settings for a Ciphered APDU
                            if (NewCipheredAPDU != null)
                            {
                                if (CipheredAPDU.IsTagGlobalCipher(NewCipheredAPDU.Tag))
                                {
                                    NewCipheredAPDU.BlockCipherKey = GlobalEncryptionKey;
                                }
                                else if (CipheredAPDU.IsTagDedicatedCipher(NewCipheredAPDU.Tag))
                                {
                                    NewCipheredAPDU.BlockCipherKey = DedicatedEncryptionKey;
                                }

                                if (PendingDecryptAuthenticationKey != null)
                                {
                                    NewCipheredAPDU.AuthenticationKey = PendingDecryptAuthenticationKey;
                                }
                                else
                                {
                                    NewCipheredAPDU.AuthenticationKey = DecryptAuthenticationKey;
                                }

                                NewCipheredAPDU.ApTitle = ServerApTitle;

                                m_LastFrameCounterReceived = NewCipheredAPDU.FrameCounter;
                            }

                            // We found a valid APDU tag so we can try to parse it. We already checked the first byte so just use the rest
                            MemoryStream DataStream = new MemoryStream(m_HighLevelDataBuffer.ToArray());

                            NewAPDU.Parse(DataStream);

                            // Remove the data that has been parsed
                            m_HighLevelDataBuffer.RemoveRange(0, (int)DataStream.Position);

                            m_Logger.WriteLine(Logger.LoggingLevel.Detailed, "APDU Received. Type: " + EnumDescriptionRetriever.RetrieveDescription(NewAPDU.Tag));

                            if (NewCipheredAPDU != null)
                            {
                                xDLMSAPDU UncipheredAPDU = null;

                                if (PendingDecryptAuthenticationKey != null)
                                {
                                    // We are in the middle of a key exchange so we could get a message using either the pending key or
                                    // the previous key. We need to attempt the Pending key first
                                    try
                                    {
                                        UncipheredAPDU = NewCipheredAPDU.UncipheredAPDU;
                                    }
                                    catch (Exception)
                                    {
                                        m_Logger.WriteLine(Logger.LoggingLevel.Detailed, "Unciphering failed using the Pending Authentication Key. Using previous key.");
                                    }

                                    if (UncipheredAPDU == null)
                                    {
                                        // Try it with the previous key
                                        NewCipheredAPDU.AuthenticationKey = DecryptAuthenticationKey;
                                        UncipheredAPDU = NewCipheredAPDU.UncipheredAPDU;
                                    }
                                }
                                else
                                {
                                    UncipheredAPDU = NewCipheredAPDU.UncipheredAPDU;
                                }

                                // Send up the Unciphered APDU
                                OnAPDUReceived(UncipheredAPDU);
                            }
                            else
                            {
                                OnAPDUReceived(NewAPDU);
                            }
                        }
                        else
                        {
                            // The tag is not valid so lets get rid of the byte and move on
                            m_HighLevelDataBuffer.RemoveAt(0);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                // This most likely means that we don't have all of the data yet for a specific message
                // so do nothing and hope the rest of the data comes in soon.
                m_Logger.WriteLine(Logger.LoggingLevel.Detailed, "Exception while parsing an APDU. Waiting for more data. Message: " + e.Message);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Sends an APDU to the connected device
        /// </summary>
        /// <param name="apdu">The APDU to send</param>
        //  Revision History
        //  MM/DD/YY who Version Issue# Description
        //  -------- --- ------- ------ ---------------------------------------
        //  05/21/13 RCG 2.80.32 N/A    Created

        public void SendAPDU(xDLMSAPDU apdu)
        {
            if (IsOpen && apdu != null)
            {
                WPDU Wrapper = new WPDU(ClientPort, ServerPort, apdu.Data);

                m_Logger.WriteLine(Logger.LoggingLevel.Detailed, "Sending APDU. Type: " + EnumDescriptionRetriever.RetrieveDescription(apdu.Tag));

                Send(Wrapper.Data);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Parses the data read from the meter
        /// </summary>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  06/07/11 jrf 2.51.10 173353 Created
        //  03/20/12 AF  2.53.51 194597 Removed the "aggregate" label and changed the phase descriptions
        //                              in the enum above
        //
        private void ParseData()
        {
            if (null == m_InsWattsDelivered)
            {
                m_InsWattsDelivered = new InstantaneousQuantity("Instantaneous Watts Delivered");
            }
            else
            {
                m_InsWattsDelivered.Refresh();
            }

            if (null == m_InsWattsReceived)
            {
                m_InsWattsReceived = new InstantaneousQuantity("Instantaneous Watts Received");
            }
            else
            {
                m_InsWattsReceived.Refresh();
            }

            if (NUMBER_OF_MONOPHASE_RECORDS == m_byPowerMonitorRecordsUsed)
            {
                m_InsWattsDelivered.MostRecentMeasurement = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), "Ins W d");
                m_InsWattsDelivered.Minimum = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), "Ins min W d");
                m_InsWattsDelivered.Maximum = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), "Ins max W d");
                m_InsWattsDelivered.Average = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), "Ins avg W d");

                m_InsWattsReceived.MostRecentMeasurement = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), "Ins W r");
                m_InsWattsReceived.Minimum = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), "Ins min W r");
                m_InsWattsReceived.Maximum = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), "Ins max W r");
                m_InsWattsReceived.Average = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), "Ins avg W r");
            }
            else //Have to read the measurements for each phase.
            {
                m_InsWattsDelivered.MostRecentMeasurementsPerPhase = new List <DemandMeasurement>();
                m_InsWattsDelivered.MinimumPerPhase = new List <DemandMeasurement>();
                m_InsWattsDelivered.MaximumPerPhase = new List <DemandMeasurement>();
                m_InsWattsDelivered.AveragePerPhase = new List <DemandMeasurement>();

                m_InsWattsReceived.MostRecentMeasurementsPerPhase = new List <DemandMeasurement>();
                m_InsWattsReceived.MinimumPerPhase = new List <DemandMeasurement>();
                m_InsWattsReceived.MaximumPerPhase = new List <DemandMeasurement>();
                m_InsWattsReceived.AveragePerPhase = new List <DemandMeasurement>();

                foreach (Phases Phase in Enum.GetValues(typeof(Phases)))
                {
                    m_InsWattsDelivered.MostRecentMeasurementsPerPhase.Add(new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("INS_W_D") + " " + EnumDescriptionRetriever.RetrieveDescription(Phase)));
                    m_InsWattsDelivered.MinimumPerPhase.Add(new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("MIN_INS_W_D") + " " + EnumDescriptionRetriever.RetrieveDescription(Phase)));
                    m_InsWattsDelivered.MaximumPerPhase.Add(new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("MAX_INS_W_D") + " " + EnumDescriptionRetriever.RetrieveDescription(Phase)));
                    m_InsWattsDelivered.AveragePerPhase.Add(new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("AVG_INS_W_D") + " " + EnumDescriptionRetriever.RetrieveDescription(Phase)));
                }

                m_InsWattsDelivered.MostRecentMeasurement = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("INS_W_D"));
                m_InsWattsDelivered.Minimum = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("MIN_INS_W_D"));
                m_InsWattsDelivered.Maximum = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("MAX_INS_W_D"));
                m_InsWattsDelivered.Average = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("AVG_INS_W_D"));

                foreach (Phases Phase in Enum.GetValues(typeof(Phases)))
                {
                    m_InsWattsReceived.MostRecentMeasurementsPerPhase.Add(new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("INS_W_R") + " " + EnumDescriptionRetriever.RetrieveDescription(Phase)));
                    m_InsWattsReceived.MinimumPerPhase.Add(new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("MIN_INS_W_R") + " " + EnumDescriptionRetriever.RetrieveDescription(Phase)));
                    m_InsWattsReceived.MaximumPerPhase.Add(new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("MAX_INS_W_R") + " " + EnumDescriptionRetriever.RetrieveDescription(Phase)));
                    m_InsWattsReceived.AveragePerPhase.Add(new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("AVG_INS_W_R") + " " + EnumDescriptionRetriever.RetrieveDescription(Phase)));
                }

                m_InsWattsReceived.MostRecentMeasurement = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("INS_W_R"));
                m_InsWattsReceived.Minimum = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("MIN_INS_W_R"));
                m_InsWattsReceived.Maximum = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("MAX_INS_W_R"));
                m_InsWattsReceived.Average = new DemandMeasurement(m_Reader.ReadDouble(), m_Reader.ReadSTIME((PSEMBinaryReader.TM_FORMAT)m_iTimeFormat), m_rmStrings.GetString("AVG_INS_W_R"));
            }
        }
Beispiel #10
0
        /// <summary>
        /// Gets the reason for the specified result.
        /// </summary>
        /// <param name="connectResult">The result to get the reason for.</param>
        /// <param name="connectResponse">The response to get the reason for.</param>
        /// <returns>The reason for the result as a string.</returns>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  09/17/09 RCG 2.30.00        Created
        //  01/20/11 RCG 2.45.23        Updating to support Connect/Disconnect Procedure Enhancement

        private string DetermineReason(RemoteConnectResult connectResult, ConnectDisconnectResponse connectResponse)
        {
            string strReason = null;

            switch (connectResult)
            {
            case RemoteConnectResult.LOAD_VOLTAGE_NOT_DETECTED:
            {
                strReason = TestResources.ReasonLoadVoltageNotDetected;
                break;
            }

            case RemoteConnectResult.LOAD_VOLTAGE_PRESENT:
            {
                strReason = TestResources.ReasonLoadVoltagePresent;
                break;
            }

            case RemoteConnectResult.REMOTE_CONNECT_FAILED:
            {
                strReason = TestResources.ReasonRemoteConnectFailed;
                break;
            }

            case RemoteConnectResult.SECURITY_VIOLATION:
            {
                strReason = TestResources.ReasonSecurityError;
                break;
            }

            case RemoteConnectResult.UNRECOGNIZED_PROCEDURE:
            {
                strReason = TestResources.ReasonUnrecognizedProcedure;
                break;
            }

            case RemoteConnectResult.REMOTE_ACTION_SUCCESS:
            {
                // The procedure can now have an extra response which we need to interpret
                switch (connectResponse)
                {
                case ConnectDisconnectResponse.Successful:
                case ConnectDisconnectResponse.SuccessfulInterventionRequired:
                {
                    // It succeeded so we don't need a reason
                    strReason = null;
                    break;
                }

                default:
                {
                    strReason = EnumDescriptionRetriever.RetrieveDescription(connectResponse);
                    break;
                }
                }
                break;
            }
            }

            return(strReason);
        }
Beispiel #11
0
        /// <summary>
        /// Parses a string into an enum value.
        /// </summary>
        /// <typeparam name="T">The enum type.</typeparam>
        /// <param name="strValue">The description of the enum value to parse.</param>
        /// <returns>The enum value.</returns>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ ---------------------------------------------
        //  04/28/09 RCG 2.20.03        Created

        public static T ParseToEnum <T>(this string strValue)
        {
            return(EnumDescriptionRetriever.ParseToEnum <T>(strValue));
        }
Beispiel #12
0
        /// <summary>
        /// Extension method for enumerations that will return the description specified using a DescriptionAttribute modifier.
        /// </summary>
        /// <param name="value">The enumeration value.</param>
        /// <returns>The description of the value.</returns>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ ---------------------------------------------
        //  04/28/09 RCG 2.20.03        Created

        public static string ToDescription(this Enum value)
        {
            return(EnumDescriptionRetriever.RetrieveDescription(value));
        }