A statistical and analytical method for building pedestrian simulation
Through the construction pedestrian simulation system combining BIM modeling, Markov decision-making process and DWA obstacle avoidance algorithm, the existing system has solved the problem of insufficient statistical analysis and data visualization, and achieved pedestrian flow efficiency assessment and bottleneck area identification, improving the evacuation efficiency and the accuracy of simulation results.
Patent Information
- Application Number
- CN202510789078.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2045-06-13
AI Technical Summary
The existing pedestrian simulation system has shortcomings in statistical analysis, data visualization, and the distinction between emergencies and normal situations. It is unable to effectively evaluate pedestrian mobility efficiency and bottleneck areas, and it is unable to display key information in real time, resulting in the simulation results that cannot fully reflect the actual use of the building.
The simulation statistics and analysis method of building pedestrians is used, and the modeling is carried out through BIM or CAD, combining Markov decision-making process, DWA obstacle avoidance algorithm and KD tree management obstacle management, pedestrian paths are visualized in real time, and thermal maps and time series maps are generated using Python and Tableau, and congested areas are identified and the facility layout is optimized.
In-depth statistical analysis and data visualization of pedestrian behavior are realized, and can quickly adapt to environmental changes, provide pedestrians with immediate optimal evacuation routes, improve evacuation efficiency, identify and alleviate potential bottleneck areas, and provide scientific basis for improvement in safety design.
Smart Images

Figure CN120336888B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of simulation technology, and in particular to a building pedestrian simulation statistics and analysis method. Background Art
[0002] Pedestrian simulation is primarily used in two areas: pedestrian evacuation within a space and the layout and evaluation of facilities within that space. In pedestrian evacuation simulation, pedestrians are generally assumed to be a single activity, moving from their current location to their destination. Pedestrians' initial positions are randomly generated based on the basic conditions within the space, and during their movement, they either move forward or are blocked. In contrast, in spatial facility simulation, pedestrians are assumed to have multiple activities, exiting the simulation space after completing all of them. Pedestrians are not generated all at once, but rather enter the simulation space gradually from a gathering point based on the simulation clock. The purpose and underlying assumptions of pedestrian simulation vary depending on the application area. In pedestrian evacuation simulation, pedestrians are assumed to already exist at the start of the simulation, have static path plans, are unable to self-regulate their time and speed, and are considered homogeneous and rational individuals, without considering the propagation of crowding forces. In spatial facility pedestrian simulation, pedestrian activity sequences are often set, resulting in pedestrians having static path planning, certain facility selection preferences, and being considered rational. The propagation of crowding forces is also not considered.
[0003] The existing pedestrian simulation system still has the following shortcomings:
[0004] 1) Insufficient statistical analysis: Existing systems lack in-depth statistical analysis of pedestrian behavior during pedestrian simulation and are unable to effectively evaluate the efficiency and bottleneck areas of pedestrian flow.
[0005] 2) Insufficient data visualization: The existing system is relatively weak in data visualization and cannot display key information such as pedestrian density and flow paths in real time, making it difficult for decision makers to intuitively understand the simulation results.
[0006] 3) Insufficient distinction between normal and emergency situations: The existing system lacks clear distinction and logical connection in the simulation process of normal pedestrian circulation and emergency evacuation, resulting in the simulation results being unable to fully reflect the actual use of the building. Summary of the Invention
[0007] The purpose of this invention is to provide a building pedestrian simulation statistics and analysis method, which provides a comprehensive pedestrian behavior assessment and optimization solution through normal pedestrian circulation simulation and emergency evacuation simulation, combined with statistical analysis, data visualization and optimization algorithm.
[0008] To achieve the above objectives, the present invention provides a building pedestrian simulation statistics and analysis method, comprising the following steps:
[0009] S1. Analyze system requirements, clarify simulation objectives, evaluate the building's safe evacuation capacity and optimize daily pedestrian flow lines, use BIM software or CAD software for modeling, and collect specific building information;
[0010] S2. Establishment of environment and agent model: constructing an accurate three-dimensional building environment model, including static and dynamic elements, and defining the agent's state space, action space and reward function;
[0011] S3, Normal Pedestrian Circulation Simulation: The agent selects a path based on a Markov decision process, collects data in real time, evaluates the rationality of facility layout based on the path deviation rate, and uses ScottPlot to visualize one-dimensional, two-dimensional, and three-dimensional charts in real time;
[0012] S4, Emergency Evacuation Simulation: When an emergency event is triggered, the Agent's goal switches to escape, and the collaborative rescue rules are activated. The algorithm pre-calculates the shortest path to the safe exit, combines it with DWA for real-time obstacle avoidance, manages obstacles through a KD tree to update the path set, uses a reward function to guide agent behavior, uses 3D trajectory playback to annotate congestion points and rescue events, and generates charts to quantitatively evaluate exit utilization and collaborative efficiency.
[0013] S5. Multi-modal comparison and optimization: Comparing normal and emergency data, using Python's Matplotlib and Tableau to generate heat maps and time series graphs, combined with DBSCAN clustering algorithm analysis, to identify building design flaws and high-frequency congestion areas, and propose targeted layout optimization solutions;
[0014] S6. Iterative Verification: Based on the feedback from the simulation results, adjust the agent behavior parameters or the environmental model and re-simulate; set the thresholds of key indicators and continue to iterate until the ideal evacuation efficiency and pedestrian circulation effect are met.
[0015] Preferably, in step S1, the specific information of the building includes floor plan, entrance and exit locations, stair width, and fire protection facilities;
[0016] Use this data to calculate accessibility indicators for each area of the building , the formula is:
[0017] ;
[0018] in, is the shortest path distance from area i to other areas j, and n is the number of areas connected to area i. The accessibility index is used to measure the convenience of personnel flow between different areas in a building. The larger the value, the closer the connection between the area and other areas, and the more convenient the flow of people.
[0019] Preferably, in step S2, agent attributes and state space are defined, where the agent attributes include speed, perception radius, and behavior target; different types of pedestrians are represented as adults, children, and the elderly, and pedestrian distribution characteristics include speed, reaction time, and perception range; and the state space, action space, and reward function of the agent motion model are defined at the same time;
[0020] The state space of the Agent motion model defines the position state, velocity state and behavior state in the simulation environment;
[0021] Location Status
[0022] Using three-dimensional coordinates It represents the specific position of the agent in the three-dimensional space of the building, and its change over time reflects the movement trajectory of the agent;
[0023] Speed status
[0024] Described by the velocity vector, Represents the speed and direction of the Agent in each direction;
[0025] Behavioral state
[0026] Set the Agent to have three basic behavior states including walking, waiting and running, and use a state variable S To represent the behavior state of the Agent, ;
[0027] The behavioral operations taken in the action space of the Agent motion model include movement and steering behaviors, as shown below:
[0028] The forward step length is , according to the speed state and time interval Calculate the new position, expressed as:
[0029] ;
[0030] in, is the old location of Agent, is the new position after taking the move action;
[0031] The total reward function of the agent: ;
[0032] Location-related rewards R location: It is used to reflect the proximity between the agent and the target position or the safe exit. The reward for being close to the target is the inverse of the distance. Assuming that the target position of the agent is , whose current location is , the reward expression for approaching the target is
[0033] ;
[0034] in θ is a very small constant to avoid the denominator being zero; by adding θ , ensuring that the denominator is always greater than 0, making the reward function mathematically valid. As the agent approaches the target, the distance decreases and the reward value increases; when it reaches the target, the reward value approaches , then trigger the "reach safe exit reward ”.
[0035] When the agent successfully reaches the safe exit, a large positive reward is given R exit, which is the reward for reaching the safe exit;
[0036] Path length reward R path : Used to measure the efficiency of the Agent's moving path;
[0037] The agent completes a move and calculates the actual path length it has traveled. L actual Theoretical shortest path length L optimal The ratio of , its path length reward is defined as ,in is a ratio coefficient, α = L optimal / L actual ;
[0038] If the Agent's path is close to the theoretical shortest path, α Close to 1, R path Relatively small; if the agent takes many detours, α Larger, R path will be smaller or negative;
[0039] Synergy Rewards R cooperate : reflects the collaboration between agents;
[0040] Assume that the number of other agents that an agent helps is , then the expression of collaborative reward is ,in is a coefficient;
[0041] The more it is, the higher the collaborative reward is, which encourages agents to assist each other;
[0042] is the weight of the reward function.
[0043] Preferably, in step S3, the following steps are specifically included:
[0044] S31, Behavioral Rule Management: The agent selects a path based on the Markov decision process. In the normal simulation, the agent dynamically selects a path based on the preset goal and optimizes the behavior through the Markov decision process.
[0045] Assume that the agent is in state s Take action After transfer to state s' The probability of , instant rewards , then the long-term cumulative reward of the Agent is for
[0046] ;
[0047] in, is a discount factor with a value range of (0, 1), which is used to measure the importance of future rewards. The agent selects the optimal action strategy by maximizing the long-term cumulative reward; is the state at time t+k (the agent's position, speed, behavior, etc. in the building); The action taken at time t+k (movement, turn, etc.); The state at time t+k+1 (execute action The new state after
[0048] Long-term cumulative rewards It is the discounted sum of the agent's rewards at all future moments starting from time t. Discount factor Used to measure the importance of future rewards. The closer it is to 0, the more the agent pays attention to immediate rewards, and the closer it is to 1, the more it pays attention to long-term rewards.
[0049] S32, real-time data collection: record regional traffic, stay time, path deviation rate The system calculates the pedestrian flow and average stay time of each area in real time, and combines the path deviation rate Assess the rationality of facility layout;
[0050] Calculation area rIn the time period [ t 1 , t 2 Pedestrian flow within F r The formula is:
[0051] ;
[0052] in, N r In the time period [ t 1 , t 2 ]Enter the area r The number of agents;
[0053] Computing Agent in the area r Average length of stay in T r The formula is:
[0054] ;
[0055] in, It is Agents in the area r The duration of stay within
[0056] S33. Visual analysis: Display crowd density through heat maps and generate facility utilization reports;
[0057] The obtained one-dimensional, two-dimensional and three-dimensional charts are displayed in real time through ScottPlot. The content of the one-dimensional data is determined based on the queried information, and the number of agents passing through each observation point within a period of time is recorded. In the two-dimensional chart, the floor plan of a building is divided into Small squares are formed, and the density of agents in each square is calculated to generate a heat map to show the density of pedestrian flow. In the three-dimensional chart, the building is divided into multiple three-dimensional small cube units, and the density of agents in each unit is calculated.
[0058] At the same time, ScottPlot generates real-time heat maps to reflect regional density and calculate the average speed of pedestrians and path deviation index. and facility utilization;
[0059] For high-frequency stay areas, record them as potential congestion points for reference in building layout optimization and calculate the two-dimensional grid Pedestrian density within , whose expression is
[0060] ;
[0061] in, For square The number of agents in For square area;
[0062] Calculating 3D cells Pedestrian density within , whose expression is
[0063] ;
[0064] in, It is a unit The number of agents in It is a unit volume.
[0065] Preferably, in step S3, the calculation formula of the path deviation rate is: , and combined with the heat map to mark the area with deviation rate > 1.5 as the optimization focus.
[0066] Preferably, in step S4, the following steps are specifically included:
[0067] S41, event triggering mechanism: switch the Agent's goal to escape and activate the collaborative rescue rules. When an emergency event is triggered, the system switches the Agent's goal from normal activity to escape through the event response module and activates the collaborative rescue reward mechanism;
[0068] S42, Dynamic Path Planning: Pre-calculate the shortest feasible path based on the A algorithm and combine it with DWA for real-time obstacle avoidance. The details are as follows:
[0069] based on A The algorithm pre-calculates the shortest feasible path from each agent to the safe exit and dynamically updates the path length , Agent selection The smallest exit is the target, and the obstacle position is queried through the real-time KD tree. The dynamic window method (DWA) is used for local obstacle avoidance to ensure the feasibility of the path.
[0070] The obstacle positions are managed based on the KD tree, and the feasible path set is updated in real time. The reward function is used to guide the agent behavior, which is expressed as follows:
[0071] ;
[0072] in, is the total reward value; R location For location-related rewards, R path is the path length reward,R speed Speed-related rewards are used to punish speed reduction caused by obstacle avoidance or detour;
[0073] In algorithm A, a KD tree is constructed and data points are inserted. The KD tree is used to process information about various objects in the environment. The position coordinates of the rescue agent, the agent to be rescued, other normally walking agents, and static obstacles are inserted into the KD tree as data points.
[0074] Initialize the parameters related to the A algorithm and define a node class to represent the nodes in the path planning. Each node contains the position coordinates ( ), father point, initialization g Point is 0, where g The value is the actual cost from the rescue agent position to the current node, and the h value represents the heuristic estimate from the current node to the position of the agent to be rescued. ) and the coordinates of the Agent to be rescued ( ), calculated using the Euclidean distance formula, the specific expression is:
[0075] ;
[0076] The value is , used to evaluate the priority of the node, The smaller the value, the higher the priority of the node; and create an open list and a closed list. The open list is used to store the nodes to be expanded. Initially, the node corresponding to the rescue agent position is added to the open list and its Value, the closed list is used to store the nodes that have been expanded, and is initially empty;
[0077] The main loop of the algorithm, after entering the loop, as long as the open list is not empty, the following operations are performed: take out the current node; determine whether the target is reached; update the neighbor node information; add the current node to the closed list;
[0078] In DWA, Agent selects The smallest exit and adjust the real-time movement direction through DWA, the formula is:
[0079] ;
[0080] in, The speed adjustment is used to control the speed of the agent or the magnitude of the change in direction. is the obstacle distance, is the deceleration coefficient (determines the intensity of speed change during obstacle avoidance, usually a negative number, indicating deceleration); is the safety distance threshold, which indicates the minimum safe distance between the agent and obstacles or other pedestrians;
[0081] During the movement, the rescue agent continuously queries the neighbor information within the range of the perception radius through the KD tree. The perception radius is , to determine whether there are obstacles or other pedestrians approaching, if the distance detected to other objects is less than the safety distance threshold When the vehicle is moving, adjust the speed or change the walking direction according to this formula to avoid collision;
[0082] S43. Data Evaluation: Calculate evacuation time, bottleneck overlap, and mark congestion points in 3D trajectory playback. Run evacuation simulations to collect data on evacuation time, congestion levels, and escape path effectiveness. Using 3D trajectory playback technology, mark bottleneck areas and rescue events, and simultaneously generate evacuation time distribution histograms and path overlap matrices to quantitatively evaluate exit utilization and coordination efficiency.
[0083] Calculating evacuation time The time difference from the emergency event triggering to the time when all agents arrive at the safe exit. Calculate the bottleneck area overlap rate O The formula is
[0084] ;
[0085] Where m is the number of all possible bottleneck areas, It is in the bottleneck area i The number of times people are jammed and overlapped, The agent passes through the bottleneck area i The total number of times.
[0086] Preferably, The main loop of the algorithm, after entering the loop, as long as the open list is not empty, the following operations are performed:
[0087] Remove the current node: remove it from the open list The node with the smallest value is used as the current node, and the position coordinates of the current node are checked to see if they are equal to the position coordinates of the agent to be rescued.
[0088] Determine whether the target has been reached: If they are equal, it means that the target node has been found. At this time, the complete path from the rescue agent to the agent to be rescued is constructed by backtracking the parent node, and then the path planning process ends; if they are not equal, the current node is expanded and the neighboring nodes within the perception radius around the current node are searched through the KD tree;
[0089] Update neighbor node information: For each queried neighbor node, calculate the new path from the rescue agent through the current node to the neighbor node.g Value, assuming the current node g The value is g current , the cost of moving from the current node to the neighboring node is cost move , then new g value g new =g current +cost move ; Recalculate the new neighbor nodes value The method is the same as that of initialization. The Euclidean distance formula is used to calculate the position coordinates of the neighboring nodes and the position coordinates of the agent to be rescued;
[0090] Calculate new The value is If the neighbor node is not in the open list or the closed list, add it to the open list and set its Value; if the neighbor node is already in the open list, and g new < g old , then update the node in the open list value;
[0091] Add the current node to the closed list: Adding the current node to the closed list means that it has been expanded and will not be expanded again in the future.
[0092] Preferably, in step S5, normal and emergency data are compared to identify design defects and propose layout optimization solutions; the simulation results are analyzed, and a heat map is generated using Python Matplotlib and Tableau to display the normal flow distribution. The changes in key indicators before and after evacuation are compared through time series graphs, and clustering algorithms are combined to identify high-frequency congestion areas. Improvement measures are proposed for problem points to provide a basis for decision-making;
[0093] The DBSCAN clustering algorithm is used to perform cluster analysis on pedestrian trajectory data in normal and emergency modes to identify high-frequency congestion areas;
[0094] The DBSCAN algorithm defines a neighborhood radius and minimum points MinPts , data points are divided into core points, boundary points and noise points; for a point p , if the number of points in its neighborhood is greater than or equal to MinPts ,but p As the core point; if p In the neighborhood of a core point, but the number of points in its own neighborhood is less than MinPts ,but p is a boundary point; otherwise it is a noise point;
[0095] Then, through cluster analysis, we can find out the areas in the building where congestion often occurs, providing a reference for optimizing the building layout.
[0096] Preferably, in step S6, the model parameters are adjusted and the simulation is repeated until the key indicators are met. Based on the analysis feedback results, the agent behavior parameters or the environment model are adjusted and the simulation is repeated until the ideal evacuation efficiency and pedestrian circulation effect are achieved.
[0097] Set key indicator thresholds and evacuation time thresholds , path deviation rate threshold ;
[0098] If the evacuation time in the simulation results > or path deviation rate , then adjust the model parameters and re-simulate until all key indicators meet the threshold requirements.
[0099] Therefore, the present invention adopts a building pedestrian simulation statistics and analysis method of the above structure, which has the following beneficial effects:
[0100] (1) The present invention is The algorithm dynamically plans routes, allowing the system to quickly adapt to environmental changes and provide pedestrians with the optimal evacuation route in real time, reducing congestion and improving evacuation efficiency. Combined with a heuristic function for measuring congestion, the system can more accurately reflect actual congestion during evacuations, helping to identify and alleviate potential bottlenecks and prevent stampedes.
[0101] (2) The present invention not only considers individual behavior but also realizes the collaborative mechanism between intelligent agents, such as assistants and people with mobility difficulties. This makes the simulation closer to the real situation and is conducive to evaluating the effectiveness of different evacuation strategies.
[0102] (3) The simulation system in the present invention can collect rich statistical data, including evacuation time, crowd distribution, congestion point analysis, etc., providing a scientific basis for the improvement of building safety design and the formulation of emergency plans.
[0103] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0104] Figure 1 The figure is a flow chart of a building pedestrian simulation statistics and analysis method of the present invention. DETAILED DESCRIPTION
[0105] The technical solution of the present invention is further described below with reference to the accompanying drawings and embodiments.
[0106] Unless otherwise defined, the technical or scientific terms used in the present invention shall have the usual meanings understood by persons of ordinary skill in the field to which the present invention belongs. The words "first", "second" and similar terms used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. Words such as "include" or "comprise" mean that the elements or objects preceding the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the object being described changes, the relative positional relationship may also change accordingly.
[0107] Example
[0108] like Figure 1 As shown, the present invention provides a building pedestrian simulation statistics and analysis method, comprising the following steps:
[0109] S1. Analyze system requirements, clarify simulation objectives, evaluate the building's safe evacuation capacity and optimize daily pedestrian flow lines, use BIM software or CAD software for modeling, and collect specific building information;
[0110] S2. Establishment of environment and agent model: constructing an accurate three-dimensional building environment model, including static and dynamic elements, and defining the agent's state space, action space and reward function;
[0111] S3, Normal Pedestrian Circulation Simulation: The agent selects a path based on a Markov decision process, collects data in real time, evaluates the rationality of facility layout based on the path deviation rate, and uses ScottPlot to visualize one-dimensional, two-dimensional, and three-dimensional charts in real time;
[0112] S4, Emergency Evacuation Simulation: When an emergency event is triggered, the Agent's goal switches to escape, and the collaborative rescue rules are activated. The algorithm pre-calculates the shortest path to the safe exit, combines it with DWA for real-time obstacle avoidance, manages obstacles through a KD tree to update the path set, uses a reward function to guide agent behavior, uses 3D trajectory playback to annotate congestion points and rescue events, and generates charts to quantitatively evaluate exit utilization and collaborative efficiency.
[0113] S5. Multi-modal comparison and optimization: Comparing normal and emergency data, using Python's Matplotlib and Tableau to generate heat maps and time series graphs, combined with DBSCAN clustering algorithm analysis, to identify building design flaws and high-frequency congestion areas, and propose targeted layout optimization solutions;
[0114] S6. Iterative Verification: Based on the feedback from the simulation results, adjust the agent behavior parameters or the environmental model and re-simulate; set the thresholds of key indicators and continue to iterate until the ideal evacuation efficiency and pedestrian circulation effect are met.
[0115] 1. Independence and correlation between normal and emergency modes
[0116] In the building pedestrian simulation system of this invention, both normal and emergency modes share the same building environment model and basic agent properties (such as movement speed). This means that both the simulation of daily human activity and the simulation of emergency evacuation are based on the same building structure and basic pedestrian movement capabilities. For example, the physical properties and spatial layout of static elements such as walls, doors, and stairs, as well as dynamic elements such as movable obstacles, are consistent in both modes. Furthermore, basic agent properties such as speed, reaction time, and perception range remain unchanged. This ensures the consistency and coherence of pedestrian behavior when switching between modes, avoiding illogical results caused by model differences.
[0117] In normal mode, the agent's primary goal is to complete a pre-defined activity, such as reaching a store to shop or going to the office to work. Its route selection is influenced by multiple factors, with facility attractiveness playing a key role. Different facilities (such as stores, restaurants, and rest areas) have varying attractiveness values for the agent, and the agent dynamically selects a route based on these attractiveness values and its own goals. For example, an agent aiming to shop will be more likely to choose routes leading to stores and less likely to choose routes farther away from stores and less attractive areas.
[0118] The agent's behavior also includes random stops and path preferences. Random stops simulate the fact that pedestrians may stop briefly in real life for various reasons, such as checking their phones or admiring their surroundings, enhancing the realism of the simulation. Path preferences reflect the individual differences in how pedestrians may choose different paths under similar circumstances. Some pedestrians may prefer to take a familiar path, even if it's not the shortest.
[0119] The agent optimizes its behavior through the Markov decision process. The Markov decision process is a probability-based decision model that assumes that the action taken by the agent in the current state depends only on the current state and has nothing to do with past history.
[0120] In this simulation, the agent is in state s Take action After transfer to state s' The probability of , instant rewards , then the long-term cumulative reward of the Agent is for
[0121] ;
[0122] in, is a discount factor with a value range of (0, 1), which is used to measure the importance of future rewards. The agent selects the optimal action strategy by maximizing the long-term cumulative reward. The closer it is to 1, the more the agent values future rewards and is more inclined to choose actions that can bring long-term benefits. The closer it is to 0, the more the agent pays attention to the current immediate reward.
[0123] When entering emergency mode, the agent's goal is forced to switch to escape. At this point, obstacle avoidance and coordination mechanisms are activated to ensure the agent can evacuate safely and quickly. Finding the nearest safe exit becomes the agent's primary task. Based on its own position and the locations of various safe exits, the agent calculates the distance to the nearest safe exit and plans a path to it.
[0124] Complying with signage is also a crucial rule in emergency mode. The agent recognizes signage during its movement and adjusts its direction accordingly. By calculating the angle between its current direction and the sign's direction, if the angle exceeds a set threshold, the agent adjusts its direction according to specific rules, aligning it more closely with the sign's direction, thereby guiding pedestrians toward the safe exit.
[0125] The collaborative rescue mechanism plays a key role in the emergency mode. Some agents are set to have rescue capabilities. When an agent that needs to be rescued is found, the rescue agent will calculate the distance between itself and the rescued agent, select the nearest agent to be rescued as the rescue target, and then adopt The algorithm plans a path to the rescue. During the rescue process, it follows the obstacle avoidance model and path planning strategy to ensure that it can successfully reach the rescued agent's location and carry out the rescue.
[0126] Mode switching is triggered by events. For example, when an emergency occurs, such as a fire alarm or a smoke sensor detecting smoke, the system immediately activates the event response module. This module forcibly switches the agent's goal from normal activities to escape and resets the agent's decision-making logic. During the switch, the agent ceases executing tasks in normal mode and instead implements the behavioral rules of emergency mode, such as seeking the nearest safe exit, following signs, and participating in rescue operations. This transition mechanism ensures the system can react quickly in emergency situations, simulating the behavioral changes of pedestrians in real-world scenarios.
[0127] 2. Statistical analysis and visualization implementation
[0128] In normal mode, data collection is carried out around multiple dimensions, aiming to fully capture the activity characteristics of pedestrians in the building. When recording the flow of people in each area, the system uses the set time period as the statistical cycle to accurately count the number of agents entering each area, and then uses the formula Calculate the area r In the time period [ t 1 , t 2 ] Pedestrian flow (people / minute) within the area. This data can intuitively reflect the intensity of personnel flow in different areas at different times, and help analyze which areas are hot spots of personnel activities.
[0129] The statistics of average stay time focus on the agent's stay behavior in each area. r Stay time within , Calculating the average length of stay is crucial for assessing the attractiveness and functional rationality of an area. For example, a long average length of stay in a rest area may indicate that the area's facilities and environment are well-equipped or comfortable. Conversely, a long average length of stay in a particular passageway may indicate that there are factors hindering the flow of people.
[0130] Path deviation rate and path deviation index Measuring the agent's path selection efficiency from different perspectives. The ratio of the actual path to the theoretical shortest path reflects whether the agent has chosen an efficient path during movement. A high deviation rate indicates that the agent may have been interfered with by factors such as facility layout and crowd congestion, requiring further analysis to optimize the layout.
[0131] Calculating pedestrian average speed is a crucial step in quantifying an agent's motion state. By recording the agent's displacement and time interval over a specific period of time and combining it with its velocity vector information, we can determine its average speed. This data not only reflects pedestrian movement speed in different areas but can also be correlated with other metrics to analyze the impact of speed changes on overall pedestrian flow.
[0132] Facility utilization statistics are collected by monitoring the interactions between agents and various types of facilities. For example, for a store, the ratio of agents entering the store to the total number of agents is counted; for vertical transportation facilities like elevators and staircases, the number of agents using them is counted. Facility utilization rates can intuitively demonstrate the frequency of use of different facilities in a building, providing a basis for optimizing facility layout and resource allocation.
[0133] Data collection in emergency mode focuses on key indicators during the evacuation process to assess evacuation effectiveness and identify potential issues. Evacuation time distribution statistics begin with the triggering of an emergency event, accurately recording the time it takes each agent to reach the safe exit. This generates an evacuation time distribution histogram. By analyzing this histogram, we can understand the changes in the number of evacuees during different time periods during the evacuation process and determine the smoothness and efficiency of the evacuation process.
[0134] Exit utilization is measured by counting the ratio of agents evacuating from each safety exit to the total number of agents. This metric intuitively reflects the degree to which each safety exit is used during the evacuation process. If the utilization rate of a particular exit is too low, it may mean that the exit has problems such as poor routing or unclear signage, and needs to be optimized.
[0135] Statistics on collaborative rescue attempts are used to evaluate the collaboration between agents in emergency situations. Every successful rescue attempt is recorded. By analyzing the number of collaborative rescue attempts, we can understand the frequency of mutual assistance between agents in emergency situations and evaluate the effectiveness of the rescue mechanism.
[0136] In addition, data such as evacuation time, congestion level, escape route effectiveness, and bottleneck area overlap rate need to be collected. Evacuation time is the time difference from the triggering of an emergency event to the arrival of all agents at the safe exit, and is a key indicator for measuring evacuation efficiency. The degree of congestion can be indirectly reflected by the density of agents in the area, using the pedestrian density formula within a two-dimensional grid or a three-dimensional cell. or The effectiveness of the escape path is comprehensively evaluated by combining factors such as the path deviation rate and whether obstacles are successfully avoided to determine whether the escape path selected by the agent is reasonable. Used to quantify the degree of congestion in areas of a building prone to congestion during evacuation. is the number of all possible bottleneck areas, It is in the bottleneck area The number of times people are jammed and overlapped, The agent passes through the bottleneck area The total number of times.
[0137] 3. Visualization Tools
[0138] Python's Matplotlib library is powerful and is primarily used in this simulation system to generate heat maps. To generate a heat map of normal pedestrian flow, the building floor is divided into numerous small squares. The pedestrian density is calculated based on the number of agents within each square, and the density values are then mapped to different colors. Typically, high-density areas are represented in red, and low-density areas in blue or green. This allows for a visual display of the density of different areas within the building, helping to quickly identify hotspots where people gather and areas with less frequent flow.
[0139] Matplotlib also allows you to plot time series graphs, comparing changes in key indicators before and after an evacuation. For example, you can plot a time-varying curve with time as the horizontal axis and indicators like the number of people evacuated and the degree of congestion in bottleneck areas as the vertical axis. By observing the curves, you can clearly see how these indicators change during the evacuation process, such as the growth trend in the number of evacuees and whether congestion in bottleneck areas has eased or worsened, allowing for in-depth analysis of the dynamics of the evacuation process.
[0140] Tableau is used to build interactive dashboards, allowing users to interact with data through an intuitive interface. In this system, users can view various statistics and visualizations in real time through the Tableau dashboard. Users can select different building floors and time periods to view corresponding data such as pedestrian density and facility utilization. They can also click on chart elements to obtain more detailed information, such as the specific number of agents in a particular area and the average length of stay.
[0141] Tableau's filter and sorting functions allow users to conduct in-depth data analysis. They can filter data for specific types of agents (such as adults, children, and the elderly) for separate analysis to understand the movement patterns of different types of pedestrians within a building. They can also sort facilities by usage rate to identify the most and least popular facilities, providing strong support for optimizing building layouts.
[0142] ScottPlot is primarily used for real-time visualization of acquired one-dimensional, two-dimensional, and three-dimensional charts. For one-dimensional charts, it records the number of Agents passing through each observation point over a period of time and presents them as a line graph or bar chart. For example, if multiple observation points are set up in a building's passageway, ScottPlot can plot the pedestrian flow at each observation point over time in real time, helping to analyze fluctuations in pedestrian flow within the passageway.
[0143] In a two-dimensional chart, ScottPlot generates a heat map based on the calculated agent density within each square. Compared to heat maps generated by Matplotlib, ScottPlot's advantage lies in its real-time nature. It updates the heat map in real time as the simulation progresses, showcasing the dynamic changes in crowd flow. Furthermore, it can add other information to the two-dimensional chart, such as the agent's movement trajectory, to further enrich the visualization.
[0144] For 3D charts, ScottPlot divides the building into multiple 3D cube units, calculates the agent density within each unit, and displays it as a 3D density model. Through operations such as rotation and zooming, users can observe the different aspects of the building from different angles.
[0145] Therefore, the present invention adopts the above-mentioned building pedestrian simulation statistics and analysis method, through The algorithm dynamically plans paths, allowing the system to quickly adapt to environmental changes and provide pedestrians with immediate optimal evacuation routes, reducing congestion and improving evacuation efficiency. Combined with a heuristic function for measuring congestion, the system can more accurately reflect the actual congestion during evacuations, helping to identify and alleviate potential bottlenecks and prevent stampedes. It not only considers individual behavior but also implements collaborative mechanisms between agents, such as assistants and people with limited mobility. This makes the simulation more realistic and facilitates the evaluation of the effectiveness of different evacuation strategies. The simulation system can collect rich statistical data, including evacuation time, crowd distribution, and congestion point analysis, providing a scientific basis for improving building safety designs and formulating emergency plans.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solutions of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A building pedestrian simulation statistics and analysis method, characterized in that: The following steps are involved: S1. Analyze system requirements, clarify simulation objectives, evaluate the building's safe evacuation capacity and optimize daily pedestrian flow lines, use BIM software or CAD software for modeling, and collect specific building information; S2. Establishment of environment and agent model: constructing an accurate three-dimensional building environment model, including static and dynamic elements, and defining the agent's state space, action space, and reward function; In step S2, the agent attributes and state space are defined. The agent attributes include speed, perception radius, and behavior target. Different types of pedestrians are represented as adults, children, and the elderly. Pedestrian distribution characteristics include speed, reaction time, and perception range. The state space, action space, and reward function of the agent motion model are also defined. The state space of the Agent motion model defines the position state, velocity state and behavior state in the simulation environment; Position Status: Using three-dimensional coordinates It represents the specific position of the agent in the three-dimensional space of the building, and its change over time reflects the movement trajectory of the agent; Speed status: Described by the velocity vector, Represents the speed and direction of the Agent in each direction; Behavioral status: Set the Agent to have three basic behavior states including walking, waiting and running, and use a state variable S To represent the behavior state of the Agent, ; The behavioral operations taken in the action space of the Agent motion model include movement and steering behaviors, as shown below: The forward step length is , according to the speed state and time interval Calculate the new position, expressed as: ; in, is the old location of Agent, is the new position after taking the move action; The total reward function of the agent: ; Location-related rewards : Used to reflect the proximity of the agent to the target location or safe exit; The reward for being close to the target is the inverse of the distance. Assuming the target position of the agent is , whose current location is , the reward expression for approaching the target is ; in is a very small constant to avoid the denominator being zero; When the agent successfully reaches the safe exit, a large positive reward is given , at this time, it is a reward for reaching the safe exit; Path length reward : Used to measure the efficiency of the Agent's moving path; The agent completes a move and calculates the actual path length it has traveled. Theoretical shortest path length The ratio of , its path length reward is defined as ,in is a ratio coefficient, ; If the Agent's path is close to the theoretical shortest path, Close to 1, Relatively small; if the agent takes many detours, Larger, will be smaller or negative; Synergy Rewards : Reflects the collaborative behavior between intelligent agents; Assume that the number of other agents that an agent helps is , then the expression of collaborative reward is ,in is a coefficient; The more it is, the higher the collaborative reward is, which encourages agents to help each other; is the weight of the reward function; S3, Normal Pedestrian Circulation Simulation: The agent selects a path based on a Markov decision process, collects data in real time, evaluates the rationality of facility layout based on the path deviation rate, and uses ScottPlot to visualize one-dimensional, two-dimensional, and three-dimensional charts in real time; S4, Emergency Evacuation Simulation: When an emergency event is triggered, the Agent's goal switches to escape, and the collaborative rescue rules are activated. The algorithm pre-calculates the shortest path to the safe exit, combines it with DWA for real-time obstacle avoidance, manages obstacles through a KD tree to update the path set, uses a reward function to guide agent behavior, uses 3D trajectory playback to annotate congestion points and rescue events, and generates charts to quantitatively evaluate exit utilization and collaborative efficiency. S5. Multi-modal comparison and optimization: Comparing normal and emergency data, using Python's Matplotlib and Tableau to generate heat maps and time series graphs, combined with DBSCAN clustering algorithm analysis, to identify building design flaws and high-frequency congestion areas, and propose targeted layout optimization solutions; S6. Iterative Verification: Based on the feedback from the simulation results, adjust the agent behavior parameters or the environmental model and re-simulate; set the thresholds of key indicators and continue to iterate until the ideal evacuation efficiency and pedestrian circulation effect are met.
2. The method for simulating statistics and analysis of pedestrians in buildings according to claim 1, characterized in that: In step S1, the specific information of the building includes floor plan, entrance and exit locations, stair width, and fire protection facilities; Use this data to calculate accessibility indicators for each area of the building , the formula is: ; in, is the shortest path distance from area i to other areas j, and n is the number of areas connected to area i. The accessibility index is used to measure the convenience of personnel flow between different areas in a building. The larger the value, the closer the connection between the area and other areas, and the more convenient the flow of people.
3. The method for simulating statistics and analysis of pedestrians in buildings according to claim 1, characterized in that: In step S3, the following steps are specifically included: S31, Behavioral Rule Management: The agent selects a path based on the Markov decision process. In the normal simulation, the agent dynamically selects a path based on the preset goal and optimizes the behavior through the Markov decision process. Assume that the agent is in state Take action After transfer to state The probability of , instant rewards , then the long-term cumulative reward of the Agent is for ; in, is a discount factor with a value range of (0, 1), which is used to measure the importance of future rewards. The agent selects the optimal action strategy by maximizing the long-term cumulative reward; is the state at time t+k; The action taken at time t+k; is the state at time t+k+1; S32, real-time data collection: record regional traffic, stay time, path deviation rate The system calculates the pedestrian flow and average stay time of each area in real time, and combines the path deviation rate Assess the rationality of facility layout; Calculation area In the time period Pedestrian flow within The formula is: ; in, It is in the time period Inner entry area The number of agents; Computing Agent in the area Average length of stay in The formula is: ; in, It is Agents in the area The duration of stay within S33. Visual analysis: Display crowd density through heat maps and generate facility utilization reports; The obtained one-dimensional, two-dimensional and three-dimensional charts are displayed in real time through ScottPlot. The content of the one-dimensional data is determined based on the queried information, and the number of agents passing through each observation point within a period of time is recorded. In the two-dimensional chart, the floor plan of a building is divided into Small squares are formed, and the density of agents in each square is calculated to generate a heat map to show the density of pedestrian flow. In the three-dimensional chart, the building is divided into multiple three-dimensional small cube units, and the density of agents in each unit is calculated. At the same time, ScottPlot generates real-time heat maps to reflect regional density and calculate the average speed of pedestrians and path deviation index. and facility utilization; For high-frequency stay areas, record them as potential congestion points for reference in building layout optimization and calculate the two-dimensional grid Pedestrian density within , whose expression is ; in, For square The number of agents in For square area; Calculating 3D cells Pedestrian density within , whose expression is ; in, It is a unit The number of agents in It is a unit volume.
4. The method for simulating statistics and analysis of pedestrians in buildings according to claim 1, characterized in that: In step S3, the calculation formula of the path deviation rate is: , and combined with the heat map to mark the area with deviation rate > 1.5 as the optimization focus.
5. The method for simulating statistics and analysis of pedestrians in buildings according to claim 4, characterized in that: In step S4, the following steps are specifically included: S41, event triggering mechanism: switch the Agent's goal to escape and activate the collaborative rescue rules; when an emergency event is triggered, the system switches the Agent's goal from normal activity to escape through the event response module and activates the collaborative rescue reward mechanism; S42, Dynamic Path Planning: Pre-calculate the shortest feasible path based on the A algorithm and combine it with DWA for real-time obstacle avoidance. The details are as follows: Pre-calculate the shortest feasible path from each agent to the safe exit based on the A algorithm and dynamically update the path length , Agent selection The smallest exit is the target, and the obstacle position is queried through the real-time KD tree. The dynamic window method (DWA) is used for local obstacle avoidance to ensure the feasibility of the path. The obstacle positions are managed based on the KD tree, and the feasible path set is updated in real time. The reward function is used to guide the agent behavior, which is expressed as follows: ; in, is the total reward value; For location-related rewards, is the path length reward, Speed-related rewards are used to punish speed reduction caused by obstacle avoidance or detour; ;in, For normal speed, is the actual speed, is the coefficient; In algorithm A, a KD tree is constructed and data points are inserted. The KD tree is used to process information about various objects in the environment. The position coordinates of the rescue agent, the agent to be rescued, other normally walking agents, and static obstacles are inserted into the KD tree as data points. Initialize the parameters related to the A algorithm and define a node class to represent the nodes in the path planning. Each node contains the position coordinates ( ), father point, initialization Point is 0, where The value is the actual cost from the rescue agent position to the current node, and the h value represents the heuristic estimate from the current node to the position of the agent to be rescued. ) and the coordinates of the Agent to be rescued ( ), calculated using the Euclidean distance formula, the specific expression is: ; The value is , used to evaluate the priority of the node, The smaller the value, the higher the priority of the node; and create an open list and a closed list. The open list is used to store the nodes to be expanded. Initially, the node corresponding to the rescue agent position is added to the open list and its Value, the closed list is used to store the nodes that have been expanded, and is initially empty; The main loop of the algorithm, after entering the loop, as long as the open list is not empty, the following operations are performed: take out the current node; determine whether the target is reached; update the neighbor node information; add the current node to the closed list; In DWA, Agent selects The smallest exit and adjust the real-time movement direction through DWA, the formula is: ; in, is the speed adjustment, is the obstacle distance, is the deceleration coefficient, is the safety distance threshold, which indicates the minimum safe distance between the agent and obstacles or other pedestrians; During the movement, the rescue agent continuously queries the neighbor information within the range of the perception radius through the KD tree. The perception radius is , to determine whether there are obstacles or other pedestrians approaching, if the distance detected to other objects is less than the safety distance threshold When the vehicle is moving, adjust the speed or change the walking direction according to this formula to avoid collision; S43. Data Evaluation: Calculate evacuation time, bottleneck area overlap rate, and mark congestion points in 3D trajectory playback; run evacuation simulations to collect data on evacuation time, congestion level, and escape path effectiveness; use 3D trajectory playback technology to mark bottleneck areas and rescue events, and simultaneously generate evacuation time distribution histograms and path overlap rate matrices to quantitatively evaluate exit utilization and coordination efficiency; Calculating evacuation time The time difference from the emergency event triggering to the time when all agents reach the safe exit; calculate the bottleneck area overlap rate The formula is ; Where m is the number of all possible bottleneck areas, It is in the bottleneck area The number of times people are jammed and overlapped, The agent passes through the bottleneck area The total number of times.
6. The method for simulating statistics and analysis of pedestrians in buildings according to claim 4, characterized in that: The main loop of the algorithm, after entering the loop, as long as the open list is not empty, the following operations are performed: Remove the current node: remove it from the open list The node with the smallest value is used as the current node, and the position coordinates of the current node are checked to see if they are equal to the position coordinates of the agent to be rescued. Determine whether the target has been reached: If they are equal, it means that the target node has been found. At this time, the complete path from the rescue agent to the agent to be rescued is constructed by backtracking the parent node, and then the path planning process ends; If they are not equal, the current node is expanded and the neighboring nodes with the perception radius around the current node are searched through the KD tree; Update neighbor node information: For each queried neighbor node, calculate the new path from the rescue agent through the current node to the neighbor node. Value, assuming the current node The value is , the cost of moving from the current node to the neighboring node is , then new value ; Recalculate the new neighbor nodes value The method is the same as that of initialization. The Euclidean distance formula is used to calculate the position coordinates of the neighboring nodes and the position coordinates of the agent to be rescued; Calculate new The value is If the neighbor node is not in the open list or the closed list, add it to the open list and set its Value; if the neighbor node is already in the open list, and , then update the node in the open list value; Add the current node to the closed list: Adding the current node to the closed list means that it has been expanded and will not be expanded again in the future.
7. The method for simulating statistics and analyzing pedestrians in buildings according to claim 1, characterized in that: In step S5, normal and emergency data are compared to identify design flaws and propose layout optimization solutions. The simulation results are analyzed, and heat maps are generated using Python Matplotlib and Tableau to display normal crowd distribution. Changes in key indicators before and after evacuation are compared using time series graphs. Clustering algorithms are used to identify high-frequency congestion areas, and improvement measures are proposed for problem areas to provide a basis for decision-making. The DBSCAN clustering algorithm is used to perform cluster analysis on pedestrian trajectory data in normal and emergency modes to identify high-frequency congestion areas; The DBSCAN algorithm defines a neighborhood radius and minimum points , data points are divided into core points, boundary points and noise points; for a point , if the number of points in its neighborhood is greater than or equal to ,but As the core point; if In the neighborhood of a core point, but the number of points in its own neighborhood is less than ,but is a boundary point; otherwise it is a noise point; Then, through cluster analysis, we can find out the areas in the building where congestion often occurs, providing a reference for optimizing the building layout.
8. The method for simulating statistics and analysis of pedestrians in buildings according to claim 7, characterized in that: In step S6, the model parameters are adjusted and the simulation is repeated until the key indicators meet the standards. Based on the analysis feedback results, the agent behavior parameters or the environment model are adjusted and the simulation is repeated until the ideal evacuation efficiency and pedestrian circulation effect are achieved. Set key indicator thresholds and evacuation time thresholds , path deviation rate threshold ; If the evacuation time in the simulation results > or path deviation rate , then adjust the model parameters and re-simulate until all key indicators meet the threshold requirements.
Citation Information
Patent Citations
Crowd evacuation simulation method and system based on multi-agent deep reinforcement learning
CN118296938A
System and Method for Real-time Transit Prioritization
US20190265059A1