question

Enrique Elizaga avatar image
0 Likes"
Enrique Elizaga asked Arun Kr edited

code to resume conveyor

can someone share a model that stops an item at a decision point and then resumes it upon receiving a message....i've been killing myself over this using process flow but I don't think it's necessary.

FlexSim 17.1.1
conveyor decision point
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

@dev, @Matthew Gillespie, @anthony.johnson, there is missing the right template to resume a stopped item in the decision point properties. It still stops the involved object and is referenced to a non existing label. I have copied the resume code to the OnMessage Trigger, which worked in previous versions fine. But now it doesn't.

please, can check this? many thanks.

regards Jörg

0 Likes 0 ·
Arun Kr avatar image
1 Like"
Arun Kr answered

Hi @Enrique Elizaga,

Here is a sample model. The model has two photo eyes and one decision point in the conveyor. When the box blocks the first sensor the decision point stops the box. And when the box clears the second sensor a message is sent to the decision point to release the boxes. This cycle is repeated.

Regards,dpcontrol-akr.fsm

Arun KR


dpcontrol-akr.fsm (18.8 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.

Enrique Elizaga avatar image
0 Likes"
Enrique Elizaga answered Arun Kr edited

@Arun KR thank you for the sample model and logic, it worked marvelously and I am currently using it in multiple points accross the model. I am getting the following error message in some decision points, and I can't seem to find the problem:

FlexScript exception: Invalid down cast. Object is not an instance of the target type. at MODEL:/DP23>variables/localType/onMessage

Also:

Property "up" accessed on invalid node. at MODEL:/DP95>variables/localType/onMessage

The code used in onMessage:

Conveyor.DecisionPoint current = param(9); Object conveyor = param(10);

treenode item = current.REF;

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

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

Arun Kr avatar image Arun Kr commented ·

Hi @Enrique Elizaga ,

I was also getting the same error message, so I managed by adding some "objectexists" conditions. If the conveyor is curved use CurvedConveyor if condition instead of StraightConveyor, as given below in the code.

Object involved = current.REF; 
  if(involved)
  {
     if(classobject(involved.up)==library().find("?StraightConveyor"))
     {
      involved.up.as(Conveyor).itemData[involved].resume();
     }
  }
2 Likes 2 ·

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.