question

Abubacker S avatar image
0 Likes"
Abubacker S asked Benjamin W2 edited

How to program the truck to reach its dock station based on its item type ?

lc-groundwork-01032020.fsm

How to program the truck to reach its respective dock station based on its item type?

In this logistics problem, triggering the inbound and outbound trucks based on the fluid levels in raw material (RM) and product storage tanks.

(2) RM unloading stations are connected to 5 tanks in a different combination. Note that, all the tanks are NOT connected to all dock stations.

Trucks are bringing a different type of items, all RM storage tanks are NOT compatible with all items. Compatible tanks for RM types:

RMtank 1 RMtank 2 RMtank 3 RMtank 4 RMtank 5
RM1 RM3 RM5 RM6 RM9
RM2 RM4 RM6 RM7 RM10
RM3 RM5 RM7 RM8 RM1
RM8 RM9

Using a FloWorks item to flow converter (a powder dumping station) the truck brought items are converted into fluid and stored in RM storage tanks.

Required solution is, the truck should travel to the respective dock station based on its RM item type and unload it in the respective tank. Different RMs should not get mixed in the same tanks. In case of unavailability of tank or dock stations are engaged, the truck should wait.

Kindly help how to resolve this problem

FlexSim 20.0.0
logistics
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Benjamin W2 avatar image Benjamin W2 commented ·

Hi @Abubacker S,

I have a few questions about your model in order to answer your question more effectively.

It sounds like you are simply trying to direct your trucks based on item assignment. How are you going to assign your raw materials on creation? Do you want them to be random?

How do you want the trucks to decide which dock to go to when unloading? It looks like unload point 1 can distribute to all tanks, while unload point 2 goes to 2 tanks.

How to you want to choose which RM goes to which tank?

Once you figure these details out, setting up your model should be straightforward. Have you completed the tutorials? There is some great information where you could learn to set this up on your own.

0 Likes 0 ·
Abubacker S avatar image Abubacker S Benjamin W2 commented ·

Hi @Benjamin W2 Thanks for your reply.

Here are my answers below:

It sounds like you are simply trying to direct your trucks based on item assignment. How are you going to assign your raw materials on creation? Do you want them to be random?

In the model ProcessFlow > Inbound trigger, Creating a token based on the event-triggered source which creates the truck in the model, travels to the dock station (code needs to be updated) and creating the items. the item types are based on the same item type present in the tank which triggered the token OnContentChange decrease to 150. Note that, tank name (Tank) was labeled on the token, item type (RMType) was labeled on items created. The labels would help to identify the right tank with the right RM item to transfer.

token.labels.assert("Tank").value  = object;
FlowTank Silo = token.Tank;
string RMType = Silo.product;
return RMType;

I am trying the write a generalized code to make the truck to travel with respect to the trigger and item to be transferred in the right tank because there are more additional dock stations and tanks that need to be added.

Currently, I used below code in ItemtoFlow which is not working:

/**Custom Code*/
Object current = ownerobject(c);
Object item = param(1);
double amount = param(2);
string prodtype=item.RMType;
int PortNo=0;
for(int k=1;k<=current.outObjects.length;k++)
{

FlowTank Silos = current.outObjects[k];
if(prodtype == Silos.product)
{
 PortNo  = k;
}
}
if (PortNo==0)
{
PortNo=5;
}
FlowObject involved = current;
//involved.output.ports.close(); //tried both
//involved.output.ports[PortNo].open();
FlowTank Silos = current.outObjects[PortNo];
Silos.input.open();

How do you want the trucks to decide which dock to go to when unloading? It looks like unload point 1 can distribute to all tanks, while unloading point 2 goes to 2 tanks.

As I mentioned above I may add more tanks or more queues/dock station in the model, the program needs to be generalized regardless of the connections, Is there any generalized way can we program this?

How do you want to choose which RM goes to which tank?

Right now I have 5 tanks storage compatible with 10 RM item types as shown in the table in question.copy-of-lc-problem-statement-flexsim-002.xlsx

Attaching Excel containing more information about the overall problem I am trying to solve. Appreciate your help if you can share a similar kind of model you have developed before.

Thanks

0 Likes 0 ·

1 Answer

Benjamin W2 avatar image
0 Likes"
Benjamin W2 answered Benjamin W2 edited

Hi @Abubacker S,

Your code is mostly correct, however it only tells the input port on your tank to open. It does not tell the item to flow where to send the fluid. By default, the Item To Flow will send the fluid to the first available port. To fix this, add an "On Reset" Trigger to all tanks that will close the inputs and open the outputs. See the following picture.

This will make sure that all input ports are closed when starting your model. Then, add an "On Item Empty" trigger to your ItemToFlow1. Add the following custom code, which is identical to yours except it will close the input port at the end of each item:

/**Custom Code*/
Object current = ownerobject(c);
Object item = param(1);

string prodtype=item.RMType;

int PortNo=0;

for(int k=1;k<=current.outObjects.length;k++)
{
	
	FlowTank Silos = current.outObjects[k];
	if(prodtype == Silos.product)
	{
		 PortNo  = k;
	}
	
}

if (PortNo==0)
{
	PortNo=5;
}

FlowObject involved = current;

//involved.output.ports.close();

//involved.output.ports[PortNo].open();

FlowTank Silos = current.outObjects[PortNo];
Silos.input.close();

This should allow your ItemToFlow to distribute to each item's respective tank.

Let me know if you have any more questions!

lc-groundwork.fsm


· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Abubacker S avatar image Abubacker S commented ·

Thanks, @Benjamin W2

This answer has resolved one of the problems. I would like to ask my next questions one by one.

Note that, the event trigger currently using a constant value 150 L decrease to or through value,

Basically the safety stock for each tank is different in reality, the order of RM is triggered based on individual safety stock level seperately as below:

Note that, I have added all the RM tanks in the group because I have a number of tanks to be added and each token can not be triggered individually using individual process flow.

How to use the above table in the event-triggered source?

Thanks.

0 Likes 0 ·
event-trigger.jpg (36.9 KiB)
safetystock.jpg (25.8 KiB)
Benjamin W2 avatar image Benjamin W2 Abubacker S commented ·

lc-groundwork2.fsmHi @Abubacker S,

Can you post each of these additional requests as their own questions? It will help us keep this forum more organized and allow several people to work on your question at once. You can tag me @Benjamin W2 if you would like to notify me specifically. However, since this is an easy question I will post my answer in this comment.

In order to get your source to fire at different levels for different tanks, you need to 1) Add a trigger level to each tank, 2) send a message from the tank, and 3) change the Event-triggered source to listen for messages.

  1. Open up the properties for each of your tanks, select the "Trigger Levels" tab, then add the level at which you would like the trigger to fire. See the following picture:
  2. Underneath the "Triggers" tab, add an "On Trigger Level" trigger. Click the green plus and underneath "Control" click "Send Message". Edit the "To" field to say "current".
  3. Change your event triggered source to listen to the "OnMessage" event.
0 Likes 0 ·