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 05-28-2011
shashanktrivedi shashanktrivedi is offline
Flexsim User
 
Join Date: Apr 2011
Posts: 59
Downloads: 26
Uploads: 0
Thanks: 26
Thanked 16 Times in 3 Posts
Rep Power: 122
shashanktrivedi will become famous soon enough
Default 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  
Old 05-28-2011
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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  
Old 05-29-2011
shashanktrivedi shashanktrivedi is offline
Flexsim User
 
Join Date: Apr 2011
Posts: 59
Downloads: 26
Uploads: 0
Thanks: 26
Thanked 16 Times in 3 Posts
Rep Power: 122
shashanktrivedi will become famous soon enough
Default

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
Attached Files
File Type: zip Order.zip (11.4 KB, 125 views)
  #4  
Old 05-29-2011
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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


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.