VIPRA Documentation
|
| Main Page | How To Use | Provided Modules | VIPRA Behaviors | Module Parameters | Developing Modules |
>Document Note: Text wrapped with <
and >
, denote a placeholder value. You should not include <
and >
when writing Behaviors.*
The general layout of a Behavior
is as follows:
Each Declaration has a subset of components.
Each section goes over what components are available for each.
Example:
Type
and Select
are both components of the `Selector` declaration
This section has some simple Syntax
rules that must be followed for a Behavior
to be considered correct.
The other sections will have the specific Syntax
rules for their respective parts, in a Section - General Syntax Rules
section
.
Behavior
must start with a Types DeclarationBehavior
must only have 1 Types DeclarationBehavior
must have at least 1 SelectorBehaviors
are NOT case-sensitive so Consider
, consider
, and ConSiDEr
are all valid.Behaviors
, the following are valid and equivalent. Types
are how pedestrians are organized in Behaviors
Each pedestrian is assigned a user-defined Type
. These Types
are used to categorize the Actions pedestrians will take during the simulation.
Types
are declared in the Types Declaration
of a Behavior
.
A Types Declaration
is what says which types are being used in the Behavior
.
Behaviors
can only have 1 Types Declaration
which can include up to 64 Types
.
Types Declarations
are slightly different from other declarations, in that they do not have components; instead each type is simply listed out.
Single Type
:
Multiple Types
:
Types Declarations
can be any length up to 64 Types
Types Declarations
must be the first declaration in a Behavior
A Pedestrians Type
can be composed of several other types.
A Pedestrian with a Composite Type
will have the attributes of each individual Type
.
How to assign Composite Types
is explained in the Selectors section.
For most users, Groups
and Types
refer to the same thing.
The main difference between a Type
and a Group
is that there is a base Group
for each Behavior
, being 'Pedestrian' (or 'Pedestrians').
Each pedestrian with a Type
is considered in that Type
's Group
.
Pedestrians with Composite Types
are in a Group
for each Type
.
Type
names can only contain Letters, Underscores, and Hyphens ‘(a-z), (A-Z), ’_', '-'`Locations
are rectangular regions that can be used in Selectors
, Conditions
, and Actions
.
After being declared, Location
names are always preceded by a @
Location
Location
Example:
Location
names are always preceded by a @
after the declarationSelectors
are how pedestrians are selected for a certain Type.
Selecting pedestrians is done through a Selector
declaration. The basic syntax is as follows:
Select
criteria to use. Available Select
criteria are listed under Available Select Criteria.Selectors are applied with precedence equal to the order they appear in the Behavior
file.
Example:
Selectors
can select from specific Groups
This has the effect of selecting the pedestrians for a Composite Type but allows for more dynamic proportions. This allows for refined selections within selections.
With 100 pedestrians:
When a pedestrian is selected from a Group
, it is marked as used and can not be selected by another Selector
.
Means: Those 15% of 'typeA' pedestrians that also are typeB can not be selected from again. Any selections for typeD in the above scenario will never also be typeB.
However, they can be selected from 'typeB'.
TODO(tyler): What happens if those values exceed 100%?
This may result in some pedestrians being of types typeA, typeB, and typeC.
TODO(tyler): What happens if we want some overlap?
Selectors
can be marked as Required
with a 'Required' Component
.
This means, if the Selector
is unable to be filled an error will be thrown, and the simulation will stop.
Output:
This select criteria will select every pedestrian to have the selected Type
Selects a percentage of a Group
for the provided Type
<value> - Number Value (1 - 100)
Example:
Selects an exact number of pedestrians from a Group
.
<value> - Number Value
Example:
Selects all pedestrians inside a given location.
<location> - Name of Location
Example:
Actions
are what affect a Pedestrian's position, velocity, state, etc.
Actions
work by applying attribute modifiers known as Atoms each time step their Condition
is satisfied.
An Unconditional Action
will ALWAYS take effect, applying its Atoms
each timestep.
Action
Example:
With this Behavior, an injured person will always walk at 75% speed.
A Conditional Action
will only take effect if its Condition
is satisfied.
Conditional Actions
are written as follows:
Action
. See Types.Example:
Pedestrians of listener will stop moving while the announcement event is occurring.
Normally Actions
only apply to the time step their Condition
is true in.
If a longer response is needed, a Duration
can be added to the Action
.
Action
Example, Someone Tripping:
Pedestrians of type tripper
will trip after 10 seconds from the simulation starting, and remain still for 15 seconds.
This will cause all trippers
to trip at exactly the same time. Normally, randomness should be added to a scenario such as this. For more information on how to add randomness to Duration
and Conditions
, see Random Values.
Atoms
are the part of an Action
that actually affects a pedestrian.
The do this by changing pedestrian Attributes.
See Available Atoms for the list of available Atoms
.
An Atom List
is the collection of Atoms
that make up an Action
.
Atom Lists
are written as follows: <atom> , <atom>
Important Note: Atom
effects are applied in the order they are listed
Example:
This Atom List
will result in the pedestrian stopping and their state being set to "listening"
(Pedestrian state is useful in Conditions)
There are two types of available Atoms
:
The Set Atom
sets a pedestrian's attribute to a specific value.
The Scale Atom
multiplies a pedestrian attribute by a given value
Currently, only pedestrian Velocity
can be scaled.
Sometimes Pedestrians will want to affect other pedestrians around them.
This is done through the use of Targets
.
Example:
This results in the pedestrian stopping the nearest pedestrian around them.
There is currently only one type of action Target
, the "nearest" Target
. This Target
describes proximity to a pedestrian as part of an Action
.
Selects the nearest of a given type to be the target
Target Modifiers
change how pedestrians are selected to be the Target of an action.
Target Modifiers
are simply appended to the end of the Action Target
.
Example:
This selects the nearest pedestrian in the direction of motion that is within 1 meter.
Targets can be filtered by their distance to the pedestrian.
Targets can be filtered by their direction from the pedestrian.
Currently, there are only two directions.
Targets can be filtered by whether they are inside a Location
or not.
A Condition
is what decides if a Conditional Action
or Event
occurs.
Conditions
are comprised of one or more Sub Conditions
and the boolean operations between them (and/or).
Conditions
do not stand on their own, and only appear as part of an Action
or Event
declaration.
Example:
This results in typeA pedestrians stopping for 10 seconds after the example event has occurred but not before 5 seconds have passed in the simulation.
A Sub Condition
defines a single condition of the state of the simulation in which it returns true.
See Available Sub Conditions
There are currently 6 total available sub conditions:
This Condition
will be true when a provided amount of time has passed from the start of an Event
Note: This is true only for one time step when the time has elapsed, until the Event
starts again.
Example:
Note: without the Duration
the pedestrian would stop moving for only one time step. See Duration.
This Condition
will be true when the condition Target is within a certain distance
Example:
Note: without the Duration
the pedestrian would stop moving for only one time step. See Duration.
This Condition
checks for the status of an Event.
Example:
This Condition
checks if a pedestrian has entered or left a Location.
Example:
This Condition
checks if a pedestrian is inside a Location.
Example:
This Condition
checks if a pedestrian's Attribute is a given Attribute Value.
Example:
Each pedestrian has what are called Attributes
.
These attributes include:
These Attributes
are important for Actions
and Conditions
.
Attributes each have a different value type.
Generally, Attribute Values
can only be compared to others of the same type, except Coordinate
values.
Coordinate
values can be compared with Locations
.
Example
An Event
is something that occurs during a simulation, that effects the whole simulation. For example, an announcement or fire could be an Event
.
Events
have a start Condition
and, optionally, an end Condition
An Event
can only be described once, if a Behavior
file tries to redefine an Event
of the same name a Behavior Error
is thrown.
Event
names are always preceded by a !
Example:
Events
a defined as follows:
Example:
Currently, there is only one special event that is predefined for each Behavior
: !Start
.
The !Start
event fires at the start of a simulation run and is always Occurring
.
Event
names are always preceded by a !
when used.
Behaviors
support 3 types of values:
Anywhere there is a numerical value required the following can be used (with some exceptions):
Exact Values
are used when the value should be a specific value
There are two kinds of Exact Values
:
Float Values
Number Values
Float Values
have decimal precision, while Number Values
are only integers.
Exact Values
are written as simple numerical values.
Example:
Range Values
are singular random values within a given range.
When the Behavior
is run, the value is the same for every individual using that Value
.
Range Values
are either Float Value Ranges
or Number Value Ranges
With the difference being that: Float Value Ranges
are any real value between the range and Number Value Ranges
are any integer value between the range.
Range Values
are written as follows:
Example:
The exact percentage will be a random integer value between 10 and 20.
Random Values
are very similar to Range Values
, with a random value in a given range.
The big difference is that: Range Values
only have one random value, Random Values
have a random value that is different for each pedestrian.
Random Values
are either Float Random Values
or Number Random Values
With the difference being that: Float Random Value
are any real value between the range and Number Random Values
are any integer value between the range.
Random Values are written as follows:
Example:
Each typeA pedestrian will stop randomly between 5 and 10 seconds after the start, then stay still for a random amount of time between 10 and 20 seconds.
Coordinate Values are X, Y, Z coordinates.
They are written:
The Y and Z coordinates are optional. When not specified, these coordinates are considered 0.
Example:
Each pedestrian can have a single State
associated with it. When a new state is set, it overrides the previous state.
States
are user defined, and used for Conditions
States
are always preceded by a '#' when used, but are excluded in the definition.
States
are defined as follows:
Example: