question

Nicky E avatar image
0 Likes"
Nicky E asked Jordan Johnson commented

Leave queue if content>5 and time > 3pm

I have a convenience store model. Works from 10 am to 10 pm.

When a person arrives after 3 pm, will leave (sink) if queue content is higher than 5, else will be sent to the queue.

How can I send to port by time of the day AND current content?

Port 1: Queue

Port 2: Sink

send to portflowqueue and code
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

·
Sebastian Hemmann avatar image
1 Like"
Sebastian Hemmann answered Jordan Johnson commented

I hope you already know that you can check the content of an object by using

object.subnodes.length > 5

and assume you are looking for a solution to know if time is later than 3pm on that day.

There are some ways to calculate times in FlexSim (but this will make it quite fast complicated). The easier way is to create a time based event that sets a variable or label that you can ask in your logic. So just create a token that appears with model start. Stays in a delay until 3 pm. Set a value on a label or variable. Resets it at any time and comes back some hours later. Everything by using "Delays".

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

Mischa Spelt avatar image Mischa Spelt commented ·

Perhaps the function

getmodelunit(CURRENT_HOUR)

comes in handy.

2 Likes 2 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Mischa Spelt commented ·

Also,

Model.dateTime.hour

will tell you the hour of the day.

1 Like 1 ·

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.