question

Cayo E avatar image
0 Likes"
Cayo E asked Patrick Zweekhorst commented

Conveyor

Is there any way, When the simulation finishes all the boxes that are on the conveyor should go to the sink. Finishing the simulation with everything stopped and the conveyor clean of boxes.

Is possible?

FlexSim 18.2.2
conveyor
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

Patrick Zweekhorst avatar image
0 Likes"
Patrick Zweekhorst answered Patrick Zweekhorst commented

Hi @Cayo E,

This is definitely possible. If you add this code to the OnRunStop trigger all boxes will be moved to the sink:

Object sink = Model.find("Sink1");
forobjecttreeunder( model() )
{
 if( isclasstype( a, "Conveyor::Conveyor" ) )
 {
  Object conveyor = a;
  int nrBoxes = conveyor.subnodes.length;
  for( int boxId = nrBoxes; boxId > 0; boxId-- )
  {
   Object box = conveyor.subnodes[ boxId ];
   moveobject( box, sink );
  }
 }
}

I have done this in the attached example model. Is this what you need?

stopconveyor.fsm


stopconveyor.fsm (33.4 KiB)
· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Cayo E avatar image Cayo E commented ·

I didn't understand where you entered the code. in which object?

0 Likes 0 ·
Patrick Zweekhorst avatar image Patrick Zweekhorst Cayo E commented ·

Hi @Cayo E,

I added this code in the OnRunStop:

0 Likes 0 ·
runstop.png (21.7 KiB)
Cayo E avatar image Cayo E Patrick Zweekhorst commented ·

This option does not appear for me, do you have an error? I attached my template I believe you will understand. I need that when the simulation is finished, the objects that are on the conveyor are sent to Sink.

cenario-a-rev03.fsmDetalhes

0 Likes 0 ·
cenario-a-rev03.fsm (66.8 KiB)
runstop.png (163.5 KiB)
Show more comments