question

Suhas H2 avatar image
0 Likes"
Suhas H2 asked tannerp commented

Pull the parts when content is less than certain quantity

Hello there,

I am trying to pull the items from the list when the object has less than 2 parts. But my model doesn't seem to work the way i want it to.practice-1.fsm

Thanks in advance

FlexSim 19.1.0
transporterpull strategy
practice-1.fsm (42.1 KiB)
· 3
5 |100000

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

tannerp avatar image tannerp commented ·

Hi @Suhas H2,

Which object needs to have less than 2 parts? Do you mean when your TaskExecuter1 has less than 2 items loaded on it? If so, you need to specify exactly what happens and in what order. For example, if I am TaskExecuter1 and I have 2 items loaded. When I drop off one of my items, should I drop off the second one or should I go get another item first?

What happens when the "object" has less than 2 parts but there are not any items available on the list?

I would recommend using Process Flow logic. You can start with an Event-Triggered Source that listens to the content change of the Task Executer, then create a series of activities, like "Acquire", "Pull from List", "Load", "Travel", etc. that can perform what you're looking for. It needs to be well-defined in advance, though, to get a good result.

0 Likes 0 ·
Suhas H2 avatar image Suhas H2 tannerp commented ·

Hi @tanner.p,

I would like Queue1 to pull items from the rack when the contents in the Queue1 is less than 2.

I have added this condition in the flow-->Pull strategy like shown below. But the task executer doesnt seem to move after the contents in the Queue1 is less than 2. Also tried to pull the item from the list in the 'On Exit' trigger on When the contents in the Queue1 is less than 2 doesnot this pull strategy get triggered and execute the pull logic?

Object current = ownerobject(c);
Variant mybag=content(current);
if (content(current) <= 2) {
	int callbackCase = param(5);
	#define CALLBACK_CASE 10293
	treenode pulled = 0;
	if (callbackCase != CALLBACK_CASE) {
		string listName = "ItemList1";
		List list = List(listName);
		string queryStr = "";
		Variant partitionId = 0;
		int removeFromList = 1;
		int addToBackOrders = 1;
		pulled = list.pull(queryStr, 1, addToBackOrders ? 1 : 0, current, partitionId, (removeFromList ? 0 : LIST_DO_NOT_REMOVE) | LIST_RETURN_BACK_ORDER_IF_NOT_FULFILL);
		if (isclasstype(pulled, "ListBackOrder"))
			eventlisten(pulled, "OnFulfill", c, 0, LIST_ON_FULFILL_VALUE, 0, 0, 0, CALLBACK_CASE, current);
		else if (objectexists(pulled))
			pullitem(current, pulled, 0, BYPASS_ALL);
	} else {
		pulled = param(1);
		current = param(6);
		pushitem(pulled, current, 0, 0);
	}


}
return current.inObjects.length + 1;
<br>
0 Likes 0 ·
Suhas H2 avatar image Suhas H2 Suhas H2 commented ·

@Jörg Vogel any help would be great.

0 Likes 0 ·

1 Answer

·
Braydn T avatar image
1 Like"
Braydn T answered tannerp commented

@Suhas H2

I am looking through your model and I can't seem to find where you push to a list. I am assuming the items in the rack will be pushed to a list.

The easiest way to to do this would be to use process flow and have an event triggered source on the queue, that will trigger when it decreases to or through 2. This is an existing option on the event triggered source. You can then pull from the list, assign the list entry to a label, acquire an operator (TaskExecutor1), have it load the object stored in the label, and then have it drop it off at the queue.

Please let me know if this is not the logic you are looking for.

· 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.

Suhas H2 avatar image Suhas H2 commented ·

@Braydn T @tanner.p

I am pushing the parts into the list when they enter into the racks.

The model works absolutely fine when i take of the condition from the 'Pull startegy' on the 'Queue1'(content(current) <= 2). But i want it to pull parts from the rack only when the 'Queue1' has parts less than 2number. practice-1-update-1.fsm.

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

Variant mybag=content(current);
if (true) {
	int callbackCase = param(5);
	#define CALLBACK_CASE 10293
	treenode pulled = 0;
	if (callbackCase != CALLBACK_CASE) {
		string listName = "ItemList1";
		List list = List(listName);
		string queryStr = "";
		Variant partitionId = 0;
		int removeFromList = 1;
		int addToBackOrders = 1;
		pulled = list.pull(queryStr, 1, addToBackOrders ? 1 : 0, current, partitionId, (removeFromList ? 0 : LIST_DO_NOT_REMOVE) | LIST_RETURN_BACK_ORDER_IF_NOT_FULFILL);
		if (isclasstype(pulled, "ListBackOrder"))
			eventlisten(pulled, "OnFulfill", c, 0, LIST_ON_FULFILL_VALUE, 0, 0, 0, CALLBACK_CASE, current);
		else if (objectexists(pulled))
			pullitem(current, pulled, 0, BYPASS_ALL);
	} else {
		pulled = param(1);
		current = param(6);
		pushitem(pulled, current, 0, 0);
	}


}


return current.inObjects.length + 1;
<br>

**I dont want to use processflow here because the racks are 10 in number and the queue's are more than 100 in my actual model. Which makes my process flow huge. Instead writing a generic code will serve my need better. Any help or suggestions are welcome.

0 Likes 0 ·
capture.png (25.4 KiB)
tannerp avatar image tannerp Suhas H2 commented ·

@Suhas H2,

Process Flow is actually going to be your best option for this. The Queues' Pull Strategy is not listening for the queue's content to drop unless there is a triggering event. So you could hard code this into all of your queues, but then you'd have to create triggers for all of the queues as well.

Instead, you can put all the queues into a group, then use a Wait for Event that constantly listens to each queue to know when the content drops below 2. You can try adding a queue (connect it to a control point and add it to a group) and you'll see that this method is very scalable.

Here's the model. Hopefully this helps.

wait-for-2-queue.fsm

2 Likes 2 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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