/// <summary> /// Получает все заправки /// </summary> /// <returns>Список обьектов типа PLFRefillClass</returns> public List <PLFRefillClass> Get_AllRefills() { double minRefillLitres = 4; double minRefillLitresAll = 19; List <PLFRefillClass> allRefills = new List <PLFRefillClass>(); PLFRefillClass oneRefill = new PLFRefillClass(); if (Records.Count < 0) { return(allRefills); } double prev = Records[0].getDoubleParam(Records[0].FUEL_VOLUME1); double current; bool refillStart = true; double refillLitresCount = 0; for (int i = 1; i < Records.Count; i++) { current = Records[i].getDoubleParam(Records[i].FUEL_VOLUME1); if ((current - prev) > minRefillLitres) { if (refillStart) { oneRefill.capacityStart = prev; oneRefill.timeStart = Records[i - 1].SYSTEM_TIME.GetSystemTime(); refillStart = false; } refillLitresCount += current - prev; } else { if (!refillStart) { if (refillLitresCount > minRefillLitresAll) { oneRefill.capacityEnd = prev; oneRefill.timeEnd = Records[i - 1].SYSTEM_TIME.GetSystemTime(); allRefills.Add(oneRefill); } oneRefill = new PLFRefillClass(); refillStart = true; refillLitresCount = 0; } } prev = current; } return(allRefills); }
/// <summary> /// Получает все сливы /// </summary> /// <returns>Список обьектов типа PLFRefillClass</returns> public List <PLFRefillClass> Get_AllDropOuts() { double minSPEED = 3; double minDropOutLitresAll = 19; double startFuelDropout = 7; bool newDropout = false; List <PLFRefillClass> allDropouts = new List <PLFRefillClass>(); PLFRefillClass oneDropout = new PLFRefillClass(); if (Records.Count < 0) { return(allDropouts); } for (int i = 1; i < Records.Count; i++) { if (Records[i].getDoubleParam(Records[i].SPEED) < minSPEED) { if (newDropout == false) { newDropout = true; oneDropout.capacityStart = Records[i].getDoubleParam(Records[i].FUEL_VOLUME1); oneDropout.timeStart = Records[i].SYSTEM_TIME.GetSystemTime(); startFuelDropout = Records[i].getDoubleParam(Records[i].FUEL_VOLUME1); } } else { if (newDropout == true) { newDropout = false; if (Records[i].getDoubleParam(Records[i].FUEL_VOLUME1) < (startFuelDropout - minDropOutLitresAll)) { oneDropout.capacityEnd = Records[i].getDoubleParam(Records[i].FUEL_VOLUME1); oneDropout.timeEnd = Records[i].SYSTEM_TIME.GetSystemTime(); allDropouts.Add(oneDropout); } oneDropout = new PLFRefillClass(); } } } return(allDropouts); }
/// <summary> /// Получает все заправки /// </summary> /// <returns>Список обьектов типа PLFRefillClass</returns> public List<PLFRefillClass> Get_AllRefills() { double minRefillLitres = 4; double minRefillLitresAll = 19; List<PLFRefillClass> allRefills = new List<PLFRefillClass>(); PLFRefillClass oneRefill = new PLFRefillClass(); if(Records.Count<0) return allRefills; double prev = Records[0].getDoubleParam(Records[0].FUEL_VOLUME1); double current; bool refillStart = true; double refillLitresCount = 0; for(int i=1;i<Records.Count;i++) { current = Records[i].getDoubleParam(Records[i].FUEL_VOLUME1); if ((current - prev) > minRefillLitres) { if (refillStart) { oneRefill.capacityStart = prev; oneRefill.timeStart = Records[i - 1].SYSTEM_TIME.GetSystemTime(); refillStart = false; } refillLitresCount += current - prev; } else { if (!refillStart) { if (refillLitresCount > minRefillLitresAll) { oneRefill.capacityEnd = prev; oneRefill.timeEnd = Records[i - 1].SYSTEM_TIME.GetSystemTime(); allRefills.Add(oneRefill); } oneRefill = new PLFRefillClass(); refillStart = true; refillLitresCount = 0; } } prev = current; } return allRefills; }
/// <summary> /// Получает все сливы /// </summary> /// <returns>Список обьектов типа PLFRefillClass</returns> public List<PLFRefillClass> Get_AllDropOuts() { double minSPEED = 3; double minDropOutLitresAll = 19; double startFuelDropout = 7; bool newDropout = false; List<PLFRefillClass> allDropouts = new List<PLFRefillClass>(); PLFRefillClass oneDropout = new PLFRefillClass(); if (Records.Count < 0) return allDropouts; for (int i = 1; i < Records.Count; i++) { if (Records[i].getDoubleParam(Records[i].SPEED) < minSPEED) { if (newDropout == false) { newDropout = true; oneDropout.capacityStart = Records[i].getDoubleParam(Records[i].FUEL_VOLUME1); oneDropout.timeStart = Records[i].SYSTEM_TIME.GetSystemTime(); startFuelDropout = Records[i].getDoubleParam(Records[i].FUEL_VOLUME1); } } else { if (newDropout == true) { newDropout = false; if (Records[i].getDoubleParam(Records[i].FUEL_VOLUME1) < (startFuelDropout - minDropOutLitresAll)) { oneDropout.capacityEnd = Records[i].getDoubleParam(Records[i].FUEL_VOLUME1); oneDropout.timeEnd = Records[i].SYSTEM_TIME.GetSystemTime(); allDropouts.Add(oneDropout); } oneDropout = new PLFRefillClass(); } } } return allDropouts; }