Example #1
0
        //public static string getT2Id(int tunnelId)
        //{
        //    StringBuilder sqlStr = new StringBuilder();
        //    sqlStr.Append("SELECT [PROBE_ID] FROM " + ProbeManageDbConstNames.TABLE_NAME);
        //    sqlStr.Append(" WHERE ");
        //    sqlStr.Append("TUNNEL_ID = " + tunnelId);
        //    sqlStr.Append(" AND [PROBE_NAME]='T2'");

        //    ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GasEmissionDB);
        //    DataSet ds = db.ReturnDS(sqlStr.ToString());
        //    if (ds.Tables[0].Rows.Count <= 0)
        //        return string.Empty;
        //    else
        //    {
        //        return ds.Tables[0].Rows[0][0].ToString();
        //    }
        //}

        #region 实时监控

        /// <summary>
        ///     获取指定探头的最新实时数据
        /// </summary>
        /// <param name="iProbeId"></param>
        /// <returns></returns>
        /// <summary>
        ///     开始按钮Click事件
        ///     原始数据实时监控
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _btnStart_Click(object sender, EventArgs e)
        {
            // 没有选择巷道
            if (tunnelId == Const.INVALID_ID)
            {
                Alert.alert(Const_GE.TUNNEL_NAME_MUST_INPUT);
                return;
            }

            // 没有选择探头
            if (cbxSensors.SelectedIndex < 0)
            {
                Alert.alert(Const_GE.PROBE_MUST_CHOOSE);
                return;
            }

            if (_btnStart.Text == "开始")
            {
                //this.timer2.Enabled = true;

                // 设置TeeChart1(监控系统原始数据M)
                TeeChartUtil.resetTeeChart(tChartM);
                // 设置TeeChart2(T2瓦斯浓度平均增加值Q)
                TeeChartUtil.resetTeeChart(tChartT2);
                // 设置TeeChart3(同一工序条件下瓦斯浓度变化值N)
                TeeChartUtil.resetTeeChart(tChartN);

                // 获取点击开始按钮时候的系统时间
                _StartTime = DateTime.Now;

                _btnStart.Text = "停止";

                timer1.Interval         = 15000;
                DEFAULT_DATA_SHOW_COUNT = 120;

                timer1.Enabled = true;
            }
            else
            {
                _btnStart.Text = "开始";
                timer1.Enabled = false;
            }

            // 清空datagridview
            _dgvData.Rows.Clear();
        }
Example #2
0
        /// <summary>
        ///     开始实时监控
        /// </summary>
        private void StartRealTimeCurveMonitoring()
        {
            // 检查是否选择了巷道和传感器
            if (!Check())
            {
                return;
            }

            // reset Tee Chart

            TeeChartUtil.resetTeeChart(tChartM);  // tChart1, 监控系统原始数据M
            TeeChartUtil.resetTeeChart(tChartT2); // tChart2, T2瓦斯浓度平均增加值Q
            TeeChartUtil.resetTeeChart(tChartN);  // tChart3, 同一工序条件下瓦斯浓度变化值N

            // 清空datagridview
            dgvData.Rows.Clear();

            // 获取指定探头的旧数据 ----------用来填充曲线。
            var dsData = GasConcentrationProbeData.FindHistaryDataTop(CurrentProbe.ProbeId, DataCountPerFrame);

            AddDataSet2TeeChart(tChartM, dsData, "M");
            AddDataSet2TeeChart(tChartN, dsData, "N");
            if (!String.IsNullOrEmpty(T2Probe.ProbeId))
            {
                var ds = GasConcentrationProbeData.FindHistaryDataTop(T2Probe.ProbeId, DataCountPerFrame);
                AddDataSet2TeeChart(tChartT2, ds, "T2");
            }

            if (dgvData.Rows.Count > 0)
            {
                // 定位滚动条
                dgvData.FirstDisplayedScrollingRowIndex = dgvData.Rows.Count - 1;
            }
            // 获取旧数据 ---------- End

            timer1.Enabled = true; // 启动定时器
        }