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
|
|||
|
|||
On Exit (Lead Time)
I have a fairly large model with something like 200 unique flow items –each representing a part. Each unique part or flow item is used say 300 times in the model. When the parts are released from the source they are all released at the same time. For example, at time 0 we release 300 of Part1 etc…. I want to figure out the lead time for each part. So (on exit) I do something like:
Count++; //Global variable If (count==1) ExitTime= time(); I need that counter because 300 or so of these things will be released simultaneously. Problem- I will need 2 global variables- one for exit into model and other for entry into sink- for each part. That’s like 400 variables to keep track of. Is there a way to do this for both in and out of the model without the use of global variables? Thanks
__________________
"A bird is an instrument working according to mathematical law, which is within the capacity of man to reproduce." -Leonardo da Vinci, 1502 Last edited by Alex Christensen; 07-28-2008 at 10:25 AM. Reason: put his question back for other forum members |
#2
|
|||
|
|||
First of all, remember that variables in C++ and Flexscript are case sensitive, so Count is not the same as count.
There's a command called getcreationtime that might be of use to you. When a flowitem is created (like in a source), its creation time is recorded for use in the model. Look at the command documentation for more information, but it's a pretty simple command. If item is defined (which it is in almost all triggers), then just use it like this: Code:
double creationTime=getcreationtime(item); Code:
for(int x=1;x<=200;x++){ pf(ExitTime[x]);pr(); } |
The Following User Says Thank You to Alex Christensen For This Useful Post: | ||
Gavin Douglas (07-28-2008) |
#3
|
||||
|
||||
Gavin,
Is there a reasn that you need them to be global variables? If not, I would recommend that you keep a label on each flow item that tracks the time the item left the source (or was created) and then when the item enters the sink you can record the stop time and do something with the two times. You can append them to a table and keep a table of item type, start, and stop times. or you can calculate an average time in system for each part type or what ever you want. Let me know if you need something more specific, Brandon
__________________
thats not normal. |
The Following 2 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
Gavin Douglas (07-28-2008) |
#4
|
|||
|
|||
yes, the array worked and the label is also a good idea.
thanks.
__________________
"A bird is an instrument working according to mathematical law, which is within the capacity of man to reproduce." -Leonardo da Vinci, 1502 |
#5
|
||||
|
||||
Quote:
I am new Flexsim User (since last 2 days) and this is my first post to community. Brandon, I have a similar problem which I thought could be solved by using labels. In my model, I want to assign a random delivery date (by using a formula)to each flowitem on creation, and then subtract the lead time from this delivery date and consequently obtain the release date of flowitems. The release dates should be brought to flowitems as labels. My questions: 1- How can I make these calculations on creation of flowitems by the source? 2- How can I append the results of the calculations to labels? Besides, I also would like to track the time that flowitems are created and leave sink. How can I do this with labels? Could you explain in more detail? Last edited by Yasemin Vatandas; 07-30-2008 at 10:02 AM. |
#6
|
||||
|
||||
Yasemin,
In the parameters GUI of the source there is a On Creation trigger that will fire each time a flowitem is created. This is where you will want to put the code to set the label on the flowitem. Be careful here because the creation time of a flowitem is not necessarily the time at which it leaves the source. If you are interested in the time that the flowitem leaves the source use the On Exit trigger instead. To create a label on the flowitem go to the flowitems GUI (button at top) and select the flowitem you are using. In the properties page for that flowitem you can add a label. The name you give the label is the same name that you will need to use in your code. In the parameters GUI of the sink you will find an On Entry trigger. This is where you will want to put the code that will do the calculations to find the total time in system. The setlabelnum and getlabelnum commands are the ones that you use to get and set the value of a label on the flowitem. Good Luck, Brandon
__________________
thats not normal. |
The Following 2 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
Yasemin Vatandas (07-31-2008) |
Thread | Thread Starter | Forum | Replies | Last Post |
Displaying the simulation time with the various date/time formats. | Regan Blackett | Tips and Tricks | 12 | 11-12-2012 08:01 AM |
Inter Arrival Time by Time of Day Mod | Brandon Peterson | Tips and Tricks | 0 | 04-23-2008 11:13 AM |