question

Stanly avatar image
0 Likes"
Stanly asked Logan Gold commented

Export machine status to excel

is it possible to export your machine status to an excell workbook in real time?

FlexSim 24.2.2
excel exportrealtime data
· 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.

Logan Gold avatar image Logan Gold ♦♦ commented ·

Hi @Stanly, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of the answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Felix Möhlmann commented

You can export data to an (unopened) excel file at any point during the model run. You could for example use the following code in the On State Change trigger of a fixed resouce.

excelopen("C:/Users/felix/Downloads/export-test.xlsx");
excelsetsheet("States"); excelwritestr(1, 2, current.as(Object).stats.state().getCategoryName(toState)); excelclose(1);
· 4
5 |100000

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

Stanly avatar image Stanly commented ·

Thank you so much for the reply. However, as soon as I put this code on to the flexscript of one of the objects the simulation crashes and would not run smoothly.


do you have any idea why that happens?

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Stanly commented ·
Opening and saving the excel file takes some time. So yes, it is unlikely that the code will keep up with higher simulation speeds.

You could improve this by only opening the file at the run start and only saving it at the end, but that would mean you couldn't access the file while the model is running at all.

Why do you even want to write live values to Excel? If you want to communicate with other software there are better methods. Both direct (emulation connections) or indirect (via a shared database).

0 Likes 0 ·
Stanly avatar image Stanly Felix Möhlmann commented ·
Yes, I do want to export the model's live data to another software. I was considering to use MQTT through emulation, but I currently do not have license required. Does the indirect method require any sort of license?
0 Likes 0 ·
Show more comments