Пример #1
0
        void SerialDataReceived(object sender, SerialDataReceivedEventArgs e, byte[] bits)
        {
            Control con = ActiveControl;

            if (con is TextBox tb)
            {
                _serialRecvBuf += Encoding.Default.GetString(bits);
                if (_serialRecvBuf.Contains("\n"))
                {
                    _serialRecvBuf = _serialRecvBuf.Trim();
                    Invoke((EventHandler) delegate {
                        txtBoxVIN.Text = _serialRecvBuf;
                    });
                    if (_serialRecvBuf.Length == 17)
                    {
                        VI.VIN = _serialRecvBuf;
                        if (_mainCfg.DynoParamIP.Length > 0)
                        {
                            if (_dynoParamRecver != null)
                            {
                                _dynoParamRecver.SendVIN(VI.VIN);
                                _dynoParamRecvFlag.Reset();
                                LoadingForm frmLoading = new LoadingForm();
                                frmLoading.BackgroundWorkAction = () => {
                                    frmLoading.CurrentMsg = new KeyValuePair <int, string>(50, "正在从MES获取测功机参数。。。");
                                    _dynoParamRecvFlag.WaitOne(_mainCfg.RecvTimeout, false);
                                    frmLoading.CurrentMsg = new KeyValuePair <int, string>(50, "测功机参数获取结束");
                                };
                                frmLoading.ShowDialog();
                            }
                            else
                            {
                                _log.TraceError("_dynoParamRecver is null");
                                MessageBox.Show("测功机参数服务端软件接口未实例化", "初始化错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            _carID = _db.GetEmissionInfoFromVIN(VI.VIN, EI);
                            FillInputTextBox();
                        }
                        _serialRecvBuf = string.Empty;
                        if (chkBoxAutoStart.Checked)
                        {
                            btnStart.PerformClick();
                        }
                    }
                }
            }
        }
Пример #2
0
        public TSIForm(string VIN, DynoCmd dynoCmd, MainSetting mainCfg, ModelLocal db, EnvironmentData envData, Logger log)
        {
            InitializeComponent();
            _lastHeight = Height;
            _VIN        = VIN;
            _dynoCmd    = dynoCmd;
            _mainCfg    = mainCfg;
            _db         = db;
            _envData    = envData;
            _log        = log;
            EmissionInfo ei = new EmissionInfo();

            _db.GetEmissionInfoFromVIN(_VIN, ei);
            _RatedRPM = ei.RatedRPM;

            _dtRealTime = new DataTable("TSIRealTime");
            _dtRealTime.Columns.Add("VIN");
            _dtRealTime.Columns.Add("StartTime");
            _dtRealTime.Columns.Add("TimeSN");
            _dtRealTime.Columns.Add("Step");
            _dtRealTime.Columns.Add("RPM");
            _dtRealTime.Columns.Add("CurrentStageTime");
            _dtRealTime.Columns.Add("Lambda");
            _dtRealTime.Columns.Add("OilTemp");
            _dtRealTime.Columns.Add("HResult");
            _dtRealTime.Columns.Add("LResult");

            _resultData = new TSIResultData();

            _timer           = new System.Timers.Timer(_mainCfg.RealtimeInterval);
            _timer.Elapsed  += OnTimer;
            _timer.AutoReset = true;

            f_result = new TSIResultForm();
        }
Пример #3
0
        public LugdownForm(string VIN, DynoCmd dynoCmd, MainSetting mainCfg, ModelLocal db, EnvironmentData envData, Logger log)
        {
            InitializeComponent();
            _lastHeight = Height;
            _VIN        = VIN;
            _dynoCmd    = dynoCmd;
            _mainCfg    = mainCfg;
            _db         = db;
            _envData    = envData;
            _log        = log;
            EmissionInfo ei = new EmissionInfo();

            _db.GetEmissionInfoFromVIN(_VIN, ei);
            _RatedRPM     = ei.RatedRPM;
            _MaxRPM       = -1;
            _canGetMaxRpm = false;

            _dtRealTime = new DataTable("LugdownRealTime");
            _dtRealTime.Columns.Add("VIN");
            _dtRealTime.Columns.Add("StartTime");
            _dtRealTime.Columns.Add("TimeSN");
            _dtRealTime.Columns.Add("RPM");
            _dtRealTime.Columns.Add("Speed");
            _dtRealTime.Columns.Add("Power");
            _dtRealTime.Columns.Add("Torque");
            _dtRealTime.Columns.Add("K");
            _dtRealTime.Columns.Add("CO2");
            _dtRealTime.Columns.Add("NOx");

            _resultData = new LDResultData();

            _timer           = new System.Timers.Timer(_mainCfg.RealtimeInterval);
            _timer.Elapsed  += OnTimer;
            _timer.AutoReset = true;

            f_result = new LDResultForm();
        }