예제 #1
0
        private void OnTimedEvent(object source, ElapsedEventArgs args)
        {
            if (m_GotDataFinished)
            {
                HandleTimer();
                return;
            }

            // we use the timer to update our data.
            TimeSpan elapsedTime = DateTime.UtcNow - m_AcquisitionOnTime;

            if (elapsedTime.TotalMilliseconds > m_DataPointSetInterval.TotalMilliseconds * (m_PacketIndex + 1))
            {
                Int32 numberOfSpectraToGenerate = Convert.ToInt32((elapsedTime.TotalMilliseconds - m_DataPointSetInterval.TotalMilliseconds * (m_DataIndex + 1)) / m_DataPointSetInterval.TotalMilliseconds);
                for (int indexSpectrum = 0; indexSpectrum < numberOfSpectraToGenerate; indexSpectrum++)
                {
                    // in minutes
                    double dCurrentTime = m_AcquisitionOnRetention + (double)m_DataIndex / m_RateProperty.Value.Value / 60.0;
                    m_ChannelTimeProperty.Update(dCurrentTime);
                    int signal = ChannelTestDriver.CurrentDataValue(dCurrentTime);
                    for (int indexDataPoint = 0; indexDataPoint < m_MyCmDevice.MaximumNumberOfDataPoints; indexDataPoint++)
                    {
                        m_Spectrum[indexDataPoint] = signal;
                    }
                    m_DataIndex++;
                    m_MyCmDevice.UpdateData(false, m_DataIndex, m_Spectrum);

                    // update the total number of spectra already acquired
                    m_SpectraIndexProperty.Update(m_DataIndex);
                }
                m_PacketIndex++;
            }
            HandleTimer();
        }
예제 #2
0
        private void OnTimedEvent(object source, ElapsedEventArgs args)
        {
            if (m_GotDataFinished)
            {
                HandleTimer();
                return;
            }
            // we use the timer to update our data.
            TimeSpan elapsedTime = DateTime.UtcNow - m_AcquisitionOnTime;

            if (elapsedTime.TotalMilliseconds > m_DataPointInterval.TotalMilliseconds * (m_PacketIndex + 1))
            {
                // create as many data points as necessary
                Int32 numberOfDataPointsToGenerate = Convert.ToInt32((elapsedTime.TotalMilliseconds - m_DataPointInterval.TotalMilliseconds * (m_DataIndex + 1)) / m_DataPointInterval.TotalMilliseconds);
                m_DataPacket = new int[numberOfDataPointsToGenerate];
                for (int i = 0; i < numberOfDataPointsToGenerate; i++)
                {
                    // in minutes
                    double dCurrentTime = m_AcquisitionOnRetention + (double)m_DataIndex / m_RateProperty.Value.Value / 60.0;
                    m_ChannelTimeProperty.Update(dCurrentTime);
                    m_DataPacket[i] = ChannelTestDriver.CurrentDataValue(dCurrentTime);
                    m_DataIndex++;
                }

                // update the total number of data points already acquired
                m_DataIndexProperty.Update(m_DataIndex);
                m_PacketIndex++;
                m_MyCmDevice.UpdateData(0, m_DataPacket);
            }

            HandleTimer();
        }