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
|
|||
|
|||
simple scheduling function?
hey guys
I want to use flesxim to execute some very simple scheduling function, such as EDD rule (the job with earliest duedate is operated first). Since the manufacturing system is dynamic, I want to write the codes of scheduling in OnExit of object Queue. So that when there is an item (job) exits from queue, the scheduling codes run and the item with the earliest duedate is selected and one label of this item is numbered as 1. The first avaliable machine will pull this item by specific label value (in this case the value is 1). This is one of my idea to solve this problem but I have some problem with that. When I run the model, the software is alwasys "NOT responding". I guess there is some logic errors with my codes but I don't know what they are and how to fix them. I attach my model here. I hope you guys can help me and we can discuss about it. I appreciate. |
#3
|
|||
|
|||
Change your for line in the queue from:
Code:
for(int ranknum=1;ranknum++;ranknum<=content(current)) Code:
for(int ranknum=1;ranknum<=content(current);ranknum++) |
The Following User Says Thank You to Lars-Olof Leven For This Useful Post: | ||
Ning Wang (01-14-2009) |
#5
|
|||
|
|||
btw, I'm not sure about the use of commands related to "rank". Here I want to find one item in the queue so I have to look up in all items, find the item and label it. Following is the code:
int smallnum=9999999; for(int ranknum=1;ranknum<=content(current);ranknum++) { int duedate=getlabelnum(rank(current,ranknum),"duedate "); if(duedate<smallnum) settablenum("no1rank",1,1,rank(current,ranknum)); } addlabel(rank(current,ranknum),"rank1"); setlabelnum(rank(current,ranknum),"rank1",1); It doesn't run these line because nothing exit from queue. Even when I try to put these codes in OnEntey, it doesn't work well. The codes run but the result are not good. Is there anyone know what' wrong? Thanks |
#6
|
|||
|
|||
Hi,
I have done some changes to your code, try this: Code:
int smallnum=9999999; int index=0; for(int ranknum=1;ranknum<=content(current);ranknum++) { int duedate=getlabelnum(rank(current,ranknum),"duedate"); if(duedate<smallnum) { index=ranknum; smallnum=duedate; } } if (index>0) { addlabel(rank(current,index),"rank1"); setlabelnum(rank(current,index),"rank1",1); } The problem you had in your code was that ranknum would always be one higher then how many there is in the queue. Example if the queue have 10 items ranknum will be 11. This code should give you a starting point for your model. Lars-Olof Last edited by Lars-Olof Leven; 01-20-2009 at 11:11 AM. |
The Following User Says Thank You to Lars-Olof Leven For This Useful Post: | ||
Ning Wang (01-19-2009) |
Thread | Thread Starter | Forum | Replies | Last Post |
Simple emergency room model | Francisco J. Ramis | Q&A | 4 | 04-22-2009 03:36 PM |
simple question for operators | Kang Han | Q&A | 1 | 10-23-2008 08:35 AM |
Cost function as a PFM in a Experimenter | Simon Farsah | Q&A | 2 | 06-23-2008 11:31 AM |
Print function | David Chan | Gripes and Goodies | 0 | 05-21-2008 09:38 PM |
Is there any simple solution to support batch mean method in flexsim? | qin tian | Q&A | 1 | 02-29-2008 01:19 PM |