Exemplo n.º 1
0
        private void loadMainLineVD(DevcieManager devMgr)
        {
            foreach (DeviceBaseWrapper dev in devMgr.getDataDeviceEnum())
            {
                try
                {
                    if (dev is VDDeviceWrapper)
                    {
                        VDDeviceWrapper vddev = dev as VDDeviceWrapper;
                        if (dev.location == "F" || dev.location == "H" || dev.location == "T")
                        {
                            //  dictVD.Add(dev.deviceName,  vddev);
                            if (!CanTriggerCSLSEvent(vddev))
                                continue;
                            vddev.OnCSLSControlEvent += new CSLSControlEventHandler(vddev_OnCSLSControlEvent);

                        }
                    }
                }
                catch (Exception ex)
                {
                    ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
                }

            }
            ConsoleServer.WriteLine("速限管理啟動完成!");
        }
Exemplo n.º 2
0
 public CSLSControlEventManager(DevcieManager devMgr)
 {
     loadMainLineVD(devMgr);
 }
Exemplo n.º 3
0
        public void PostInitial()
        {
            //I_MFCC_VD robj =(I_MFCC_VD) RemoteBuilder.GetRemoteObj(typeof(I_MFCC_VD),
               //    RemoteBuilder.getRemoteUri("192.168.22.89",(int) RemotingPortEnum.MFCC_VD1, "MFCC_VD"));

               //robj.setRealTime("VD231", 1, 0, 1);
               ConsoleServer.WriteLine("設備管理啟動中......!");
               device_mgr = new Host.TC.DevcieManager(mfcc_mgr);
               ConsoleServer.WriteLine("設備管理啟動完成!");
               line_mgr = new LineManager();
               output_device_fetch_mgr = new OutputDevicFetchManager(this.device_mgr);

               FiveMinTask = new FiveMinTask();

               OneMinTask = new OneMinTask();

               avimgr = new Host.AVI.AVIManager();
               etcmgr = new Host.ETC.ETC_Manager();

               tmr1min.Start();
               System.Threading.Thread.Sleep(10000);

               getinitVd5minData();

               event_mgr = new Host.Event.EventManager();

               moving_construct_mgr = new Host.Event.MovingConstruct.MovingConstructManager();
               jammgr = new Host.Event.Jam.JamManager(device_mgr);
               tem_mgr = new Host.Event.TEM.TemManager();
               route_mgr = new Host.Event.Redirect.RouteRedirectManager();

            #if DEBUG
               //    RemoteInterface.HC.FetchDeviceData[] d = output_device_fetch_mgr.Fetch(new string[] { "CMS" }, "N1",150000, 174200);
               //    jammgr.DoVD_InteropData("VD-N6-E-17.6", System.DateTime.Now.AddSeconds(-System.DateTime.Now.Second));
               //  jammgr.DoVD_InteropData( "VD-N6-E-18.0", System.DateTime.Now.AddSeconds(-System.DateTime.Now.Second));

            #endif

               weather_mgr = new Host.Event.Weather.WeatherManager();
               iid_mgr = new Host.Event.IID.IIDManager();
        }
Exemplo n.º 4
0
        private void loadRampVD(DevcieManager devMg)
        {
            OdbcConnection cn = new OdbcConnection(Global.Db2ConnectionString);
            #if !DEBUG
               OdbcCommand cmd =new OdbcCommand( "select degree_vd,location_r,direction,lineid,divisionid,divisionname,mileage,degree_lane,g_code_id,RGSDeviceName from vwrampDegree where location_r='O'  or location_r='I' ");
            #else
               OdbcCommand cmd = new OdbcCommand("select degree_vd,location_r,direction,lineid,divisionid,divisionname,mileage,degree_lane,g_code_id,RGSDeviceName from vwrampDegree where location_r='O' ");

            #endif

               try
               {
               cn.Open();
               cmd.Connection = cn;
               OdbcDataReader rd = cmd.ExecuteReader();
               while (rd.Read())
               {
                   try
                   {
                       string devname, location_r, lineid, divisionid, divisionname, divisiontype, direction,rgs_devicename;
                       int mile_m,laneid,g_code_id;
                       devname = rd[0].ToString();
                       location_r = rd[1].ToString();
                       direction = rd[2].ToString();
                       lineid = rd[3].ToString();
                       divisionid = rd[4].ToString();
                       divisionname = rd[5].ToString();
                     //  divisiontype = rd[6].ToString();
                       mile_m = System.Convert.ToInt32(rd[6]);
                       laneid = System.Convert.ToInt32(rd[7]);

                       if (!rd.IsDBNull(8))
                           g_code_id = System.Convert.ToInt32(rd[8]);  // for MetroNetwork
                       else
                           g_code_id = -1;

                       if (!rd.IsDBNull(9))
                           rgs_devicename = rd[9].ToString();
                       else
                           rgs_devicename = null;

                       RampVDData rvddata = new RampVDData(devname, lineid, direction, divisionid, divisionname, location_r,devMg[devname] as TC.VDDeviceWrapper,mile_m,laneid,g_code_id,rgs_devicename);

                       this.rampVDDataList.Add(rvddata);

                       rvddata.OnEvent += new EventHandler(rvddata_OnEvent);

                   }
                   catch (Exception ex1)
                   {
                       ConsoleServer.WriteLine(ex1.Message + "," + ex1.StackTrace);
                   }

               }
               }
               catch (Exception ex)
               {
               ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
               }
               finally
               {
               cn.Close();
               }
        }
Exemplo n.º 5
0
        private void loadMainLineVD(DevcieManager devMgr)
        {
            foreach (DeviceBaseWrapper dev in devMgr.getDataDeviceEnum())
               {
               if (dev is VDDeviceWrapper)
               {
                   if (!lines.Contains(dev.lineid + "-" + dev.direction))
                   {
                       lines.Add(dev.lineid + "-" + dev.direction, ArrayList.Synchronized(new System.Collections.ArrayList()));
                       lineJamRanges.Add(dev.lineid + "-" + dev.direction, ArrayList.Synchronized(new System.Collections.ArrayList()));
                       lineDegree2and1JamRanges.Add(dev.lineid + "-" + dev.direction, ArrayList.Synchronized(new System.Collections.ArrayList()));
                   }

                   if (dev.location == "F" || dev.location == "H" || dev.location == "T")
                   {
                       htVDDevices.Add(dev.deviceName, dev);
                        ((ArrayList)lines[dev.lineid + "-" + dev.direction]).Add(dev);
                   }

               }
               }

               IDictionaryEnumerator ie = lines.GetEnumerator();  //取得所有的路線
               while (ie.MoveNext())
               {
               ((ArrayList)ie.Value).Sort();   //排序所有的車輛偵測器

               ArrayList vdlist = (ArrayList)ie.Value;
               if (vdlist.Count == 1)
                   (vdlist[0] as DeviceBaseWrapper).AryInx = 0;

               // 填上前後車輛偵測器鏈結
               if (vdlist.Count > 1)
                   for (int i = 0; i < vdlist.Count; i++)
                   {
                       ((DeviceBaseWrapper)vdlist[i]).AryInx = i;

                       if (i == 0)
                           ((DeviceBaseWrapper)vdlist[i]).NextDevice = vdlist[i + 1] as DeviceBaseWrapper;
                       else if (i == vdlist.Count - 1)
                           ((DeviceBaseWrapper)vdlist[i]).PreDevice = vdlist[i - 1] as DeviceBaseWrapper;
                       else
                       {
                           ((DeviceBaseWrapper)vdlist[i]).PreDevice = vdlist[i - 1] as DeviceBaseWrapper;
                           ((DeviceBaseWrapper)vdlist[i]).NextDevice = vdlist[i + 1] as DeviceBaseWrapper;
                       }

                   }

               }

               // oneMinTmr.Elapsed += new System.Timers.ElapsedEventHandler(oneMinTmr_Elapsed);
               // oneMinTmr.Start();
               oneMinTmr = new System.Threading.Timer(new System.Threading.TimerCallback(oneMinTmr_Elapsed));
               oneMinTmr.Change(0, 60 * 1000);

               ConsoleServer.WriteLine("壅塞管理啟動完成!");
        }
Exemplo n.º 6
0
 public JamManager(DevcieManager devMgr)
 {
     loadMainLineVD( devMgr);
        loadRampVD( devMgr);
 }
Exemplo n.º 7
0
        public void PostInitial()
        {
            //I_MFCC_VD robj =(I_MFCC_VD) RemoteBuilder.GetRemoteObj(typeof(I_MFCC_VD),
               //    RemoteBuilder.getRemoteUri("192.168.22.89",(int) RemotingPortEnum.MFCC_VD1, "MFCC_VD"));

               //robj.setRealTime("VD231", 1, 0, 1);
               ConsoleServer.WriteLine("設備管理啟動中......!");
               device_mgr = new Host.TC.DevcieManager(mfcc_mgr);
               ConsoleServer.WriteLine("設備管理啟動完成!");

               vd5minavg_mgr = new FiveMinVDAVGDataManager();
            #if DEBUG
               //new HC_FWIS_Robj().RGS_setManualGenericDisplay("RGS-N6-W-0.4",
               // new RGS_GenericDisplay_Data(2, 0, new RGS_Generic_ICON_Data[0],
               //     new RGS_Generic_Message_Data[]{new  RGS_Generic_Message_Data("系統測試",
               //       new System.Drawing.Color[]{System.Drawing.Color.Red,System.Drawing.Color.Red,System.Drawing.Color.Red,System.Drawing.Color.Red},new System.Drawing.Color[]{System.Drawing.Color.Black,System.Drawing.Color.Black,System.Drawing.Color.Black,System.Drawing.Color.Black},0,0)}
               //     , new RGS_Generic_Section_Data[0]),false);
               //(this.device_mgr["RGS-N6-W-0.4"].getRemoteObj() as I_MFCC_RGS).setGenericDisplay("RGS-N6-W-0.4",
               // new RGS_GenericDisplay_Data(2, 0, new RGS_Generic_ICON_Data[0],
               //     new RGS_Generic_Message_Data[]{new  RGS_Generic_Message_Data("系統測試",
               //       new System.Drawing.Color[]{System.Drawing.Color.Red,System.Drawing.Color.Red,System.Drawing.Color.Red,System.Drawing.Color.Red},new System.Drawing.Color[]{System.Drawing.Color.Black,System.Drawing.Color.Black,System.Drawing.Color.Black,System.Drawing.Color.Black},0,0)}
               //     , new RGS_Generic_Section_Data[0]));
               //    RemoteInterface.HC.FetchDeviceData[] d = output_device_fetch_mgr.Fetch(new string[] { "CMS" }, "N1",150000, 174200);
               //    jammgr.DoVD_InteropData("VD-N6-E-17.6", System.DateTime.Now.AddSeconds(-System.DateTime.Now.Second));
               //  jammgr.DoVD_InteropData( "VD-N6-E-18.0", System.DateTime.Now.AddSeconds(-System.DateTime.Now.Second));
            #endif
               this.rgs_polygon_section_mapping = new RGS_PolygonSectionMapping();
               line_mgr = new LineManager();

               output_device_fetch_mgr = new OutputDevicFetchManager(this.device_mgr);

               //    output_device_fetch_mgr.Fetch(new string[] { "RMS" }, "N6" , "W", 35000, 1, 0, false);

            #if !DEBUG
               FiveMinTask = new FiveMinTask();

               //    OneMinTask = new OneMinTask();
              // avimgr = new Host.AVI.AVIManager();
             //  etcmgr = new Host.ETC.ETC_Manager();  //2014-5-14 停用
            #endif
               etcmgr = new Host.ETC.ETC_Manager();
            OneMinTask = new OneMinTask();
               avimgr = new Host.AVI.AVIManager();
               tmr1min.Start();
               System.Threading.Thread.Sleep(10000);

            #if DEBUG
               //{
               //    string ret = "";
               //    try
               //    {
               //        ret = "FiveMinQueueCnt:" + Program.matrix.vd5minavg_mgr.VDFiveMinQueueCnt;
               //        foreach (DeviceBaseWrapper dev in Program.matrix.device_mgr.getDataDeviceEnum())
               //        {
               //            if (dev is VDDeviceWrapper)
               //            {
               //                VDDeviceWrapper vddev = dev as VDDeviceWrapper;
               //                ret += vddev.ToString() + "\r\n";

               //            }
               //        }

               //     Console.WriteLine(ret);
               //    }
               //    catch (Exception ex)
               //    {
               //        throw new RemoteException(ex.Message + "," + ex.StackTrace);
               //    }
               //}
               //int vol=0,spd=0,occ=0,level=0,ttime=0,lttime=0,httime=0;
               //this.line_mgr["N3"].getAllTrafficData("N", 224700, 231400, ref vol, ref spd, ref occ, ref level, ref ttime, ref lttime, ref httime);
            #endif
               event_mgr = new Host.Event.EventManager();

            #if DEBUG

            #else
               cctvmgr = new CCTV.CCTV_Manager();

               moving_construct_mgr = new Host.Event.MovingConstruct.MovingConstructManager();
              // moving_construct_mgr.setEvent(1,"test",DateTime.Now,"N1","S",15000,16000,16,"0001","TEST","Y" );
               //moving_construct_mgr.setEvent(1, "test", DateTime.Now, "N1", "S", 16000, 17000, 16, "0001", "TEST", "Y");
             //  moving_construct_mgr.CloseMovingConstructEvent(1);
            #endif
               jammgr = new Host.Event.Jam.JamManager(device_mgr);
            #if DEBUG
               //Program.initRemoteInterface();
               //Console.ReadKey();
               route_mgr74 = new Host.Event.Redirect74.RouteRedirectManagerT74();
               route_mgr = new Host.Event.Redirect.RouteRedirectManager();
               metro_network_mgr = new Event.MetroNetwork.MetroNetworkManager();
            #endif
            #if !DEBUG
               tem_mgr = new Host.Event.TEM.TemManager();

               rampctl_mgr = new Event.RampControl.RampControl_Manager();
               metro_network_mgr = new Event.MetroNetwork.MetroNetworkManager();
               route_mgr74 = new Host.Event.Redirect74.RouteRedirectManagerT74();
               route_mgr = new Host.Event.Redirect.RouteRedirectManager();
               ltr_mgr = new Event.LTR.LTR_Manager();

               weather_mgr = new Host.Event.Weather.WeatherManager();

               iid_mgr = new Host.Event.IID.IIDManager();
               svcarea_mgr = new Event.ServiceArea.ServiceAreaManager();
               csls_mgr = new Event.CSLSControl.CSLSControlEventManager(device_mgr);
            #endif
               Program.initRemoteInterface();
               try
               {
               WebService.SendSMS("0988163835", "host is online!");
               }
               catch(Exception ex) {

               Console.WriteLine(ex.Message + "," + ex.StackTrace);
               ;}
            #if !DEBUG
               try
               {
               WebService.SendSMS("0932500190", "host is online!");
               }
               catch { ;}
               try
               {
               WebService.SendSMS("0919712057", "host is online!");
               }
               catch { ;}
            #endif

            #if DEBUG
               //RemoteInterface.HC.I_HC_Comm rrobj = (RemoteInterface.HC.I_HC_Comm)RemoteInterface.RemoteBuilder.GetRemoteObj(typeof(RemoteInterface.HC.I_HC_Comm),
               //    RemoteInterface.RemoteBuilder.getRemoteUri("10.21.50.224", (int)RemoteInterface.RemotingPortEnum.HOST_FIWS, "Comm"));
               //int pr = 0;
               // rrobj.GetCurrentOutput("CMS-N3-N-123.6", ref pr);
               //(this.device_mgr["RGS-N6-W-0.4"].getRemoteObj() as I_MFCC_RGS).setGenericDisplay("RGS-N6-W-0.4",
               // new RGS_GenericDisplay_Data(2, 0, new RGS_Generic_ICON_Data[0],
               //     new RGS_Generic_Message_Data[]{new  RGS_Generic_Message_Data("系統測試",
               //       new System.Drawing.Color[]{System.Drawing.Color.Red,System.Drawing.Color.Red,System.Drawing.Color.Red,System.Drawing.Color.Red},new System.Drawing.Color[]{System.Drawing.Color.Black,System.Drawing.Color.Black,System.Drawing.Color.Black,System.Drawing.Color.Black},0,0)}
               //     , new RGS_Generic_Section_Data[0]));
               //    RemoteInterface.HC.FetchDeviceData[] d = output_device_fetch_mgr.Fetch(new string[] { "CMS" }, "N1",150000, 174200);
               //    jammgr.DoVD_InteropData("VD-N6-E-17.6", System.DateTime.Now.AddSeconds(-System.DateTime.Now.Second));
               //  jammgr.DoVD_InteropData( "VD-N6-E-18.0", System.DateTime.Now.AddSeconds(-System.DateTime.Now.Second));
            #else
               apid_mgr = new Event.APID.APIDManager();
            #endif
        }