question

michela-08 avatar image
0 Likes"
michela-08 asked michela-08 commented

Create object using process flow

Hi,

In my model, I want to create parts based on the labels Variant and Station using process flow in the respective Queue as shown in the model's process flow. I want to create parts as per the Variant and Station name as given in the global table. I have tried the "Create Object" option in the process flow and I have written a code for the parts destination ,but this logic is not working.

Can you please tell me how to achieve this and tell me what is wrong in my process flow.

Trial_model.fsm

FlexSim 22.2.3
processflowprocessorcreate object
trial-model.fsm (34.6 KiB)
5 |100000

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

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered michela-08 commented

Why are you assigning new "Variant" and "Station" values to the token instead of using the ones that are written to the item when created by the source?

"Table(...).cell" returns a reference to the node that represents the table cell. To get its value you have to add ".value" to the end. Or just use the [][] syntax ( Table(...)[token.Row]["ItemName] ).

You are not returning a pointer to an object in your custom code, so no item gets created since there is no valid destination given.

Example:

if(token.Variant == "L" && token.Station == "Station 1")
{
    token.Part_Name = Table("Parts_creation").cell(token.Row,"ItemName").value;
    return Model.find("Queue1");
}
· 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.

michela-08 avatar image michela-08 commented ·

Where to add this code?

As tried adding this code in the Create In custom code of Create Object. But it's not working.

Then how to access the labels created without creating in the assign labels? Can you explain how to use this?

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann michela-08 commented ·

The code was an example of how to modify the code of the "Create In" option. Since the part name would have to be assigned later anyway (see your other question), that line can actually be taken out.

It would also seem logical that the place the item should be created in would only depend on the "Station" label (at least in your attached model).

1669629982824.png

trial-model_1.fsm

0 Likes 0 ·
1669629982824.png (28.4 KiB)
trial-model-1.fsm (33.5 KiB)
michela-08 avatar image michela-08 Felix Möhlmann commented ·
Yes I am looking into it. Thank you this really helped.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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