/// <summary> /// Shuffle Move /// </summary> /// <param name="telegram"></param> private void CreateShuttleTask(string telegram) //TODO should this go into the control object? { int level; string destination = string.Empty; string current = telegram.GetFieldValue(this, TelegramFields.Current); //GetFieldValue by string not enum (faster) MultiShuttle ms = GetMultishuttleFromAisleNum(GetBinLocField(current, BinLocFields.Aisle)); ShuttleTask st = new ShuttleTask(); st.Source = DCIbinLocToMultiShuttleLoc(current, out level, ms); string tlgDest = telegram.GetFieldValue(this, TelegramFields.Destination); if (tlgDest.LocationType() == LocationTypes.BinLocation)//A shuffle move { destination = DCIbinLocToMultiShuttleLoc(tlgDest, out level, ms); } else if (tlgDest.LocationType() == LocationTypes.DropStation)//A move to a drop station { // takes the form aasyyxz: aa=aisle, s = side, yy = level, x = conv type see enum ConveyorTypes , Z = loc A or B e.g. 01R05OA destination = string.Format("{0}{1}{2}OA", GetPSDSLocFields(tlgDest, PSDSRackLocFields.Aisle), GetPSDSLocFields(tlgDest, PSDSRackLocFields.Side), level.ToString().PadLeft(2, '0')); } else if (tlgDest.LocationType() == LocationTypes.RackConvOut) { destination = DCIrackLocToMultiShuttleRackLoc(level, tlgDest);//Create the rack location destination for the shuttle task } st.Destination = destination; st.Level = level; st.LoadID = telegram.GetFieldValue(this, TelegramFields.TUIdent); st.caseData = CreateDCICaseData(telegram); ms.shuttlecars[level].ShuttleTasks.Add(st); }
void theMultishuttle_OnArrivedAtInfeedRackConvPosB(object sender, RackConveyorArrivalEventArgs e) { ShuttleTask st = new ShuttleTask(); string destination = ((IATCCaseLoadType)e._caseLoad).Destination; if (destination.LocationType() == LocationTypes.RackConv) { // IATCCaseLoadType atcLoad = e._caseLoad as IATCCaseLoadType; // atcLoad.Location = atcLoad.Destination; // string sendTelegram = mheController_Multishuttle.CreateTelegramFromLoad(TelegramTypes.MultishuttleTransportFinishedTelegram, atcLoad); // mheController_Multishuttle.SendTelegram(sendTelegram, true); return; } if (destination.LocationType() == LocationTypes.DS) { //Need to create a RI to RO task to the shuttle int level; if (!int.TryParse(e._locationName.Substring(3, 2), out level)) { Log.Write(string.Format("Multishuttle Control {0} Error: Error arriving at infeed raCK conveyor when trying to find level", ParentAssembly.Name)); return; //Error! } st.Destination = MHEController_Multishuttle.DCILocToMultiShuttleConvLoc(level, destination); st.Level = level; st.LoadID = e._caseLoad.Identification; st.Source = e._locationName; theMultishuttle.shuttlecars[level].ShuttleTasks.Add(st); } else if (destination.LocationType() != LocationTypes.BinLocation) { Log.Write("WARNING: Arrived at infeed rack and destination is NOT a binlocation.", Color.Red); return; } else { //int level; //st.Destination = mheController_Multishuttle.DCIbinLocToMultiShuttleLoc(destination, out level, theMultishuttle); //st.Level = level; //st.LoadID = e._caseLoad.Identification; //st.Source = e._locationName; //theMultishuttle.shuttlecars[level].ShuttleTasks.Add(st); //Task is set when load arrives at first position, it's possible that the shuttle is already waiting so need to be kicked again. int level; st.Destination = mheController_Multishuttle.DCIbinLocToMultiShuttleLoc(destination, out level, theMultishuttle); st.Level = level; if (theMultishuttle.shuttlecars[level].waitingForLoadAtRI) { theMultishuttle.shuttlecars[level].ShuttleOnArrived(null, null); } } }
void theMultishuttle_OnArrivedAtInfeedRackConvPosB(object sender, RackConveyorArrivalEventArgs e) { ShuttleTask sT = new ShuttleTask(); sT.Barcode = e._caseLoad.SSCCBarcode; sT.Source = e._locationName; sT.Destination = GenerateBinLocation(e._locationName.Level().ToString()); theMultishuttle.shuttlecars[sT.Source.Level()].ShuttleTasks.Add(sT); }
private ShuttleTask GenerateBinLocRetrival(int aisle, int level = 0) { ShuttleTask sT = new ShuttleTask(); string freeLevel = string.Empty; string binLocation = string.Empty; if (level == 0) // no level has been imputted { freeLevel = GetRandomFreeLevel(); } else if (level > 0) { freeLevel = level.ToString().PadLeft(2, '0'); } if (freeLevel != string.Empty) // if nothing was returned from GetRandomFreeLevel then string will be empty { //sT.LoadColor = System.Drawing.Color.Peru; //sT.LoadHeight = 0.32f; //sT.LoadLength = 0.6f; //sT.LoadWidth = 0.4f; //sT.LoadWeight = 2.3f; sT.Source = GenerateBinLocation(freeLevel); //sT.Source = string.Format("{0}{1}{2}{3}", (char)GetRackSide() //s - side // , rand.Next(1, (int)theMultishuttle.RackBays + 1).ToString().PadLeft(3, '0') //xxx - Bin loc // , freeLevel //yy - level // , rand.Next(1, 3).ToString().PadLeft(2, '0')); //dd - depth //Core.Environment.Log.Write(sT.Source); string side = "R"; int intFreeLevel; int.TryParse(freeLevel, out intFreeLevel); if (theMultishuttle.LeftEvenLevelInfeed) //infeeds and outfeeds are mixed { if (theMultishuttle.LeftEvenLevelInfeed && intFreeLevel % 2 == 0) { side = "R"; } else if (theMultishuttle.LeftEvenLevelInfeed && intFreeLevel % 2 > 0) { side = "L"; } } sT.Destination = string.Format("{0}{1}{2}OB", aisle.ToString().PadLeft(2, '0'), side, freeLevel); sT.Barcode = FeedCase.GetSSCCBarcode(); return(sT); } return(null); }
void theMultishuttle_OnArrivedAtInfeedRackConvPosB(object sender, RackConveyorArrivalEventArgs e) { ShuttleTask st = new ShuttleTask(); DCICaseData caseData = e._caseLoad.Case_Data as DCICaseData; string destination = caseData.Destination; if (destination.LocationType() == LocationTypes.RackConvIn) { Case_Load atcLoad = e._caseLoad as Case_Load; caseData.Current = caseData.Destination; string sendTelegram = controller.CreateTelegramFromLoad(TelegramTypes.TUReport, atcLoad); controller.SendTelegram(sendTelegram); return; } if (destination.LocationType() == LocationTypes.DropStation) { //Need to create a RI to RO task to the shuttle int level; if (!int.TryParse(e._locationName.Substring(3, 2), out level)) { Log.Write(string.Format("Multishuttle Control {0} Error: Error arriving at infeed rack conveyor when trying to find level", ParentAssembly.Name)); return; //Error! } st.Destination = MHEController_Multishuttle.DCILocToMultiShuttleConvLoc(level, destination); st.Level = level; st.LoadID = e._caseLoad.Identification; st.Source = e._locationName; theMultishuttle.shuttlecars[level].ShuttleTasks.Add(st); } else if (destination.LocationType() != LocationTypes.BinLocation) { Log.Write("WARNING: Arrived at infeed rack and destination is NOT a binlocation.", Color.Red); return; } else { int level; st.Destination = controller.DCIbinLocToMultiShuttleLoc(destination, out level, theMultishuttle); st.Level = level; st.LoadID = e._caseLoad.Identification; st.Source = e._locationName; theMultishuttle.shuttlecars[level].ShuttleTasks.Add(st); } }
private void DelayedShuttleTask(RackConveyorArrivalEventArgs e) { Core.Environment.Log.Write("task"); ShuttleTask sT = new ShuttleTask(); sT.Level = e._locationName.Level(); //sT.LoadColor = Color.Peru; //sT.LoadHeight = 0.32f; //sT.LoadLength = 0.65f; //sT.LoadWidth = 0.32f; //sT.LoadWeight = 2.3f; sT.Destination = "01R06OB"; sT.Source = e._locationName; sT.Barcode = FeedCase.GetSSCCBarcode(); theMultishuttle.shuttlecars[sT.Level].ShuttleTasks.Add(sT); }
void theMultishuttle_OnArrivedAtInfeedRackConvPosA(object sender, RackConveyorArrivalEventArgs e) { ShuttleTask st = new ShuttleTask(); string destination = ((IATCCaseLoadType)e._caseLoad).Destination; if (destination.LocationType() == LocationTypes.RackConv) { IATCCaseLoadType atcLoad = e._caseLoad as IATCCaseLoadType; atcLoad.Location = atcLoad.Destination; string sendTelegram = mheController_Multishuttle.CreateTelegramFromLoad(TelegramTypes.MultishuttleTransportFinishedTelegram, atcLoad); mheController_Multishuttle.SendTelegram(sendTelegram, true); //return; } if (e._elevator.ElevatorConveyor.Route.Loads.Count == 0) { e._elevator.SetNewElevatorTask(); } }
/// Rack Location for an ElevatorTask takes the form: aasyyxz: a=aisle, s = side, y = level, x = input or output, Z = loc A or B e.g. 01R05OA /// Source location for a shuttleTask takes the form: sxxxyydd: Side, xxx location, yy = level, dd = depth public bool CreateShuttleTask(string origin, string dest, CaseData cData, ShuttleTaskTypes taskType) { ShuttleTask sT = new ShuttleTask(); if (taskType == ShuttleTaskTypes.RackToConv) { int l = 0; int.TryParse(origin.Datcom_Y_Vertical(), out l); sT.Level = l; sT.Source = string.Format("{0}{1}{2}{3}", origin.Datcom_Side(), origin.Datcom_X_horizontal(), origin.Datcom_Y_Vertical(), origin.Datcom_GroupOrDepth().PadLeft(2, '0')); sT.Destination = string.Format("{0}{1}{2}OA", dest.Datcom_Aisle(), dest.Datcom_Side(), dest.Datcom_Y_Vertical()); } else if (taskType == ShuttleTaskTypes.ConvToRack) { int l = 0; int.TryParse(origin.Datcom_Y_Vertical(), out l); sT.Level = l; sT.Source = string.Format("{0}{1}{2}IB", origin.Datcom_Aisle(), origin.Datcom_Side(), origin.Datcom_Y_Vertical()); sT.Destination = string.Format("{0}{1}{2}{3}", dest.Datcom_Side(), dest.Datcom_X_horizontal(), dest.Datcom_Y_Vertical(), dest.Datcom_GroupOrDepth().PadLeft(2, '0')); var loc = theMultishuttle.ConveyorLocations.Find(x => x.LocName == sT.Source); if (loc != null && loc.LocName.ConvType() == ConveyorTypes.InfeedRack && loc.Active && cData.ULID == loc.ActiveLoad.Identification) { ((Case_Load)loc.ActiveLoad).Case_Data = cData; } else { Log.Write(loc + " does not have an active load or the load is incorrect, ignoring message", Color.Red); //possibly an issue with VFC! return(false); } } else if (taskType == ShuttleTaskTypes.Shuffle) { int l = 0; int.TryParse(origin.Datcom_Y_Vertical(), out l); sT.Level = l; sT.Source = string.Format("{0}{1}{2}{3}", origin.Datcom_Side(), origin.Datcom_X_horizontal(), origin.Datcom_Y_Vertical(), origin.Datcom_GroupOrDepth().PadLeft(2, '0')); sT.Destination = string.Format("{0}{1}{2}{3}", dest.Datcom_Side(), dest.Datcom_X_horizontal(), dest.Datcom_Y_Vertical(), dest.Datcom_GroupOrDepth().PadLeft(2, '0')); } sT.LoadID = cData.ULID; sT.caseData = cData; sT.caseData.colour = Color.Blue; theMultishuttle.shuttlecars[sT.Source.LevelasInt()].ShuttleTasks.Add(sT); return(true); }
private void TUMissionSingleBlock(string telegram) { try { if (Core.Environment.InvokeRequired) { Core.Environment.Invoke(() => TUMissionSingleBlock(telegram)); return; } //Look for the load somewhere in the model, if the load is found then change it's status, if not create it at the current location Case_Load caseLoad = Case_Load.GetCaseFromIdentification(telegram.GetFieldValue(this, TelegramFields.TUIdent)); if (caseLoad != null) { DCICaseData caseData = caseLoad.Case_Data as DCICaseData; UpDateLoadParameters(telegram, caseLoad); if (telegram.GetFieldValue(this, TelegramFields.Current).LocationType() == LocationTypes.PickStation) { //Check how many loads are at the pickstation, first i need to find the pick station string currentLoc = telegram.GetFieldValue(this, TelegramFields.Current); string destLoc = telegram.GetFieldValue(this, TelegramFields.Destination); string aisle = GetPSDSLocFields(currentLoc, PSDSRackLocFields.Aisle); string side = GetPSDSLocFields(currentLoc, PSDSRackLocFields.Side); string psLevel = GetPSDSLocFields(currentLoc, PSDSRackLocFields.Level); string psA = string.Format("{0}{1}{2}{3}A", aisle, side, psLevel, GetPSDSLocFields(currentLoc, PSDSRackLocFields.ConvType)); string psB = string.Format("{0}{1}{2}{3}B", aisle, side, psLevel, GetPSDSLocFields(currentLoc, PSDSRackLocFields.ConvType)); MultiShuttle ms = GetMultishuttleFromAisleNum(psA); PickStationConveyor psConv = ms.PickStationConveyors.Find(x => x.Name == string.Format("{0}{1}PS{2}", aisle, side, psLevel)); //Check how many loads are on the pickstation if there is only 1 then send a single mission if (psConv.LocationA.Active && psConv.LocationB.Active) { Case_Load caseA = psConv.LocationA.ActiveLoad as Case_Load; Case_Load caseB = psConv.LocationB.ActiveLoad as Case_Load; DCICaseData caseDataA = caseA.Case_Data as DCICaseData; DCICaseData caseDataB = caseB.Case_Data as DCICaseData; //This is a double move to the elevator so don't send a single if (caseB.Identification == telegram.GetFieldValue(this, TelegramFields.TUIdent)) //LocationB just set the destination { UpDateLoadParameters(telegram, caseB); return; } else if (caseA.Identification == telegram.GetFieldValue(this, TelegramFields.TUIdent)) //LocationA Should be the second message so create the elevator task { UpDateLoadParameters(telegram, caseA); string DestLoadA, DestLoadB; if (caseDataA.Destination.LocationType() == LocationTypes.DropStation && GetPSDSLocFields(caseDataA.Destination, PSDSRackLocFields.Side) != side) { //First check if the destination is to a drop station... check if the drop station is on this elevator //If not choose a destination to level 1 and remember the load route DestLoadA = string.Format("{0}{1}{2}{3}B", GetPSDSLocFields(caseDataA.Current, PSDSRackLocFields.Aisle), GetPSDSLocFields(caseDataA.Current, PSDSRackLocFields.Side), FindLevelForReject(ms), "I"); } else { DestLoadA = string.Format("{0}{1}{2}{3}B", aisle, side, //GetLocFields(caseDataA.Destination, PSDSRackLocFields.Level), //GetLocFields(caseDataA.Destination, PSDSRackLocFields.ConvType)); GetLocFields(caseDataA.Destination, PSDSRackLocFields.Level) != "" ? GetLocFields(caseDataA.Destination, PSDSRackLocFields.Level) : GetBinLocField(caseDataA.Destination, BinLocFields.YLoc), GetLocFields(caseDataA.Destination, PSDSRackLocFields.ConvType) != "" ? GetLocFields(caseDataA.Destination, PSDSRackLocFields.ConvType) : "I"); } if (caseDataB.Destination.LocationType() == LocationTypes.DropStation && GetPSDSLocFields(caseDataB.Destination, PSDSRackLocFields.Side) != side) { //First check if the destination is to a drop station... check if the drop station is on this elevator //If not choose a destination to level 1 and remember the load route DestLoadB = string.Format("{0}{1}{2}{3}B", GetPSDSLocFields(caseDataB.Current, PSDSRackLocFields.Aisle), GetPSDSLocFields(caseDataB.Current, PSDSRackLocFields.Side), FindLevelForReject(ms), "I"); } else { DestLoadB = string.Format("{0}{1}{2}{3}B", aisle, side, GetLocFields(caseDataB.Destination, PSDSRackLocFields.Level) != "" ? GetLocFields(caseDataB.Destination, PSDSRackLocFields.Level) : GetBinLocField(caseDataB.Destination, BinLocFields.YLoc), GetLocFields(caseDataB.Destination, PSDSRackLocFields.ConvType) != "" ? GetLocFields(caseDataB.Destination, PSDSRackLocFields.ConvType) : "I"); } ElevatorTask et = new ElevatorTask(caseA.Identification, caseB.Identification) { LoadCycle = Cycle.Double, Flow = TaskType.Infeed, SourceLoadA = psA, SourceLoadB = psB, DestinationLoadA = DestLoadA, DestinationLoadB = DestLoadB, UnloadCycle = Cycle.Single }; if (et.DestinationLoadA == et.DestinationLoadB) { et.UnloadCycle = Cycle.Double; } ms.elevators.First(x => x.ElevatorName == side + aisle).ElevatorTasks.Add(et); } else { Log.Write(string.Format("Error {0}: None of the tuIdents match any of the loads at the PS on StartTransportTelegram"), Color.Orange); } } else { SingleLoadAtPS(telegram, caseLoad); } } else if (telegram.GetFieldValue(this, TelegramFields.Current).LocationType() == LocationTypes.RackConvOut) { LoadAtRackConv(telegram, caseLoad); } else if (telegram.GetFieldValue(this, TelegramFields.Current).LocationType() == LocationTypes.RackConvIn && caseData.Current == telegram.GetFieldValue(this, TelegramFields.Current)) //Mission for load at Infeed Rack conveyor { ShuttleTask st = new ShuttleTask(); string destination = caseData.Destination; if (destination.LocationType() != LocationTypes.BinLocation) { Log.Write("WARNING: Arrived at infeed rack and destination is NOT a binlocation.", Color.Red); return; } string current = telegram.GetFieldValue(this, TelegramFields.Current); string aisle = GetRackLocFields(current, PSDSRackLocFields.Aisle); string side = GetRackLocFields(current, PSDSRackLocFields.Side); string location = string.Format("{0}{1}{2}IB", aisle, side, GetRackLocFields(current, PSDSRackLocFields.Level)); MultiShuttle ms = GetMultishuttleFromAisleNum(location); int level; st.Destination = DCIbinLocToMultiShuttleLoc(destination, out level, ms); st.Level = level; st.LoadID = caseLoad.Identification; st.Source = location; ms.shuttlecars[level].ShuttleTasks.Add(st); } else { Log.Write(string.Format("{0}: MultishuttleStartTransportTelegram received but the load was found elsewhere in the model ({1}) message ignored", Name, caseData.Current), Color.Red); } } //Anything FROM a binloc will not have a load until the shuttle gets to the bin location at this point it will be created. else if (telegram.GetFieldValue(this, TelegramFields.Current).LocationType() == LocationTypes.BinLocation) { CreateShuttleTask(telegram); } else if (telegram.GetFieldValue(this, TelegramFields.Current).LocationType() == LocationTypes.BinLocation && telegram.GetFieldValue(this, TelegramFields.Destination).LocationType() == LocationTypes.DropStation) //It's a shuffle move { SingleLoadOut(telegram); } else { Log.Write("Error: Load not found in StartTransportTelegramReceived", Color.Red); } } catch (Exception ex) { Log.Write(ex.ToString()); if (ex.InnerException != null) { Log.Write(ex.InnerException.ToString()); } } }
/// <summary> /// Rack Location for an ElevatorTask takes the form: aasyyxz: a=aisle, s = side, y = level, x = input or output, Z = loc A or B e.g. 01R05OA /// Elevator Source location for a shuttleTask takes the form: sxxxyydd: Side, xxx location, yy = level, dd = depth /// </summary> /// <param name="info"></param> /// <param name="cPoint"></param> public MHEControl_MultiShuttleSimulation(MultiShuttleSimInfo info, MultiShuttle cPoint) { theMultishuttle = cPoint; multiShuttleSimInfo = info; // set this to save properties theMultishuttle.OnArrivedAtPickStationConvPosB += multiShuttle_OnArrivedAtPickStationConvPosB; theMultishuttle.OnArrivedAtPickStationConvPosA += multiShuttle_OnArrivedAtPickStationConvPosA; theMultishuttle.OnArrivedAtInfeedRackConvPosB += theMultishuttle_OnArrivedAtInfeedRackConvPosB; theMultishuttle.OnArrivedAtOutfeedRackConvPosA += theMultishuttle_OnArrivedAtOutfeedRackConvPosA; theMultishuttle.OnArrivedAtOutfeedRackConvPosB += theMultishuttle_OnArrivedAtOutfeedRackConvPosB; theMultishuttle.OnLoadTransferingToPickStation += theMultishuttle_OnLoadTransferingToPickStation; theMultishuttle.OnArrivedAtRackLocation += theMultishuttle_OnArrivedAtRackLocation; //List<string> setShuttleTasks = new List<string>() { "L0270902", "R0150202", "L0340102", "R0280302", "L0090701", "R0400802", "L0370802", "R0140102", "L0390402", "R0180602" }; //foreach (string item in setShuttleTasks) //{ // ShuttleTask sT = new ShuttleTask(); // sT.LoadColor = Color.Peru; // sT.LoadHeight = 0.32f; // sT.LoadLength = 0.65f; // sT.LoadWidth = 0.32f; // sT.LoadWeight = 2.3f; // sT.Source = item; // sT.Level = sT.Source.Level(); // sT.Destination = string.Format("01R{0}OB", sT.Level.ToString().PadLeft(2, '0')); // sT.Barcode = FeedCase.GetSSCCBarcode(); // theMultishuttle.shuttlecars[sT.Level].ShuttleTasks.Add(sT); //} ShuttleTask sT = new ShuttleTask(); try { //sT.LoadColor = Color.Peru; //sT.LoadHeight = 0.32f; //sT.LoadLength = 0.65f; //sT.LoadWidth = 0.32f; //sT.LoadWeight = 2.3f; sT.Source = "R0011001";//"L0011001" sT.Level = sT.Source.Level(); sT.Destination = string.Format("01{0}{1}OA", (char)(sT.Source.Side()), sT.Level.ToString().PadLeft(2, '0')); sT.Barcode = FeedCase.GetSSCCBarcode(); theMultishuttle.shuttlecars[sT.Level].ShuttleTasks.Add(sT); sT = new ShuttleTask(); //sT.LoadColor = Color.Peru; //sT.LoadHeight = 0.32f; //sT.LoadLength = 0.65f; //sT.LoadWidth = 0.32f; //sT.LoadWeight = 2.3f; sT.Source = "R0110801"; sT.Level = sT.Source.Level(); sT.Destination = string.Format("01{0}{1}OA", (char)sT.Source.Side(), sT.Level.ToString().PadLeft(2, '0')); sT.Barcode = FeedCase.GetSSCCBarcode(); theMultishuttle.shuttlecars[sT.Level].ShuttleTasks.Add(sT); } catch (Exception ex) { Log.Write("Error in simulation: " + ex.Message, Color.Red); } //for (int i = 0; i < 30; i++) //{ // ShuttleTask task = GenerateBinLocRetrival(1); // if (task != null) // { // theMultishuttle.shuttlecars[task.Source.Level()].ShuttleTasks.Add(task); // task = null; // } //} //List<RackConveyor> infeedRackConvTemp = new List<RackConveyor>(); //foreach (DematicActionPoint dAP in theMultishuttle.ConveyorLocations) //{ // if (dAP.LocName.ConvType() == ConveyorTypes.InfeedRack) // { // infeedRackConvTemp.Add((dAP.Parent.Parent.Parent) as RackConveyor); // } //} //var hash = new HashSet<RackConveyor>(infeedRackConvTemp); //List<RackConveyor> infeedRackConv = hash.ToList(); }