question

Theresa B avatar image
0 Likes"
Theresa B asked Theresa B commented

Handling an invalid object reference exception in Process Flow (expected error)

Hey forum,

Hope you've all been well.

I've been trying to model the arrival of a perishable product to measure the amount of waste that may occur given different truck schedules.

I've created a model that anonymises the work but essentially:

  • 2 sources deliver products and trucks at different rates
  • A combiner "loads" some products onto a truck and sends them to another queue (purely for visualisation)
    • I've chosen the combine function "Join" rather than "Pack" because otherwise the process flow can still access (and destroy!) products that have entered the combiner
  • A process flow triggered On Entry of products to a queue
  • Label is assigned for the hour on which the product arrives
  • A decide activity checks that an hour hasn't passed
  • If it is a new token, it goes into a delay (of an hour, the time the product will last) and then be assigned a new label, indicating an hour has passed and loop back to the decide activity
  • If it is a token connected from the loop, the product will be destroyed and an object will be created in an unconnected queue

The model is called SendToPortByDwellTime_shell.fsm on FlexSim's file share site.

I think it is a positive that there is no path/NULL to a product that has entered the combiner because it ensures that there is no over-counting of waste but how to I handle the exception properly and send those tokens into a separate sink?

Or perhaps I am using an overcomplicated or wrong approach to solving my problem?

Thanks in advance!

FlexSim 22.2.0
processflowexception errordestroy objectperishable
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 Theresa B commented

Since I can't access models on the cloud I can't look at your model. From your description, I don't see the need to have a loop in the process flow. Don't all tokens enter the delay exactly once, so it could also just be set up as a straight flow?

In regards to your actual question. You could do the same by keeping the items when they enter the combiner and just set a label on them (for example set a "Processed" from 0 to 1). Depending on that label the process flow could then either delete and log the waste item or do nothing.

Your approach is also valid though. You can check if the item exists before your destroy it with "objectexists(token.item)" (replace 'item' with the respective label name in your model if it is different.

1660847283716.png


1660847283716.png (31.7 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.

Theresa B avatar image Theresa B commented ·
Great, thanks for your solution, Felix!

You're correct, I did not need that loop - I think I was just looking at the flow for so long that it looked normal.

I didn't know about the objectexists() command, so that's a handy tool to have up my sleeve.

0 Likes 0 ·