static void Main(string[] args)
        {
            string citpath = @"H:\工作文件汇总\铁科院\程序\车载加速度\数据文件\CitData_170413050607_GJGX\CitData_170413050607_GJGX.cit";

            CITFileProcess cithelper      = new CITFileProcess();
            var            fileInfomation = cithelper.GetFileInformation(citpath);

            var channelList = cithelper.GetChannelDefinitionList(citpath);

            var channelData = cithelper.GetAllMileStone(citpath);

            var type        = cithelper.GetDataType(citpath);
            var DataVersion = cithelper.GetDataVersion(citpath);

            var date = cithelper.GetDate(citpath);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 偏差修正
        /// </summary>
        /// <param name="citFilePath">cit文件路径</param>
        /// <param name="iicFilePath">iic文件路径</param>
        /// <param name="listIC">里程修正结果集合</param>
        /// <param name="cyjg">采样点</param>
        /// <param name="gjtds">通道数量</param>
        /// <param name="sKmInc">增减里程</param>
        /// <param name="listETC">偏差类型</param>
        public void ExceptionFix(string citFilePath, string iicFilePath, List <IndexSta> listIC, List <ExceptionType> listETC)
        {
            List <Defects> listDC = new List <Defects>();

            try
            {
                using (OleDbConnection sqlconn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + iicFilePath + ";Persist Security Info=True"))
                {
                    string       sqlCreate = "select RecordNumber,maxpost,maxminor from fix_defects where maxval2 is null or maxval2<>-200";
                    OleDbCommand sqlcom    = new OleDbCommand(sqlCreate, sqlconn);
                    sqlconn.Open();
                    OleDbDataReader oleDBdr = sqlcom.ExecuteReader();
                    while (oleDBdr.Read())
                    {
                        Defects dc = new Defects();
                        dc.iRecordNumber = int.Parse(oleDBdr.GetValue(0).ToString());
                        dc.iMaxpost      = int.Parse(oleDBdr.GetValue(1).ToString());
                        dc.dMaxminor     = double.Parse(oleDBdr.GetValue(2).ToString());
                        listDC.Add(dc);
                    }

                    oleDBdr.Close();
                    sqlconn.Close();
                }
                Application.DoEvents();
            }
            catch
            {
            }

            FileInformation fi = citHelper.GetFileInformation(citFilePath);

            //
            List <Milestone>       listMilestone = citHelper.GetAllMileStone(citFilePath);
            List <cPointFindMeter> listcpfm      = new List <cPointFindMeter>();

            for (int i = 0; i < listMilestone.Count; i++)
            {
                cPointFindMeter cpfm = new cPointFindMeter();
                cpfm.lLoc   = listMilestone[i].mFilePosition;
                cpfm.lMeter = Convert.ToInt64(listMilestone[i].mKm * 100000 + listMilestone[i].mMeter * 100);

                listcpfm.Add(cpfm);
            }


            for (int i = 0; i < listDC.Count; i++)
            {
                for (int j = 0; j < listcpfm.Count; j++)
                {
                    if (listcpfm[j].lMeter == listDC[i].GetMeter())
                    {
                        int iValue = PointToMeter(listIC, listcpfm[j].lLoc, fi.iChannelNumber, fi.iKmInc);
                        if (iValue > 0)
                        {
                            listDC[i].bFix      = true;
                            listDC[i].iMaxpost  = iValue / 1000;
                            listDC[i].dMaxminor = iValue % 1000;
                        }
                        break;
                    }
                }
            }


            //将修正后的偏差数据存储到iic中

            try
            {
                using (OleDbConnection sqlconn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + iicFilePath + ";Persist Security Info=True"))
                {
                    string       sqlCreate = "";
                    OleDbCommand sqlcom    = new OleDbCommand(sqlCreate, sqlconn);
                    sqlconn.Open();
                    for (int i = 0; i < listDC.Count; i++)
                    {
                        if (listDC[i].bFix)
                        {
                            sqlcom.CommandText = "update fix_defects set maxpost=" + listDC[i].iMaxpost.ToString() +
                                                 ",maxminor=" + listDC[i].dMaxminor.ToString() + ",maxval2=-200 where RecordNumber=" + listDC[i].iRecordNumber.ToString();
                            sqlcom.ExecuteNonQuery();
                        }
                    }
                    sqlconn.Close();
                }
                Application.DoEvents();
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 接口函数:计算峰峰值指标
        /// </summary>
        /// <param name="citFileName">cit文件全路径</param>
        /// <param name="citFileName">idf文件全路径</param>
        /// <returns></returns>
        private List <String> PreProcessDeviation2(String citFileName, int pointCount, string idfFileName = null)
        {
            List <String> dataStrList = new List <String>();

            cdlist.channelDefinitionList = cfprocess.GetChannelDefinitionList(citFileName);

            fileinfo = cfprocess.GetFileInformation(citFileName);
            //int tds = fileinfo.iChannelNumber;

            long[] position = cfprocess.GetPositons(citFileName);
            long   startPos = position[0]; //开始位置、结束位置
            long   endPos   = position[1];

            List <Milestone> allmilelist;
            List <Milestone> milelist = cfprocess.GetAllMileStone(citFileName);

            //验证是否修正
            if (!String.IsNullOrEmpty(idfFileName))
            {
                IndexOperator _op = new IndexOperator();
                _op.IndexFilePath = idfFileName;
                MilestoneFix mile = new MilestoneFix(citFileName, _op);
                mile.ReadMilestoneFixTable();
                allmilelist = mile.GetMileageReviseData(milelist);
            }
            else
            {
                allmilelist = milelist;
            }

            //开始里程  和结束里程
            double[] d_tt = new double[allmilelist.Count];
            for (int i = 0; i < allmilelist.Count; i++)
            {
                double obj = allmilelist[i].GetMeter() / 1000;
                d_tt[i] = obj;
            }

            double[] d_wvelo = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("Speed", "速度"), startPos, endPos);
            double[] d_gauge = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("Gage", "轨距"), startPos, endPos);

            double[] d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("L_Prof_SC", "左高低_中波"), startPos, endPos);

            //StreamWriter sw2 = new StreamWriter("d:/peakvalue_all.csv", true, Encoding.Default);
            //StringBuilder sbtmp = new StringBuilder();
            //sbtmp.Append("d_tt,");
            //sbtmp.Append("d_wvelo,");
            //sbtmp.Append("d_gauge,");
            //sbtmp.Append("d_wx");
            //sw2.WriteLine(sbtmp.ToString());
            //for (int i = 0; i < d_tt.Length; i++)
            //{
            //    sw2.Write(d_tt[i]);
            //    sw2.Write(",");
            //    sw2.Write(d_wvelo[i]);
            //    sw2.Write(",");
            //    sw2.Write(d_gauge[i]);
            //    sw2.Write(",");
            //    sw2.Write(d_wx[i]);
            //    sw2.Write("\n");
            //}
            //sw2.Close();

            List <String> tmpDataStrList = pdc.WideGaugePreProcess("左高低_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);

            dataStrList.AddRange(tmpDataStrList);

            d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("R_Prof_SC", "右高低_中波"), startPos, endPos);

            tmpDataStrList = pdc.WideGaugePreProcess("右高低_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);
            dataStrList.AddRange(tmpDataStrList);

            d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("L_Align_SC", "左轨向_中波"), startPos, endPos);

            tmpDataStrList = pdc.WideGaugePreProcess("左轨向_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);
            dataStrList.AddRange(tmpDataStrList);

            d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("R_Align_SC", "右轨向_中波"), startPos, endPos);

            tmpDataStrList = pdc.WideGaugePreProcess("右轨向_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);
            dataStrList.AddRange(tmpDataStrList);

            return(dataStrList);
        }