Skip to content

output (block)

Syntax

output {
    filename = "<filename>"
    trigger {
        type = interval
        value = <number_of_steps>
    }
    executor = <agent_id>
    columns {
        <column_header> = <expression>
        ...
    }
}

Description

The output block is used to generate/append to output files when a specific trigger occurs. This block cannot exist within any other blocks.

The filename field specifies the name of the output file that is generated. This file will appear in the USER_OUTPUT directory of the simulation output.

The only valid trigger type currently is interval. This trigger indicates that the information in the block is to be logged periodically at the interval specified. The value specified for the interval specifies the number of simulation steps between triggering the output.

The executor field specifies the agent ID that is to be performing the actions specified in the columns sub-block.

The columns sub-block includes one or more user-defined fields. Each field consists of a CSV header name, followed by an equals sign, followed by the expression. When the output is triggered, each of these expressions is evaluated and appended to the output file for the block under the corresponding column.

Examples

The following code will generate an output file called custom_out.csv

output {
    filename = "custom_out.csv"
    trigger {
        type = interval
        value = 5
    }
    executor = 0
    columns {
        TIME = now()
        MY_VAR = my_var + 1
        ID = id()
        MY_LIST = list(1, 2, 3)
    }
}

Depending on the simulation parameters, the output file might contain something like this:

TIME,MY_VAR,ID,MY_LIST
0.000000,24.000000,0.000000,"[1.000000,2.000000,3.000000]"
5.000000,24.000000,0.000000,"[1.000000,2.000000,3.000000]"
10.000000,24.000000,0.000000,"[1.000000,2.000000,3.000000]"
15.000000,24.000000,0.000000,"[1.000000,2.000000,3.000000]"

See Also