ATTENTIONThis 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. |
flexsim.com |
#1
|
|||
|
|||
control the source input "By the time of the day"
Hi,
I have a question on source: I would like the source to make the flowitem as the attached jpg. I tried to use "b=By the time of the day" from picklist, but I don understand how's it works. treenode current = ownerobject(c); /**By Time of Day:*/ int second = 1; int minute = 60; int hour = 3600; int day = 86400; int shift = 28800; /** \nModel Time Unit: */ int timeunits = /**/second/**/;/** (second, minute, hour, day)\n*/ int timeinseconds = fmod(time()*timeunits, day); hour = trunc(timeinseconds / hour); shift = trunc(timeinseconds / shift) + 1; /**\n*/ /**/if(shift == 2 && hour != 12) return exponential(0,5,1); else return exponential(0,15,1);/**/ /**\n\nshift 1 = hour 0-7, shift 2 = hour 8-15, shift 3 = hour 16-23 This assumes that the simulation starts at hour 0*/ does it mean that if i change exponential distribution to normal distribution, the 3 peaks will appear at hour 3-4, 11-12, 19-20? Regards, Kelvin |
#2
|
||||
|
||||
No, the exponential distribution as with all the statistical distributions are a distribution over a possible range of values as determined by random probabilities, so please don't confuse them as a distribution of values spread over a time period.
The "By Time of Day" option is just showing you an example of how you will need to write your own conditional expression ("if" statements, or "switch" statements or whatever) to define the interarrival time based on what time of the day it is. The example they give as shown below can be interpreted as saying if it is shift 2 or in other words, the simulation time is between hours 8 and 15 of each day, and the time is not hour 12, then the interarrival time will be defined by exponential(0,5,1) otherwise the interarrival time will be defined by exponential(0,15,1). Code:
if(shift == 2 && hour != 12) return exponential(0,5,1); else return exponential(0,15,1); |
The Following User Says Thank You to Cliff King For This Useful Post: | ||
KelvinHo (05-13-2008) |
#3
|
||||
|
||||
Kelvin,
Here is a model that has what I think you are looking for. The source has a custom built inter arrival time that uses the time of day to lookup an inter arrival time from a table. Each line of code is commented to help you understand what I did if you want to edit it. The following are required fields in the code template field: Table Name - Name of the global table Model Time Unit - The unit of measure for the sim time Table Lookup Time Unit - The unit of measure for the first column (lookup) of the table Table Value Time Unit - The unit of measure for the second column (value) of the table Good Luck, Brandon
__________________
thats not normal. |
The Following User Says Thank You to Brandon Peterson For This Useful Post: | ||
KelvinHo (05-13-2008) |
Thread | Thread Starter | Forum | Replies | Last Post |
error message "Clock overflow, running stopped" | Martin Kooijman | Q&A | 11 | 04-17-2008 10:29 AM |
about "no select" and "show parameter window from side bar" | qin tian | Gripes and Goodies | 3 | 03-21-2008 08:10 AM |
can "do not release item" commend be used in source? | KelvinHo | Q&A | 2 | 03-10-2008 12:30 AM |
Which variable stores "Properties -> General ->Flags -> Protected" information? | KelvinHo | Q&A | 1 | 03-06-2008 06:18 AM |
"Getting Started" and "Tutorial" models for v4.01 | Cliff King | Product Announcements | 0 | 12-10-2007 07:34 PM |