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
|
|||
|
|||
Dynamic Combiner componentlist updation
Hi,
We are trying to update Target quantity (in table componentlist) in combiner dynamically, and following below code createinstance(node("/Combiner",library()),model()); treenode combinernode = last(model()); ----- then we are drawing connection to racks and queue from combiner afterwards we are trying to update target quantity. --- treenode componentlist=getvarnode(combinernode,"componentli st"); settablenum(componentlist, 2,1,10); Unfortunately not able to update combiner target quantity dynamically,have tried most of the options, don't know where i am making mistake. Kindly advise. Thanks in advance. Regards Shashank Trivedi |
#2
|
|||
|
|||
Good point. The object relies on a reset or click to create the table...
For now just add this line before you set the values: settablesize(componentlist,nrip(combinernode)-1,2); |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
shashanktrivedi (05-29-2011) |
#3
|
|||
|
|||
Thanks alot jason for your kind reply.
We have very simple model one source (source-1) connected to one queue and same queue connected to combiner on port-1 and for combiner port-2 , one queue followed by one source. Now we are combining items from these two sources and pack quantity is defined dynamically as per item type from source-1, item types are defined using the function duniform(5,10,2). We are using following code in on entry trigger in the combiner. /**Custom Code*/ treenode item = parnode(1); treenode current = ownerobject(c); int port = parval(2); int value= (getitemtype(item)); treenode componentlist=getvarnode(current,"componentlist"); settablesize(componentlist,nrip(current)-1,2); settablenum(componentlist, 1,1,value); setvarnum(current,"targetcomponentsum",value); pf(value); Unfortunately model is behaving very erratic and not doing packing correctly as per required pack quantity. Attaching model for reference as well. Kindly advise. Regards Shashank Trivedi |
#4
|
|||
|
|||
Usually you'd only change the component list for items that arrive on port 1, but there's no test for that in the code you've posted.
By the way - a lot of code problems are easily solved by placing a breakpoint in the left margin and stepping through the model events and then the code while observing the local variables. Last edited by Jason Lightfoot; 05-29-2011 at 05:02 AM. |
The Following 3 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
vivek dubey (06-13-2017) |
Tags |
combiner, dynamic |
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Script | shashanktrivedi | Q&A | 2 | 05-26-2011 11:36 PM |
Dynamic Transportation | shashanktrivedi | Q&A | 2 | 05-25-2011 10:48 PM |
Dynamic Scripting itemtype | shashanktrivedi | Q&A | 3 | 05-25-2011 10:44 PM |
How to display dynamic text next to an object | Cliff King | Tips and Tricks | 4 | 11-11-2010 01:45 PM |
Dynamic script generation: Good Example with a User Command | Naresh Yamani | Tips and Tricks | 2 | 05-16-2008 06:54 PM |