question

Jouky D avatar image
0 Likes"
Jouky D asked Benjamin W2 commented

How to Export Dashboard tables every 2.3 (for example) units of simulation time?

Hello,

Can I export a data table automatically every 2 days of the simulation (for example) to obtain an Excel file (or CSV) for each exportation during 10 days, i.e. 5 Excels files o 5 sheets in an excel file?

Thank you

FlexSim 20.0.2
timeexcel exportflexsim 20.0.2automatic
5 |100000

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

tannerp avatar image
1 Like"
tannerp answered Benjamin W2 commented

This is a little unorthodox, but I think it's still possible. I used Process Flow to create a token every 1 second. The token is assigned a "ModelTime" label, which is just the time in the model (used later to name exported CSV files). The Custom Code activity in the Process Flow takes the data from the WIP By Type table and clones it to GlobalTable1 (you could do any chart type as long as you have a Stats Collector/Calculated Table for it).

The exported files are saved with labels that are created by concatenation so that you can figure out which CSV file is associated with each second in the model.

Hopefully this helps. You can always modify it to meet your needs.

exporttest.fsm


· 2
5 |100000

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

Jouky D avatar image Jouky D commented ·

But I have to transform the Dashboard to a Calculated Table. And a ProcessFlow associated to this calculatedTable is created. But then, it will reach the maximum size of the model. Do you know how could I fix this? How can I delete the ProcessFlow and keep the table changed?

0 Likes 0 ·
Benjamin W2 avatar image Benjamin W2 Jouky D commented ·

@Jouky D, this sounds like a new question. Try posting this on answers and you will get more people to look at it.

0 Likes 0 ·
Benjamin W2 avatar image
1 Like"
Benjamin W2 answered Jouky D commented

Hi @Jouky D,

You might try something like this:

  1. Create a user event. Go to tools, click the green plus, enter the time of the event in "First Event Time" field. Check "Repeat event."
  2. In your "Event Code", add the following custom code:


excelcreateworkbook();
excelsetsheet("Sheet1");
excelexporttable("Table1",1,1,5,3);
excelsave("NewWorkBook.xlsx");
excelclose(0);

Here is some documentation on these commands:





1587053774847.png (109.5 KiB)
1587053803922.png (90.6 KiB)
· 7
5 |100000

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

Jouky D avatar image Jouky D commented ·

Hello, thank you for this information. But how do I call in this Code a Dashboard table for each sheet (i.e: the first unit of time is the first sheet, second unit of time the second sheet, etc.)? And a new excel document for another dashboard? Can we do a loop to obtain a sheet for each unit of time executed and to obtain an excel workbook for each Dashboard table? And the most important question: how do I call a Dashboard table when the length of this could change, so in excelexporttable I cannot put a numrows?

Thank you for your time.

0 Likes 0 ·
Braydn T avatar image Braydn T Jouky D commented ·

@Jouky D

You can put this code in a user Event like ben mentioned, or you could create a inter arrival source in process flow, and add a code block. If you do either of those things, you will not need a loop.

You will have to programatically determine the number that you are looking for. Our documentation has ways of determining the number of rows and columns in a table. https://docs.flexsim.com/en/20.1/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Table.html

1 Like 1 ·
Jouky D avatar image Jouky D Braydn T commented ·

Thanks for that! But how can I call a dashboard WIP table in the Code? Is not the same as calling a Global Table.

0 Likes 0 ·
Show more comments