|
5仿真币
各位好:
对FLEXSIM编程,使用的多的是什么语言。如下:
PROSEEND
// I know this code looks confusing for a simple random algorithm.
// The reason I have to do all of this stuff is because this code is evaluated twice: once when
// the warehouse picker wants to know his offset, and once when the item actually enters.
// Thus, if a stochastic variable is used, it needs to be recorded, so that we don't
// re-evaluate, and thus get a different answer the second time.fsnode* item = parnode(1);
fsnode* curlabel = node("/f_curbaynumber", labels(item));
if(! objectexists(curlabel) )
{
nodeinsertinto(labels(item));
curlabel = last(labels(item));
setname(curlabel, "f_curbaynumber");
nodeadddata(curlabel, DATATYPE_NUMBER);
fsnode* initialbay = rank(o(Rack, current).node_v_contenttable, trunc(uniform(1, content(o(Rack, current).node_v_contenttable) + .999)));
fsnode* currentbay = initialbay;
while(objectexists(currentbay))
{
if(getnodenum(currentbay) < content(currentbay))
{
setnodenum(curlabel, getrank(currentbay));
return getrank(currentbay);
}
currentbay = next(currentbay);
}
currentbay = prev(initialbay);
while(getrank(currentbay) >= 1)
{
if(getnodenum(currentbay) < content(currentbay))
{
setnodenum(curlabel, getrank(currentbay));
return getrank(currentbay);
}
currentbay = prev(currentbay);
}
setnodenum(curlabel, 1);
return 1;
}
else
{
float returnvalue = getnodenum(curlabel);
destroyobject(curlabel);
return returnvalue;
} |
|