ATTENTION

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.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 07-28-2008
Gavin Douglas Gavin Douglas is offline
Flexsim User
 
Join Date: Feb 2008
Posts: 65
Downloads: 1
Uploads: 0
Thanks: 27
Thanked 1 Time in 1 Post
Rep Power: 152
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
__________________
"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  
Old 07-28-2008
Alex Christensen Alex Christensen is offline
Flexsim Technical Support
 
Join Date: Nov 2007
Location: Provo, UT
Posts: 96
Downloads: 41
Uploads: 8
Thanks: 29
Thanked 141 Times in 56 Posts
Rep Power: 298
Alex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to behold
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.
The Following User Says Thank You to Alex Christensen For This Useful Post:
Gavin Douglas (07-28-2008)
  #3  
Old 07-28-2008
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 382
Downloads: 29
Uploads: 6
Thanks: 192
Thanked 516 Times in 235 Posts
Rep Power: 490
Brandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant future
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.
The Following 2 Users Say Thank You to Brandon Peterson For This Useful Post:
Gavin Douglas (07-28-2008)
  #4  
Old 07-28-2008
Gavin Douglas Gavin Douglas is offline
Flexsim User
 
Join Date: Feb 2008
Posts: 65
Downloads: 1
Uploads: 0
Thanks: 27
Thanked 1 Time in 1 Post
Rep Power: 152
Gavin Douglas is on a distinguished road
Default

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  
Old 07-30-2008
Yasemin Vatandas's Avatar
Yasemin Vatandas Yasemin Vatandas is offline
Flexsim User
 
Join Date: Jul 2008
Location: Hamburg, Germany
Posts: 36
Downloads: 9
Uploads: 0
Thanks: 29
Thanked 3 Times in 3 Posts
Rep Power: 146
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 10:02 AM.
  #6  
Old 07-30-2008
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 382
Downloads: 29
Uploads: 6
Thanks: 192
Thanked 516 Times in 235 Posts
Rep Power: 490
Brandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant future
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.
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


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.