Esempio n. 1
0
        private bool GenerateBeaconData()
        {
            bool rt = true;
            //BMGR-0022
            //read route info from sydb
            //split the routes into RouteSpacing and Spacing routes
            RouteSegConfig SyDBRouteCfg = new RouteSegConfig(sydb);

            SyDBRouteCfg.generateRouteSegments();

            for (int i = 0; i < beaconList.Count(); ++i)
            {
                #region [originsignal]

                foreach (GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON.INPUT_SIGNAL inSig in beaconList[i].m_ibbmInfo.Input_Signal)
                {
                    GENERIC_SYSTEM_PARAMETERS.SIGNALS.SIGNAL OrgSig = sydb.signalInfoList.Find(x => x.Name == inSig.Name.ToString());

                    if (null == OrgSig)
                    {
                        TraceMethod.RecordInfo($"Warning:{inSig.Info} can't find in sydb.signals, no data will generate for it!");
                        continue;
                    }

                    //create an OriginSignal by IBBM input and the real signal
                    OriginSignal newOrgSig = new OriginSignal(OrgSig, inSig);

                    if (false == newOrgSig.GetRouteSegments(SyDBRouteCfg, beaconList[i].m_ibbmInfo))
                    {
                        TraceMethod.RecordInfo($"Warning:IBBM {inSig.Info} to {beaconList[i].Info} Generate RouteSegments fail!");
                    }

                    if (Sys.Reopening == inSig.Type)
                    {
                        beaconList[i].m_ReopenOrgSig = newOrgSig;
                    }
                    else if (Sys.Approach == inSig.Type)
                    {
                        beaconList[i].m_AppOrgSigLst.Add(newOrgSig);
                    }
                    else
                    {
                        TraceMethod.RecordInfo($"IBBM {inSig.Info} to {beaconList[i].Info} error, unknown type");
                    }
                }
                #endregion

                GenerateVariantList(beaconList[i]);
            }

            return(rt);
        }
Esempio n. 2
0
        //BMGR-0050 //BMGR-0049
        /// <summary>
        /// generate all message of section info for one beacon, not consider upstream
        /// </summary>
        /// <param name="beacon"></param>
        /// <returns></returns>
        private List <Message> GenerateMessage(BEACON beacon)
        {
            //the order in msgLst should not be changed
            List <Message> msgLst     = new List <Message>();
            int            msgRankIdx = 0;

            {//BMGR-0050 generate leu default message rank = 0
                Message msg_leudefault = new Message(msgRankIdx++);
                msgLst.Add(msg_leudefault);
            }

            {//rank = 1
                Message msgRed = new Message(msgRankIdx++);
                msgLst.Add(msgRed);
            }

            Message msgBase = new Message();

            if (BeaconType.Approach == beacon.m_ibbmInfo.GetBeaconType())
            {
                #region [only approach]
                //BMGR-0078 only app
                foreach (OriginSignal appOrg in beacon.m_AppOrgSigLst)
                {
                    foreach (RouteSegment appRS in appOrg.RsList)
                    {
                        Message msgApp = new Message(msgRankIdx++, msgBase);
                        msgApp.apRs = appRS;//BMGR-0079 has app then no overlap

                        msgLst.Add(msgApp);
                    }
                }
                #endregion
            }
            else if (BeaconType.Reopening == beacon.m_ibbmInfo.GetBeaconType())
            {
                #region [only reopen]
                if (null != beacon.m_ReopenOrgSig)
                {
                    //BMGR-0079
                    foreach (RouteSegment rs in beacon.m_ReopenOrgSig.RsList)
                    {
                        msgBase.rpRs = rs;//msg add reopen rs

                        //BMGR-0077 if RSroute has overlap, then generate rs + ol
                        if (null != rs.m_overlap)
                        {
                            if (null != rs.m_overlap.m_pathLst && 0 < rs.m_overlap.m_pathLst.Count())
                            {//reopen rs + overlap path
                                foreach (PathInfo path in rs.m_overlap.m_pathLst)
                                {
                                    Message msgolp = new Message(msgRankIdx++, msgBase);
                                    msgolp.olPath  = path;
                                    msgolp.overlap = rs.m_overlap;

                                    msgLst.Add(msgolp);
                                }
                            }
                            else
                            {//reopen rs + overlap with no path
                                Message msgol = new Message(msgRankIdx++, msgBase);
                                msgol.overlap = rs.m_overlap;

                                msgLst.Add(msgol);
                            }
                        }
                        else//BMGR-0077 if RSroute has no overlap and no appRoute, then generate rs
                        {
                            Message msgrs = new Message(msgRankIdx++, msgBase);
                            msgLst.Add(msgrs);
                        }
                    }
                }
                #endregion
            }
            else
            {
                #region [reopen and approach]
                if (null != beacon.m_ReopenOrgSig)
                {
                    foreach (RouteSegment rs in beacon.m_ReopenOrgSig.RsList)
                    {
                        msgBase.rpRs = rs;//msg add reopen rs

                        //BMGR-0077 if RSroute has overlap, then generate rs + ol
                        if (null != rs.m_overlap)
                        {
                            if (null != rs.m_overlap.m_pathLst && 0 < rs.m_overlap.m_pathLst.Count())
                            {//reopen rs + overlap path
                                foreach (PathInfo path in rs.m_overlap.m_pathLst)
                                {
                                    Message msgolp = new Message(msgRankIdx++, msgBase);
                                    msgolp.olPath  = path;
                                    msgolp.overlap = rs.m_overlap;

                                    msgLst.Add(msgolp);
                                }
                            }
                            else
                            {//reopen rs + overlap with no path
                                Message msgol = new Message(msgRankIdx++, msgBase);
                                msgol.overlap = rs.m_overlap;

                                msgLst.Add(msgol);
                            }
                        }
                        else//BMGR-0077 if RSroute has no overlap, then generate rs
                        {
                            Message msgrs = new Message(msgRankIdx++, msgBase);
                            msgLst.Add(msgrs);
                        }

                        //BMGR-0078 rs+ol first now rs+app rs.dest sig == app.org sig
                        OriginSignal appOrg = beacon.GetOriginSignalBySignalName(rs.GetDstSignalName());
                        if (null != appOrg && null != appOrg.RsList)
                        {
                            foreach (RouteSegment appRS in appOrg.RsList)
                            {
                                Message msgApp = new Message(msgRankIdx++, msgBase);
                                msgApp.apRs = appRS;

                                msgLst.Add(msgApp);
                            }
                        }
                    }
                }
                #endregion
            }

            if (msgRankIdx != msgLst.Count())
            {
                TraceMethod.RecordInfo(string.Format("Beacon[{0}] GenerateMessage run error msgRankIdx[{1}] != msgLst.Count[{2}]",
                                                     beacon.Name,
                                                     msgRankIdx,
                                                     msgLst.Count()));
                return(null);
            }

            return(msgLst);
        }