question

wl86 avatar image
0 Likes"
wl86 asked Felix Möhlmann answered

Unable to acquire Resource that is made using code

I'm encountering an issue when trying to acquire Resources that are created using code.


Attached is a minimal example that shows the issue. The flow contains a Resource asset defined on a Group, and at the beginning of the flow I add an Operator to this Group using a code stage. The token will move through the subsequent Acquire Resource activity without complaining, but the token label that should point to the Operator shows <no path>.


Can this be solved?


Background
In my use case, the number of Operators, Transporters, etc. are parameters, so creating them dynamically using code seems to me like the best way. But maybe there is a better way altogether of achieving this?


Acquire dynamically created operator.fsm

FlexSim 22.1.4
flexscriptcodeacquire resource
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
3 Likes"
Felix Möhlmann answered

The link between the group objects and the resource is made on model reset. If you delete the objects afterwards you get a NULL reference, like in your model.

Use a model parameter to change the number of objects in a group. The number will update when the model is reset and the resource will correctly link to the group objects.

1721388766592.png


1721388766592.png (51.9 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.