Skip to content

Commit

Permalink
Change geometry and close two gates
Browse files Browse the repository at this point in the history
  • Loading branch information
chraibi committed Oct 12, 2024
1 parent edab256 commit b066925
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 4 additions & 4 deletions files/inifile.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"a_ped": 0.1,
"d_ped": 0.4,
"a_ped_min": 0.1,
"a_ped_max": 1.0,
"d_ped_min": 0.1,
"d_ped_max": 1.0,
"a_ped_max": 0.5,
"d_ped_min": 0.4,
"d_ped_max": 0.6,
"a_wall": 0.4,
"d_wall": 0.2,
"radius": 0.10
Expand All @@ -19,7 +19,7 @@
"fps": 60,
"time_step": 0.001,
"number_agents": 50,
"simulation_time": 300
"simulation_time": 500
},
"measurement_line": {
"vertices": [
Expand Down
13 changes: 10 additions & 3 deletions simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,12 @@ def init_simulation(
accessible_areas = parse_accessible_areas(_data)
if from_file:
geometry = from_wkt(
"POLYGON ((-8.88 -7.63, 8.3 -7.63, 8.3 27.95, -8.88 27.95, -8.88 -7.63), (-3.54 -1.13, -3.57 19.57, -1.52 19.57, -1.37 19.71, -1.37 21.09, -1.52 21.23, -1.67 21.23, -1.67 21.18, -1.545 21.18, -1.4200000000000002 21.065, -1.4200000000000002 19.735, -1.545 19.62, -3.6199999999999997 19.62, -3.59 -1.13, -3.54 -1.13), (3.57 -0.89, 3.64 19.64, 1.47 19.57, 1.32 19.71, 1.32 21.09, 1.47 21.23, 1.62 21.23, 1.62 21.18, 1.4949999999999999 21.18, 1.37 21.065, 1.37 19.735, 1.4949999999999999 19.62, 3.69 19.69, 3.6199999999999997 -0.89, 3.57 -0.89), (0.67 19.57, 0.82 19.71, 0.82 21.09, 0.67 21.23, 0.38 21.23, 0.23 21.09, 0.23 19.71, 0.38 19.57, 0.67 19.57), (-0.42 19.57, -0.27 19.71, -0.27 21.09, -0.42 21.23, -0.72 21.23, -0.87 21.09, -0.87 19.71, -0.72 19.57, -0.42 19.57))"
"POLYGON ((-8.88 -7.63, 8.3 -7.63, 8.3 27.95, -8.88 27.95, -8.88 -7.63), (-3.54 -1.13, -3.57 19.57, -1.52 19.57, -1.37 19.71, -0.87 19.71, -0.72 19.57, -0.42 19.57, -0.27 19.71, -0.27 21.09, -0.42 21.23, -0.72 21.23, -0.87 21.09, -1.37 21.09, -1.52 21.23, -1.67 21.23, -1.67 21.18, -1.545 21.18, -1.4200000000000002 21.065, -1.4200000000000002 19.735, -1.545 19.62, -3.6199999999999997 19.62, -3.59 -1.13, -3.54 -1.13), (3.57 -0.89, 3.64 19.64, 1.47 19.57, 1.32 19.71, 0.82 19.71, 0.67 19.57, 0.38 19.57, 0.23 19.71, 0.23 21.09, 0.38 21.23, 0.67 21.23, 0.82 21.09, 1.32 21.09, 1.47 21.23, 1.62 21.23, 1.62 21.18, 1.4949999999999999 21.18, 1.37 21.065, 1.37 19.735, 1.4949999999999999 19.62, 3.69 19.69, 3.6199999999999997 -0.89, 3.57 -0.89))"
)
# geometry with two doors
# geometry = from_wkt(
# "POLYGON ((-8.88 -7.63, 8.3 -7.63, 8.3 27.95, -8.88 27.95, -8.88 -7.63), (-3.54 -1.13, -3.57 19.57, -1.52 19.57, -1.37 19.71, -1.37 21.09, -1.52 21.23, -1.67 21.23, -1.67 21.18, -1.545 21.18, -1.4200000000000002 21.065, -1.4200000000000002 19.735, -1.545 19.62, -3.6199999999999997 19.62, -3.59 -1.13, -3.54 -1.13), (3.57 -0.89, 3.64 19.64, 1.47 19.57, 1.32 19.71, 1.32 21.09, 1.47 21.23, 1.62 21.23, 1.62 21.18, 1.4949999999999999 21.18, 1.37 21.065, 1.37 19.735, 1.4949999999999999 19.62, 3.69 19.69, 3.6199999999999997 -0.89, 3.57 -0.89), (0.67 19.57, 0.82 19.71, 0.82 21.09, 0.67 21.23, 0.38 21.23, 0.23 21.09, 0.23 19.71, 0.38 19.57, 0.67 19.57), (-0.42 19.57, -0.27 19.71, -0.27 21.09, -0.42 21.23, -0.72 21.23, -0.87 21.09, -0.87 19.71, -0.72 19.57, -0.42 19.57))"
# )
else:
geometry = build_geometry(accessible_areas)
# areas = build_areas(destinations, labels)
Expand Down Expand Up @@ -226,7 +230,10 @@ def run_simulation(
# )
logging.info(f"{default_range=}")
with open("values.txt", "w", encoding="utf-8") as file_handle:
while simulation.elapsed_time() < _simulation_time:
while (
simulation.elapsed_time() < _simulation_time
and simulation.agent_count() > 0
):
simulation.iterate()
if simulation.iteration_count() % 100 == 0:
number_agents_in_simulation = simulation.agent_count()
Expand All @@ -244,7 +251,7 @@ def run_simulation(
params
)
if motivation_i > 1:
logging.info(
logging.error(
f"{simulation.iteration_count()}: {agent.id}: {motivation_i = }"
)
v_0, time_gap = motivation_model.calculate_motivation_state(
Expand Down

0 comments on commit b066925

Please sign in to comment.