question

Nathan H5 avatar image
0 Likes"
Nathan H5 asked Connor A commented

How to change resource number using a global table?

I am looking to change the number of resources available based on the time of day in process flow. I believe that you are able to do this using a global table, but how would you call the values from the table based on the time of day. For example at 8 am I want 2 resources but at 8:30am I want 3 resource available.

FlexSim 21.2.4
processflowresourceglobal tables
· 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.

Connor A avatar image Connor A commented ·

Hi @Nathan H5, was Connor A's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Connor A avatar image
0 Likes"
Connor A answered

Hello @Nathan H5, if you are wanting to use a global table based on the time, to change the resources in your model that should be possible by using the "dateTime" features in FlexSim. I made a model that changes the number of flow items being create in two ways. The simpler way which is changing it on an hourly basis and then another way that is more complex but changes it every half hour.

The simple method to do this for every hour is to find the row number of the Global Table by using "Model.dateTime.hour + 1", adding one is necessary, because that will make it correspond to the first row of the global table for 12 am and then the next row for every additional hour. Here is a photo that global table. In it there is the "currentTime" column, that technically isn't needed for the simulation but I have it on there so you can know what time each row corresponds to easily.

1636668975239.png

The method that I used to allow for half hour increments is a bit more complicated than the full hour because every half hour must be taken into account with a separate row on the global table. What I did is used custom code to add a label to the token to multiply the hour by two because twice as many rows are necessary. Then if it is current 30 minutes or more into the hour the number stays the same otherwise I subtract one to just get the hour row number.

1636669403999.png
Hopefully that makes sense and from there I just used the Quantity column on the Table to decide what the current quantity should be. Feel free to change the quantity column to anyway you see fit. I will attach my model to this answer for you to look at. Please let me know if this helps and answers your question.

Also here is a link to a similar question: https://answers.flexsim.com/questions/104690/arrival-time-distribution-in-source-change-by-time.html

And here is a link to the DateTime feature in the FlexSim Doc's:

https://docs.flexsim.com/en/22.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/DateTime.html#Property-hour

Here is my model(It is easier to the quantity change by time of day on the token in the process flow than the model, all the logic for time of day is in the assign labels activities of my process flow):
ChangeQuantityByTime.fsm


5 |100000

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

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.