question

SudheerReddy avatar image
0 Likes"
SudheerReddy asked Joerg Vogel edited

Tutorial 4.3 Creating clones using instances

In below image

Activity Source:Starting 2 Rolls label rollQuantity is 20 for all instances. If I would like to assign different rollQuantity for different instances may be from Global Table or through Variable then how would it be achieved. In my model there are two process flows one is General Process Flow and other is Fixed Resource Process Flow called Sticker Roll Logic. I'm talking about Sticker Roll Logic where process flow instances is used.

I'm attaching the model for reference.

41-2.fsm

FlexSim 20.0.0
process flow
41-2.fsm (86.1 KiB)
· 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.

zacharyh avatar image zacharyh ♦ commented ·

@Sudheer R

This could be achieved in a lot of different ways depending on what you are trying to achieve. By clicking on the black arrow next to the Value box you will be given a lot of different options as seen in the image below.

You could choose a Value By Case, where a specific factor would decide what the rollQuantity is. Or you could do set a Statistical Distribution or By Percentage so that the rollQuantity isn't always the same. Or there is the option for Global Table Lookup where you would be able to get a value from a table.

0 Likes 0 ·
SudheerReddy avatar image SudheerReddy zacharyh ♦ commented ·

@zachary.h thanks for your answer. But I am aware of Value by case, Statistical Distribution and Global Table in normal process flow. But my question is not for normal process flow logic.

As shown in below image

In Quick Properties there are 8 attached objects in Process Flow Instances which are running simultaneously in Fixed Resource Process Flow(Sticker Roll Logic). I have a GlobalTable1 where I have specified RollQty now I'm trying to attach a Global Table to Sticker Roll Logic. For example instance1 it should use Row 1, instance2 Row 2 and so on.

How to achieve this in process flow instances logic. Attached is my updated model for your reference

41-4.fsm

0 Likes 0 ·
41-4.fsm (71.9 KiB)
instance.png (48.6 KiB)

1 Answer

Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Joerg Vogel edited

You can get a reference to the Attached Objects (instances) by the property

token.instance

or the current keyword

current

The value is a pointer like Plane1/StickerMachine or Plane4/StickerMachine4.

If you need a number to access a global table row, you can

  • add a label at each StickerMachine that you read:
token.instance.yourLabel
  • find the index of an array of pointers to the StickerMachine
Array stickerMachines = [Plane1/StickerMachine,
                         Plane2/StickerMachine2,
                         Plane3/StickerMachine3];
int row = stickerMachines.indexOf(token.instance);
  • extract the number of the name string
  • ...
5 |100000

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