Search code examples
anylogic

How to get the value of timeplot chat using dataset multiplied by getHour() in Anylogic?


I am trying to get a plot in time chart using the values of a dataset multiplied by getHour().

This is causing an error.

enter image description here

enter image description here

Please note, at the start of the model, the value in acceptedCfD dataset is zero. Overtime it increases to an positive value.


Solution

  • This question you are asking makes me nervous

    First, a dataset is an object equivalent to some sort of collection of x,y values that also has some methods.

    so a dataset can contain the time and the value at that time.

    When you plot a dataset, you are plotting that, the time and the value to plot at that time, for each point in your collection.

    getHour returns the hour of the day from 0 to 11.

    so imagine your dataset has

    time:0, value:1
    time:1, value 3
    time:2, value 5
    

    what does it mean to multiply that with anything?

    if you want to multiply each value of that dataset with getHour() you will need to create a function for that, so you would get

    time:0, value: 1*getHour()
    time:1, value: 3*getHour()
    time:2, value: 5*getHour()
    

    Or maybe you want it the other way around:

       time:0*getHour(), value: 1
        time:1*getHour(), value: 3
        time:2*getHour(), value: 5
    

    There's definitely something conceptually very wrong in what you are doing