personensimulation updated

This commit is contained in:
Sandro Zimmermann 2025-12-18 01:08:41 +01:00
parent 08c4911b66
commit 37471e04b2

View File

@ -2,7 +2,6 @@
import numpy as np
import matplotlib.pyplot as plt
import time as tiime
GRIDSIZE_X = 35
GRIDSIZE_Y = 35
@ -47,14 +46,13 @@ def comp_density(grid):
# state transition t -> t + dt
def update(old, new):
print(count_peds(old))
#print(count_peds(old))
for x in range(1, GRIDSIZE_X+1):
for y in range(1, GRIDSIZE_Y+1):
#
# transition functions
#
if old[x, y] == CELL_PED:
if old[x,y] == CELL_PED:
delta_x = EXIT_X - x
delta_y = EXIT_Y - y
@ -78,15 +76,22 @@ def update(old, new):
min = np.inf
jump_to = None
for key in terrain:
'''for key in terrain:
if terrain[key]["cell"] == CELL_EMP:
if terrain[key]["vector"] < min:
min = terrain[key]["vector"]
jump_to = terrain[key]'''
for key in terrain:
if terrain[key]["vector"] < min:
min = terrain[key]["vector"]
jump_to = terrain[key]
print(jump_to)
if jump_to != None:
if jump_to != None and jump_to["cell"] == CELL_EMP:
new[jump_to["x"], jump_to["y"]] = CELL_PED
old[x,y] = CELL_OBS
old[x,y] = CELL_PED
else:
new[x,y] = old[x,y]
def set_terrain(grid, x, y):
cell = grid[x,y]