Ejemplo n.º 1
0
        /// <summary>
        /// 接口函数:把两个对齐的波形文件,进行对比,找出变化的区段
        /// </summary>
        /// <param name="cit_1">第一个cit波形文件</param>
        /// <param name="idf_1">第一个idf文件</param>
        /// <param name="cit_2">第二个cit波形文件</param>
        /// <param name="idf_2">第二个idf文件</param>
        /// <returns></returns>
        public List <String> ChangeDetectionProcess(String cit_1, String idf_1, String cit_2, String idf_2)
        {
            List <String> dataStrList = new List <String>();

            long startPos_0 = milePosClsStart_0.GetPos();
            long endPos_0   = milePosClsEnd_0.GetPos();
            long startPos_1 = milePosClsStart_1.GetPos();
            long endPos_1   = milePosClsEnd_1.GetPos();

            double[] d_tt_1       = GetMileWithIdf(indexStaClsList_0, milePosClsStart_0, milePosClsEnd_0, CommonClass.listDIC[0].iChannelNumber);
            double[] d_wvelo_1    = cdp.GetSingleChannelData(cit_1, dataProcessing.GetChannelNumberByChannelName(cit_1, "Speed", "速度"), startPos_0, endPos_0);
            double[] d_wx_gauge_1 = cdp.GetSingleChannelData(cit_1, dataProcessing.GetChannelNumberByChannelName(cit_1, "Gage", "轨距"), startPos_0, endPos_0);


            double[] d_tt_2       = GetMileWithIdf(indexStaClsList_1, milePosClsStart_1, milePosClsEnd_1, CommonClass.listDIC[1].iChannelNumber);
            double[] d_wvelo_2    = cdp.GetSingleChannelData(cit_2, dataProcessing.GetChannelNumberByChannelName(cit_2, "Speed", "速度"), startPos_1, endPos_1);
            double[] d_wx_gauge_2 = cdp.GetSingleChannelData(cit_2, dataProcessing.GetChannelNumberByChannelName(cit_2, "Gage", "轨距"), startPos_1, endPos_1);

            double[] d_wx_1 = cdp.GetSingleChannelData(cit_1, dataProcessing.GetChannelNumberByChannelName(cit_1, "L_Prof_SC", "左高低_中波"), startPos_0, endPos_0);
            double[] d_wx_2 = cdp.GetSingleChannelData(cit_2, dataProcessing.GetChannelNumberByChannelName(cit_2, "L_Prof_SC", "左高低_中波"), startPos_1, endPos_1);

            List <String> tmpDataStrList = changeDetcPro.ChangeDetectionPrcs("左高低_中波", d_tt_1, d_wx_1, d_wvelo_1, d_wx_gauge_1, d_tt_2, d_wx_2, d_wvelo_2, d_wx_gauge_2);

            dataStrList.AddRange(tmpDataStrList);

            d_wx_1 = cdp.GetSingleChannelData(cit_1, dataProcessing.GetChannelNumberByChannelName(cit_1, "R_Prof_SC", "右高低_中波"), startPos_0, endPos_0);
            d_wx_2 = cdp.GetSingleChannelData(cit_2, dataProcessing.GetChannelNumberByChannelName(cit_2, "R_Prof_SC", "右高低_中波"), startPos_1, endPos_1);

            tmpDataStrList = changeDetcPro.ChangeDetectionPrcs("右高低_中波", d_tt_1, d_wx_1, d_wvelo_1, d_wx_gauge_1, d_tt_2, d_wx_2, d_wvelo_2, d_wx_gauge_2);
            dataStrList.AddRange(tmpDataStrList);

            d_wx_1 = cdp.GetSingleChannelData(cit_1, dataProcessing.GetChannelNumberByChannelName(cit_1, "L_Align_SC", "左轨向_中波"), startPos_0, endPos_0);
            d_wx_2 = cdp.GetSingleChannelData(cit_2, dataProcessing.GetChannelNumberByChannelName(cit_2, "L_Align_SC", "左轨向_中波"), startPos_1, endPos_1);

            tmpDataStrList = changeDetcPro.ChangeDetectionPrcs("左轨向_中波", d_tt_1, d_wx_1, d_wvelo_1, d_wx_gauge_1, d_tt_2, d_wx_2, d_wvelo_2, d_wx_gauge_2);
            dataStrList.AddRange(tmpDataStrList);

            d_wx_1 = cdp.GetSingleChannelData(cit_1, dataProcessing.GetChannelNumberByChannelName(cit_1, "R_Align_SC", "右轨向_中波"), startPos_0, endPos_0);
            d_wx_2 = cdp.GetSingleChannelData(cit_2, dataProcessing.GetChannelNumberByChannelName(cit_2, "R_Align_SC", "右轨向_中波"), startPos_1, endPos_1);

            tmpDataStrList = changeDetcPro.ChangeDetectionPrcs("右轨向_中波", d_tt_1, d_wx_1, d_wvelo_1, d_wx_gauge_1, d_tt_2, d_wx_2, d_wvelo_2, d_wx_gauge_2);
            dataStrList.AddRange(tmpDataStrList);

            return(dataStrList);
        }
Ejemplo n.º 2
0
        private double[] GetMileWithIdf(List <IndexStaClass> listIC, MilePosClass startCls, MilePosClass endCls, int tds)
        {
            List <double> retVal  = new List <double>();
            Boolean       isKmInc = false;//false代表减里程
            int           i       = 0;

            if (double.Parse(listIC[0].lStartMeter) < double.Parse(listIC[listIC.Count - 1].LEndMeter))
            {
                isKmInc = true;//增里程
            }

            for (i = 0; i < listIC.Count; i++)
            {
                if (startCls.GetPos() >= listIC[i].lStartPoint && startCls.GetPos() <= listIC[i].lEndPoint)
                {
                    long jvli = Math.Abs(startCls.mile - (long)(double.Parse(listIC[i].LEndMeter) * 1000));

                    int iCount = (int)(jvli / (float.Parse(listIC[i].lContainsMeter) * 1000 / listIC[i].lContainsPoint));

                    long lCurPos = startCls.GetPos() - listIC[i].lStartPoint;
                    int  iIndex  = 0;
                    if (listIC[i].sType.Contains("长链"))
                    {
                        int    iKM       = 0;
                        double dCDLMeter = float.Parse(listIC[i].lContainsMeter) * 1000;
                        if (isKmInc == false)
                        {
                            iKM = (int)float.Parse(listIC[i].LEndMeter);
                        }
                        else
                        {
                            iKM = (int)float.Parse(listIC[i].lStartMeter);
                        }
                        for (iIndex = 0; iIndex < iCount && (startCls.GetPos() + iIndex * tds * 2) < listIC[i].lEndPoint; iIndex++)
                        {
                            float     f  = (1 + iIndex) * ((float.Parse(listIC[i].lContainsMeter) * 1000 / listIC[i].lContainsPoint));
                            WaveMeter wm = new WaveMeter();
                            if (isKmInc == false)
                            {
                                wm.Km    = iKM;
                                wm.Meter = (float)(dCDLMeter - f);

                                retVal.Add(wm.Km + wm.Meter / 1000f);
                            }
                            else
                            {
                                wm.Km    = iKM;
                                wm.Meter = f;

                                retVal.Add(wm.Km + wm.Meter / 1000f);
                            }
                            wm.lPosition = (startCls.GetPos() + (iIndex * tds * 2));
                        }
                    }
                    else
                    {
                        double dMeter = float.Parse(listIC[i].lStartMeter) * 1000;
                        for (iIndex = 0; iIndex < iCount && (startCls.GetPos() + iIndex * tds * 2) < listIC[i].lEndPoint; iIndex++)
                        {
                            float     f  = (1 + iIndex) * ((float.Parse(listIC[i].lContainsMeter) * 1000 / listIC[i].lContainsPoint));
                            WaveMeter wm = new WaveMeter();
                            if (isKmInc == false)
                            {
                                wm.Km    = (int)((dMeter - f) / 1000);
                                wm.Meter = (float)((dMeter - f) % 1000);

                                retVal.Add(wm.Km + wm.Meter / 1000f);
                            }
                            else
                            {
                                wm.Km    = (int)((dMeter + f) / 1000);
                                wm.Meter = (float)((dMeter + f) % 1000);

                                retVal.Add(wm.Km + wm.Meter / 1000f);
                            }
                            wm.lPosition = (startCls.GetPos() + (iIndex * tds * 2));
                        }
                    }



                    break;
                }
            }

            for (++i; i < listIC.Count; i++)
            {
                if (endCls.GetPos() >= listIC[i].lStartPoint && endCls.GetPos() <= listIC[i].lEndPoint)
                {
                    long jvli = Math.Abs(endCls.mile - (long)(double.Parse(listIC[i].lStartMeter) * 1000));

                    int iCount = (int)(jvli / (float.Parse(listIC[i].lContainsMeter) * 1000 / listIC[i].lContainsPoint));

                    long lCurPos = listIC[i].lStartPoint;
                    int  iIndex  = 0;
                    if (listIC[i].sType.Contains("长链"))
                    {
                        int    iKM       = 0;
                        double dCDLMeter = float.Parse(listIC[i].lContainsMeter) * 1000;
                        if (isKmInc == false)
                        {
                            iKM = (int)float.Parse(listIC[i].LEndMeter);
                        }
                        else
                        {
                            iKM = (int)float.Parse(listIC[i].lStartMeter);
                        }
                        for (iIndex = 0; iIndex < iCount && (listIC[i].lStartPoint + iIndex * tds * 2) < endCls.GetPos(); iIndex++)
                        {
                            float     f  = (1 + iIndex) * ((float.Parse(listIC[i].lContainsMeter) * 1000 / listIC[i].lContainsPoint));
                            WaveMeter wm = new WaveMeter();
                            if (isKmInc == false)
                            {
                                wm.Km    = iKM;
                                wm.Meter = (float)(dCDLMeter - f);

                                retVal.Add(wm.Km + wm.Meter / 1000f);
                            }
                            else
                            {
                                wm.Km    = iKM;
                                wm.Meter = f;

                                retVal.Add(wm.Km + wm.Meter / 1000f);
                            }
                            wm.lPosition = (listIC[i].lStartPoint + (iIndex * tds * 2));
                        }
                    }
                    else
                    {
                        double dMeter = float.Parse(listIC[i].lStartMeter) * 1000;
                        for (iIndex = 0; iIndex < iCount && (listIC[i].lStartPoint + iIndex * tds * 2) < endCls.GetPos(); iIndex++)
                        {
                            float     f  = (1 + iIndex) * ((float.Parse(listIC[i].lContainsMeter) * 1000 / listIC[i].lContainsPoint));
                            WaveMeter wm = new WaveMeter();
                            if (isKmInc == false)
                            {
                                wm.Km    = (int)((dMeter - f) / 1000);
                                wm.Meter = (float)((dMeter - f) % 1000);

                                retVal.Add(wm.Km + wm.Meter / 1000f);
                            }
                            else
                            {
                                wm.Km    = (int)((dMeter + f) / 1000);
                                wm.Meter = (float)((dMeter + f) % 1000);

                                retVal.Add(wm.Km + wm.Meter / 1000f);
                            }
                            wm.lPosition = (startCls.GetPos() + (iIndex * tds * 2));
                        }
                    }

                    break;
                }



                int iCount_m = (int)(listIC[i].lContainsPoint);

                long lCurPos_m = listIC[i].lStartPoint;
                int  iIndex_m  = 0;
                if (listIC[i].sType.Contains("长链"))
                {
                    int    iKM       = 0;
                    double dCDLMeter = float.Parse(listIC[i].lContainsMeter) * 1000;
                    if (isKmInc == false)
                    {
                        iKM = (int)float.Parse(listIC[i].LEndMeter);
                    }
                    else
                    {
                        iKM = (int)float.Parse(listIC[i].lStartMeter);
                    }
                    for (iIndex_m = 0; iIndex_m < iCount_m && (listIC[i].lStartPoint + iIndex_m * tds * 2) < listIC[i].lEndPoint; iIndex_m++)
                    {
                        float     f  = (1 + iIndex_m) * ((float.Parse(listIC[i].lContainsMeter) * 1000 / listIC[i].lContainsPoint));
                        WaveMeter wm = new WaveMeter();
                        if (isKmInc == false)
                        {
                            wm.Km    = iKM;
                            wm.Meter = (float)(dCDLMeter - f);

                            retVal.Add(wm.Km + wm.Meter / 1000f);
                        }
                        else
                        {
                            wm.Km    = iKM;
                            wm.Meter = f;

                            retVal.Add(wm.Km + wm.Meter / 1000f);
                        }
                        wm.lPosition = (listIC[i].lStartPoint + (iIndex_m * tds * 2));
                    }
                }
                else
                {
                    double dMeter = float.Parse(listIC[i].lStartMeter) * 1000;
                    for (iIndex_m = 0; iIndex_m < iCount_m && (listIC[i].lStartPoint + iIndex_m * tds * 2) < listIC[i].lEndPoint; iIndex_m++)
                    {
                        float     f  = (1 + iIndex_m) * ((float.Parse(listIC[i].lContainsMeter) * 1000 / listIC[i].lContainsPoint));
                        WaveMeter wm = new WaveMeter();
                        if (isKmInc == false)
                        {
                            wm.Km    = (int)((dMeter - f) / 1000);
                            wm.Meter = (float)((dMeter - f) % 1000);

                            retVal.Add(wm.Km + wm.Meter / 1000f);
                        }
                        else
                        {
                            wm.Km    = (int)((dMeter + f) / 1000);
                            wm.Meter = (float)((dMeter + f) % 1000);

                            retVal.Add(wm.Km + wm.Meter / 1000f);
                        }
                        wm.lPosition = (startCls.GetPos() + (iIndex_m * tds * 2));
                    }
                }
            }



            return(retVal.ToArray());
        }