Esempio n. 1
0
        /// <summary>
        /// Constructor for the Load Profile Status LID object
        /// </summary>
        /// <param name="retriever">The LIDRetriever for the device.</param>
        /// <param name="fltLPPulseWeightMultiplier">The multiplier used to convert from meter value to real value</param>
        // Revision History	
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 10/02/06 RCG 7.40.00 N/A    Created

        internal LoadProfileStatusLIDS(LIDRetriever retriever, float fltLPPulseWeightMultiplier)
        {
            m_LIDRetriever = retriever;
            m_LIDs = new DefinedLIDs();
            m_ChannelsList = new List<ANSILoadProfileChannel>();
            m_byIntervalLength = new CachedByte();
            m_byNumberOfChannels = new CachedByte();
            m_bIsChannelStatusCached = false;
            m_fltLPPulseWeightMultiplier = fltLPPulseWeightMultiplier;
        }
Esempio n. 2
0
        /// <summary>
        /// Method that handles the writing of the Register Data to the XML file.
        /// </summary>
        /// <param name="xmlDoc">The XmlDocument that this data is going into</param>
        /// <param name="ESN">Electronic Serial Number of the meter</param>
        /// <returns>The outcome of writing the current register data to the file</returns>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  09/28/09 AF  2.30.04        Created
        //  10/02/09 AF  2.30.05        Changed the way the result is handled so that we
        //                              don't falsely claim success
        //  10/06/09 AF  2.30.07        Restructured after code review
        //  03/27/12 jrf 2.53.52 TREQ3440/3447 Adding support for writing extended energy
        //                              registers and extended self read registers to the
        //                              CRF file.
        //
        public override CreateCRFResult Write(XmlDocument xmlDoc, string ESN)
        {
            XmlNode ChannelsNode;

            m_Result = base.Write(xmlDoc, ESN);

            try
            {
                if (m_SelfReadRegisters.Count > 0)
                {
                    ChannelsNode = BuildChannelsNode();

                    // Process the self reads one by one
                    foreach (QuantityCollection SRQtyCollection in m_SelfReadRegisters)
                    {
                        m_TimeOfReading = SRQtyCollection.DateTimeOfReading;

                        foreach (Quantity SRReg in SRQtyCollection.Quantities)
                        {
                            WriteQuantity(ChannelsNode, SRReg);
                        }
                    }
                }
                if (m_ExtendedSelfReadRegisters.Count > 0)
                {
                    ChannelsNode = BuildChannelsNode();

                    // Process the self reads one by one
                    foreach (ExtendedSelfReadRecord ExtSRReg in m_ExtendedSelfReadRegisters)
                    {
                        WriteReading(ChannelsNode, ExtSRReg.QuantityID.lidDescription, ExtSRReg.Measurement, ExtSRReg.TimeOfOccurence);
                    }
                }
                else if (m_CurrentRegisters.Count > 0)
                {
                    ChannelsNode = BuildChannelsNode();

                    foreach (Quantity CurReg in m_CurrentRegisters)
                    {
                        WriteQuantity(ChannelsNode, CurReg);
                    }
                }
                else if (m_ExtendedRegisters.Count > 0)
                {
                    ChannelsNode = BuildChannelsNode();

                    foreach (ExtendedCurrentEntryRecord ExtReg in m_ExtendedRegisters)
                    {
                        WriteReading(ChannelsNode, ExtReg.QuantityID.lidDescription, ExtReg.Measurement, m_TimeOfReading);
                    }
                }

                if (m_InstantaneousCurrentDataRecords.Count > 0)
                {
                    ChannelsNode = BuildChannelsNode();

                    foreach (InstantaneousCurrentDataRecord InsCurr in m_InstantaneousCurrentDataRecords)
                    {
                        WriteReading(ChannelsNode, InsCurr.Description, InsCurr.Value, InsCurr.ReadingTime);
                    }
                }

                if (m_MaxDemandRecords.Count > 0)
                {
                    int         iNoMD = 0;
                    DefinedLIDs LIDs  = new DefinedLIDs();

                    ChannelsNode = BuildChannelsNode();

                    string StrMaxDemand    = "Max Demand ";
                    string UnitDescription = "(" + LIDs.DEMAND_MAX_W_DEL.lidDescription + ")";

                    foreach (AMIMDERCD MaxDemadRecord in m_MaxDemandRecords)
                    {
                        iNoMD++;

                        string Description = StrMaxDemand + iNoMD.ToString(CultureInfo.InvariantCulture) + UnitDescription;
                        WriteReading(ChannelsNode, Description, MaxDemadRecord.MaxWattsReceived, MaxDemadRecord.DateOfDemandReset);
                    }
                }

                // If we reach this point, we can assume success
                m_Result = CreateCRFResult.SUCCESS;
            }
            catch (Exception)
            {
                m_Result = CreateCRFResult.PROTOCOL_ERROR;
            }

            return(m_Result);
        }