question

Raashid Mohammed avatar image
0 Likes"
Raashid Mohammed asked Logan Gold commented

How to put arrival time in date and time format in source in Arrival schdeule

I have two questions

1. how to put arrival time in SOURCE arrival schedule in date and time format

for example something like this 8/2/2016 4:00:00 PM instead of seconds

2. how to change to simulation start date and time

currently my model runs with model start time

8:00:00 AM Thu 25 Aug 2016

how can change that before simulation run

please help

thanks

Raashid

Choose One
date
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

·
Logan Gold avatar image
4 Likes"
Logan Gold answered Logan Gold commented

1.) The ArrivalTime column of a Source's Arrival Schedule always needs a value that is a number. However, you can use the convert() command to convert a date/time format into model time. So you could have a Global Table with all the date/time information you want to convert to be used in a Source's Arrival Schedule. Then, use something like the Source's OnReset trigger to convert the values in the Global Table to be used in the Arrival Schedule. Using 8:00:00 AM Thu 25 Aug 2016 as a model's start time, this command will return 3600:

convert("9:00:00 AM Thu 25 Aug 2016", DATETIME_STR, MODEL_TIME);

2.) Go to Edit, then Model Settings. The Model Settings window has two fields for Model Start Time - the time and date. You can make changes in either field to change the Model Start Time.

· 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.

Raashid Mohammed avatar image Raashid Mohammed commented ·

Thank you

How do I connect global table to source arrival schedule ?

I know how to import directly from excel but don't know how to import from global table to source

For the model start time instead changing the time by going to the settings. is there a way I can lookup value and change the model start time on Model reset ?

0 Likes 0 ·
Logan Gold avatar image Logan Gold ♦♦ Raashid Mohammed commented ·

Here is an example model of how you can connect a Global Table to a Sourcen's arrival schedule:

sourceschedule-datetimeformat-example-v16-1-2.fsm

GlobalTable1 is set up with the time/date format I want to use in the Source. To use the convert() command, the format needs to be exactly what you see here.

In the Source's OnReset trigger, I used code to reference those times/dates in the Global Table, convert them into model time using the convert() command, then copy that number into the Source's Arrivals Table. I was able to use a command called getvarnode() to get a reference to the arrival table - it is a variable in the Source's tree called schedule. Since this variable is a table itself, I used the settablenum() command to make the changes.

To change the Model Start Time with code in the OnModelReset trigger, you'd need to do something like:

treenode startNode = node("/Tools/ModelUnits/ModelDateTime/start", model());
double startTime = convert("8:00:00 AM Fri 26 Aug 2016", DATETIME_STR, FS_DATETIME);
set(startNode, startTime);
applicationcommand("convertunixtime", startNode, startTime);

Where the first parameter in the convert() command (the string with the time and date) is the value that you want to change the model's start time to. That string is getting converted into a format called FlexSim datetime, which is a number that is needed in the application command called convertunixtime. So if you are starting with a different format, it needs to be converted into the FlexSim datetime format before being used in the convertunixtime application command.

1 Like 1 ·
christophe C2 avatar image christophe C2 Logan Gold ♦♦ commented ·

@Logan Gold

I have the same problem.

I want to use a one year excel schedule by date, representing my Working order. Each working order includes a quantity of pieces to be produce.

How can I add some quantity in the exemple you have linked to your answer ?

For exemple,

I would like to have 25 pieces out of my source on the 01/08/2017 at 07:00 AM ?

0 Likes 0 ·
Show more comments

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.