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); }
public BankZoneDataA GetDataUnitZoneACalibr(bool _check) { 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 = new BankZoneData(BankZone.EType.LINE); zi.index = 0; zi.idata = 0; zi.size = Count; zi.size /= Sensors; zi.size *= Sensors; zi.length = ZoneLength; zi.last = true; z.Add(i, zi); } GotZones = true; 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; } } return(z); }
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); } }