예제 #1
0
파일: Dut.cs 프로젝트: JaydenChou/TestSuite
        public void Read(TimeSpan elapsedTime, double setpoint, double reference)
        {
            // Only process found or failed DUTs.
            if ((Status == DutStatus.Testing) ||
                (Status == DutStatus.Fail))
            {
                double reading = 0.0;
                string message = string.Empty;

                // If the DUT uses a datalogger...
                if ((_settings?.Label == "Datalogger") && (DutInterface != null))
                {
                    reading = DutInterface.Readings[Index];
                }
                // If the DUT is a G3...
                else if (_sensitG3 != null)
                {
                    _sensitG3.Read();

                    reading = _sensitG3.Readings[VariableType.GasConcentration];
                    message = _sensitG3.Message;
                }
                // If the DUT is a generic serial device...
                else if (_genericSerialDevice != null)
                {
                    _genericSerialDevice.Read();

                    message = _genericSerialDevice.Message;
                }
                // If the DUT is a "manual" device...
                else if (_manual != null)
                {
                    _manual.Read();

                    reading = _manual.Readings[VariableType.GasConcentration];
                }

                // Format data from device.
                var testResult = new TestResults
                {
                    ElapsedTime   = elapsedTime,
                    Setpoint      = setpoint,
                    Reference     = reference,
                    SensorValue   = reading,
                    SensorMessage = message,
                };

                // Save test results to csv file.
                _csv?.WriteRecords(new List <TestResults> {
                    testResult
                });

                // Save the result.
                Results.Add(testResult);
            }
        }
예제 #2
0
        public void Read(TimeSpan elapsedTime, double setpoint, double reference)
        {
            // Only process found or failed DUTs.
            if ((Status == DutStatus.Testing) ||
                (Status == DutStatus.Fail))
            {
                double reading = 0.0;

                // If the DUT uses a datalogger...
                if ((_settings.Label == "Datalogger") && (DutInterface != null))
                {
                    reading = DutInterface.Readings[Index];
                }
                // If the DUT is a G3...
                else if (_sensitG3 != null)
                {
                    _sensitG3.Read();

                    reading = _sensitG3.Readings[VariableType.GasConcentration];
                }
                // If the DUT is a "manual" device...
                else if (_manual != null)
                {
                    _manual.Read();

                    reading = _manual.Readings[VariableType.GasConcentration];
                }

                // Save the result.
                Results.Add(new TestResults
                {
                    ElapsedTime = elapsedTime,
                    Setpoint    = setpoint,
                    Reference   = reference,
                    SensorValue = reading
                });
            }
        }