예제 #1
0
        /// <summary>
        /// Converts the interval status to string format.
        /// </summary>
        /// <param name="CurrentInterval">The interval to convert.</param>
        /// <returns>The interval status in string format.</returns>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 10/06/08 RCG 2.00.00 N/A    Created
        // 02/19/09 jrf 2.10.05 127954 Making change to time adjust interval statuses
        //                             to be consistent with changes being made to firmware.

        private string ConvertIntervalStatus(LPIntervalDataRecord CurrentInterval)
        {
            string strStatus = "";
            ExtendedIntervalStatus CurrentStatus = (ExtendedIntervalStatus)CurrentInterval.IntervalStatus;

            if ((CurrentStatus & ExtendedIntervalStatus.DSTChange) == ExtendedIntervalStatus.DSTChange)
            {
                strStatus += "D";
            }

            if ((CurrentStatus & ExtendedIntervalStatus.PowerFailure) == ExtendedIntervalStatus.PowerFailure)
            {
                strStatus += "O";
            }

            //Only show one A for either a backwards or forwards time adjust.
            if ((CurrentStatus & ExtendedIntervalStatus.ClockAdjustForward) == ExtendedIntervalStatus.ClockAdjustForward)
            {
                strStatus += "A";
            }
            else if ((CurrentStatus & ExtendedIntervalStatus.ClockAdjustBackward) == ExtendedIntervalStatus.ClockAdjustBackward)
            {
                strStatus += "A";
            }

            return(strStatus);
        }
예제 #2
0
        /// <summary>
        /// Adds all of the intervals in the specified blocks.
        /// </summary>
        /// <param name="loadProfileData">The load profile object to add the intervals to.</param>
        /// <param name="loadProfileBlocks">The load profile blocks to add.</param>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 10/06/08 RCG 2.00.00 N/A    Created

        private void AddIntervals(ref LoadProfileData loadProfileData, LPBlockDataRecord[] loadProfileBlocks)
        {
            for (int iBlock = 0; iBlock < loadProfileBlocks.Length; iBlock++)
            {
                LPBlockDataRecord    CurrentBlock = loadProfileBlocks[iBlock];
                LPIntervalDataRecord LastInterval = CurrentBlock.Intervals[CurrentBlock.Intervals.Length - 1];

                for (int iInterval = 0; iInterval < CurrentBlock.Intervals.Length; iInterval++)
                {
                    LPIntervalDataRecord CurrentInterval = CurrentBlock.Intervals[iInterval];
                    DateTime             IntervalTime;

                    if (iInterval + 1 < CurrentBlock.Intervals.Length)
                    {
                        // Figure out the time of the interval.
                        IntervalTime = DetermineIntervalTime(CurrentBlock, iInterval, loadProfileData.IntervalDuration);
                        IntervalTime = AdjustTimeForDST(IntervalTime, CurrentInterval, CurrentBlock.Intervals[iInterval + 1], LastInterval);
                    }
                    else
                    {
                        // We already know the time of the last interval.
                        IntervalTime = (DateTime)CurrentBlock.BlockEndTime;
                    }

                    loadProfileData.AddInterval(CurrentInterval.IntervalData,
                                                ConvertChannelStatuses(CurrentInterval),
                                                ConvertIntervalStatus(CurrentInterval),
                                                IntervalTime,
                                                DisplayScaleOptions.UNITS);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Converts the channel statuses to string format.
        /// </summary>
        /// <param name="interval">The interval to convert.</param>
        /// <returns>The channel status as strings.</returns>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 10/06/08 RCG 2.00.00 N/A    Created
        // 03/09/11 RCG 2.50.08        Adding Power Restoration status

        private string[] ConvertChannelStatuses(LPIntervalDataRecord interval)
        {
            string[] ChannelStatuses = new string[interval.ChannelStatuses.Length];

            for (int iChannel = 0; iChannel < interval.ChannelStatuses.Length; iChannel++)
            {
                ExtendedChannelStatus CurrentStatus = interval.ChannelStatuses[iChannel];
                string strStatus = "";

                switch (CurrentStatus)
                {
                case ExtendedChannelStatus.Overflow:
                {
                    strStatus = "V";
                    break;
                }

                case ExtendedChannelStatus.Partial:
                {
                    strStatus = "S";
                    break;
                }

                case ExtendedChannelStatus.Long:
                {
                    strStatus = "L";
                    break;
                }

                case ExtendedChannelStatus.Skipped:
                {
                    strStatus = "K";
                    break;
                }

                case ExtendedChannelStatus.Test:
                {
                    strStatus = "T";
                    break;
                }

                case ExtendedChannelStatus.PowerRestoration:
                {
                    strStatus = "SR";
                    break;
                }
                }

                ChannelStatuses[iChannel] = strStatus;
            }

            return(ChannelStatuses);
        }
예제 #4
0
        /// <summary>
        /// Adjusts the time for DST as needed.
        /// </summary>
        /// <param name="intervalTime">The raw time for the current interval.</param>
        /// <param name="currentInterval">The current interval object.</param>
        /// <param name="nextInterval">The next interval object.</param>
        /// <param name="lastInterval">The last interval object.</param>
        /// <returns>The adjusted time.</returns>
        // Revision History
        // MM/DD/YY who Version Issue#          Description
        // -------- --- ------- -------------  ---------------------------------------
        // 10/06/08 RCG 2.00.00 N/A             Created
        // 01/07/09 KRC 2.10.01 itron00124215   Fixed issues with DST time being off
        //
        private DateTime AdjustTimeForDST(DateTime intervalTime, LPIntervalDataRecord currentInterval, LPIntervalDataRecord nextInterval, LPIntervalDataRecord lastInterval)
        {
            DateTime AdjustedTime = intervalTime;

            // Only adjust if DST is enabled in the meter.
            if (DSTEnabled == true)
            {
                // There are two case where we need to adjust. The first and most common is when the
                // current interval's flag does not match the last interval's flag.
                if (IsDSTFlagSet(currentInterval) == true && IsDSTFlagSet(lastInterval) == false)
                {
                    // Adjust the time forward
                    AdjustedTime = AdjustedTime.Add(Table53.DSTAdjustAmount);
                }
                else if (IsDSTFlagSet(currentInterval) == false && IsDSTFlagSet(lastInterval) == true)
                {
                    // Adjust the time backward
                    AdjustedTime = AdjustedTime.Subtract(Table53.DSTAdjustAmount);
                }

                // The second is when the current interval's flag does not match the next since the interval
                // ending at the DST change still has the previous flag.
                if (nextInterval != null && IsDSTFlagSet(currentInterval) == true && IsDSTFlagSet(nextInterval) == false)
                {
                    // Adjust backwards since the current interval end time is really no longer in DST
                    AdjustedTime = AdjustedTime.Subtract(Table53.DSTAdjustAmount);
                }
                else if (nextInterval != null && IsDSTFlagSet(currentInterval) == false && IsDSTFlagSet(nextInterval) == true)
                {
                    // Adjust forwards since the current interval end time is really in DST
                    AdjustedTime = AdjustedTime.Add(Table53.DSTAdjustAmount);
                }
            }

            return(AdjustedTime);
        }
예제 #5
0
        /// <summary>
        /// Gets whether or not the DST flag is set for the specified interval
        /// </summary>
        /// <param name="interval">The interval to check.</param>
        /// <returns>True if the DST flag is set. False otherwise.</returns>
        // Revision History
        // MM/DD/YY who Version Issue# Description
        // -------- --- ------- ------ ---------------------------------------
        // 10/03/08 RCG 2.00.00 N/A    Created

        private bool IsDSTFlagSet(LPIntervalDataRecord interval)
        {
            return((interval.IntervalStatus & ExtendedIntervalStatus.DSTChange) == ExtendedIntervalStatus.DSTChange);
        }