question

Henna N avatar image
0 Likes"
Henna N asked Kavika F edited

Condition Decide for Global table

Hi Everyone,

In the Process Flow I am giving a condition decide where if GlobalTable1 "Avavilable" Column is equal to "Minimum order" Column then move the object from Queue1 to Queue3

1672209064467.png

But the condition is not working.

Note: the "Available" column is based on calculation.

Working: When part arrive at Queue1 "Available" Column is added with 100 and when part exit from Queue2 to Processor the "Available" column is subtracted by "Consumption" column. when the available column reaches to "Minimum order" the Condition decide.

Global table.fsm

FlexSim 22.0.0
global tableconditional decidedecimal precision
1672209064467.png (78.4 KiB)
global-table.fsm (37.8 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.

1 Answer

Kavika F avatar image
0 Likes"
Kavika F answered

Hey @Henna N, after doing some trial and error, it seems that the evaluation between min and available isn't working do to an underlying difference in the values of the numbers. Although FlexSim displays to a certain precision, the actual values have many more decimal places under the hood. My assumption is that the min (0.01) is different than the calculated available amount.

A workaround is to simply round the two values to the nearest hundreds-place using Math.round(). Here's an example of how I changed the decision code to match your needs:

Table table = Table("GlobalTable1");
double min = Math.round(table[1][2],2);
double available = Math.round(table[1][3],2);
if (/** \nCondition: *//***tag:expression*//**/available == min/**/) {
  return /** \nIf Condition is true: *//***tag:true*//**/1/**/;
}
return /** \nIf Condition is false: *//***tag:false*//**/2/**/;

global-table_1.fsm


global-table-1.fsm (37.5 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.