jupedsim.simulation
#
Module Contents#
- class Simulation(*, model: jupedsim.models.CollisionFreeSpeedModel | jupedsim.models.GeneralizedCentrifugalForceModel, geometry: str | shapely.GeometryCollection | shapely.Polygon | shapely.MultiPolygon | shapely.MultiPoint | list[tuple[float, float]], dt: float = 0.01, trajectory_writer: jupedsim.serialization.TrajectoryWriter | None = None, **kwargs: Any)[source]#
Defines a simulation of pedestrian movement over a continuous walkable area.
Movement of agents is described with Journeys, Stages and Transitions. Agents can be added and removed at will. The simulation processes one step at a time. No automatic stop condition exists. You can simulate multiple disconnected walkable areas by instantiating multiple instances of simulation.
Creates a Simulation.
- Parameters:
model (CollisionFreeSpeedModel | GeneralizedCentrifugalForceModel) – Defines the operational model used in the simulation.
geometry (str | shapely.GeometryCollection | shapely.Polygon | shapely.MultiPolygon | shapely.MultiPoint | list[tuple[float, float]]) –
Data to create the geometry out of. Data may be supplied as:
list of 2d points describing the outer boundary, holes may be added with use of excluded_areas kw-argument
GeometryCollection
consisting only out ofPolygons
,MultiPolygons
andMultiPoints
MultiPoint
forming a “simple” polygon when points are interpreted as linear ring without repetition of the start/end point.str with a valid Well Known Text. In this format the same WKT types as mentioned for the shapely types are supported: GEOMETRYCOLLETION, MULTIPOLYGON, POLYGON, MULTIPOINT. The same restrictions as mentioned for the shapely types apply.
dt (float) – Iteration step size in seconds. It is recommended to leave this at its default value.
trajectory_writer (jupedsim.serialization.TrajectoryWriter | None) – Any object implementing the TrajectoryWriter interface. JuPedSim provides a writer that outputs trajectory data in a sqlite database. If you want other formats such as CSV you need to provide your own custom implementation.
kwargs (Any) –
- Keyword Arguments:
excluded_areas – describes exclusions from the walkable area. Only use this argument if geometry was provided as list[tuple[float, float]].
- add_waypoint_stage(position: tuple[float, float], distance) int [source]#
Add a new waypoint stage to this simulation.
- add_queue_stage(positions: list[tuple[float, float]]) int [source]#
Add a new queue state to this simulation.
- add_exit_stage(polygon: str | shapely.GeometryCollection | shapely.Polygon | shapely.MultiPolygon | shapely.MultiPoint | list[tuple[float, float]]) int [source]#
Add an exit stage to the simulation.
- Parameters:
polygon (str | shapely.GeometryCollection | shapely.Polygon | shapely.MultiPolygon | shapely.MultiPoint | list[tuple[float, float]]) –
Polygon without holes representing the exit stage. Polygon can be passed as:
list of 2d points describing the outer boundary
GeometryCollection
consisting only out ofPolygons
,MultiPolygons
andMultiPoints
MultiPoint
forming a “simple” polygon when points are interpreted as linear ring without repetition of the start/end point.str with a valid Well Known Text. In this format the same WKT types as mentioned for the shapely types are supported: GEOMETRYCOLLETION, MULTIPOLYGON, POLYGON, MULTIPOINT. The same restrictions as mentioned for the shapely types apply.
- Returns:
Id of the added exit stage.
- Return type:
- add_journey(journey: jupedsim.journey.JourneyDescription) int [source]#
- Parameters:
journey (jupedsim.journey.JourneyDescription) –
- Return type:
- add_agent(parameters: jupedsim.models.GeneralizedCentrifugalForceModelAgentParameters | jupedsim.models.CollisionFreeSpeedModelAgentParameters) int [source]#
- Parameters:
parameters (jupedsim.models.GeneralizedCentrifugalForceModelAgentParameters | jupedsim.models.CollisionFreeSpeedModelAgentParameters) –
- Return type:
- mark_agent_for_removal(agent_id: int) bool [source]#
Marks an agent for removal.
Marks the given agent for removal in the simulation. The agent will be removed from the simulation in the start of the next
iterate()
call. The removal will take place before any interaction between agents will be computed.
- agents() Iterable[jupedsim.agent.Agent] [source]#
- Return type:
Iterable[jupedsim.agent.Agent]
- agent(agent_id) jupedsim.agent.Agent [source]#
- Return type:
- agents_in_polygon(poly: str | shapely.GeometryCollection | shapely.Polygon | shapely.MultiPolygon | shapely.MultiPoint | list[tuple[float, float]]) list[jupedsim.agent.Agent] [source]#
Return all agents inside the given polygon.
- Parameters:
poly (str | shapely.GeometryCollection | shapely.Polygon | shapely.MultiPolygon | shapely.MultiPoint | list[tuple[float, float]]) –
Polygon without holes in which to check for pedestrians. Polygon can be passed as:
list of 2d points describing the outer boundary
GeometryCollection
consisting only out ofPolygons
,MultiPolygons
andMultiPoints
MultiPoint
forming a “simple” polygon when points are interpreted as linear ring without repetition of the start/end point.str with a valid Well Known Text. In this format the same WKT types as mentioned for the shapely types are supported: GEOMETRYCOLLETION, MULTIPOLYGON, POLYGON, MULTIPOINT. The same restrictions as mentioned for the shapely types apply.
- Returns:
All agents inside given polygon.
- Return type:
- get_last_trace() jupedsim.tracing.Trace [source]#
- Return type:
- get_geometry() jupedsim.geometry.Geometry [source]#
- Return type: