question

Jay Khedekar avatar image
0 Likes"
Jay Khedekar asked Jason Lightfoot answered

How to access Simulation time clock in FlexScript?

I want to add a decide condition that when time is more than or equal to 6:55:00 am it will select a different travel destination and and when it's earlier than 6:55:00am it will redirect to a different route.


I am thinking to put up a code in decide, but I am not sure how to access model time in that?

Should it be model.time >= 6:55:00am?

FlexSim 21.1.5
FlexSim 22.1.3
flexscripttimeconditional decide
5 |100000

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

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered
Model.dateTime.hour >= 7 || Model.dateTime.hour == 6 && Model.dateTime.minute >= 55
5 |100000

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

Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered

One method:

double testTime=Math.frac(DateTime.compose(2022,1,1,6,55,0,0).excelTime);  //create 6:55:00 time as fraction of day
double currTime=Math.frac(Model.dateTime.excelTime);  //get current time as fraction of day
return currTime>testTime;
5 |100000

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