Go Back   Flexsim Community Forum > Flexsim Software > Q&A
FAQ Downloads Calendar Search Mark Forums Read vBExperience Register

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #1  
Old 07-28-2008, 09:13 AM
Gavin Douglas Gavin Douglas is offline
Flexsim User
 
Join Date: Feb 2008
Posts: 48
Thanks: 17
Thanked 1 Time in 1 Post
Downloads: 0
Uploads: 0
Rep Power: 29
Gavin Douglas is on a distinguished road
Default 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
__________________
Too Lazy to Work, Too Nervous to Steal

Last edited by Alex Christensen; 07-28-2008 at 09:25 AM.. Reason: put his question back for other forum members
Reply With Quote
  #2  
Old 07-28-2008, 09:23 AM
Alex Christensen Alex Christensen is offline
Flexsim Technical Support
 
Join Date: Nov 2007
Location: Provo, UT
Posts: 80
Thanks: 28
Thanked 104 Times in 45 Posts
Downloads: 39
Uploads: 8
Rep Power: 153
Alex Christensen is a name known to allAlex Christensen is a name known to allAlex Christensen is a name known to allAlex Christensen is a name known to allAlex Christensen is a name known to allAlex Christensen is a name known to all
Default

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);
For storing a large number of variables like this, there is a global variable type called doublearray. It's like having a large number (like 200) of organized variables. Use them like this:
Code:
for(int x=1;x<=200;x++){
pf(ExitTime[x]);pr();
}
This will print out the first 200 values stored in the doublearray ExitTime. Make sure that ExitTime is a doublearray with size greater than or equal to 200. In C, C++, and Flexscript, you have to keep track of array sizes yourself.
Reply With Quote
The Following User Says Thank You to Alex Christensen For This Useful Post:
Gavin Douglas (07-28-2008)
  #3  
Old 07-28-2008, 09:34 AM
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 364
Thanks: 182
Thanked 428 Times in 214 Posts
Downloads: 29
Uploads: 7
Rep Power: 314
Brandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud of
Default

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.
Reply With Quote
The Following 2 Users Say Thank You to Brandon Peterson For This Useful Post:
Dustin Derrick (08-26-2008), Gavin Douglas (07-28-2008)
  #4  
Old 07-28-2008, 11:38 AM
Gavin Douglas Gavin Douglas is offline
Flexsim User
 
Join Date: Feb 2008
Posts: 48
Thanks: 17
Thanked 1 Time in 1 Post
Downloads: 0
Uploads: 0
Rep Power: 29
Gavin Douglas is on a distinguished road
Default

yes, the array worked and the label is also a good idea.


thanks.
__________________
Too Lazy to Work, Too Nervous to Steal
Reply With Quote
  #5  
Old 07-30-2008, 12:29 AM
Yasemin Vatandas's Avatar
Yasemin Vatandas Yasemin Vatandas is offline
Flexsim User
 
Join Date: Jul 2008
Location: Hamburg, Germany
Posts: 36
Thanks: 29
Thanked 3 Times in 3 Posts
Downloads: 9
Uploads: 0
Rep Power: 24
Yasemin Vatandas is on a distinguished road
Question

Quote:
Originally Posted by Brandon Peterson View Post
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
Hello all,

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 09:02 AM..
Reply With Quote
  #6  
Old 07-30-2008, 12:51 PM
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 364
Thanks: 182
Thanked 428 Times in 214 Posts
Downloads: 29
Uploads: 7
Rep Power: 314
Brandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud ofBrandon Peterson has much to be proud of
Default

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.
Reply With Quote
The Following 2 Users Say Thank You to Brandon Peterson For This Useful Post:
Dustin Derrick (08-26-2008), Yasemin Vatandas (07-31-2008)
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying the simulation time with the various date/time formats. Regan Blackett Tips and Tricks 5 10-27-2008 07:41 AM
Inter Arrival Time by Time of Day Mod Brandon Peterson Tips and Tricks 0 04-23-2008 10:13 AM


All times are GMT -6. The time now is 08:44 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Powered by NuWiki v1.3 RC1 Copyright ©2006-2007, NuHit, LLC
Copyright 2007 Flexsim Software Products, Inc.