How can I pull information from a token for use in custom code?

How can I pull information from a token for use in custom code?

michael_kramer1
Not applicable
39 Views
4 Replies
Message 1 of 5

How can I pull information from a token for use in custom code?

michael_kramer1
Not applicable

[ FlexSim 16.2.1 ]

I am checking AGV battery level to determine if it needs to be routed to a charge station. Currently I have hard-coded the TE resource name and the logic works fine. What I need help with is making the decision independent of the TE name, perhaps pulling that information from the token. Below is a screen shot of the process flow and the code in the decision point block. Ideally I'd like to pass the TE name to the variable "tugger", which is used in the "agvinfo" function.

3556-agv-charge-station-decision.png

0 Likes
Accepted solutions (1)
40 Views
4 Replies
Replies (4)
Message 2 of 5

jeff_nordgren
Not applicable

@Michael Kramer

Mike,

It's tough to debug a graphic. Any way you can send your model or better yet a sample model showing the specific problem you are having?

0 Likes
Message 3 of 5

michael_kramer1
Not applicable

@Jeff Nordgren

Sure, model attached. The AGV hits the decision point between 7:49 and 7:50.

0 Likes
Message 4 of 5

matt_long
Not applicable
Accepted solution

Your parent token has a reference to the AGV stored on the label "resource". All you need to do in your Decision activity AGV Battery Recharge is reference that label and get the name of it:

string tugger = getname(getlabel(token, "resource"));
0 Likes
Message 5 of 5

michael_kramer1
Not applicable

Thank you, works great.

0 Likes