I'm trying to build up a pedastrian simulation with the ED logistics suite for a student project. Instead of simulating a pedastrian flow through a room, we focus on queues for each room and we measured values for the flow beetween several rooms. Therefore we need to move some atoms from one queue to another with a given probability. We found out the following solution for doing that:
Code: Select all
ForAtomLayerUnder( AtomByName([Abschnitt2],Main),
do( dim([MyRand], vbValue, Random(100)),
if( MyRand < 20,
MoveAtom(First(AtomByName([Abschnitt2],Main)),AtomByName([von2nach12],Main))
, if( MyRand < 40,
MoveAtom(First(AtomByName([Abschnitt2],Main)),AtomByName([von2nach23],Main)))
)
)
)
First we tried to use Last instead of First, but the outcome was not the expected result. Makes the above implementation sense for our Problem? Did we make any common mistakes?
The above shown Code is executed within a time based User Event. We experienced some errors after saving our model. The Event got lost after saving, but other items are saved correctly.