Exemple #1
0
        public CRstSet CSCompute_1(double startTime_, double endTime_, double buttonX_, double topX_, double buttonY_, double topY_, double length_)
        {
            double ms      = 0;
            double TQDelay = 0;

            //刷新所有时空内的车辆
            RefreshCVicNrs(startTime_, endTime_, buttonX_, topX_, buttonY_, topY_);

            string SQL = "select * from data530_VEH_RECORD where 1=1 ";

            SQL += GenerateQuaSQL_VEHICLE_DEC().Length != 0 ? " and " + GenerateQuaSQL_VEHICLE_DEC() + " " : " ";
            SQL += GenerateQuaSQL(1).Length != 0 ? " and " + GenerateQuaSQL(1) + " " : " ";
            SQL += GenerateQuaSQL(2).Length != 0 ? " and " + GenerateQuaSQL(2) + " " : " ";
            SQL += GenerateQuaSQL(3).Length != 0 ? " and " + GenerateQuaSQL(3) + " " : " ";
            SQL += " and t < ";
            SQL += endTime_.ToString();
            SQL += " and t >= ";
            SQL += startTime_.ToString();
            SQL += " and WorldX <= " + topX_.ToString();
            SQL += " and WorldX > " + buttonX_.ToString();
            SQL += " and WorldY <= " + topY_.ToString();
            SQL += " and WorldY > " + buttonY_.ToString();

            OleDbDataReader dataReader = _easyAccess.ExecuteDataReader(SQL);

            int i = 0;

            if (dataReader.HasRows)
            {
                while (dataReader.Read())
                {
                    ms      += Convert.ToDouble(dataReader.GetValue(Constant.V_MS).ToString());
                    TQDelay += Convert.ToDouble(dataReader.GetValue(Constant.TQ_DELAY).ToString());
                    i++;
                }
            }

            CRstSet rst = new CRstSet(_cVicNrs.Count, 0);

            rst.avaMS      = ms / i;
            rst.avaTQDelay = TQDelay / i;
            rst.density    = _cVicNrs.Count / length_;
            return(rst);
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            BasicInfo basic = new BasicInfo();

            double startTime = Convert.ToDouble(basic.textBox3.Text);
            double endTime   = Convert.ToDouble(basic.textBox4.Text);
            double buttonX   = Convert.ToDouble(basic.textBox6.Text);
            double topX      = Convert.ToDouble((basic.textBox5.Text));
            double buttonY   = Convert.ToDouble(basic.textBox8.Text);
            double topY      = Convert.ToDouble(basic.textBox7.Text);


            double elength = Convert.ToDouble(basic.textBox10.Text);
            double ewidth  = Convert.ToDouble(basic.textBox14.Text);
            double slength = Convert.ToDouble(basic.textBox2.Text);
            double swidth  = Convert.ToDouble(basic.textBox15.Text);
            double nlength = Convert.ToDouble(basic.textBox9.Text);
            double nwidth  = Convert.ToDouble(basic.textBox1.Text);
            double wlength = Convert.ToDouble(basic.textBox11.Text);
            double wwidth  = Convert.ToDouble(basic.textBox12.Text);
            double length  = (elength + slength + nlength + wlength) / 4;

            double tstep = Convert.ToDouble(this.textBox8.Text);

            double space        = elength * (ewidth - 3) + wlength * (wwidth - 3) + nlength * (nwidth - 3) + slength * (swidth - 3) + wwidth * ewidth;
            double _totalvolume = (endTime - startTime) * space;

            CRstSet rst               = _citySmart.CSCompute_Efficiency(startTime, endTime, buttonX, topX, buttonY, topY, tstep, _totalvolume);
            string  stats_car         = PrivateRound(rst.carNum, 4).ToString();
            string  stats_v           = PrivateRound(rst.avaMS, 4).ToString();
            string  stats_delay       = PrivateRound(rst.avaTQDelay, 4).ToString();
            string  steingstats_queue = PrivateRound(rst.density * 1000, 4).ToString();

            this.textBox10.Text = Convert.ToString(rst.utilization * 100);
            double carnumber = Convert.ToDouble(stats_car);

            this.textBox9.Text = Convert.ToString(rst.utilization * 100 / carnumber);
        }