question

chia725 avatar image
0 Likes"
chia725 asked Jason Lightfoot commented

The integration of label

Hello,

I have encounter some problem with the integration of my label. I am trying to accomplish the car to go to every station and check if there's things to pick or to load. That I used several pull from list activity, the reason for this is that I want to make sure the to be pickup list is updated. So I set each station with an unique pulled label. And set it to be the item of load.

But my problem for now is if there's things to unload activity.

For the decision code, my thought for now is like below:

(token.item.destination == token.Q2 || token.item2.destination == token.Q2)

return 1;

else

return 2;

To integrate all the possibility and return 1. But for the Item of Unload activity, I am not sure if I want to define a label that contains everything on the car how can I do this.

1696794595419.png

That I'm wondering if I use an assign label activity with custom code as below will work:

for (token.item2.destination == token.Q1 ||

token.item3.destination == token.Q1 || token.item4.destination == token.Q1 ||

token.item5.destination == token.Q1 || token.item6.destination == token.Q1)

return setlabel();

But as I try it in, there's appears to be some error. I am looking forward to any of your advice! Thank you very much!

1009 label integration.fsm

FlexSim 21.0.10
label
· 1
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

Hi @chia725, was the answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot commented

This looks way too complicated and you haven't a good grasp of FlexScript it seems. You should do all the tutorials and consult any student resources your institution may have given you.

Then you can consider getting the task executer to do a continual loop first without any pickup/dropoff (use a task sequence as it will be preempted later).

Then detect the prearrival event at each control point and check if there's drop/collection for it.

If there is, then create the preempting unload/load task (Preempt_only - you want the looper taskseqence to continue after the load/unloads have finished)

This method should scale much better than what you have and is easier to maintain/manage/understand.

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

chia725 avatar image chia725 commented ·
Thank you for your help! I’ve tried to accomplish what you’re saying but it’s a little bit hard for me to find all the functions that you’ve mentioned. So I’m wondering is there any example of this kind of case? Thank you so much!
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ chia725 commented ·

Yes I can see that as a student or new FlexSim user there would be a lot to learn to implement that. So , is there some reason you're not using the ports to connect to the destination and tick the use transport option to assign a destination?

If there is a valid reason, you can still learn how FlexSim works with the AGV system by looking at the AGV templates.

You will see that to make things simpler you should assign a destination label to your item. I would change your source 'destination' fields for 'destinationID' and then label the item with the destination object using:

Model.find("Sink"+item.destinationID);   // Assuming you're sending to the sinks

Once you have this information on the items you can start doing useful things with it.

When you arrive at a control point you can detect the control point (cp) and then find the object(s) connected as Location to that CP using this expression:

 AGV.Connections(cp,"Location")[1];   // returns the first object connected
 AGV.Connections(cp,"Location").length;  //returns the number of objects connected

You could use that to check if there are items in those objects to pick up or if you have items for those objects. However its probably easier to look on a list of items to pick up with the list partitioned by the cp. Then you just pull the number you can carry off the list and load them. Populate this list when the items enter the queue.

For the unload you can do the same. The expression to find the cp from the object (destination) will be similar:

 AGV.Connections(destination,"Location")[1]; 

If you put the item on a drop off list then you can partition the list by this expression for the cp:

AGV.Connections(token.item.destination,"Location")[1];

You don't need the equivalent label 'from' in the pickup list since you can just refer to the item's location using 'up'

AGV.Connections(token.item.up,"Location")[1];


I may attach an example for moderators to see here, so they can reference it in guiding you further. Since it's a different approach to the standard templates, I may post it as an example elsewhere. We try not to provide finsihed/whole solutions to students, and instead encourage them to try for themselves with help and guidance.

0 Likes 0 ·
chia725 avatar image chia725 Jason Lightfoot ♦ commented ·
Thank you very much, I'll look through it and try to implement it. The reason that I didn't use the agv template is as mention in the question I asked a few days ago. I wan to use historical data that will assign to different destination and I want it to implement multiple task at the same time. Like if there's thing to carry but there's already cargo on the car. The car will also carry it but transport to different destination within the loop.
0 Likes 0 ·
Show more comments

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.