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 01-14-2009
Ning Wang Ning Wang is offline
Flexsim User
 
Join Date: Apr 2008
Posts: 13
Downloads: 1
Uploads: 0
Thanks: 16
Thanked 1 Time in 1 Post
Rep Power: 147
Ning Wang is on a distinguished road
Default 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.
  #2  
Old 01-14-2009
Ning Wang Ning Wang is offline
Flexsim User
 
Join Date: Apr 2008
Posts: 13
Downloads: 1
Uploads: 0
Thanks: 16
Thanked 1 Time in 1 Post
Rep Power: 147
Ning Wang is on a distinguished road
Default

Model is here
Attached Files
File Type: zip 0115.zip (64.8 KB, 265 views)
  #3  
Old 01-14-2009
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

Change your for line in the queue from:
Code:
for(int ranknum=1;ranknum++;ranknum<=content(current))
to:
Code:
for(int ranknum=1;ranknum<=content(current);ranknum++)
Lars-Olof
The Following User Says Thank You to Lars-Olof Leven For This Useful Post:
Ning Wang (01-14-2009)
  #4  
Old 01-14-2009
Ning Wang Ning Wang is offline
Flexsim User
 
Join Date: Apr 2008
Posts: 13
Downloads: 1
Uploads: 0
Thanks: 16
Thanked 1 Time in 1 Post
Rep Power: 147
Ning Wang is on a distinguished road
Default

OMG
a stupid mistake~~~~
But the machines are not pull parts now (the flowitems just stay in the queue and not come out). How to fix it?
Thanks
  #5  
Old 01-14-2009
Ning Wang Ning Wang is offline
Flexsim User
 
Join Date: Apr 2008
Posts: 13
Downloads: 1
Uploads: 0
Thanks: 16
Thanked 1 Time in 1 Post
Rep Power: 147
Ning Wang is on a distinguished road
Default

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  
Old 01-16-2009
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

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);
}
I put the code in OnEntry.

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


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.