Jump to content

Problem: Error in Tally Calculation


miketsai0829

Recommended Posts

Hi,


I have a simple two stage supply chain network with 2 products (source), 1 Store (workstation), 1 warehouse (workstation), and 1 sink. 2 entities represent orders for each product, and each entity carries orders from data table. Another 2 entities represent replenishment.When orders are greater than current inventory, the store sends a signal to DC and ship replenishment. I use subclass workstation to process the orders, but I couldn't set up the correct logic for calculating service level, which is inventory/orders. In my process, I can put a decide step and say if modelentity.product1 is greater than 0 then calculate service level . This works (no product 2). I can also put a decide step and say if modelentity.product2 is greater than 0 then calculate service level. This also works (no product 1). However, if I put a decide step and say if modelentity. product1>0 or modelentity.product2>0 then calculate service level, I get error message.In the tally step, I have to put (inventoryA+ inventoryB)/(OrderA+OrderB) to make it work. if I put (inventoryA)/(OrderA) and add one more row (inventoryB)/(OrderB), it doesn't work. Now the problem is I cannot calculate the service level for each product. Does anybody know how to solve this problem? Thank you.q1.PNG.713066845e8dd43f462cb87efa41c4b3.PNG

Link to comment
Share on other sites

The expression (inventoryA+ inventoryB)/(OrderA+OrderB) will always work if either is > 0 because there is no chance to divide by 0.

The expression (inventoryA)/(OrderA) will not work if the only product produced is B because it will cause a divide by 0.


I'm not sure why you would want to record a Tally observation when there are no observations yet? And it seems equally inaccurate (but won't generate an error) if you record a Tally observation on both service levels even though you only just produced one of them. It seems like the correct approach is to record the service level ONLY on a product that has just been produced or completed.


But in case I don't understand what you are trying to do, to do exactly what you requested:

1) For the observation Value use an expression like InventoryA/Math.Max(1,OrderA) to avoid the divide by 0, but it will generate a bad value when the value is undefined.

2) To avoid recording that bad value, in the Advanced Options > Number of Observations field put the logical expression OrderA>0 which will cause it to record 0 observations when false or 1 observation otherwise.

Link to comment
Share on other sites

×
×
  • Create New...