question

Mohamed Roushdy avatar image
0 Likes"
Mohamed Roushdy asked Felix Möhlmann answered

Dynamic creation of photoeye during model run

i'm trying to create a photoeye on a conveyor. i'm using a modified code based on great answers in "Build Decision Point with Code - FlexSim Community" and "Create conveyor system in code - FlexSim Community", my problem is i'm not able to use Event trigger source "On cover", i've to reset the model first, is there any solution to trriger "on Cover" without reset?


string conveyorname = "conveyor";

int conveyorgroup = 1;

int conveyornum = duniform(1,4,1);


conveyorname = conveyorname + conveyorgroup + conveyornum;

Object conveyor=Model.find(conveyorname);


double conveyorlen = getvarnum(conveyor, "length");

double distalong=uniform(1,conveyorlen,2);

Object photoEye= createPhotoeye(conveyor,distalong);


// Add label to find the associated PE

token.PE = photoEye;

//Add to Photo Eye Group

Group("PhotoEyes").addMember(photoEye);

current.PE=photoEye;


FlexSim 25.1.0
photoeye
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

You could try what I suggest in the linked post below and use a Wait for Event activity and looping tokens instead of a source. https://answers.flexsim.com/questions/178007/updating-event-triggered-source-parameters-during.html

5 |100000

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