Пример #1
0
 internal QueuedReadRequest(string itemID, int startIndex, int count, int batchSize, QueuedReadRequestEventHandler callback)
 {
     BatchSize  = batchSize;
     ItemID     = itemID;
     StartIndex = startIndex;
     Count      = count;
     Callback   = callback;
     Data       = null;
 }
Пример #2
0
        /// <summary>
        /// Get the time from the build starts to the heating ends
        /// </summary>
        /// <param name="db"></param>
        /// <param name="startTime">Time when build is started</param>
        /// <returns></returns>
        public static TimeSpan?GetHeatTime(IItemDatabase db, DateTime startTime)
        {
            LogRowDataPoint dataPoint = db.GetAllDP("Process.ProcessManager.HeatStartPlateDone").FirstOrDefault(p => (p.TimeStamp >= startTime && p.Value > 0.5));

            if (dataPoint == null)
            {
                return(null);
            }

            return(dataPoint.TimeStamp - startTime);
        }
Пример #3
0
        /// <summary>
        /// Get the time from the build start time until bottom temperature reached 100 degrees
        /// </summary>
        /// <param name="db"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime">Time when build is stopped</param>
        /// <returns></returns>
        public static TimeSpan?GetTotalBuildTime(IItemDatabase db, DateTime startTime, DateTime endTime)
        {
            LogRowDataPoint dataPoint = db.GetFirstItemDP("OPC.Temperature.BottomTemperature", p => (p.TimeStamp >= endTime && p.Value <= 110d));

            if (dataPoint == null)
            {
                dataPoint = db.GetLastItemDP("OPC.Temperature.BottomTemperature");
            }

            return(dataPoint.TimeStamp - startTime);
        }
Пример #4
0
        /// <summary>
        /// Get the time from the build end time until bottom temperature reached 100 degrees
        /// </summary>
        /// <param name="db"></param>
        /// <param name="endTime">Time when build is stopped</param>
        /// <returns></returns>
        public static TimeSpan?GetCoolingDownTime(IItemDatabase db, DateTime endTime)
        {
            LogRowDataPoint dataPoint = db.GetAllDP("OPC.Temperature.BottomTemperature").FirstOrDefault(p => (p.TimeStamp >= endTime && p.Value <= 110d));

            if (dataPoint == null)
            {
                return(null);
            }

            return(dataPoint.TimeStamp - endTime);
        }
Пример #5
0
        public void GetItemRange(string itemId, out DateTime from, out DateTime to)
        {
            int count = m_LogIndexes.GetItemRowCount(itemId);

            LogRowDataPoint f = m_LogDataCache.GetDataPoint(m_LogIndexes.GetItemRow(itemId, 0));

            LogRowDataPoint t = f;

            if (count > 1)
            {
                t = m_LogDataCache.GetDataPoint(m_LogIndexes.GetItemRow(itemId, count - 1));
            }

            from = f.TimeStamp;
            to   = t.TimeStamp;
        }
Пример #6
0
        /// <summary>
        /// Get the time from the first layer until Internal Process State not running
        /// </summary>
        /// <param name="db"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public static TimeSpan?GetMeltTime(IItemDatabase db, DateTime startTime, DateTime endTime)
        {
            LogRowDataPoint processStopped = db.GetLastItemDP("Process.ProcessManager.InternalProcessStop",
                                                              p => p.TimeStamp > startTime && p.Value >= 0.5);

            if (processStopped == null)
            {
                return(null);
            }

            LogRowDataPoint firstLayer = db.GetFirstItemDP("Beam.LayerThickness", p => p.TimeStamp >= startTime && p.TimeStamp <= endTime && p.Value > 0);

            if (firstLayer == null)
            {
                return(null);
            }
            //throw new ApplicationException("Did not find the time of the first layer in the log file.");

            return(processStopped.TimeStamp - firstLayer.TimeStamp);
        }
Пример #7
0
        /// <summary>
        /// Get the end time of the build.
        /// </summary>
        /// <param name="db"></param>
        /// <param name="buildEnd"></param>
        /// <param name="completed"></param>
        /// <remarks>
        /// Will return the timestamp of the following in prioritized order:
        /// 1. Build is done, completed is set to true
        /// 2. Build is crashed.
        /// 3. Time of the last action in the log file.
        /// 4. Time of the last task.
        /// </remarks>
        public static void GetBuildEnd(IItemDatabase db, out DateTime buildEnd, out bool completed)
        {
            LogRowDataPoint buildDone    = db.GetLastItemDP("Process.ProcessManager.BuildDone", x => x.Value == 1);
            LogRowDataPoint buildCrashed = db.GetLastItemDP("Process.ProcessManager.BuildCrashed", x => x.Value == 1);

            LogRowDataPoint stopProcess = db.GetLastItemDP("Process.ProcessManager.StopProcess", x => x.Value == 1);
            LogRowDataPoint lastTask    = db.GetLastItemDP("Process.ProcessManager.Task");

            LogRowDataPoint lastMeltAction = db.GetLastItemDP("Process.ProcessManager.Action");

            completed = false;

            if (buildDone != null && buildDone.Value == 1)
            {
                buildEnd  = buildDone.TimeStamp;
                completed = true;
            }
            else if (buildCrashed != null && buildCrashed.Value == 1)
            {
                buildEnd = buildCrashed.TimeStamp;
            }
            else if (lastMeltAction != null)
            {
                buildEnd = lastMeltAction.TimeStamp;
            }
            else if (stopProcess != null)
            {
                buildEnd = stopProcess.TimeStamp;
            }
            else if (lastTask != null)
            {
                buildEnd = lastTask.TimeStamp;
            }
            else
            {
                throw new ApplicationException("End of build not found.");
            }
        }
Пример #8
0
        public IEnumerable <LogRowDataPoint> GetDataPoints(IEnumerable <LogRowIndex> indexes)
        {
            foreach (LogRowIndex logRowIndex in indexes)
            {
                if (!m_DataPointCache.TryGetValue(logRowIndex.RowStart, out var reference))
                {
                    LogRowDataPoint point = LogRowDataFactory.CreateDataPoint(m_PagedReader, logRowIndex);
                    reference = new WeakReference(point);
                    m_DataPointCache.Add(logRowIndex.RowStart, reference);
                }

                LogRowDataPoint dataPoint = reference.Target as LogRowDataPoint;

                //Reload data point
                if (dataPoint == null)
                {
                    dataPoint        = LogRowDataFactory.CreateDataPoint(m_PagedReader, logRowIndex);
                    reference.Target = dataPoint;
                }

                yield return(dataPoint);
            }
        }
Пример #9
0
        /// <summary>
        /// Returns true if request is full filled
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        public bool Add(LogRowDataPoint point)
        {
            m_dataPoints.Add(point);

            return(m_dataPoints.Count == m_request.BatchSize);
        }