//getstate string DetermineState(Dump dump, TypeOfDump tod, TypeOfZone toz, bool spd) { string curstate = dump.State.Current; string state = dump.State.Current; if (checkLoadZone(tod, toz, false) && curstate == state) { state = OnLoadingZone(dump); } if (checkLoad(tod, toz, (spd || dump.State.Current == "LL")) && curstate == state) { state = OnLoad(dump); } if (checkUnload(tod, toz, (spd || dump.State.Current == "UU")) && curstate == state) { state = OnUnload(dump); } if (checkShiftChange(tod, toz, (spd || dump.State.Current == "PP")) && curstate == state) { state = OnShiftChange(dump); } if (checkOutage(tod, toz, spd) && curstate == state) { state = OnOutage(dump); } if (checkMove(tod, toz, spd) && curstate == state) { state = OnMove(dump); } return(state); }
public Zone(string id, TypeOfZone toz, List <Point> list) { Index = Count; Id = id; Type = toz; Points = list; Count++; }
public void Add(string id, TypeOfZone type, List <Point> points) { bool havenot = true; foreach (Zone z in _list) { if (z.Id == id) { havenot = false; } } if (havenot) { _list.Add(new Zone(id, type, points)); } }
public usedExcavator ToucheExcavator(string truckimei, double latitude, double longitude, DateTime datetime, int speedKPH) { int excav = -1; excav = Dumps.SearchExcavator(latitude, longitude); if (excav == -1) { return(null); } TypeOfZone toz = TypeOfZone.OnTruckZone; TypeOfDump tod = TypeOfDump.Excavator; Dump dump = Dumps[excav]; bool spd = false; string newState = DetermineState(dump, tod, toz, spd); return(new usedExcavator() { id = excav, newstate = newState }); }
protected override TypeOfZone EventHandler(DumpMessage msg) { SetLocation(msg.Location); TypeOfZone result = TypeOfZone.None; if (FindNearLoadingZone(Location)) { if (result == TypeOfZone.OnStoragePoint) { result = TypeOfZone.OnLoadingOrStorageZone; } else { result = TypeOfZone.OnLoadingZone; } } if (FindNearExcavator(Location)) { if (result == TypeOfZone.OnLoadingZone) { result = TypeOfZone.OnLoadingPoint; } } if (FindNearDepot(Location)) { if (result == TypeOfZone.OnLoadingPoint) { result = TypeOfZone.OnLoadingOrStorageZone; } else { result = TypeOfZone.OnStoragePoint; } } if (FindNearParking(Location)) { result = TypeOfZone.OnShiftChangePoint; } return(result); }
//check zone bool checkLoadZone(TypeOfDump tod, TypeOfZone toz, bool spd) { return(tod == TypeOfDump.Dumptruck && (toz == TypeOfZone.OnLoadingZone || toz == TypeOfZone.OnLoadingOrStorageZone)) //|| (tod == TypeOfDump.Excavator && toz == TypeOfZone.OnTruckZone) ; }
bool checkMove(TypeOfDump tod, TypeOfZone toz, bool spd) { return((tod == TypeOfDump.Excavator && toz == TypeOfZone.None && spd) || (tod == TypeOfDump.Dumptruck && toz == TypeOfZone.None && spd)); }
bool checkShiftChange(TypeOfDump tod, TypeOfZone toz, bool spd) { return((tod == TypeOfDump.Dumptruck && toz == TypeOfZone.OnShiftChangePoint && !spd) || (tod == TypeOfDump.Dumptruck && toz == TypeOfZone.OnGarage && !spd)); }
bool checkUnload(TypeOfDump tod, TypeOfZone toz, bool spd) { return(tod == TypeOfDump.Dumptruck && (toz == TypeOfZone.OnStoragePoint || toz == TypeOfZone.OnLoadingOrStorageZone) && !spd); }
bool checkLoad(TypeOfDump tod, TypeOfZone toz, bool spd) { return((tod == TypeOfDump.Dumptruck && toz == TypeOfZone.OnLoadingPoint && !spd) || (tod == TypeOfDump.Excavator && toz == TypeOfZone.OnTruckZone)); }