Example #1
0
        public void mergeDates(ref List <CoupleDate> contain, ref int num, GatePacket gatePacket)
        {
            num = 0;
            int    curPosX = (int)(gatePacket.tag.stampPos[0] / 1000);
            int    inc     = (int)(gatePacket.tag.stampInc[0] / 1000);
            int    bin     = (int)gatePacket.head.bin;
            int    cellNum = (int)gatePacket.tag.cellNum;
            double value;

            if (bin == (int)DAQ_MEAS_MODE.TOF_PEAK)
            {
                for (int i = 0; i < cellNum && curPosX < maxPos; i++)
                {
                    value = gatePacket.measureDate[i];
                    int tmpIndex = (int)(curPosX / ConstParameter.DefaultPosInc);
                    //int index = (int)(curPosX / mergeUnit);
                    int        index  = (int)(curPosX / inc);
                    CoupleDate cpDate = source[index];
                    cpDate.index   = index;
                    cpDate.realPos = curPosX;
                    if (value < ConstParameter.CoupleThreshold)
                    {
                        cpDate.isOK = true;
                    }
                    else
                    {
                        cpDate.isOK = false;
                    }

                    if (index == lastCouple.index)
                    {
                        if (cpDate.isOK == false || lastCouple.isOK == false)
                        {
                            lastCouple.isOK = false;
                        }
                    }
                    else
                    {
                        CoupleDate date = contain[num++];
                        //date.index = lastCouple.index;
                        //date.realPos = lastCouple.realPos;
                        //date.isOK = lastCouple.isOK;

                        ////reset
                        //lastCouple.isOK = true;
                        //lastCouple.index = index;
                        ////lastCouple.realPos =
                        date.index   = cpDate.index;
                        date.realPos = cpDate.realPos;
                        date.isOK    = cpDate.isOK;

                        lastCouple.index   = cpDate.index;
                        lastCouple.realPos = cpDate.realPos;
                        lastCouple.isOK    = cpDate.isOK;
                    }
                    curPosX += inc;
                }
            }
        }
Example #2
0
        public void clear()
        {
            lastCouple = new CoupleDate();

            source = null;
            GC.Collect();

            source = new List <CoupleDate>();
            while (source.Count < maxNum)
            {
                CoupleDate coupleDate = new CoupleDate();
                source.Add(coupleDate);
            }
        }
Example #3
0
        /**The constructor
         * @param diameter the diameter of the pipeline, mm
         * .*/
        public CoupleDateService(double diameter)
        {
            double l = 3.14 * diameter;

            mergeUnit = l / 360 * ConstParameter.AnglePreUnit;  //distantce for 2°

            maxPos = l;

            source = new List <CoupleDate>();

            lastCouple = new CoupleDate();

            int maxHeight = (int)(l / ConstParameter.DefaultPosInc * 1.2); //the max num of the array the stroge the datas

            maxNum = maxHeight + 1;
            while (source.Count < maxNum)
            {
                CoupleDate coupleDate = new CoupleDate();
                source.Add(coupleDate);
            }
        }