Skip to content

print_file

Syntax

print_file("<filename>", <expr>)
print_file("<filename>", <expr>, ...,<expr>)

Parameters

<filename>
The name of the output file, surrounded by quotes.
<expr>
One or more strings (surrounded by quotes) or expressions (not surrounded by quotes) to write to a file.

Description

This action is used to print information to the specified file in the user output directory.

If the file already exists, it will be appended to.

Examples

This model prints "Hello" to a file called my_outfile_one.txt, and prints "6" to a file called my_outfile_two.txt.

simulation {
    start_date = 2020-Jan-01
    end_date = 2020-Jan-01
    locations = none
    default_model = none
}

condition Demo {
    start_state = Excluded
    meta_start_state = Finish

    state Finish {
        print_file("my_outfile_one.txt", "Hello")
        print_file("my_outfile_two.txt", 1+2+3)

        wait(0)
        default(Excluded)
    }
}

See Also