question

shanice.c avatar image
0 Likes"
shanice.c asked shanice.c commented

Triggers not working

I have my resource(queue or processor) available summary in a globaltable(TableCheckAvailableResource).

1631761863543.png


When a task is created, the number of resource available in table minus one, whenever product exit the resource the number +1 by setting in triggers.


I'm using the same way in a process flow from AGV's point of view(the process flow named "Object"), AGV will look for task to execute. Now I'd like to let product create new task, and dispatch the task to AGV. AGV reads the task information from a table(the process flow named "Object2_AGV process flow" and "Product_ProcessFlow").

I cannot find the reason why resource available summary in a globaltable only decrease by using these 2 flows, when product exits, the number never increase again. I think this cause product not able to find it's destination.


0916.fsm

FlexSim 21.2.0
global tabletriggers
1631761863543.png (16.8 KiB)
0916.fsm (1.4 MiB)
5 |100000

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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered shanice.c commented

The triggers work correctly. If you set a break point in the code and step through it you will see the cell value correctly increase. However, the "Process Finish" event also causes the corresponding token in the "Product_ProcessFlow" to move on and re-enter the "Code: Determine TaskType" activity. There the value is decremented again. As this happens at the same model time, the table won't get updated between these when you run the model normally.

Aside from that I get an error at 327s, because you don't cover the case that the query in some of the "Assign [Transporter, FromStation, ToStation] & Look for Destination" activities doesn't return any rows.

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

shanice.c avatar image shanice.c commented ·

@Felix Möhlmann I am sorry to misunderstand you what you mean. I think maybe I shouldn't use value > 0 as condition to decide whether there are enough resource in the "Code: Determine TaskType" activity, as you mentioned that the other corresponding token will also enter that code. Maybe this makes SQL query unable to get a row to get a resource. I will try to use SQL query result to replace "value > 0" part.

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann shanice.c commented ·

In the mentioned Assign activity you have the following code to assign the "toStation" value.

1631784827611.png

//查有空EQ數目
Table tempTable = Table.query("SELECT EQLocation \
FROM EQTable \
WHERE Area = 1 AND Status = 'idle' AND Registered = 0 "); //找第一區&有空&未被選擇
int countTask = tempTable.numRows;

//寫出查到的該資源 的名稱
    Object tempToStation  = tempTable[countTask][1];

In the case that no matching row is found, "countTask" will 0. This will result in an error because 0 is not a valid row for "tempTable[countTask][1]".

Regarding the triggers: There are also a number of tokens waiting in a "Wait for Event".

1631785012979.png

As soon as an item exits a processor these will re-enter the "Code: Determine TaskType" activity. One of those probably creates a new task, because a processor is available and immediately decrements the table cell again.

I'd suggest you put a break point in the trigger(s) of the processor and all other relevant code to try and pin down where the logic might be going wrong.

1631785289342.png

0 Likes 0 ·
1631784827611.png (3.3 KiB)
1631785012979.png (28.2 KiB)
1631785289342.png (28.8 KiB)
shanice.c avatar image shanice.c Felix Möhlmann commented ·

Hi, @Felix Möhlmann Thanks for your help, the most important logic problem is now solved.

0 Likes 0 ·
shanice.c avatar image
0 Likes"
shanice.c answered shanice.c commented

@Felix Möhlmann

But why the value is decremented again if I have put a delay, and re assigned it's FromStation. Shouldn't it become another new Tasktype, as the token.product label is changed? So the value be decremented will not be the same.

1631779551255.png


1631779551255.png (6.7 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.