How do I resume item on message trigger?

How do I resume item on message trigger?

jonathan_s3
Not applicable
92 Views
9 Replies
Message 1 of 10

How do I resume item on message trigger?

jonathan_s3
Not applicable

[ FlexSim 20.2.3 ]

Using either a decision point or a conveyor station, how do I resume item on message trigger without process flow?

0 Likes
Accepted solutions (1)
93 Views
9 Replies
Replies (9)
Message 2 of 10

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

I might pass in the item to resume as the sending object. The question then is which object is receiving the message, and from where is it sent?

0 Likes
Message 3 of 10

jason_lightfootVL7B4
Autodesk
Autodesk

Here's an example using the DP arrival (to stop and send a delayed message) and DP messagetrigger to resume.

DPstopMessageResume.fsm

Message 4 of 10

jonathan_s3
Not applicable

In your example the decision point is sending the message to itself. So

conveyor.itemData[fromObject].resume();

resolves correctly. But if another object is sending the message then it does not. I get:

time: 4.958494 exception: FlexScript exception: MODEL:/Pos1>variables/Custom/onMessage


In another thread the reply used some kind of label on the object to point to the flow item. But I can't figure out how to do that. Here's that thread:

https://answers.flexsim.com/questions/40783/code-to-resume-conveyor.html


Why aren't there more pick list options for on message triggers? It seems like it would be incredibly useful.

0 Likes
Message 5 of 10

jason_lightfootVL7B4
Autodesk
Autodesk

Here's an example where the top conveyor's DP sends a message to the lower DP (centerObjects reference).

The lower DP ignores it if it doesn't have an item - which I set as a label on arrival and clear on message.remoteDPmessageResume.fsm

Message 6 of 10

jonathan_s3
Not applicable

I think I figured it out. On arrival I have a code snippet:

current.OtherItem = item

Where "OtherItem" is a pointer label I created on my station.

35835-1610130318114.png

Then on message can resume the item using that pointer label to the item.

I created the resume code first as an on Arrival trigger then copy/paste the code from there to the on message trigger code.


Object fromObject = param(1);

double msgparam1 = param(2);

double msgparam2 = param(3);

double msgparam3 = param(4);

Conveyor.DecisionPoint current = param(9);

Conveyor conveyor = param(10);

{ //************* PickOption Start *************\\

/***popup:Conveyor_StopResumeItem*/

/***tag:description*//**Resume Item*/

if (/**\nCondition: *//***tag:condition*//**/true/**/) {

Object involved = /** \nItem: *//***tag:item*//**/current.OtherItem/**/;

involved.up.as(Conveyor).itemData[involved].resume();

}

} //******* PickOption End *******\\


This forces a resume item pick option in the on message trigger to show up.

Image.png

With this method I really only wrote one line of code by hand. It was just figuring out where all the pieces needed to go after that. Seems to work so far.

0 Likes
Message 7 of 10

jason_lightfootVL7B4
Autodesk
Autodesk

Is this all related the that 4 station workcenter with the trays that return underneath or is it something new?

0 Likes
Message 8 of 10

jonathan_s3
Not applicable

Yes and no. It was something that was frustrating me so I had to figure it out. I will use it for that model.

I can't for the life of me understand or replicate the process flow you wrote that worked for that model.

0 Likes
Message 9 of 10

jason_lightfootVL7B4
Autodesk
Autodesk

We can do a zoom meeting if you want to go through it and I can explain everything.

0 Likes
Message 10 of 10

jonathan_s3
Not applicable

Next week sometime sure.

0 Likes