This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.
This model is an example how to control a Source depending on a Global Table.
The Global Table (ArrivalSchedule) holds the information for Arrival Time, ItemName, ItemType, Quantity and ItemSize. Depending on this information a number of items (Quantity) arrive at the ArrivalTime in the system, ItemType, Name and Size are set.
The main code is on the Source in OnReset, OnMessage and OnExit. The Source also has two labels.
One remark about the Arrival Time is that as shown in the Output Console the Arrival Time is not exactly e.g. 5.0000 for the first three arriving items but 5.0000, 5.0001, 5.0002. The reason is to prevent strange behavior because of events at the same time the control messages for the Source at the same time are send with a slight time difference of 0.001 seconds, which is the Arrival Time at the Source.
Another concept is included in this model which is not using any string comparison (call Labels or Tables by name), which speeds up the model execution time. The labels and tables are called by rank and to keep the code more readable and understandable Global Macros are used to define constants which just return a value which is the rank of the node.
Attention:
Do not delete or rename the object Logo_FlexsimD, because otherwise the model will not work correctly. Also do not rename, delete or rerank other objects.