question

sanaz karamimoghaddam avatar image
0 Likes"
sanaz karamimoghaddam asked Logan Gold commented

referencing node numeric value of a zone partition

Hi all,

I have a label on my processflow, value of which should be the limit of a partition in a zone (the object expanded on the tree in the attached picture). I tried getvarnum command and referenced the node in the tree by using the drop done tool in code but it returns zero, so I assume I am either referencing the value using an incorrect code, or the partition limit value is not referenceable?

Thanks

node-q.pngzone-q.png

FlexSim 16.2.1
zone partitiontree nodereferencing
node-q.png (30.2 KiB)
zone-q.png (23.1 KiB)
· 3
5 |100000

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

Matt Long avatar image
2 Likes"
Matt Long answered Matt Long commented

I would encourage you to not pull values directly from the tree within Process Flow activities. The structure is not guaranteed to stay the same for each FlexSim release, as well, the data may not be what you expect to be (ie limit vs limitNode). The Partition Constraint allows you to enter code for the Limit value. I would recommend either storing that data in a global variable or a label on the instance or Process Flow object. Then you type directly into the Limit field with something like:

  1. myGlobalVariable //Global Variable
  2. getlabel(processFlow, "labelName") //Label on the Process Flow
  3. getlabel(current, "labelName") //Label on the instance object
  4.  

It does look like the code header for the Partition Constraint Limit is wrong. It should be:

  1. treenode instance = param(1);
  2. treenode zone = param(2);
  3. treenode processFlow = ownerobject(zone);
· 2
5 |100000

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

Logan Gold avatar image
1 Like"
Logan Gold answered Logan Gold commented

Where are you using the getvarnum() command? It sounds like you are trying to reference the limitNode node that is being shown in the first picture, but that is the node that actually contains the number/code representing the limit of a partition in a zone. In other words, it is the node that contains the same 1.00 from the second picture and it sounds like you are trying to reference the limitNode node from within itself.

If what you are trying to do is reference a Process Flow label from the Partition Constraints tab of a zone instead (within the Limit field), then use the getlabel() command. I believe it is a naming error, but there is a label in the Limit field code called "zone" which actually references the Process Flow object. So in the Limit field, you can use this code:

getlabel(zone, "labelName")

Where "labelName" should be the name of the Process Flow label you are trying to reference.

· 2
5 |100000

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