示例#1
0
        // 更新M_N数据
        // 同一工序下,瓦斯浓度变化值N
        private void UpdateMnData()
        {
            if (CurrentProbe == null)
            {
                return;
            }
            var datas  = GasConcentrationProbeData.FindNewRealData(CurrentProbe.ProbeId, 2);
            var time   = datas[0].RecordTime;
            var value  = datas[0].ProbeValue;
            var value1 = datas[1].ProbeValue;

            var valueN = value - value1;

            // 判断是否是最新数据
            if (time != _lastTimeMn && _lastTimeMn != DateTime.MinValue)
            {
                _lastTimeMn = time;

                // 往DGV中填充数据
                dgvData.Rows.Add(value + "%", time);
                if (dgvData.Rows.Count > 0)
                {
                    // 定位滚动条
                    dgvData.FirstDisplayedScrollingRowIndex = dgvData.Rows.Count - 1;

                    // 瓦斯浓度超过安全范围
                    if (value >= YellowDataThreshold && value <= RedDataThreshold)
                    {
                        dgvData.Rows[dgvData.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Yellow;
                    }
                    else if (value > RedDataThreshold)
                    {
                        dgvData.Rows[dgvData.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Red;
                    }
                }

                TeeChartUtil.addSingleData2TeeChart(tChartM, DataCountPerFrame, time, value);
                TeeChartUtil.addSingleData2TeeChart(tChartN, DataCountPerFrame, time, valueN);
            }
            else
            {
                _lastTimeMn = time;
            }
        }
示例#2
0
        private void UpdateT2Data()
        {
            if (T2Probe.ProbeId == string.Empty)
            {
                return;
            }
            var datas  = GasConcentrationProbeData.FindNewRealData(T2Probe.ProbeId, 2);
            var time   = datas[0].RecordTime;
            var value0 = datas[0].ProbeValue;
            var value1 = datas[1].ProbeValue;

            // 判断是否是最新数据
            if (time == _lastTimeT2)
            {
                return;
            }
            _lastTimeT2 = time;

            var value = value1 - value0;

            TeeChartUtil.addSingleData2TeeChart(tChartT2, DataCountPerFrame, time, value);
        }
示例#3
0
        // 更新M_N数据
        // 同一工序下,瓦斯浓度变化值N
        private void updateMNData()
        {
            var datas  = GasConcentrationProbeData.FindNewRealData(currentProbeId, 2);
            var time   = datas[0].RecordTime;
            var time1  = datas[1].RecordTime;
            var value  = datas[0].ProbeValue;
            var value1 = datas[1].ProbeValue;

            var valueN = value - value1;

            // 判断是否是最新数据
            if (time != _LastTimeMN)
            {
                _LastTimeMN = time;

                // 往DGV中填充数据
                _dgvData.Rows.Add(value + "%", time);
                if (_dgvData.Rows.Count > 0)
                {
                    // 定位滚动条
                    _dgvData.FirstDisplayedScrollingRowIndex = _dgvData.Rows.Count - 1;

                    // 瓦斯浓度超过安全范围
                    if (value >= yellowDataThreshold && value <= redDataThreshold)
                    {
                        _dgvData.Rows[_dgvData.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Yellow;
                    }
                    else if (value > redDataThreshold)
                    {
                        _dgvData.Rows[_dgvData.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Red;
                    }
                }

                TeeChartUtil.addSingleData2TeeChart(tChartM, DEFAULT_DATA_SHOW_COUNT, time, value);
                TeeChartUtil.addSingleData2TeeChart(tChartN, DEFAULT_DATA_SHOW_COUNT, time, valueN);
            }
        }
示例#4
0
        /// <summary>
        ///     获取指定探头的最新2行实时数据
        /// </summary>
        /// <param name="iProbeId"></param>
        /// <returns></returns>
        //public static DataSet getLatest2RowsData(string iProbeId)
        //{
        //    StringBuilder sqlStr = new StringBuilder();
        //    sqlStr.Append("SELECT TOP 2 * FROM " + GasConcentrationProbeDataDbConstNames.TABLE_NAME);
        //    sqlStr.Append(" WHERE " + GasConcentrationProbeDataDbConstNames.PROBE_ID + " = " + iProbeId);
        //    sqlStr.Append(" ORDER BY " + GasConcentrationProbeDataDbConstNames.PROBE_DATA_ID + " DESC");

        //    ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GasEmissionDB);
        //    DataSet ds = db.ReturnDS(sqlStr.ToString());
        //    return ds;
        //}
        private void updateT2Data()
        {
            if (_T2Id == string.Empty)
            {
                tChartT2.Header.Text = "该巷道没有设置T2传感器.";
                return;
            }

            var datas  = GasConcentrationProbeData.FindNewRealData(_T2Id, 2);
            var time   = datas[0].RecordTime;
            var value0 = datas[0].ProbeValue;
            var value1 = datas[1].ProbeValue;

            // 判断是否是最新数据
            if (time != _LastTimeT2)
            {
                _LastTimeT2 = time;

                var value = value1 - value0;
                t2DeltaSumValue += value;
                value            = t2DeltaSumValue / ++t2DataCount;
                TeeChartUtil.addSingleData2TeeChart(tChartT2, DEFAULT_DATA_SHOW_COUNT, time, value);
            }
        }