question

Liany TN avatar image
0 Likes"
Liany TN asked Liany TN commented

Subtract between rows of the same column of data using a calculated table

Hi!

I would like to know how I can get the difference between each of the arrival times in queue 2 of the items that were already processed by means of a calculated table.

To do this, I have a simple model that has a statistics collector that saves the arrival times to queue 2, that is, I need to calculate n - (n-1) where n is the arrival times to queue 2. In addition, I would like to have all this information in a single table with the columns of the arrival times to queue 2 and the difference between the times that were calculated; all this through the use of a calculated table.

If anyone can help me I will be very grateful!

Thank you, LIANY

simplemodelquestion.fsm

FlexSim 19.2.4
statistics collectorcalculated table
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

Brittany Evans avatar image
1 Like"
Brittany Evans answered Liany TN commented
@Liany TN,

In order to solve this issues, I would start by recommending making changes to your statistics collector so that you can use the functionality of the CalculatedTable to answer this question. I believe that I was able to make your requested table by doing the following steps:

  1. On your Event Listener for the On Entry of Queue 2, I added an Event Data Label called Row_Value. The Row_Value was set to be the current items ID, which you used for your SKU in your original StatsCollector.
  2. I duplicated your Event Listener for the On Entry of Queue 2, but made a few modifications. For this event, I had a Row_Value label, but this time instead of it being equal to the ID of the item, I had it equal to the ID of the item -1. This meant that the second item that came in would have a Row_Value of 1 instead of 2. I also put a condition on this duplicated Event Listener so it would not add a row for the first item that came in because I did not want that extra row in there for no reason.
  3. Under the Data Recording Tab of your Statistic Collector, I changed the Row Creation Mode to be Unique Row Values where the Row Value was my Row_Value label. This meant that there would be a row for each item.
  4. I changed the name of your Finish Column to say First_Finish_Time and changed the Update Model to be By Event Dependency.
  5. I duplicated the First_Finish_Time Column to create my new Second_Finish_Time.
  6. I clicked the "Edit Event/Column Dependencies..." Button and set the first event to update the First_Finish_Time Column and the second event to update the Second_Finish_Time Column. This resulted in a row for each item that recorded the time it entered and the time the next item entered on the same row.
  7. With the new updated StatsCollector, it was really easy to create the table you wanted using the CalculatedTable. You start by creating the new CalculatedTable that uses your StatsCollector as the Primary Table.
  8. Under Metrics, you can add in Single Column Metrics for those columns you wish to preserve from the original StatsCollector.
  9. For the time difference column, you can use a Time Span metric that will take the difference between two time columns and display that difference in whatever units you want. In the case of the new StatsCollector those columns are First_Finish_Time Column and Second_Finish_Time Column. My example left the difference in Seconds since that was your model units.

I have also attached my model for reference. Hope this helps.

25828-simplemodelquestion-updated.fsm


· 1
5 |100000

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

Liany TN avatar image Liany TN commented ·

Hi, @Brittany Evans

Thanks for your time and your answer. This was so helpful for me.

Best Regards,

Liany!

0 Likes 0 ·