question

Kyle P avatar image
0 Likes"
Kyle P asked Kyle P commented

Task Sequence losing "drop from list" reference

I am having problems with a bus routing model. The model is designed to pickup people at various bus stops and drop them off based on a bus route loop. The only way I've been able to get this to work is with Task Sequence Lists. I don't like working with these, but the functionality is great if you can get them to work.

I am getting the following error:

time: 243.000000 exception: FlexScript exception: Invalid down cast. Object is not an instance of the target type. at MODEL:/Bus1>variables/loadtrigger i: MODEL:/Tools/GlobalLists/TSList1/26/onFulfill/1

And have narrowed it down to this variable in a trigger in which I am pulling task sequences:

1657134244918.png


I think the model is losing the reference to the task sequence and then cannot find it when it goes to drop the task sequence. This seems to happen when it grabs a task from the onResourceAvailable trigger and then more tasks are added to the task list before it can unload all of the items it loaded. I'm fine with the error just persisting but it seems to be creating artifacts to where certain tasks in the task list get left on the list and never executed (once per error). I would guess this is the task the bad reference points to when the drop task from list fails.


I have attached the file I'm working with. Let me know if anything needs clarification.


Bus Example.fsm

FlexSim 22.1.2
tasksequencetaskliston load trigger
1657134244918.png (61.3 KiB)
bus-example.fsm (82.3 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

Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Kyle P commented

I would change current to be Object and then have a new local variable called te for the TaskExecuter task - but even if you do that you'll still have the problem that param(1) isn't a valid item when the trigger is called in the Callback case. You could put the test for callback case before you assign the item variable.

This is a purely technical answer - I've not looked into how or why you're doing what you are.

· 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.

Kyle P avatar image Kyle P commented ·
What is the Callback case doing? Seems like it's listening for an event, but I'm not sure what event and why.
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Kyle P commented ·

It's the case where the pull is unsuccessful but you leave a backorder on the list. Then when the backorder is fulfilled this trigger is fired again. You no longer have a callback handler in your code so it can't do anything with that anyway. Drop a new task executer in a model and add a PullFrom List option to the Load Trigger and you'll see the differences between your code and the standard trigger option.

Perhaps you could describe the intention behind what you're doing and we can advise you on the approach more generally.


0 Likes 0 ·
Kyle P avatar image Kyle P Jason Lightfoot ♦♦ commented ·
I got it working by not pushing the ts query to a backorder for the load operation. If there is no item to load then the ts is handled by the onResourceAvailable trigger. Thank you for your help!
0 Likes 0 ·