The global table is not updating correctly with control points

The global table is not updating correctly with control points

vothan_salomao
Contributor Contributor
237 Views
7 Replies
Message 1 of 8

The global table is not updating correctly with control points

vothan_salomao
Contributor
Contributor

[ FlexSim 23.2.0 ]

Hello!!AGV GlobalTable.fsm
I'm trying to fill in two columns of the global table with the following information:


In the CP column, I want the column to update in real-time with the information from destination.CP.

In the LastCP column, I want the column to update in real-time with the information from the last CP that the AGV passed, I'm using recentCP.


However, when running the code, both columns still have the same information. Could someone help me by telling me what's wrong with my code and how I could fix it?

https://prnt.sc/0hQawjGVDalY





0 Likes
Accepted solutions (1)
238 Views
7 Replies
Replies (7)
Message 2 of 8

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

The exception message tells you exactly the problem - the token doesn't have the label 'destination'. You can verify this by putting a breakpoint in your code.

1695655164466.png

and then click on the token when it fires the code.

When an exception occurs the rest of the code is not executed.


Message 3 of 8

vothan_salomao
Contributor
Contributor

Hello @Jason Lightfoot. thanks for the answer

My question is specific about globalTable. How a i can modify the columns LastCP and CP in real time?

The value Token. destination i understand the problem. But dont understand how modify the columns CP and LastCP, what is problem with my code? global-table.png

0 Likes
Message 4 of 8

jason_lightfootVL7B4
Autodesk
Autodesk

Put breakpoints on lines 25 and 44 - you will see that your code is updating the table correctly up to the point where the lack of the label 'destination' causes the exception.


Of course these triggers make the code look complicated. In fact it could just be a line for each:

Table("AGVs")[current.name]["cp"]=agv.destinationCP;
Table("AGVs")[current.name]["lastCP"]=agv.recentCP;
0 Likes
Message 5 of 8

vothan_salomao
Contributor
Contributor

The problem is, my global table dont update with correct value of CP and LastCP1695668583159.png

0 Likes
Message 6 of 8

jason_lightfootVL7B4
Autodesk
Autodesk

Try putting this on the draw code of the AGV if you want a realtime view. The same could be done with a list and field expressions:

AGV agv=AGV(current);
Table t=Table("AGVs");
t[current.name]["cp"]=agv.destinationCP;
t[current.name]["lastCP"]=agv.recentCP;
t[current.name]["destination"]=agv.finalDestinationCP;
Object dest=agv.finalDestinationCP;
if (dest)
    t[current.name]["Distance"]=distancetotravel(current,dest);
0 Likes
Message 7 of 8

vothan_salomao
Contributor
Contributor

Hello @Jason Lightfoot , thank you very much for the help. I conducted some tests and managed to solve the problem by placing the code in the "Trigger On AGV Allocate" of the AGVs

0 Likes
Message 8 of 8

jonah_kendellR47TC
Autodesk
Autodesk

Hi @Vothan Salomão, was Jason Lightfoot's 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