is_group_open()
Determines whether a group is open.
Synopsis
is_group_open()
Description
This action must be called by a group agent. It checks whether the group associated with a group agent is open at the current simulation step.
Returns
Returns \(1\) (true
) if the group associated with the group_agent
caller is open; and \(0\) (false
) otherwise.
Examples
simulation {
start_date = 2020-Jan-01
end_date = 2020-Jan-01
locations = none
default_model = none
}
place my_place {
has_group_agent = 1
site = 0, 0, 0, 0
}
startup {
add_to_schedule(my_place,Everyday,2am,0,11pm,0)
}
condition TestCondition {
group_start_state = GroupAgentStateA
start_state = Excluded
state GroupAgentStateA {
if (is_group_open()) then print("my_place is open at step ", now)
if (not(is_group_open())) then print("my_place is closed at step ", now)
wait(3)
next(GroupAgentStateB)
}
state GroupAgentStateB {
if (is_group_open()) then print("my_place is open at step ", now)
if (not(is_group_open())) then print("my_place is closed at step ", now)
wait(0)
next(Excluded)
}
}
Executing the above results in the following output:
my_place is closed at step 0
my_place is open at step 3
See Also
add_to_schedule() is_group_agent() remove_from_schedule() reset_schedule()