Ejemplo n.º 1
0
        public void CreateGraphReads()
        {
            if (!mIsMidCycleStartAllowed)
            {
                GraphStart = InterruptionCycle.GetNextCycleStart(_DataReads[0].UTCTime);
            }
            else
            {
                GraphStart = _DataReads[0].UTCTime;
            }
            GraphEnd = GraphStart.AddSeconds(InterruptionCycle.Length.TotalSeconds * mNumCycles);

            int      setPosition;
            DateTime time, lastAdded = new DateTime();
            double   readValue;
            bool     hasReachedEnd = false;
            bool     repeatToFill  = false;
            TimeSpan offset        = new TimeSpan();

            do
            {
                for (int i = 0; i < _DataReads.Count; ++i)
                {
                    time      = _DataReads[i].UTCTime.Add(offset);
                    readValue = _DataReads[i].Value;

                    if (time >= GraphStart && time <= GraphEnd && time > lastAdded)
                    {
                        setPosition = InterruptionCycle.GetSetPosition(time);
                        mGraphReads[setPosition].Add(new GraphRead(readValue,
                                                                   InterruptionCycle.GetGraphTime(GraphStart, time, mNumCycles)));
                        lastAdded = time;
                    }
                    if (time > GraphEnd)
                    {
                        hasReachedEnd = true;
                    }
                }
                offset = offset.Add(InterruptionCycle.Length);
            } while (!hasReachedEnd && repeatToFill);
        }