How do I collect a list with data from each entity?

336 views
Skip to first unread message

Cristiano Silva

unread,
Apr 5, 2021, 11:28:09 AM4/5/21
to Jaamsim Users Discussion Group
Good morning guys.

How do I collect a list with data from each entity?

I want to collect a list of waiting times in a queue for each entity.

I want to draw a boxplot with the waiting time in the queue, so I need to collect the waiting time for each one.

Following the manual, I was able to collect average, standard deviation, etc. of the set, but not of each separate entity.

Thank you very much!

Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'

Harry King

unread,
Apr 5, 2021, 11:45:05 AM4/5/21
to Jaamsim Users Discussion Group
Use the EntityLogger object to create a log file. A record is written each time it receives an entity.

Harry

Cristiano Silva

unread,
Apr 9, 2021, 8:41:53 AM4/9/21
to Harry King, Jaamsim Users Discussion Group
I understood.

I used an "Assign" and an "EntityLogger", but I couldn't place the "Assign" before the server and after the queue.

Therefore, I am not able to collect the times that each entity was waiting in a queue.

Could you please send a suggestion?


Thank you very much!

Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'

--
You received this message because you are subscribed to the Google Groups "Jaamsim Users Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jaamsim-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/jaamsim-users/996df58c-21e9-497d-b6f7-f0f9ddbb87fbn%40googlegroups.com.

john.b...@arup.com

unread,
Apr 9, 2021, 11:55:38 AM4/9/21
to Jaamsim Users Discussion Group
Have a search for this: "How long did an entity wait in a queue?" I asked this a while ago. Answer is to use States. Here's the quick answer

JaamSim records the time in state for each entity to handle exactly this type of problem. You don't need to define any attributes.

Use the StateAssignment input for the queue to assign a state to each entity on arrival, say "Waiting", and then use the StateAssignment input for the server to assign another state to each entity at the start of processing, say "Processing". The time the entity spent in the queue is then given by StateTimes("Waiting").

Cristiano Silva

unread,
Apr 9, 2021, 12:10:22 PM4/9/21
to john.b...@arup.com, Jaamsim Users Discussion Group
Great.

I used StateAssignment -> "waiting"

later

in EntityLogger, in Key Inputs, DataSource -> {'this.obj.StateTimes ("wait") / 1 [s]'}

Correct ?


Thank you very much!

Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'

Cristiano Silva

unread,
Apr 17, 2021, 7:50:38 PM4/17/21
to John Beasley, Jaamsim Users Discussion Group, Harry King, Harvey Harrison
Hello, I hope you are well.

I created two videos on YouTube on this subject that we talked about.

Could you please check how it turned out?

https://www.youtube.com/watch?v=3DnQt3Fw1Fo&list=PLRvwRusArl39IYHrsQRj89onSVvFeWIIP&index=12



Thank you very much!

Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'


On Sat, Apr 10, 2021 at 8:32 AM John Beasley <John.B...@arup.com> wrote:
One final point. In the model, if you limit the total number of cars in the simulation run to 1200, (otherwise 1209 are produced) then you can ensure that all cars have been through the queue and the server and left the simulation. (Otherwise I saw one car still in the server at end of run and that very slightly changes the averages.)  Anyhow, when I limited the number of cars to 1200 then the two results are near enough identical:

59.92485 from the output report
59.9248 from the output window showing AverageQueueTime

I suspect any apparent difference is due to rounding or resolution, etc - but that's good enough for me!

As for collaboration, etc - I can't take any credit. I'm just a user! That said, like you, I think it is great. The software is developed by Harry King and Harvey Harrison so write to them - I have included their email addresses.

Regards,

John



From: Cristiano Silva <cristi...@gmail.com>
Sent: 10 April 2021 12:20
To: John Beasley <John.B...@arup.com>
Subject: Re: [External] Re: [jaamsim-users] Re: How do I collect a list with data from each entity?
 
Great John.

Now I understood perfectly.

Thank you very much...

Congratulations on participating in such an important initiative.

I want to collaborate with your project.


Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'


On Sat, Apr 10, 2021 at 8:14 AM John Beasley <John.B...@arup.com> wrote:
Hi there,

You have set the State of the object to "TimeInCarsQueue" as the object enters  CarsQueue. This line in your .cfg file: 

CarsQueue StateAssignment { TimeInCarsQueue }

That's perfectly correct. 

However, the State of the object will remain "TimeInCarsQueue" until it is changed to something else. In you model this doesn't happen anywhere so the time in this state that you get in the output file includes time in the queue AS WELL AS time in the server. That's why you get the "wrong" answer.

To fix it so that you are just measuring times in the queue, give the object a New State as it enters the Server. 

I attached a fixed version of your model. I gave the object a new State of "TimeInToll" when it entered the server - this is the line in the .cfg file:

Toll StateAssignment { TimeInToll }

Now if you run this you'll see that some of cars don't wait (as expected) and if you calculate the average time in the queue from the report file it is 59.54748445 seconds. If you look at the Output Window for the Queue object in your model, you will see AverageQueueTime is 59.4982 s - essentially the same as the report result. 





From: Cristiano Silva <cristi...@gmail.com>
Sent: 09 April 2021 23:41
To: John Beasley <John.B...@arup.com>
Subject: Re: [External] Re: [jaamsim-users] Re: How do I collect a list with data from each entity?
 
Good night sir John.

Please, could you check my model ( attached shipping. ).

The first line of the file: 002_model_toll-Report.log

The value is returning: 6.335083999999999 [s]

This first value had to return zero, since the first car does not wait any time in the queue.

The average of the values in the 002_model_toll-Report.log file returned: 79.5862186200332

The average in AverageQueueTime returned: 59.4982

These values should be the same, that is, the value of the file, after I made the average, it should also be 59.4982, but it was different, it was 79.5862186200332.

In the example you sent, it worked, these average values of the file and the Output Viewer were the same.


Thank you very much!

Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'


On Fri, Apr 9, 2021 at 2:57 PM John Beasley <John.B...@arup.com> wrote:
Looks almost right. Example attached. Also you can change the units used for time across the whole simulation. Look at the menu "Units" and select time in seconds and then all reports, etc will be in seconds. The EntityLogger file (in the latest version) at least gives you just a number - the units set as above. I attach the output file too.


From: Cristiano Silva <cristi...@gmail.com>
Sent: 09 April 2021 17:10
To: John Beasley <John.B...@arup.com>
Cc: Jaamsim Users Discussion Group <jaamsi...@googlegroups.com>
Subject: [External] Re: [jaamsim-users] Re: How do I collect a list with data from each entity?
 
 ____________________________________________________________
Electronic mail messages entering and leaving Arup business systems are scanned for viruses and acceptability of content.

Cristiano Silva

unread,
Apr 17, 2021, 7:52:20 PM4/17/21
to John Beasley, Jaamsim Users Discussion Group, Harry King, Harvey Harrison
Note: I added subtitles, it is possible to translate to English.


Atenciosamente,
Cristiano Luís Turbino de França e Silva
==============================
                      GNU / Linux
    ,                ,       /       .-.
   /                  \     /      (e e)
  ((__-^^-,-^^-__))   /     _.`V'._
    `-_---' `---_-'      /    //~~W~~\\
  <__|o ` 'o|__>   /    //,           ,\\
        \   `  /       /    // |            | \\
         ):  :(      /      \) |            | (/
        :o_o:    /           \           /
          "-"    /              `w -  w'

Reply all
Reply to author
Forward
0 new messages