Esempio n. 1
0
        //overlap type -> switch position
        public ObjOverlap(GENERIC_SYSTEM_PARAMETERS.OVERLAPS.OVERLAP overlap,GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL sig)
        {
            m_Ol = overlap;
            //BMGR-0066
            m_switchPos = GetSwitchPos();

            m_pathLst = new List <PathInfo>();

            m_sig = sig;
        }
Esempio n. 2
0
        public void test_overlapAPI()
        {
            Prepare.ReloadGlobalSydb(".//input//overlapsSydb_FromHHHT2.xml");

            ObjOverlap ovelap = new ObjOverlap(null, null);

            Debug.Assert(true == ovelap.GeneratePath(null));
            Debug.Assert(ovelap.GetSigname() == "Null");

            Dictionary <string, string[]> validoverlaps = new Dictionary <string, string[]>()
            {
                //overlap                   //dstSig  //ibbm   //variant num //olpathInfo
                { "O_S0101", new string[] { "S0101", "VB0101", "0", "" } },
                { "O_S0102", new string[] { "S0102", "VB0102", "0", "" } },
                { "O_S0103", new string[] { "S0103", "VB0103", "0", "S0103" } },
                { "O_S0107", new string[] { "S0107", "VB0107", "2", "S0107|P0101-N S0107|P0101-R" } },
                { "O_S0107_N", new string[] { "S0107", "VB0107", "2", "S0107|P0101-N" } },
                { "O_S0107_R", new string[] { "S0107", "VB0107", "2", "S0107|P0101-R" } },
                { "O_S0107_NOIN", new string[] { "S0107", "VB0107E", "2", "S0107|P0101-R" } },
                { "O_X0109", new string[] { "X0109", "VB0109", "6", "X0109|P0105-R|P0103-R|P0102-R" } },
                { "O_S0304", new string[] { "S0304", "VB0304", "4", "S0304|P0302-N|P0602-N S0304|P0302-N|P0602-R" } },
                { "O_S0304_NOIN", new string[] { "S0304", "VB0304E", "4", "S0304|P0302-N|P0602-R" } },
                { "O_S1101_N", new string[] { "S1101", "VB1101", "4", "S1101|P1101-N|P1103-N" } },
                { "O_S1101_R", new string[] { "S1101", "VB1101", "2", "S1101|P1101-R" } },
                { "O_S0608", new string[] { "S0608", "VB0608", "6", "S0608|P0606-N|P0608-N|P0610-R S0608|P0606-R" } }
            };

            #region check for valid ovelap
            {
                foreach (var ol in sydb.overlapInfoList)
                {
                    if (validoverlaps.ContainsKey(ol.Name))
                    {
                        string signame = validoverlaps[ol.Name][0];
                        GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL sig = (GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL)Sys.GetNode(signame,sydb.signalInfoList.Cast <Node>().ToList());
                        ObjOverlap overlap = new ObjOverlap(ol,sig);
                        Debug.Assert(overlap.GetSigname() == signame);

                        GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON inb = (GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON)Sys.GetNode(validoverlaps[ol.Name][1],sydb.ibbmInfoList.Cast <Node>().ToList());
                        Debug.Assert(true == overlap.GeneratePath(inb));
                        Debug.Assert(validoverlaps[ol.Name][3] == Prepare.getXmlNodeStr(overlap.GetXmlNode(),"/Path/@NAME"));

                        List <Variant> vlist = new List <Variant>();
                        Debug.Assert(true == overlap.CalVariants(vlist));
                        Debug.Assert(vlist.Count.ToString() == validoverlaps[ol.Name][2]);

                        haschecked = true;
                    }
                }
                Debug.Assert(haschecked == true);
                haschecked = false;
            }
            #endregion
        }
Esempio n. 3
0
        public static int GetSigIDInBlock(int blkID, List <int> sigList)
        {
            SyDB sydb  = SyDB.GetInstance();
            var  block = (GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK)Sys.GetNode(blkID, sydb.blockInfoList.Cast <Node>().ToList());

            foreach (int sID in sigList)
            {
                GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL sig = sydb.signalInfoList.Find(x => x.ID == sID);
                if (null != sig && true == SyDB.IsLocatedOnBlock(sig.Kp,sig.Track_ID,block))
                {
                    return(sID);
                }
            }
            return(-1);
        }
Esempio n. 4
0
        void test_splitRoute()
        {
            Prepare.ReloadGlobalSydb(".//input//Routes_fromHHHT2.xml");
            RouteSegConfig SyDBRouteCfg = new RouteSegConfig(sydb);

            Debug.Assert(false == SyDBRouteCfg.splitRoute(null));

            int[] rids = { 183,161,66,76,231 }; //these route has Spacing_Signal_ID_List, 231 has no Spacing_Signal_ID_List also can be test by this
            foreach (int id in rids)
            {                                   //test blockinfo of route has Spacing_Signal_ID_List
                clearlist(SyDBRouteCfg);
                var sydbroute = sydb.routeInfoList.Find(x => x.ID == id);

                Debug.Assert(true == SyDBRouteCfg.splitRoute(sydbroute));

                Debug.Assert(SyDBRouteCfg.m_RouteSpacing_routeLst[0].m_OrgSig.ID == sydbroute.Origin_Signal_ID);         //get RouteSpacing_route start with same sig as 183
                Debug.Assert(SyDBRouteCfg.m_Spacing_routeLst.Count == sydbroute.Spacing_Signal_ID_List.Signal_ID.Count); //get some Spacing_route

                List <StringData> blocks = new List <StringData>();
                SyDBRouteCfg.m_Spacing_routeLst.AddRange(SyDBRouteCfg.m_RouteSpacing_routeLst);
                foreach (var r in SyDBRouteCfg.m_Spacing_routeLst)
                {
                    foreach (var b in r.m_BlkLst)
                    {
                        blocks.Add(b.ID);
                    }
                }

                Debug.Assert(sydbroute.Block_ID_List.Block_ID.All(blocks.Contains));//add all split route blocks == orinal route blocks
            }

            {                                                                                                    //test pointlist of route has no Spacing_Signal_ID_List
                clearlist(SyDBRouteCfg);
                var sydbroute = sydb.routeInfoList.Find(x => x.ID == 231);                                       //this route has no Spacing_Signal_ID_List
                Debug.Assert(true == SyDBRouteCfg.splitRoute(sydbroute));
                Debug.Assert(SyDBRouteCfg.m_RouteSpacing_routeLst[0].m_OrgSig.ID == sydbroute.Origin_Signal_ID); //get RouteSpacing_route same as 231
                GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL dstsig = (GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL)MethodHelper.InvokePrivateMember(SyDBRouteCfg.m_RouteSpacing_routeLst[0],"DstSig");
                Debug.Assert(dstsig.ID == sydbroute.Destination_Signal_ID);
                Debug.Assert(SyDBRouteCfg.m_Spacing_routeLst.Count == 0);//get no Spacing_route
            }
        }
Esempio n. 5
0
        void test_generateRouteSegments()
        {
            Prepare.ReloadGlobalSydb(".//input//Routes_fromHHHT2.xml");
            RouteSegConfig SyDBRouteCfg = new RouteSegConfig(sydb);//this will call RouteSegConfig.generateRouteSegments()

            Debug.Assert(true == SyDBRouteCfg.generateRouteSegments());

            int count      = 0;
            int splitcount = 0;

            foreach (var r in sydb.routeInfoList)
            {
                if (r.IsValidBMRoute())
                {
                    RouteSegment route = SyDBRouteCfg.m_RouteSpacing_routeLst.Find(x => x.m_OrgSig.ID == r.Origin_Signal_ID && x.RouteInfo().ID == r.ID);
                    Debug.Assert(null != route);
                    ++count;
                    splitcount = splitcount + r.Spacing_Signal_ID_List.Signal_ID.Count;
                    foreach (int id in r.Spacing_Signal_ID_List.Signal_ID)
                    {
                        route = SyDBRouteCfg.m_Spacing_routeLst.Find(x => x.m_OrgSig.ID == id && x.RouteInfo().ID == r.ID);
                        Debug.Assert(null != route);
                    }


                    route.CalOverlap(null);

                    GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL dstsig = (GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL)MethodHelper.InvokePrivateMember(route,"DstSig");
                    if (null != dstsig.Overlap_ID)
                    {
                        Debug.Assert(null != route.m_overlap);
                    }
                    else
                    {
                        Debug.Assert(null == route.m_overlap);
                    }
                }
            }
            Debug.Assert(count == SyDBRouteCfg.m_RouteSpacing_routeLst.Count());
            Debug.Assert(splitcount == SyDBRouteCfg.m_Spacing_routeLst.Count());
        }
Esempio n. 6
0
        private void SetRouteSegment(int orgID,int dstID,GENERIC_SYSTEM_PARAMETERS.ROUTES.ROUTE route)
        {
            this.RouteInfo = route;
            GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL orgSig = SyDB.GetInstance().signalInfoList.Find(x => x.ID == orgID);
            GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL dstSig = SyDB.GetInstance().signalInfoList.Find(x => x.ID == dstID);

            if (null == orgSig || null == dstSig)
            {
                throw new Exception($"sydb error:{route.Info} create RouteSegment error. can't find orgsig[{orgID}] or dstsig[{dstID}] in sydb.Signal");
            }

            OrgSig = orgSig;
            DstSig = dstSig;

            if (0 == m_BlkLst.Count())
            {
                throw new Exception($"sydb error:{Info} error. has no block in route");
            }
            m_PtLst = new List <PointInfo>();
            GetPointLstFromBlkLst();
        }
Esempio n. 7
0
 public OriginSignal(GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL signal,GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON.INPUT_SIGNAL input)
 {
     //BMGR-0017 set ibbm and signal info
     this.SignalInfo = signal;
     this.m_ibbmIn   = input;
 }
Esempio n. 8
0
 public PathInfo(GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL signal,List <PointInfo> points)
 {
     m_sig     = signal;
     pointList = points;
     m_type    = PATH_TYPE.OVERLAP;
 }
Esempio n. 9
0
 public PathInfo(GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL signal)
 {
     m_sig     = signal;
     m_type    = PATH_TYPE.OVERLAP;
     pointList = new List <PointInfo>();
 }