Ejemplo n.º 1
0
        public BankZoneDataA GetNextDataUnitZoneA(int?_TubeLength, L_TickPosition _MTP)
        {
            if (IsComplete())
            {
                return(null);
            }
            BankZoneDataA z = new BankZoneDataA(BankZone.EUnitToEType(Tp), Sensors, prevZone == null ? 0 : prevZone.index + 1);

            for (int i = 0; i < Sensors; i++)
            {
                BankZoneData zi = GetNextZone(i, _TubeLength, _MTP);
                if (zi == null)
                {
                    return(null);
                }
                z.Add(i, zi);
            }
            //            BankZoneData2 z = BankZoneData2.Create(GetNextZone02(false, _TubeLength, _MTP), GetNextZone02(true, _TubeLength, _MTP));
            if (z == null)
            {
                return(null);
            }
            if (z.last)
            {
                GotZones = true;
            }
            //				pr(AnsiString("z.index=") + z.index);
            //				pr(AnsiString("z1.data=") + (unsigned long)(z1.data));
            //				pr(AnsiString("z1.data2=") + (unsigned long)
            //					(z1.data + z1.size));
            //				pr(AnsiString("z2.data=") + (unsigned long)(z2.data));
            //				pr(AnsiString("z2.data2=") + (unsigned long)
            //					(z2.data + z2.size));
            //				pr(AnsiString("deltaZ2Z1=") + ((int)(z2.data - z1.data)));
            //				pr(AnsiString("SensorsPosition=") + _dataUnit->SensorsPosition);
            //				pr(AnsiString("SensorsPosition2=") +
            //					_dataUnit->SensorsPosition2);
            //				pr(z.ToString());
            prevZone = z;
            if (z.last)
            {
                complete = true;
            }
            return(z);
        }
Ejemplo n.º 2
0
        public ZoneThick GetNextDataUnitZone(bool _check, int?_TubeLength, L_TickPosition _MTP)
        {
            if (IsComplete())
            {
                return(null);
            }
            NextZone(_TubeLength, _MTP);
            ComputeZones();
            ZoneThick PrevZone = ZonesAll.LastOrDefault();

            if (PrevZone != null)
            {
                if (PrevZone.Last)
                {
                    GotZones = true;
                }
            }
            if (ZonesComputed.Count == 0)
            {
                return(null);
            }
            ZoneThick z = ZonesComputed[0];

            if (!_check)
            {
                //				pr(AnsiString("z.index=") + z.index);
                //				pr(AnsiString("z1.data=") + (unsigned long)(z1.data));
                //				pr(AnsiString("z1.data2=") + (unsigned long)
                //					(z1.data + z1.size));
                //				pr(AnsiString("z2.data=") + (unsigned long)(z2.data));
                //				pr(AnsiString("z2.data2=") + (unsigned long)
                //					(z2.data + z2.size));
                //				pr(AnsiString("deltaZ2Z1=") + ((int)(z2.data - z1.data)));
                //				pr(AnsiString("SensorsPosition=") + _dataUnit->SensorsPosition);
                //				pr(AnsiString("SensorsPosition2=") +
                //					_dataUnit->SensorsPosition2);
                //				pr(z.ToString());
                if (z.Last)
                {
                    complete = true;
                }
                ZonesComputed.RemoveAt(0);
            }
            return(z);
        }
Ejemplo n.º 3
0
        BankZoneData GetNextZone(int _sensor, int?_TubeLength, L_TickPosition _MTP)
        {
            double soffset = SensorsPosition + MOffset[_sensor];

            if (prevZone == null)
            {
                //                string sss = _second ? " 2" : " 1";
                double?tbp = _MTP.TickByPosition(soffset);
                //pr("soffset=" + soffset.ToString());
                //pr("TickByPosition=" + tbp.ToString());
                int?idata0 = IndexByTick(tbp);
                //pr("idata0="+idata0.ToString());
                if (idata0 == null)
                {
                    //                    pr("idata0"+sss);
                    return(null);
                }

                int?idata1 = IndexByTick(_MTP.TickByPosition(soffset + ZoneLength));
                if (idata1 == null)
                {
                    //                    pr("idata1" + sss);
                    return(null);
                }
                if (idata1.Value == idata0.Value)
                {
                    //                    pr("idata==idata1" + sss);
                    return(null);
                }

                int zsize = idata1.Value - idata0.Value;
                zsize /= Sensors;
                zsize *= Sensors;
                if (zsize <= 0)
                {
                    //                    pr("zsize <= 0" + sss);
                    return(null);
                }

                BankZoneData z = new BankZoneData(BankZone.EUnitToEType(Tp));
                z.length = ZoneLength;
                z.index  = 0;
                z.idata  = idata0.Value;
                z.size   = zsize;
                //                pr("------ " + _sensor.ToString() + " --------" + z.ToString());
                return(z);
            }
            else
            {
                if (prevZone.last)
                {
                    return(null);
                }
                BankZoneData z  = new BankZoneData(BankZone.EUnitToEType(Tp));
                BankZoneData pz = prevZone.MZones[_sensor];
                z.idata  = pz.idata + pz.size;
                z.length = ZoneLength;
                z.index  = prevZone.index + 1;

                double pos = ZoneLength * (z.index + 1);
                if (_TubeLength != null)
                {
                    if (pos >= _TubeLength.Value)
                    {
                        z.last   = true;
                        z.length = Convert.ToInt32(ZoneLength - (pos - _TubeLength.Value));
                        pos      = _TubeLength.Value;
                    }
                }
                pos += soffset;
                //pr("pos=" + pos.ToString());
                //if (_MTP.Count != 0)
                //{
                //    pr("_MTP[0].position=" + _MTP[0].position.ToString());
                //    pr(string.Format("_MTP[{0}].position={1}", (_MTP.Count - 1).ToString(), _MTP[_MTP.Count - 1].position.ToString()));
                //}

                //int lcount = _MTP.Count;

                double?tbp    = _MTP.TickByPosition(pos);
                int?   idata1 = IndexByTick(tbp);
                if (idata1 == null)
                {
                    return(null);
                }

                z.size  = idata1.Value - z.idata;
                z.size /= Sensors;
                z.size *= Sensors;
                if (z.size <= 0)
                {
                    return(null);
                }
                //pr(string.Format("pos: {0} + soffset: {1} = {2}", pos.ToString(), soffset.ToString(), (pos + soffset).ToString()));
                //pr(string.Format("tbp={0}", tbp.ToString()));
                //pr(string.Format("idata={0}", idata1.ToString()));
                return(z);
            }
        }
Ejemplo n.º 4
0
        void NextZone(int?_TubeLength, L_TickPosition _MTP)
        {
            ZoneThick PrevZone = ZonesAll.LastOrDefault();

            if (PrevZone == null)
            {
                int?idata0 = IndexByTick(_MTP.TickByPosition(SensorsPosition));
                if (idata0 == null)
                {
                    return;
                }

                int?idata1 = IndexByTick(_MTP.TickByPosition(SensorsPosition + ZoneLength));
                if (idata1 == null)
                {
                    return;
                }
                if (idata1.Value == idata0.Value)
                {
                    return;
                }

                int zsize = idata1.Value - idata0.Value;
                if (zsize <= 0)
                {
                    return;
                }

                ZoneThick z = new ZoneThick(rawStrobes, idata0.Value, zsize, 0, ZoneLength, false);
                ZonesAll.Add(z);
                ZonesGot.Add(z);
                pr(z.ToString());
            }
            else
            {
                if (PrevZone.Last)
                {
                    return;
                }
                int  idata  = PrevZone.rawstrobes_index + PrevZone.Size;
                int  length = ZoneLength;
                bool last   = false;

                double pos = ZoneLength * (PrevZone.Index + 2);
                if (_TubeLength != null)
                {
                    if (pos >= _TubeLength.Value)
                    {
                        last   = true;
                        length = Convert.ToInt32(ZoneLength - (pos - _TubeLength.Value));
                        pos    = _TubeLength.Value;
                    }
                }
                int?idata1 = IndexByTick(_MTP.TickByPosition(SensorsPosition + pos));
                if (idata1 == null)
                {
                    return;
                }

                int size = idata1.Value - idata;
                if (size <= 0)
                {
                    return;
                }
                ZoneThick z = new ZoneThick(rawStrobes, idata, size, PrevZone.Index + 1, length, last);
                ZonesAll.Add(z);
                ZonesGot.Add(z);
                pr(z.ToString());
            }
        }