question

christoph gruber avatar image
0 Likes"
christoph gruber asked christoph gruber commented

Priority change by time

Hi,

I have a list with items to transport with different priorities first. After a given time (e.g 5 min) the priority from a certain items (e.g. Type3) increases. My question now, is it the right way how do I do it? Or is there a smarter way to change priority on a list? Ohter question: Why the breakpoint doesn´t work?

Every hint are wellcome. Thank you in advance.

prioritychangeonlist-1.fsm


FlexSim 19.2.4
priority of delivering itemsllistproirity
screen.png (87.2 KiB)
5 |100000

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

Jordan Johnson avatar image
1 Like"
Jordan Johnson answered christoph gruber commented

I see two options that would improve on your method. I agree that it is a little bit awkward to create an extra field in the list, just so you can change a different field. Both options don't use the changeType field.

For the first option, I deleted the Priority label field and replaced it with a Priority expression field, with this code:

if (value.Priority == 3 && (Model.time - pushTime) > 5) {
	return 1;
}
return value.Priority;

This makes the Priority field give back the value that you want. When you pull from the list, you can use

SELECT Priority

to add a label called Priority with the current value of that field to the puller. That would mean the puller knows the new priority and the original token knows its original priority. You could also modify the code above to change the priority label.

prioritychangeonlist-option-1.fsm

For the second option, I kept the Priority label field (as dynamic) and used the Max Wait Timer on the Push to List activity to change the label, with this code:

if (token.Priority == 3) {
	token.Priority = 1;
}

prioritychangeonlist-option-2.fsm


· 4
5 |100000

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

christoph gruber avatar image christoph gruber commented ·

Hi Jordan, thank you very much for your helpful answers. All the options are great, especially option 1 looks fine for me….but

But there appears another problem and that´s look like a buck for me. See the picture. Normally in the General Tab from the list the option “Assign SELECT values to pullers label” should be sufficient, but the model just works correct with addition the next option “…SELECT value as Quantifire” – it looks strange, because this option is to reduce the expression value from the list.

With only the first option, the puller take always the value from the first list entry and not the list entry from the pulled entry!

prioritychangeonlist-option-1-2.fsm

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ christoph gruber commented ·

If you need the label on the thing that was pulled to change, you should change it in the list field. The list is pulling the correct item, because the list field reports that it's priority is 1, and the pull uses field values, not necessarily label values.

The reason it works with the "Select value as quantifier" is because it is reducing the priority value on the pulled item. In your case, the list field is as Priority 1 because the item has been on the list long enough. When you pull it, it decrements that field to 0. Because it's zero, the token moves on from the list, and the puller reports that when it got an item, it's priority was 1.

It sounds like you want the label on the items on the list to change, not just the field value. So you should change your code to reflect that:

/**Custom Code*/
Variant value = param(1);
Variant puller = param(2);
treenode entry = param(3);
double pushTime = param(4);

if (value.Priority == 3 && (Model.time - pushTime) > 5) {
	value.Priority = 1;
}
return value.Priority;
0 Likes 0 ·
christoph gruber avatar image christoph gruber Jordan Johnson ♦♦ commented ·

Yes @jordan.johnson you are right! Now I understand, thank you very much again for your explanation (and for open my eyes :).

0 Likes 0 ·
christoph gruber avatar image christoph gruber commented ·
0 Likes 0 ·
Ralf Gruber avatar image
3 Likes"
Ralf Gruber answered Jeff Nordgren edited

Christoph,

make the priority field a dynamic field on the list, so it will automatically update, once you update the value on the token.

Ralf

· 4
5 |100000

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

christoph gruber avatar image christoph gruber commented ·

Thank you Ralf,

yes, in my model the priority field is a dynamic field. But is there a better way than to change priorty by time in the list itself, hidden in any expression field?

0 Likes 0 ·
tannerp avatar image tannerp christoph gruber commented ·

Ralf's suggestion is going to work best for updating the priority of the token. There's not a hidden expression field that I'm aware of that would be any more efficient. If the field that you're prioritizing changes in some way, just reflect the priority in the priority field of the list rather than changing the list itself.

0 Likes 0 ·
christoph gruber avatar image christoph gruber commented ·

Hi @tanner.p and @Ralf Gruber

"hidden in any expression field" was ironic ;) because I did this in my list! So I ask again, is there a better way to build my model (changing priority every 5 min from Typ3 - source on the right side)? ....and what about the breakpoint?

Thank you for helping me to anderstand

0 Likes 0 ·
tannerp avatar image tannerp christoph gruber commented ·

I'm not sure if there's a better way. @Ralf Gruber, any ideas?

bumped

0 Likes 0 ·

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.