Split


For each incoming agent ("original") creates one or several other agents and outputs them via outCopy port. A new agent created may have a meaning of a copy, a sibling, etc. and can be of arbitrary type. It is your responsibility to set the properties of the new agents (maybe to copy some properties of the original). The number of new agents can be changed dynamically.

The whole operation takes zero model time.

There are two "extension points" where you can setup a new agent: its construction code (parameter New agent (copy)) and On exit (copy) code. In both places you can access the original agent as original and the index of the new agent as index. In case you wish to mark the relation between the original agent and the new ones, you can have a custom field (e.g. id) and assign the id of the original to the new agents. If later on you wish the siblings/copies to join the original, you can use that id as the criteria. The actual "reunion" may be implemented using one or several Match blocks or by a custom code. In the simplest case when there is just one copy per original and the order of them is not changed in their flows, you can use Combine block to compose one agent from two.

Parameters

Number of copies [dynamic]
The number of new agents to be created for the current original agent.
Value type: int
Local variable: agent - the original agent
New agent (copy) [dynamic]
New agent type (or expression returning the type of the new agent (copy)) created by this block. Referred below as TCopy.
Local variables: T original - the original agent
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
Change dimensions [dynamic]
If the option is selected (true), you will be able to change the dimensions of the agent created by this block specifying the new Length, Width and Height values below.
Type of value: boolean
Local variables: TCopy agent - the new agent
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
T original - the original agent
Length [dynamic]
[Visible if the Change dimensions option is selected] The new length of the created agent.
Type of value: double
Local variables: TCopy agent - the new agent
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
T original - the original agent
Width [dynamic]
[Visible if the Change dimensions option is selected] The new width of the created agent.
Type of value: double
Local variables: TCopy agent - the new agent
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
T original - the original agent
Height [dynamic]
[Visible if the Change dimensions option is selected] The new height of the created agent.
Type of value: double
Local variables: TCopy agent - the new agent
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
T original - the original agent
Location of copy
Defines the place where the new agent (copy) will be placed. There are six alternative options:
Not specified - You do not specify the location for created copies.
Network / GIS node - New agents (copies) are placed in the given network node, GIS point, or GIS region.
Attractor - New agents (copies) are placed in the specified attractor.
(x, y, z) - Copies are placed in the point with the specified coordinates X, Y, Z.
(latitude, longitude) - Copies are placed in the given point on the GIS map with the specified Latitude and Longitude.
Geographic place - Copies are placed in the particular location on the GIS map. You define this place using the Name of place parameter below.
Get value: locationType
Valid values: Split.LOCATION_NOT_SPECIFIED, Split.LOCATION_NODE, Split.LOCATION_ATTRACTOR, Split.LOCATION_XYZ, Split.LOCATION_LATLON, Split.LOCATION_GEO_PLACE
Node [dynamic]
[Visible ifLocation of copy isNetwork / GIS node] Network node, GIS point, or GIS region where the agents created by this block are put.
Value type: Node
Local variables: TCopy agent - the copy agent created at this block
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
Attractor [dynamic]
[Visible if Location of copy isAttractor] Attractor where the agents created by this block are put.
Value type: Attractor
Local variables: TCopy agent - the copy agent created at this block
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
X, Y, Z [dynamic]
[Visible if Location of copy is(x, y, z)] X,Y,Z coordinates of the point where the agents will be put.
Type of value: double
Local variables: TCopy agent - the copy agent created at this block
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
... located in [dynamic]
[Visible and applies only if the Location of copy option is set to (x, y, z)] Specifies where the agents created by this block will be added to: either Level or Network.
Type of value: boolean destinationInNetwork
Default value: false
Level [dynamic]
[Visible and applies only if the ...located in Level option is selected] The level the agent created by this block will be added to.
Type of value: Level
Local variables: TCopy agent - the copy agent created by this block
Network [dynamic]
[Visible and applies only if the ...located in Network option is selected] The network the agent created by this block will be added to.
Type of value: INetwork
Local variables: TCopy agent - the copy agent created by this block
Latitude, Longitude [dynamic]
[Visible if Location of copy is(latitude, longitude)] Latitude and longitude of the point on the GIS map where the new agents (copies) will be placed.
Type of value: double
Local variables: TCopy agent - the copy agent created at this block
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
Name of place [dynamic]
[Visible if Location of copy isGeographic place] The name of the particular location on the GIS map, where the new agents (copies) are placed. You specify the name as text put in quotes, e.g. "London". GIS map will search for a location with such name. The first location from the list of GIS search results will be used.
Type of value: String
Local variables: TCopy agent - the copy agent created at this block
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
Speed [dynamic]
[Visible if Location of copy isspecified] The speed of the new agents (copies) generated by the block.
Value type: double
Default value: 10 m/s
Local variables: TCopy agent - the copy agent created at this block
int indexCopy - the index of the new agent (among others created for the current original, is 0 if one new agent per original is created)
Advanced
Add copies to
Here you specify where the agents created by this block will be stored: in the default population of root agent, or in some custom population (specified below in the Population property).
Syntax: boolean addToCustomPopulation
Population [dynamic]
[Visible if Add copies to: custom population] The name of the agent population where the agents created by this block will be stored.
Value type: AgentList
Local variables: TCopy agent - the new agent
int indexCopy - the index of the new agent (see above)
T original - the original agent
Actions
On enter [code]
Code executed when the original agent enters the block.
Local variable: agent - the agent.
On exit copy [code]
Code executed for each new agent when it exits the block.
Local variables: TCopy agent - the new agent
int indexCopy - the index of the new agent (see above)
T original - the original agent
On exit original [code]
Code executed when the original agent exits the block.
Local variable: agent - the original agent

Ports

in
The input port.
out
The output port for the original agents.
outCopy
The output port for the new agents created by the block.