Ejemplo n.º 1
0
        public void testLoop()
        {
            while (testwasstopped == false && K2700frontSwitchOn == true && TCPconnected == true)
            {
                if (Properties.Settings.Default.savedTestSignalMode == "Chamber controlled" && chamberProgramStarted == false)
                {
                    performChamberStartStatus();
                    if (digitalChannelStart == "1\r\n")
                    {
                        chamberProgramStarted = true;
                    }
                    Thread.Sleep(5000);
                }
                else if (Properties.Settings.Default.savedTestSignalMode == "Chamber controlled" && chamberProgramStarted == true)
                {
                    performChamberStartStatus();
                    if (digitalChannelStart == "0\r\n")
                    {
                        chamberProgramStarted = false;
                        TestAbortedEventArgs testFinished = new TestAbortedEventArgs(true);
                        TestAborted(this, testFinished);
                    }
                }

                if (Properties.Settings.Default.savedTestSignalMode == "Chamber controlled" && chamberProgramStarted == true || Properties.Settings.Default.savedTestSignalMode == "Timer")
                {
                    for (int i = 0; i < 20 && testwasstopped == false; i++)
                    {
                        if (testSample[i] != null)
                        {
                            performVoltageMeasurementOnChannel(Int32.Parse(testSample[i].ChNumber));
                            if (TCPconnected == true)
                            {
                                performTemperatureMeasurement();
                                performHumidityMeasurement();
                                performDigitalChannelMeasurement();
                            }

                            Thread.Sleep(scanRate);

                            processMeasurementData();

                            if ((testSample[i].LowerTestLimit > (int)Convert.ToDouble(measuredCurrent)) || (testSample[i].UpperTestLimit < (int)Convert.ToDouble(measuredCurrent)))
                            {
                                testSample[i].Limitexceeded = true;
                                testSample[i].TestResult    = "Failed";
                            }

                            DataUpdateEventArgs args = new DataUpdateEventArgs(measuredTemp, measuredHum, measuredCurrent, measuredChannel, testSample[i].Limitexceeded);
                            DataUpdated(this, args);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void UpdateGraph(object sender, DataUpdateEventArgs e)
        {
            if (testRunning == true)
            {
                this.Invoke((MethodInvoker) delegate
                {
                    chartBuilder.MeasurementDisplay[e.measuredChannel - 1].Series["Current mA"].Points.AddY(float.Parse(e.measuredCurrent));
                    chartBuilder.MeasurementDisplay[e.measuredChannel - 1].Series["Temperature"].Points.AddY(Int32.Parse(e.measuredTemp));
                    chartBuilder.MeasurementDisplay[e.measuredChannel - 1].Series["Humidity"].Points.AddY(Int32.Parse(e.measuredHum));

                    dataGridViewContainer[e.measuredChannel - 1].Rows.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), e.measuredCurrent, e.measuredTemp, e.measuredHum);

                    if (e.limitexceeded == true)
                    {
                        labels[e.measuredChannel - 1].BackColor = Color.Red;
                    }
                });
            }
        }