question

shanice.c avatar image
0 Likes"
shanice.c asked shanice.c commented

How to read imported data as source time?

I'm using Excel Import/Export Interface to import historic log data as my simulation product creation time. As the Excel Import/Export Interface could import user self-defined data, this will make it different from defaulted 3 columns(ArrivalTime, ItemName, Quantity).1642398838936.png

Then if I import the following data like the picture(The coulmns of imported data has been different from defaulted). I want FlexSim to use first column(Receive_Time) as the time it create a product(I want FlexSim read this column to create product). Then, how does FlexSim read the data imported? 1642399074595.png

I tried to set Start Time of the simulation a little bit earlier than 2021/12/1 10:40:10, but the simulation seems not starting at all. So is this because of the column format has changed so that FlexSim could not read. Or because I make mistake in setting the Model Start time?

1642399927820.png

Thank you very much!

TestImport.fsm

Station1 task.xlsx

FlexSim 21.1.0
sourceimport datastarttime
1642398838936.png (6.7 KiB)
1642399074595.png (12.5 KiB)
1642399927820.png (270.7 KiB)
testimport.fsm (61.4 KiB)
station1-task.xlsx (11.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.

1 Answer

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered shanice.c commented

You imported the excel values as text, which FlexSim can not read as time data (Text data is aligned to the left in table cells, numbers to the right). To import the date times as numbers check the respective option in the excel inport interface.

1642404110683.png

This will automatically convert the excel time format (days since 01.01.1900) to the format FlexSim uses (seconds since 01.01.1601). So in order to use the values as arrival times the date time values have to be converted into model time. This can be done using "Model.getTime(datetime value)".

The following code goes through the nodes of the source where the schedule data is stored and converts the values.

treenode schedule = Model.find("Source1>variables/schedule");
for(int index = 1; index <= schedule.subnodes.length; index++)
{
schedule.subnodes[index].first.value = Model.getTime(schedule.subnodes[index].first.value);
}

You can either run this manually in the script window or paste it in as "Post Import Code" in the import interface and have it run automatically after each import (activate with the checkbox).

Finally, I would suggest to insert the "ItemName" and "Quantity" columns into excel, so you don't have adjust those after importing.

testimport_fm.fsm
station1-task_fm.xlsx


1642404110683.png (41.4 KiB)
testimport-fm.fsm (63.5 KiB)
· 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.

shanice.c avatar image shanice.c commented ·
@Felix Möhlmann Thank you! I have succeed in importing data and convert them to FlexSim time.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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