Head (before)

global variable statistics — SIMUL8 Community Forum

Head (after)

Ask the SIMUL8 Community

Content (before)

global variable statistics

prennaprenna
Created at
in Community support
If I introduce a global data by information store and add this to the KPI, I can view only the last value of the simulation run. How the average (for example as the average number in queue) during the simulation can be introduced in the KPI summary. I Can save every change of the global variable and the time of change in a spreedsheet and compute the value over a simulation; but this is more complex for several global variables to introduce


Comments

  • Was this answer helpful?


    0
    There are probably several ways of doing it. If there are certain places in your VL code that the global value is being changed, you can create a subroutine that you can past the value (and name) of the object and this can be recorded in a spreadsheet with the current time.



    You could also create a subroutine that is called at a certain interval and will record the current values of the global items that you are interested in along with the time.
  • BetweenComments (1)

  • Was this answer helpful?


    0
    I need a global variable accessible by all functions. Just the one



    Where in my add on should I place



    my variable = 15



    ?
  • BetweenComments (2)

  • Was this answer helpful?


    0

    I am not quite sure I understand what the exact problem is, it looks like there might be a few.

    • to get a global variable (accessible from all parts of VL) - go to Data and Rules>Information store>create a variable
    • to create a local variable (only accessible from one section of VL) - go to the VL>local variable button> create your variable (or highlight the name in the VL>right click>create local data item).

    You can pass global variable to the KPI manager (where you can track it's value over runs and get the average at the end) by going to the information store>right-click the variable>add to KPIs. If you have done that, it sounds you did, then you can get the value for each run from the results manager, but you are correct, you will only get 1 number per run.

    If you want to watch something like the number of people in the queue and how it changes over time, you can actually save the the average number in Q into your KPIs and then use the 'time interval results' (in results manager (press the bottom part)>time interval results>options>'add' button).
    https://www.simul8.com/support/help/doku.php?id=features:time_interval_results

    Alternatively, you can actually get the data from SIMUL8 charts (the contents of queues are one of them). This solution is probably a bit clunky if you run a trial and have several global variables as well (a lot of columns to record). But the way you would do it would be to either - right click>copy data to clipboard. Or you can use VL command 'copy chart data to spreadsheet' or 'copy object chart data to spreadsheet'. That way you don't have to collect the change data yourself.

    I hope that makes sense.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Attach file
Attach image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Content (after)