Пример #1
0
        private string bitStrTohexStr(string bitStr)
        {
            if (0 != bitStr.Length % 8)
            {
                TraceMethod.RecordInfo($"Error: generate BM Message len={bitStr.Length} % 8 != 0, which is invalid!");
            }
            System.Text.RegularExpressions.CaptureCollection cs =
                System.Text.RegularExpressions.Regex.Match(bitStr, @"([01]{8})+").Groups[1].Captures;
            //byte[] byteList = new byte[cs.Count];

            byteList = new byte[cs.Count];

            string hexBuff = "";

            for (int i = 0; i < cs.Count; ++i)
            {
                byteList[i] = Convert.ToByte(cs[i].Value, 2);
                hexBuff    += Convert.ToString(byteList[i], 16).ToUpper().PadLeft(2, '0') + " ";
            }

            //AfterCoding = new byte[128];
            //ScrambleTel(byteList, AfterCoding);

            hexBuff = hexBuff.Remove(hexBuff.Length - 1, 1);
            return(hexBuff);
        }
Пример #2
0
        //in this func use class member BFGen.isITC
        private bool GenBeaconXMLFile(IBeaconInfo beacon, string filename)
        {
            Balise xmlFile = new Balise();

            //BMGR-0002
            xmlFile.name = new StringData(beacon.Name);

            //BMGR-0003
            xmlFile.Telegram.type = new StringData("LONG");

            //Telegram get
            if (isITC)
            {//BMGR-0004
                TraceMethod.RecordInfo("error:iTC not support now!");
                xmlFile.Telegram.Value = new StringData("iTC not support");
            }
            else
            {
                BeaconMessage bm = new BeaconMessage();
                xmlFile.Telegram.Value = new StringData(bm.GenerateMessage(beacon, sydb.LineID));
            }

            FileSerializer.Serialize(xmlFile, filename, AddLogHead());
            return(true);
        }
Пример #3
0
 private bool AddNewRoute(bool isSplitRoute, RouteSegment rs)
 {
     if (isSplitRoute == true)
     {
         if (rs.m_PtLst.Count > 0)
         {
             TraceMethod.Record(TraceMethod.TraceKind.ERROR, $"sydb split route[{rs.Info}] should has no point, this route will ignore\n");
             return(false);
         }
         if (null == m_Spacing_routeLst.Find(x => (x.m_OrgSig.ID == rs.m_OrgSig.ID &&
                                                   x.m_BlkLst.Count == rs.m_BlkLst.Count && x.m_BlkLst.All(rs.m_BlkLst.Contains))))
         {
             m_Spacing_routeLst.Add(rs);
         }
         else
         {
             TraceMethod.RecordInfo($"Warning: split route[{rs.Info}] is repeated, ignore the repeat ones!\r\n");
         }
     }
     else
     {
         if (null == m_RouteSpacing_routeLst.Find(x => (x.m_OrgSig.ID == rs.m_OrgSig.ID &&
                                                        x.m_BlkLst.Count == rs.m_BlkLst.Count && x.m_BlkLst.All(rs.m_BlkLst.Contains))))
         {
             m_RouteSpacing_routeLst.Add(rs);
         }
         else
         {
             TraceMethod.RecordInfo($"Warning: route[{rs.Info}] is repeated, ignore the repeat ones!\r\n");
         }
     }
     return(true);
 }
Пример #4
0
        //BMGR-0022
        public bool GetRouteSegments(RouteSegConfig SyDBRouteCfg,GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON beaconIbbm)
        {
            //use SigTypeFunc instead of Type_function, the values are similar
            if (Sys.TYPEFUNC_SPACING == SignalInfo.Signal_Type_Function)
            {
                UpdateRsList(SyDBRouteCfg.m_Spacing_routeLst,beaconIbbm);
                if (1 != RsList.Count())
                {
                    TraceMethod.RecordInfo($"Original Signal[{SignalInfo.Info}] find routesegment error, the route num={RsList.Count()} of Spacing Signal should be 1!");
                    return(false);
                }
            }
            else if (Sys.TYPEFUNC_ROUTESPACING == SignalInfo.Signal_Type_Function)
            {
                UpdateRsList(SyDBRouteCfg.m_RouteSpacing_routeLst,beaconIbbm);
                if (RsList.Count() < 1 || RsList.Count() > 10)
                {
                    TraceMethod.RecordInfo($"Original Signal[{SignalInfo.Info}] find routesegment error, the route num={RsList.Count()} of Route Spacing Signal should be [1,10]!");
                    return(false);
                }
            }
            else
            {
                TraceMethod.RecordInfo($"Original Signal[{SignalInfo.Info}] SigTypeFunc={SignalInfo.Signal_Type_Function} is unknow!");
                return(false);
            }

            return(true);
        }
Пример #5
0
        public bool generateRouteSegments()
        {
            //BMGR-0022 if more than one route, should be ordered by ID increase.
            List <GENERIC_SYSTEM_PARAMETERS.ROUTES.ROUTE> orderRouteList = Sydb.routeInfoList.OrderBy(o => (int)o.ID).ToList();

            foreach (GENERIC_SYSTEM_PARAMETERS.ROUTES.ROUTE route in orderRouteList)
            {
                if (false == route.IsValidBMRoute())
                {
                    continue;
                }

                //this is a RouteSpacing route
                if (null == route.Spacing_Signal_ID_List.Signal_ID || 0 == route.Spacing_Signal_ID_List.Signal_ID.Count)
                {
                    try
                    {
                        RouteSegment rs = new RouteSegment(route);
                        AddNewRoute(false, rs);
                    }
                    catch (Exception ex)
                    {
                        TraceMethod.RecordInfo(ex.Message);
                    }
                }
                else if (0 < route.Spacing_Signal_ID_List.Signal_ID.Count) //split the route to 1 RouteSpacing route and 1 or more Spacing route
                {                                                          //after BMGR-0022: split the route which has spacing signals
                    splitRoute(route);
                }
            }
            return(true);
        }
Пример #6
0
        public override XmlVisitor GetVariantXmlNode()
        {
            XmlVisitor variant1 = XmlVisitor.Create("Variant", null);

            {//BMGR-0040 //BMGR-0030
                variant1.AppendChild("Index", m_Idx);
                variant1.AppendChild("Type", string.Format("POINT_{0}", PointVariantPos[0]));
                variant1.AppendChild("Object_name", string.Format("{0}_{1}", m_pt.Point.Name, PointVariantPos[0]));
            }

            //BMGR-0041 //BMGR-0031
            if (-1 != InputRank)
            {
                variant1.AppendChild("Input_rank", InputRank);
            }
            else if (-1 != value)
            {
                variant1.AppendChild("Value", value);
            }
            else
            {
                TraceMethod.RecordInfo($"Point[{m_pt.Info}] not in IBBM input and can't calculate value, log Error!");
            }
            return(variant1);
        }
Пример #7
0
        /// <summary>
        /// set the cell value and style.
        /// now set style of each cell, has not found the method of set col or row style
        /// </summary>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="val"></param>
        /// <param name="daseed">if the cell has dash line</param>
        /// <param name="background">if the cell has background</param>
        private void setcellvaluestyle(IRow row, int col, string val, bool daseed = false)
        {
            ICell cell = row.GetCell(col);

            if (null == cell)
            {
                cell = row.CreateCell(col);
            }

            if (true == daseed)
            {
                cell.CellStyle = dashstyle;
            }
            else
            {
                if (colstyles.ContainsKey(col))
                {
                    cell.CellStyle = colstyles[col];
                }
                else
                {
                    TraceMethod.RecordInfo($"get no cellstyle of col{col}");
                }
            }
            cell.SetCellValue(val);
        }
Пример #8
0
        /// <summary>
        /// 生成数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void progressBar1_Click(object sender, EventArgs e)
        {
            if (true == IsBusy)
            {
                return;
            }
            IsBusy = true;
            //show the log tab
            this.tags.SelectedTab = tabPageLog;

            //update the interface
            GenProess(100, 0);
            TraceMethod.RecordInfo("Start to generate, please wait....");

            if (Program.AUTOTEST)
            {//if for test, do it directly
                Generate();
            }
            else
            {
                //create a new thread to do the generate
                Thread doGenerate = new Thread(Generate);
                doGenerate.Start();
            }
        }
Пример #9
0
        public override bool Generate(object outputpath)
        {
            string path = (string)outputpath + "\\LEU";

            Sys.NewEmptyPath(path);

            string filename = string.Format("{0}\\LEU_Result_Filtered_Values.xml", path);
            bool   isGen    = GenerateLEUResultFilterFile(filename);

            if (!isGen)
            {
                TraceMethod.RecordInfo("Generate LEU Result Filtered Value file error!");
                return(false);
            }
            #region [THFDebug]
            if (BMGenTest.Program.GenerateTJFormat)
            {
                if (GenBasciXml(filename, path))
                {
                    TraceMethod.RecordInfo("Generate basic_beacons.xml file successfully!");
                }
                else
                {
                    TraceMethod.RecordInfo("Generate basic_beacons.xml file error!");
                }
            }
            #endregion
            TraceMethod.RecordInfo("[Steps 4-3]:BMGenTool Generate LEU Result Filtered Value file run completed!");
            return(true);
        }
Пример #10
0
        public override bool Generate(object outputpath)
        {
            //chapter 4
            string path = (string)outputpath + "\\BMV";

            Sys.NewEmptyPath(path);

            if (!GenrateDeviceByIBBM())
            {
                TraceMethod.RecordInfo("GenrateDeviceByIBBM error!");
                return(false);
            }

            if (!GenerateBeaconData())
            {
                TraceMethod.RecordInfo("GenerateBeaconData error!");
                return(false);
            }

            //BMGR-0014 generate block_mode_variants_file for all beacons in a line
            string filename = string.Format("{0}\\block_mode_variants_file.xml", path);

            if (!GenerateBMVFile(filename))
            {
                TraceMethod.RecordInfo("Generate block_mode_variants_file.xml error!");
                return(false);
            }

            TraceMethod.RecordInfo("[Steps 4-2]:BMGenTool BMVFGen run completed!");
            return(true);
        }
Пример #11
0
        private bool splitRoute(GENERIC_SYSTEM_PARAMETERS.ROUTES.ROUTE route)
        {
            if (null == route)
            {
                return(false);
            }
            int startSigID = route.Origin_Signal_ID;
            List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK> blkList = new List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK>();
            List <int> dstSigIDs = new List <int>();

            dstSigIDs.AddRange(route.Spacing_Signal_ID_List.Signal_ID.Cast <int>());
            dstSigIDs.Add(route.Destination_Signal_ID);
            foreach (int blkID in route.Block_ID_List.Block_ID)
            {
                var blk = (GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK)Sys.GetNode(blkID, Sydb.blockInfoList.Cast <Node>().ToList());

                int dstSigID = SyDB.GetSigIDInBlock(blkID, dstSigIDs);
                if (0 < dstSigID && dstSigIDs.Exists(x => x == dstSigID))
                {
                    List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK> newBlkList = new List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK>();
                    newBlkList.AddRange(blkList);
                    newBlkList.Add(blk);
                    try
                    {
                        RouteSegment split_rs = new RouteSegment(startSigID, dstSigID, newBlkList, route);

                        //update info for new split route
                        {
                            blkList.Clear();
                            dstSigIDs.Remove(dstSigID);
                            startSigID = dstSigID;
                        }

                        if (route.Origin_Signal_ID == split_rs.m_OrgSig.ID)//route_spacing signal route
                        {
                            AddNewRoute(false, split_rs);
                        }
                        else//spacing signal route
                        {
                            AddNewRoute(true, split_rs);
                        }
                    }
                    catch (Exception ex)
                    {
                        TraceMethod.RecordInfo(ex.Message);
                    }
                }
                else
                {
                    blkList.Add(blk);
                }
            }//end of foreach (int blkID in route.BlockIDList)
            if (0 != dstSigIDs.Count)
            {
                TraceMethod.RecordInfo($"route {route.Info} split error, some signal can't get splited route, such as signalID[{dstSigIDs[0]}]\n");
                return(false);
            }
            return(true);
        }
Пример #12
0
 public bool check(string name)
 {//BMGR-0031
     if (-1 == InputRank && -1 == value)
     {
         TraceMethod.RecordInfo($"Error: Point[{m_pt.Info}] not in beacon[{name}] IBBM input, please check!");
         return(false);
     }
     return(true);
 }
Пример #13
0
 public bool CheckAspect(ASPECT asp)
 {
     if (Aspect.Exists(x => x.Mask == asp.Mask))
     {
         TraceMethod.RecordInfo($"Error: {asp.Mask} is repeat in balise {name}-{id}");
         return(false);
     }
     return(true);
 }
Пример #14
0
        public override bool Generate(object outputpath)
        {
            bool   rt     = true;
            string logMsg = "";

            string path = (string)outputpath + "\\Beacon";

            Sys.NewEmptyPath(path);

            if (!Init())
            {
                return(false);
            }

            //generate beacon_name.xml file and refBeaconLst by balise layout file
            int i     = 0;
            int count = sydb.GetBeacons().Count();

            foreach (IBeaconInfo beacon in sydb.GetBeacons())
            {
                TraceMethod.RecordInfo($"Creating message file for {beacon.Info}.");

                //BMGR-0001 generate beacon_name.xml
                string filename = string.Format("{0}\\{1}.xml", path, beacon.Name);

                if (!GenBeaconXMLFile(beacon, filename))
                {
                    logMsg = string.Format("Generate {0}.xml file error!", beacon.Name);
                    TraceMethod.RecordInfo(logMsg);
                    rt = false;
                    continue;
                }

                if (isBGenBin)
                {
                    if (false == GenBeaconBinFile(path, filename, beacon))
                    {
                        logMsg = string.Format("Generate {0}.tgm and udf file error!", beacon.Name);
                        TraceMethod.RecordInfo(logMsg);
                        rt = false;
                        continue;
                    }
                }
                ++i;
                //更新进度条状态 +30 is for the following other steps
                UpdateProgressBar(count + 30, i);
            }

            if (BMGenTest.Program.GenerateTJFormat)//this output file only for user debug, not record in document
            {
                GenTJFormatFileHead(path);
            }

            TraceMethod.RecordInfo("[Steps 4-1]:BMGenTool BFGen end!");
            return(rt);
        }
Пример #15
0
        /// <summary>
        /// get the distance of beacon and nearest sddb in beacon direction
        /// unit: cm( sydb kp data is cm)
        /// </summary>
        /// <param name="beacon"></param>
        /// <returns></returns>
        private int CalBeacon2SDDB(BEACON beacon)
        {
            GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK beaconBlk = SyDB.GetLocatedBlock(beacon.m_layoutInfo.kp, beacon.m_layoutInfo.TrackID);

            if (null == beaconBlk)
            {
                TraceMethod.Record(TraceMethod.TraceKind.ERROR, $"Beacon {beacon.Info} type={beacon.m_ibbmInfo.GetBeaconType()} find beacon located block get null, can't get BMB_SDDB_distance");
                return(0);
            }
            //calculate length from beacon to beacon located Blk end
            string dir    = beacon.m_ibbmInfo.Direction;
            int    length = Sys.GetSDDBLenOfLocatedBlock(beacon.m_layoutInfo.kp, beaconBlk, dir);

            if (Sys.GetSDDBPosInLocatedBlock(beaconBlk, dir) == Sys.SddbInBlock.end)
            {
                return(length);
            }

            //calculate length from beaconBlk end to SDDB //only sddb and beacon in different blk will do this
            int nextBlkID = -1;

            GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK curBlk = beaconBlk;
            while (true)
            {
                if (curBlk.Is_Direction_Opposite.Equals(true))
                {
                    dir = SyDB.GetReverseDir(dir);
                }
                nextBlkID = SyDB.GetNextBlkID(curBlk, dir);
                if (nextBlkID == -1)
                {
                    TraceMethod.RecordInfo($"{curBlk.Info} search next block in {dir} occer convergent point,Error:Beacon {beacon.Info} type={beacon.m_ibbmInfo.GetBeaconType()} can't get BMB_SDDB_distance.");
                    return(0);
                }
                var nextBlk = (GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK)Sys.GetNode(nextBlkID, sydb.blockInfoList.Cast <Node>().ToList());
                if (null == nextBlk)
                {
                    TraceMethod.RecordInfo($"{curBlk.Info} search next block in {dir} get null,Error:Beacon {beacon.Info} type={beacon.m_ibbmInfo.GetBeaconType()} can't get BMB_SDDB_distance");
                    return(0);
                }

                Sys.SddbInBlock sddbInWalk = Sys.SddbWalkThroughBlock(nextBlk, dir);
                if (Sys.SddbInBlock.none != sddbInWalk)
                {
                    if (Sys.SddbInBlock.end == sddbInWalk)
                    {
                        length += nextBlk.GetBlockLen();
                    }
                    break;
                }

                length += nextBlk.GetBlockLen();
                curBlk  = nextBlk;
            }
            return(length);
        }
Пример #16
0
        private void GenTJFormatFileHead(string path)
        {
            string        logMsg      = "";
            XmlVisitor    allFileRoot = null;
            string        filename    = string.Format("{0}\\all_beacons.xml", path);
            XmlFileHelper allxmlFile  = XmlFileHelper.CreateFromString(null);

            AddLogHead(ref allxmlFile);

            allxmlFile.SetRoot("Beacons", null);
            allxmlFile.Save2File(filename);

            allFileRoot = allxmlFile.GetRoot();
            allFileRoot.UpdateAttribute("NUMBERS", sydb.GetBeacons().Count());

            foreach (IBeaconInfo beacon in sydb.GetBeacons())
            {
                string telValue = "";
                if (isITC)
                {//BMGR-0004
                    TraceMethod.RecordInfo("iTC not support now!");
                    telValue = "iTC not support";
                }
                else
                {
                    BeaconMessage bm = new BeaconMessage();
                    telValue = bm.GenerateMessage(beacon, sydb.LineID);
                }

                byte[] urstel = DataOpr.String2byte(telValue);

                XmlVisitor beaconNode = XmlVisitor.Create("Beacon", null);
                beaconNode.UpdateAttribute("ID", beacon.ID);
                beaconNode.UpdateAttribute("NAME", beacon.Name);
                byte[] content = new byte[128];
                bool   result  = DataOpr.PackCallScram_Tel(urstel, content);
                if (result)
                {
                    string tel1 = DataOpr.Byte2string(content);
                    beaconNode.AppendChild("Telegram0", telValue);
                    beaconNode.AppendChild("Telegram1", tel1);
                }
                else
                {
                    logMsg = string.Format("Encoding Error!");
                    TraceMethod.RecordInfo(logMsg);
                    continue;
                }
                allFileRoot.AppendChild(beaconNode);
            }

            allxmlFile.Save2File(filename);
            logMsg = "Generate basic_beacons.xml file successfully!";
            TraceMethod.RecordInfo(logMsg);
        }
Пример #17
0
        private void Init()
        {
            logFile = currentRunDir + "\\Log\\BMGen.log";
            logMsg  = "BMGen started.";
            TraceMethod.RecordInfo(logMsg);

            //deal the config.xml which used to save the configuration
            configFile = currentRunDir + "\\Config\\config.xml";

            if (!File.Exists(configFile))
            {//create a new config file, which is empty
                XmlFileHelper xmlFile = XmlFileHelper.CreateFromString(null);
                xmlFile.SetRoot("config", null);
                if (!Directory.Exists(currentRunDir + "\\Config\\"))
                {
                    Directory.CreateDirectory(currentRunDir + "\\Config\\");
                }
                xmlFile.Save2File(configFile);
            }
            else
            {
                //set the input file path
                setTextBox(textBoxSyDB, "BeaconLayout_SYDB");
                setTextBox(textBoxLayout, "Layout_beacons");
                setTextBox(textBoxBoundaryBeacon, "Boundary_beacons");
                //set the output path
                setTextBox(textBoxOutput, "Output");
                setTextBox(textBox_UpstreamFile, "Upstream_File");
            }

            if (BMGenTest.Program.GenerateTJFormat)
            {
                Assembly ass = Assembly.LoadFile(Path.GetFullPath(".//MetaFly.dll"));
                Version  ver = ass.GetName().Version;
                TraceMethod.RecordInfo("MetaFly.dll " + ver.ToString());
            }

            {
                this.Text = "Bcode_iTRNV-BMGenTool2_V1.0.2_Build_20200409_debug";
                //set the project
                radioButtoniTC.Checked           = false;
                Upstream_path_considered.Checked = false;
                radioButtonInteroperable.Checked = true;
                //set if choose generate bin files
                checkBoxGenBin.Checked = false;
                UpdateUpstreamPage();
            }

            if (Program.AUTOTEST)
            {
                object    nullobj = new object();
                EventArgs nulle   = new EventArgs();
                progressBar1_Click(nullobj, nulle);
            }
        }
Пример #18
0
 public static Node GetNode(string name, List <Node> list)
 {
     foreach (Node node in list)
     {
         if (node.Name == name)
         {
             return(node);
         }
     }
     TraceMethod.RecordInfo(string.Format("Error: can't find node whose name={0} in sydb", name));
     return(null);
 }
Пример #19
0
        //BMGR-0046
        private bool GenerateBeaconInfoNode(BEACON beacon, ref XmlVisitor node, int outnum)
        {
            if (false == beacon.SetBeaconInfoNode_LEURF(ref node, outnum))
            {
                TraceMethod.RecordInfo($"Write SetBeaconInfoNode_LEURF for {beacon.Info} error!");
                return(false);
            }
            //BMGR-0047
            node.AppendChild("Variants_inputs", beacon.GetVariantsInputs());

            return(true);
        }
Пример #20
0
 public static Node GetNode(int id, List <Node> list)
 {
     foreach (Node node in list)
     {
         if (node.ID == id)
         {
             return(node);
         }
     }
     TraceMethod.RecordInfo(string.Format("Error: can't find node whose id={0} in sydb", id));
     return(null);
 }
Пример #21
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);
        }
Пример #22
0
        private bool GenerateBin(string filename, string outDir, List <LEU_filtered_values.leu.BEACON> list)
        {
            FileInfo fi      = new FileInfo(filename);
            string   leuname = fi.Name.Replace(".xml", "");
            Process  p       = new Process();

            p.StartInfo.FileName = this.leuComPath;
            if (isITC)
            {//BMGR-0075
                p.StartInfo.Arguments = string.Format("{0} -o {1} -udf -tgm -telformat sacem", filename, outDir);
            }
            else
            {//BMGR-0076
                p.StartInfo.Arguments = string.Format("{0} -o {1} -udf -tgm -telformat udf", filename, outDir);
            }
            p.StartInfo.CreateNoWindow  = true;
            p.StartInfo.UseShellExecute = false;
            TraceMethod.RecordInfo($"Generating bin file of {fi.Name}......");
            p.Start();
            p.WaitForExit();
            p.Close();
            TraceMethod.RecordInfo($"TGM and UDF binary file for {fi.Name} created.");

            List <string> genFiles = new List <String>();

            genFiles.Add($"{outDir}//{leuname}_te1.bin");
            genFiles.Add($"{outDir}//{leuname}_tpc.bin");
            genFiles.Add($"{outDir}//{leuname}_tse.bin");

            foreach (LEU_filtered_values.leu.BEACON b in list)
            {
                int    i       = b.outNum;
                string tgmname = string.Format("\\telgen_{0}.TGM", i);
                string udfname = string.Format("\\TELGEN_{0}.udf", i);

                genFiles.Add(outDir + tgmname);
                genFiles.Add(outDir + udfname);
            }

            foreach (string newFile in genFiles)
            {
                if (!File.Exists(newFile))
                {
                    TraceMethod.RecordInfo(string.Format("call {0} error.", this.leuComPath), TraceMethod.TraceKind.ERROR);
                    return(false);
                }
            }

            TraceMethod.RecordInfo(string.Format("GenerateBin for leu {0} created success.", fi.Name));
            return(true);
        }
Пример #23
0
        //BMGR-0046
        public string GetLindedSignalName()
        {
            if (null != m_ReopenOrgSig)
            {
                return(m_ReopenOrgSig.GetName());
            }
            else if (m_AppOrgSigLst.Count() > 0)
            {
                return(m_AppOrgSigLst[0].GetName());
            }

            TraceMethod.RecordInfo(string.Format("Beacon[{0}] has no signal. error in GetLindedSignalName", Name));
            return("ErrorNoLinkedSignal");
        }
Пример #24
0
        //BMGR-0041 //BMGR-0031
        //if input pos is same with origin Position, return 1
        //not same, return 0
        //input pos invalid, will raise exception
        public int GetPosValue(string pos)
        {
            if (Sys.Normal != pos && Sys.Reverse != pos)
            {
                TraceMethod.RecordInfo(string.Format("input pos[{0}] in GetPosValue is invalid pointName[{1}]", pos, Point.Name));
                return(9999);

                //throw new Exception(string.Format("input pos[{0}] in GetPosValue is invalid", pos));
            }

            if (Position[0] == pos[0])
            {
                return(1);
            }
            return(0);
        }
Пример #25
0
 public static void NewEmptyPath(string path)
 {
     try
     {
         if (Directory.Exists(path))
         {
             Directory.Delete(path, true);
         }
         Directory.CreateDirectory(path);
     }
     catch (System.Exception ex)
     {
         string logMsg = string.Format("Exception while deal directory! {0}", ex.Message);
         TraceMethod.RecordInfo(logMsg);
     }
 }
Пример #26
0
        //BMGR-0016 output LEU info
        private bool GenerateLEUInfoNode(GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON ibbm, ref XmlVisitor node)
        {
            if (false == LEUList.Exists(x => x.Name == ibbm.LEU.LEU_Name))
            {
                TraceMethod.RecordInfo($"input LEU[{ibbm.LEU.LEU_Name}] error, not exist in LEU list");
                return(false);
            }
            int idx = LEUList.FindIndex(x => x.Name == ibbm.LEU.LEU_Name);
            //LEU
            XmlVisitor leu = XmlVisitor.Create("LEU", null);

            leu.UpdateAttribute("NAME", LEUList[idx].Name);
            leu.AppendChild("Id", LEUList[idx].ID);
            leu.AppendChild("BM_beacon_output_number", ibbm.LEU.Beacon_Output_number);
            node.AppendChild(leu);
            return(true);
        }
Пример #27
0
        private bool Init()
        {
            bool rt = false;

            sydb.clear(onlyclearbeacon: true);
            try
            {
                if ("" != boundaryFile && Path.GetExtension(boundaryFile) == ".xml")
                {
                    string xsdfullname = ".//Config//boundarybeacon.xsd";
                    if (File.Exists(xsdfullname) && XsdVerify.Verify(boundaryFile, xsdfullname))
                    {
                        Line_boundary_BM_beacons beacons = FileLoader.Load <Line_boundary_BM_beacons>(boundaryFile);
                        sydb.ReadBoundaryBeacon(beacons);
                        rt = true;
                    }
                }
            }
            catch (System.Exception ex)
            {
                TraceMethod.RecordInfo($"Read boundary beacon xml file [{boundaryFile}] error: {ex.Message}, please check!");
            }

            try
            {
                if ("" != layoutFile)
                {
                    if (false == sydb.ReadcsvBeacon(layoutFile))
                    {
                        TraceMethod.RecordInfo($"Read csv file [{layoutFile}] error");
                    }
                    else
                    {
                        rt = true;
                    }
                }
            }
            catch (System.Exception ex)
            {
                TraceMethod.RecordInfo($"Read csv file [{layoutFile}] error: {ex.Message}, please check!");
            }

            return(rt);
        }
Пример #28
0
        public override bool Generate(object outputpath)
        {
            if (!Init())
            {
                return(false);
            }
            //chapter 5.2
            string path = (string)outputpath + "\\LEUBinary";

            Sys.NewEmptyPath(path);


            int i = 0;

            foreach (LEU_filtered_values.leu leu in LeuInfoList)
            {
                string filePath = string.Format("{0}\\{1}", path, leu.NAME);
                Sys.NewEmptyPath(filePath);

                //BMGR-0060
                string filename = string.Format("{0}\\{1}.xml", filePath, leu.NAME);
                //生成每一个LEU的LEU Global.xml文件
                if (!this.GenLEUXmlFile(leu, GidInfoList[i++], filename))
                {
                    TraceMethod.RecordInfo($"Generate {leu.NAME}.xml file error!");
                    return(false);
                }

                if (true == isBin && !GenerateBin(filename, filePath, leu.beaconList))
                {
                    TraceMethod.RecordInfo($"call {leuComPath} for {leu.NAME} file error!");
                    return(false);
                }

                UpdateProgressBar(70 + LeuInfoList.Count, 70 + i);
            }
            //CI report need compiled msg, so call this after GenerateBin
            //if GenerateBin is not called, the report compiled msg will be empty
            CIReportExcel tt = new CIReportExcel(CIReportTmplt, path, leulist, LeuInfoList, isBin);

            TraceMethod.RecordInfo("[Steps 4-4]:BMGenTool generate LEU files completed! All progress is OK!");
            return(true);
        }
Пример #29
0
        /// <summary>
        /// 计算互联互通项目beacon报文头,共50个bit
        /// </summary>
        /// <param name="beacon"></param>
        /// <returns></returns>
        /// //BMGR-0007 BMGR-0053
        private string CalHeadTel()
        {
            string head50bits = "";

            head50bits =
                MSG_CONSTANT.Q_UPDOWN +  //1bit
                MSG_CONSTANT.M_VERSION + //2~8bit = 7
                MSG_CONSTANT.Q_MEDIA +   //9bit
                MSG_CONSTANT.N_PIG +     //10~12bit = 3
                MSG_CONSTANT.N_TOTAL +   // 13~15bit = 3
                MSG_CONSTANT.M_DUP;      // 16~17bit = 2

            //18~25bit,M_MCOUNT = 8
            if (false == isVB)
            {
                head50bits += MSG_CONSTANT.M_MCOUNT_NOBM;
            }
            else
            {
                if (null == msg)//beacon default msg
                {
                    head50bits += MSG_CONSTANT.M_MCOUNT_BMDEFAULT;
                }
                else if (0 == msg.GetRank())//leu default msg BMGR-0053 00000000
                {
                    head50bits += MSG_CONSTANT.M_MCOUNT_LEUDEFAULT;
                }
                else//normal msg BMGR-0053 11111111
                {
                    head50bits += MSG_CONSTANT.M_MCOUNT_LEU;
                }
            }

            head50bits += dataTobitStr(lineID, 10) +   //26~35bit,NID_L = 10
                          dataTobitStr(beaconID, 14) + //36~49bit,NID_BG = 14
                          MSG_CONSTANT.Q_LINK;         //50bit

            if (50 != head50bits.Length)
            {
                TraceMethod.RecordInfo("Error of CalHeadTel, the message is not 50 bits!");
            }
            return(head50bits);
        }
Пример #30
0
 public bool CalOverlap(GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON ibbm)
 {
     //BMGR-0026
     if (null != DstSig.Overlap_ID)//get overlap
     {
         var ol = (GENERIC_SYSTEM_PARAMETERS.OVERLAPS.OVERLAP)Sys.GetNode((int)DstSig.Overlap_ID,SyDB.GetInstance().overlapInfoList.Cast <Node>().ToList());
         m_overlap = new ObjOverlap(ol,DstSig);
         //BMGR-0067
         if (false == m_overlap.GeneratePath(ibbm))
         {
             TraceMethod.RecordInfo($"RouteSegment {Info} generate overlap path error!");
             return(false);
         }
     }
     else
     {
         m_overlap = null;
     }
     return(true);
 }