3

Instead of calculating the size of the queue, I would like to identify the different objects in each queue in order to multiply them with their average processing time and then obtain the time in queue.

I tried to identify the different object in the queue by using the queue.get(index) function but I can't determine what this function returns. I would like to know from which source come the entities in the queue.

For example, I called the entities from source 1 =1 , but if I do queue.get(0)==1?0.2 :0.3 it does not work.Do you have any idea that could help me?

Thanks in advance,

Pau
  • 31
  • 1

1 Answers1

3

Accessing a member of the queue

The request queue.get(index) will return the Agent object itself. The type of the returned Agent will be determined by the Agent type setting of the delay block. This should typically and automatically be set to the same type as the Source's Agent type, otherwise you get a casting error.

Getting the source information

Your idea of taking the source information from the agent's name is not working, as the name is in no way linked to the source it comes from.

For identifying from which source the Agent came, the most intuitive option would be this:

  1. Create and use a custom Agent type
  2. In this agent type you add a variable where you save information about the source where it came from. The type of the field could be a String containing an source id, or the type "Source" containing directly the Source object
  3. This field gets filled in the "On exit" field of each source

When you want to identify the source in the queue, you can use the field to make your comparison, eg. like this:

queue.get(index).mySourceId.equals("Source1")?0.2 :0.3

Florian
  • 962
  • 1
  • 5
  • 17