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 02-01-2008
Sung Kim Sung Kim is offline
Flexsim User
 
Join Date: Jan 2008
Location: York, PA
Posts: 85
Downloads: 70
Uploads: 0
Thanks: 70
Thanked 9 Times in 6 Posts
Rep Power: 160
Sung Kim is on a distinguished road
Default 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  
Old 02-01-2008
Jeff Nordgren's Avatar
Jeff Nordgren Jeff Nordgren is offline
Technical Support Manager
 
Join Date: Jul 2007
Location: Orem, UT
Posts: 65
Downloads: 79
Uploads: 0
Thanks: 40
Thanked 21 Times in 17 Posts
Rep Power: 233
Jeff Nordgren is just really niceJeff Nordgren is just really niceJeff Nordgren is just really niceJeff Nordgren is just really nice
Default

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  
Old 02-01-2008
Sung Kim Sung Kim is offline
Flexsim User
 
Join Date: Jan 2008
Location: York, PA
Posts: 85
Downloads: 70
Uploads: 0
Thanks: 70
Thanked 9 Times in 6 Posts
Rep Power: 160
Sung Kim is on a distinguished road
Default 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  
Old 02-01-2008
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default

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)
  #5  
Old 02-05-2008
Sung Kim Sung Kim is offline
Flexsim User
 
Join Date: Jan 2008
Location: York, PA
Posts: 85
Downloads: 70
Uploads: 0
Thanks: 70
Thanked 9 Times in 6 Posts
Rep Power: 160
Sung Kim is on a distinguished road
Default WOW!!!

Thank you very much, Kris! It is so COOL!! (You are good... )


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


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.