question

Amy M3 avatar image
0 Likes"
Amy M3 asked Amy M3 commented

conditional decide based on time range

I want to check to see if I'm on 1st shift or not. I have a decide and I can do Model.time<x hours but that only works for a day. What would be the syntax to say is time between 8am and 4pm so it works if I run the model a week? Or is there a way to designate shifts?

FlexSim 21.2.3
time
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

·
Ben Wilson avatar image
0 Likes"
Ben Wilson answered Amy M3 commented

FlexScript's DateTime object has an hour property that can be queried to give you the model's current hour of the day. See the documentation:

FlexScript Class - DateTime (flexsim.com)

So you can get the model's current hour, then use that in your logic:

double currentHour = Model.dateTime.hour; 

You might check out Time Tables as a way to define shifts, along with behaviors that happen at the start and end of the shifts.

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

Amy M3 avatar image Amy M3 commented ·

Thanks Ben,got it to work, could not find how to say "between" but just discovered the code builder and was able to do > and < using &&.





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.