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 |
|
Downloads |
Q&A Using Flexsim and building models |
#1
|
||||
|
||||
Stopping automatically the simulation after set a Timetable or User Event
Hello All,
I created a timetable for a processor One of the my model goal is to reach the the less time to process the products But, the simulation is running after all the flowItem have gone away or finished, I think it should stop just after the last flowitem is finished. SomeOne has figure it out, How to make that the simulation stop automatically after the all flowitems have passed,Using TimeTable or User Events? Thanks for the Help! |
#2
|
||||
|
||||
I normally do it the way, that on the sink I compare the input of the sink with the number of items which will arrive in the system. Yes, I need to know, how many items will arrive in the system, but then the code is easy: // IF INPUT IS GREATER EQUAL NUMBER OF ARRIVAL ITEMS if(getinput(current) >= 23) { // SCREENREFRESH repaintall(); // STOP SIMULATION RUN stop(); }
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
#3
|
|||
|
|||
Hi,
One tip. If you want Tom's code to work when using experimenter or not using the experimenter, replace stop() with endreplication(0). Lars-Olof |
#4
|
||||
|
||||
Thanks Tom / Lars
But a have some separators set in the model, and not all the products are splitted just a percentage, Ex: The source could have 100 flowitems but at the final sink could get 300. That why I looking for other way to stop the simulation. I was thinking on check if the object type FLOWITEM exist in the simulacion. If I understand well, the FLOWITEM are destroy after they arrive into the sink. but Quess what? I don't know how to do it. Thanks for any help. |
#5
|
||||
|
||||
Gleny,
In my eyes your idea to check if there are objects FLOWITEM in the model is not really a good idea, because depending on your model size the search can be slow and therefore it will slow down your simulation run. So I would not use it, but still to answer your question, you could do something with forobjecttreeunder(). See the manual to get the idea. My idea would be to mark the last arriving item in your system by using a label and set this label to 1. At the Sink OnEntry I would check for the label on the items. If this label is 1 it is the last item and I would stop the simulation run. It is clear that you need to know which item is the last arriving item. I am pretty sure that you can get this information. If not, that you might go for the slow solution idea above.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following 2 Users Say Thank You to Tom David For This Useful Post: | ||
Sebastian Hemmann (03-16-2010) |
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamically populate the timetable | Gleny Rodriguez | Q&A | 1 | 03-10-2010 05:42 PM |
User Event as Experimenter? | ankus d | Q&A | 2 | 02-17-2009 08:06 AM |
User Event firing - precision problems | Shankar Narayan | Q&A | 6 | 02-16-2009 07:01 AM |
Problem with user event | Yasemin Vatandas | Q&A | 2 | 08-06-2008 02:49 AM |
question about User Event | Ning Wang | Q&A | 3 | 04-22-2008 10:56 AM |