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
|
|||
|
|||
Setting the number of operators
Hi,
Is there a trick or demo model that automatically generate (or activate) only necessary number of operators/transporters based on the given user input? I need to test several scenarios varying the number of operators. I would like to avoid attaching/detaching operators manually to the dispatcher by scenario. Any advice will be appreciated. |
The Following 2 Users Say Thank You to Sung Kim For This Useful Post: | ||
Stefan Trabut (05-09-2011) |
#2
|
||||
|
||||
Just attach all your operators, then based on the scenario, close the input ports of the operators that are not needed. And make sure you open the input ports of the ones you do need to make sure everything is reset from previous scenarios.
__________________
Jeff Flexsim Support |
#3
|
|||
|
|||
Thank you for the trick!
just out of curiosity, instead of attaching max operators, is there a way to generate and attach the operators to the port automatically? I think I am too lazy.. .. just checking though.
|
#4
|
|||
|
|||
Sung,
Connect a Dispatcher to at least one Operator, create a label on the Dispatcher called OperatorQty. Then in the OnReset of the Dispatcher place the following code: treenode current = ownerobject(c); /**Create and connect operators based on a label value*/ //this code assumes that you always have at least 1 operator on this team int oprequired = getlabelnum(current,"OperatorQty"); int opnow = nrop(current); if(opnow>oprequired) //we have too many operators { for(int index=opnow; index>oprequired; index--) {destroyobject(outobject(current,index)); }} else if(oprequired>opnow) //we need more operators { for(int index=opnow+1; index<=oprequired; index++) { //createinstance(node("/Source",library()),model()); //alternative option to create copy createcopy(outobject(current,1),model()); //copy the first operator connected contextdragconnection(current,last(model),"A"); //connect the new operator } openallop(current); //allows the Dispatcher to acknowledge the connection} |
The Following 3 Users Say Thank You to Kris Geisberger For This Useful Post: | ||
Sucharith Vanguri (03-20-2010) |
Thread | Thread Starter | Forum | Replies | Last Post |
Statistics: Random Number Streams | Tom David | Q&A | 19 | 08-12-2014 02:02 AM |
Operators on Multiple Networks | Nico Zahn | Q&A | 0 | 10-10-2007 03:02 AM |