Moving atoms from one queue to another

All topics specific to modeling questions in Enterprise Dynamics
Post Reply
HannesTegeler
Posts: 1
Joined: Sunday 06 March, 2011 - 14:30

Moving atoms from one queue to another

Post by HannesTegeler »

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.
User avatar
MatthijsJongboer
Posts: 200
Joined: Thursday 11 November, 2010 - 14:12

Re: Moving atoms from one queue to another

Post by MatthijsJongboer »

This code and the mentioned location (User Events) suggests overruling of the channel principles of ED. You define the time when an event (the userevent) has to be executed and move the atoms from one queue to another. Because of the open structure of ED, it is possible to program this but results in problems with the standard ED atoms such as the queue.
Why not use the standard ED Atoms to achieve what you want?
For your example code, you can define your own sendto statement where two output channels from a queue are each connected to other queues. Your sendto code would then look something like:

Code: Select all

do(
 dim([MyRand], vbValue, Random(100)),
 if( MyRand < 20,
  1,
  if( MyRand < 40,
   2
  )
 )
)
User avatar
MatthijsJongboer
Posts: 200
Joined: Thursday 11 November, 2010 - 14:12

Re: Moving atoms from one queue to another

Post by MatthijsJongboer »

The presented solution might be the answer to continue modelling. If the answer leaves room for additional questions or discussion, feel free to continue in this thread on the topic 'Moving atoms from one queue to another'. For new topics, you can start a new thread.
Post Reply