get_role()
The role id of the agent within a given group
Synopsis
get_role(<group-name>)
Description
Returns the role id of the agent in the given group.
If the agent is not a member of any group of the given type, the
function returns -1
.
The names of the roles are defined in the file role_metadata.txt
in
the synthetic population metadata
directory. The roles defined in
the default synthetic popluation are:
GROUP,ROLE_0,ROLE_1
Household,child,adult
School,student,teacher
Grade,student,teacher
Workplace,worker,manager
Prison,resident,staff
Nursing_Home,resident,staff
College_Dorm,resident,resident
Barracks,resident,resident
State,resident,resident
County,resident,resident
Census_Tract,resident,resident
Block_Group,resident,resident
Parameters
<group-name>
The name of a declared group.
Errors
A compile-time error occurs if the named group is not declared in the model.
Examples
if (get_role(School) == teacher) then print("agent ", id, " is a teacher in school ", School)