question

Aditya Prakash avatar image
1 Like"
Aditya Prakash asked Preet commented

How do I obtain current simulation date and time?

How do I obtain current date. Is realtime() the best way to do it?

FlexSim 16.1.0
timesimulation timedaterealtimesimulation 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.

Matt Long avatar image
7 Likes"
Matt Long answered Joshua S commented

There's a new command in FlexSim 2106 called convert(). Convert allows you to convert dates and times from different formats like Excel Date Time, FlexSim Date Time and Model Time. This is especially useful when importing data from Excel that is based upon specific dates and times.

A couple of ways you can use the convert() command is in conjunction with the time() command and getmodelunit()

  1. getmodelunit(CURRENT_TIME) //Returns FS_DATETIME
  2. time() //Returns model time
  3. convert(time(), MODEL_TIME, DATETIME_STR) //Will print out date time based upon the date/time format string, for example 8:00:00 AM Fri 24 Jun 2016

Check out the command documentation for convert() for more information.

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

Ben Wilson avatar image
7 Likes"
Ben Wilson answered Preet commented

realtime() will give you the real current date and time, from your computer's clock. This should closely match the time you see on your watch, your cell phone, or the clock on the wall. This is different than the time in your simulation.

If you are looking for the current date in your simulation, this is based on your chosen time unit and start date, both specified when starting a new model.

As you're running your simulation, you can obtain various date and time values for current simulation time from the tree as shown here:


modelunits.png (32.3 KiB)
simtime.gif (221.5 KiB)
· 3
5 |100000

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