Ejemplo n.º 1
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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        private void InitializeBeamCurrentCompensation()
        {
            string currents = "Measurements.BeamCurrentFeedback.Settings.Elements.Pair[].Current";
            string feedback = "Measurements.BeamCurrentFeedback.Settings.Elements.Pair[].Feedback";

            string[] allCurrents = new FullnameEnumerator(currents, m_Database).ToArray();
            string[] allFeedback = new FullnameEnumerator(feedback, m_Database).ToArray();
            if (!m_Database.Exists("Measurements.BeamCurrentFeedback.Settings.Enabled"))
            {
                throw new KeyNotFoundException("Cannot find beam current feedback compensation data");
            }

            if (allCurrents.Length != allFeedback.Length)
            {
                throw new ArgumentException("Error with beam current feedback compensation array");
            }

            LogRowDataPoint[][] dataCurrent =
                allCurrents.Select(currId => m_Database.GetAllDP(currId).ToArray()).ToArray();
            LogRowDataPoint[][] dataFeedback =
                allFeedback.Select(fbId => m_Database.GetAllDP(fbId).ToArray()).ToArray();

            const string applyFeedbackCompensationId = "Process.CalibrationControl.ApplyBeamFeedbackCompensation";

            LogRowData[]      allApplyTimes = m_Database.GetAll(applyFeedbackCompensationId).ToArray();
            List <LogRowData> applyTimes    = new List <LogRowData>();

            if (!Boolean.Parse(allApplyTimes[0].Value))
            {
                applyTimes.Add(allApplyTimes[0]);
            }
            applyTimes.AddRange(allApplyTimes.Where(p => Boolean.Parse(p.Value)));

            TimeSelectionListBox.Items.AddRange(applyTimes.ToArray());

            TimeSelectionListBox.SelectedValueChanged += (oo, ee) =>
            {
                var      box  = (ListBox)oo;
                var      data = (LogRowData)box.SelectedItem;
                DateTime time = data.TimeStamp;

                GraphsSplitContainer.Panel1.Controls.Clear();

                double[] currentSnapshot  = dataCurrent.GetDataPoints(time).Select(p => p.Value).ToArray();
                var      feedbackSnapshot = dataFeedback.GetDataPoints(time).Select(p => p.Value).ToArray();

                ZedGraphControl zed = CalculatedGraphs.PlotBeamCurrentFeedback(
                    CalculatedGraphs.GetBeamCurrentFeedbackDeviation(currentSnapshot, feedbackSnapshot));
                zed.Dock = DockStyle.Fill;
                zed.IsShowPointValues         = true;
                zed.GraphPane.YAxis.Scale.Max = 3;
                zed.GraphPane.YAxis.Scale.Min = -3;
                zed.AxisChange();

                ZedGraphControl zed2 =
                    CalculatedGraphs.PlotBeamCurrentFeedback(
                        CalculatedGraphs.GetBeamCurrentFeedback(currentSnapshot, feedbackSnapshot));
                zed2.Dock = DockStyle.Fill;
                zed2.GraphPane.YAxis.Title.Text = "feedback (mA)";
                zed2.IsShowPointValues          = true;
                zed2.GraphPane.YAxis.Scale.Max  = 50;
                zed2.GraphPane.YAxis.Scale.Min  = 0;
                zed2.AxisChange();

                var panel = new SplitContainer {
                    Dock = DockStyle.Fill
                };
                GraphsSplitContainer.Panel1.Controls.Add(panel);
                panel.Panel1.Controls.Add(zed2);
                panel.Panel2.Controls.Add(zed);
            };

            TimeSelectionListBox.SelectedIndex = 0;
        }