Cells
Icon
Additional References
- Please refer to our chapters on Basic Concepts and Entities for a clear understanding of the term Cell.
- Refer to the Entities chapter for basic modeling operations.
- For an in-depth examination of the built-in properties and behaviors of Cells, refer to the relevant detailed chapters.
- For information on interactions with other entities and Agent's motion in Cell spaces, please refer to the Interactions between Entities chapter.
- Detailed guidelines and rules for customizing Cell behaviors are available in the Processes chapter.
Key Points
Structure of Space
- Cells are the basic units that constitute space. Each cell is a square with a side length of 1.
- Cells are arranged in a rectangular grid, forming a Cell population that creates a continuous 2D plane.
- The Nominal Coordinates (built-in property
Coordinates
) of each Cell represent the center of the square, with both the x and y coordinates being integers. - A Cell individual covers the following range, x dimension:
[x - 0.5, x + 0.5)
, y dimension:[y - 0.5, y + 0.5)
. An Agent is considered to be on a Cell if its coordinates fall within these ranges. - The width of the 2D space in the x direction is calculated as
cell_entity.MaxX - cell_entity.MinX + 1
. The same formula applies for the y direction. - The absolute direction in a 2D Cell space is East 0°, North 90°.
Here is an example of a Cell space.
- The origin of the Cell space is in the lower left corner, with the maximum X and Y coordinates being 5. The distribution and coordinates of all individuals within this Cell population are illustrated below.
- The space has a width of 6 and a height of 6.
- When an Agent's coordinates are exactly
[0.5, 0.5]
, it is located within the Cell centered at[1, 1]
, not any of the other three surrounding Cells.
Wrapping of Space
- The range of Cell space is finite, but it can be set to wrap in both horizontal and vertical directions.
- When an Agent moves in a fixed direction, it will either wrap around the space or stop at the boundary. If wrapping is enabled, the Agent continues moving and re-enters from the opposite boundary. If not, the Agent stops at the boundary.
- More details about Agent's motion in Cell spaces under different wrap modes can be found in the Interactions in Cell Spaces section of the Interactions between Entities chapter.
When specifying the spatial position of an Agent through coordinates, if the input coordinates exceed the range set by the Cell, during the simulation run,
- If the Cell is set not to wrap, the system will report an error.
- If the Cell is set to wrap, there will be no error, and the system will automatically calculate it within the space coordinate range.
Distance in Space
When measuring the distance between any two points in space, it is related to whether the space itself wraps.
- When space doesn't wrap
- The spatial distance is the Euclidean distance, such as
sqrt((x_2 - x_1)^2 + (y_2 - y_1)^2)
- The spatial distance is the Euclidean distance, such as
- When space wraps
- Obviously, there are two ways to reach another point from one point in a straight line, the shorter one is the true distance between the two points.
- The related Process Steps or Functions provided by the system take into account whether the space wraps.
The system provides the following functionalities that account for whether the Cell space wraps or not. Using them properly can significantly reduce workload:
- Function
NearestDistance
returns the shortest distance between two entities/coordinates. - Function
AngleTowards
returns the absolute direction angle based on the shortest distance. - Agent and Cell built-in methods
GetNeighbors
return neighboring Agents in space,GetNeighborCells
returns neighboring Cells in space. - Move Component.
Relationship between Cells and Other components
- When the Cell component is missing from the model, all space-related logic (including Agent spatial coordinates, Move or Place At activities) will trigger runtime errors.
- For information about built-in properties and built-in behaviors that depend on Cell entities, refer to the table in the Detailed Specifications chapter.
Basic Settings for Cells
Coordinate System Settings
Origin Settings
-
You can choose a location for the origin in the Cell Population Matrix either the center of the matrix, one of the four corners (top left, bottom left, top right, bottom right), or the mid-point of any of the four edges (top, bottom, left, and right).
Maximum and minimum X and Y coordinates
-
These refer to the center coordinates of the Cell individual furthest from the origin. Since Cells are arranged in a matrix, these coordinates are integers.
-
The origin's position determines these coordinates. For instance, if the origin is at the bottom left corner, the minimum X and Y coordinates will be 0, while the maximum XY coordinates can be set as positive integers. As illustrated below, after configuration, this Cell space contains a total of 11×11 Cells, and the
Coordinate
built-in property value of the Cell in the top right corner is [11,11]. -
Other scenarios follow similarly; no need to list individually here.
-
The above values correspond to the built-in properties
MinX
,MaxX
,MinY
, andMaxY
for Cells, which can be accessed for modeling purposes.
World Wrap Settings
- You can choose whether to wrap around horizontally, vertically, or both.
- For further details about the Agent's motion in Cell spaces under various wrap modes, please refer to the Interactions between Entities chapter, specifically the Interactions in Cell Spaces section.
Observe the pattern of Agents entering and leaving the field of view; if the speed is too fast, consider running the simulation step-by-step.
Individual Properties Settings
The setting method is similar to that of Individual Properties Settings for Agents.
Example
The classic cellular automaton - John Horton Conway's Game of Life