question

Bryan Suharik avatar image
0 Likes"
Bryan Suharik asked Joerg Vogel edited

setitemtype not working?

Hello, I can't seem to change the itemtype of the source upon creation of the source through code.

AS you can see, the source is created. I've already assigned the arrival interval based on a global table that works well, but upon creation it defaults to item type = 1. I have a processor down stream that varies the process time depending on the item type, but i can't build the source with the item type i need.

How do you code in an item type assignment for a Source that's been created through code?

THANKS!

createinstance(node("/Source",library),model()); treenode Pump=last(model()); setloc(Pump,-50,cr,0); string InterArrivalTime1 = "treenode current =ownerobject(c); return gettablenum(\"GlobalTable20\",1,1);"; setvarstr(Pump,"interarrivaltime",InterArrivalTime1); setitemtype(Pump,3);

This is the source that's created...as you can see, the item type remains 1.00 by default and doesn't change to 3 as i'd like in the setitemtype.

FlexSim 16.0.6
sourcecodeitemtypeinitialized value
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Bryan Suharik avatar image Bryan Suharik commented ·

Sorry, forgot to attach image. Thanks

0 Likes 0 ·
setitemtype.png (17.9 KiB)

1 Answer

Arun Kr avatar image
2 Likes"
Arun Kr answered Bryan Suharik commented

Hi Bryan,

You need to use

setvarnum(Source,"interarrivaltype",itemtypenumber);

Basically, you need to access and change the node info responsible for your requirement.

Regards,

Arun KR


treenodeview.png (51.6 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Bryan Suharik avatar image Bryan Suharik commented ·

Yep, that was it. I knew i was close! The node is actually "interarrivalitemtype", but close enough as i got it! Thanks!

0 Likes 0 ·