Skip to content

condition

Syntax

condition <condition_name> {

    # INITIAL STATES
    start_state = <state_name>
    meta_start_state = <state_name>
    group_start_state = <state_name>

    # TRANSMISSION PROPERTIES
    transmission_mode = <transmission_mode>
    transmissibility = <transmissibility_value>
    exposed_state = <exposed_state>
    transmission_network_name = <transmission_network_name>

    # OUTPUT PROPERTIES
    output = <value>

    # STATES
    ...
    <states>
    ...
}

Description

Declares a condition block. A "condition block" defines a condition to track within the population. Conditions may represent diseases, behaviors, beliefs, or any other aspect of the population of interest to the modeler. A FRED program may include any number of conditions. The set of properties for conditions is shown in the synopsis. Each property has a default value as shown.

It is an error for two separate conditions to have the same name.

Examples

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

network my_network {
    is_directed = 1
}

condition TestCondition {
    start_state = Excluded
    meta_start_state = MetaStart

    state MetaStart {
        add_edge(my_network, 1, 2)
        print("Expect 1 == ", has_edge_from(my_network, 1, 2))
        print("Expect 0 == ", has_edge_from(my_network, 2, 1))

        add_edge(my_network, 2, 1)
        print("Expect 1 == ", has_edge_from(my_network, 1, 2))
        print("Expect 1 == ", has_edge_from(my_network, 2, 1))

        delete_edge(my_network, 1, 2)
        print("Expect 0 == ", has_edge_from(my_network, 1, 2))
        print("Expect 1 == ", has_edge_from(my_network, 2, 1))

        wait(0)
        default(Excluded)
    }
}

See Also