public void Reset()
 {
     ControllerState = ControllerStateEnum.Control;
     Clock.Reset();
     SignalGroups.ForEach(x => x.Reset());
     BlockStructure.Reset();
     Extras.Reset();
 }
示例#2
0
        //加载路网
        private void InitialSystem()
        {
            vis = new Vissim();
            vis.LoadNet(@"E:\vissim4.3\Example\lianglukou.inp", 0);
            vis.Simulation.Resolution = 1;
            vis.Evaluation.set_AttValue("DATACOLLECTION", true); //软件激活datacollection检测器评价
            vis.Evaluation.set_AttValue("TRAVELTIME", true);     //软件激活traveltime检测器评价
            vis.Evaluation.set_AttValue("QUEUECOUNTER", true);   //软件激活queuecounter检测器评价
            vis.Evaluation.set_AttValue("DELAY", true);          //软件激活dealy检测器评价

            //设置各检测器的评价周期


            label15.Text         = "";                                     //仿真步数显示控件初始化
            progressBar1.Minimum = 0;                                      //进度条显示控件最小值设置
            progressBar1.Maximum = Convert.ToInt32(vis.Simulation.Period); //进度条显示控件最大值设置
            //仿真信息表格展示
            VehicleInputs vehins = vis.Net.VehicleInputs;

            listView2.Clear();
            listView2.View          = View.Details;
            listView2.FullRowSelect = true;
            listView2.Columns.Add("交叉口ID", 100, HorizontalAlignment.Center);
            listView2.Columns.Add("延时时间(s)", 100, HorizontalAlignment.Center);
            listView2.Columns.Add("仿真时间(s)", 100, HorizontalAlignment.Center);
            listView2.Columns.Add("输入交通量(pcu)", 100, HorizontalAlignment.Center);
            for (int i = 1; i <= vehins.Count; i++)
            {
                ListViewItem itm = listView2.Items.Add(vehins[i].ID.ToString());
                itm.SubItems.AddRange(new string[] { (vehins[i].AttValue["TIMEFROM"]).ToString(), vis.Simulation.Period.ToString(), (string)(vehins[i].AttValue["VOLUME"]).ToString() });
            }

            //修改vissim中各交叉口信号机周期

            for (int i = 1; i <= 4; i++)
            {
                vis.Net.SignalControllers.GetSignalControllerByNumber(i).AttValue["CYCLETIME"] = infoArr[i - 1];
                groups = vis.Net.SignalControllers[i].SignalGroups;

                for (int j = 1; j <= Convert.ToInt32(groups.Count); j++)
                {
                    group = groups.GetSignalGroupByNumber(j);
                    if (j == 1)
                    {
                        group.AttValue["GREENEND"] = firstgreenArr[i - 1];
                        group.AttValue["REDEND"]   = 0;
                        group.AttValue["AMBER"]    = 3;
                    }
                    else
                    {
                        group.AttValue["GREENEND"] = infoArr[i - 1] - 3;
                        group.AttValue["REDEND"]   = infoArr[i - 1] - secondgreenArr[i - 1] - 3;
                        group.AttValue["AMBER"]    = 3;
                    }
                }
            }
        }