Skip to content

Instantly share code, notes, and snippets.

@mathematiguy
Created November 19, 2024 03:42
Show Gist options
  • Save mathematiguy/6ba65ac279a0c90c113bc780d5f68997 to your computer and use it in GitHub Desktop.
Save mathematiguy/6ba65ac279a0c90c113bc780d5f68997 to your computer and use it in GitHub Desktop.
# Crowd Size Estimation Program
# Parameters
# Footpath width (meters)
width_min = 16
width_max = 18
width_avg = (width_min + width_max) / 2
# Drift velocity (meters per second)
velocity_min = 1.0
velocity_max = 1.3
velocity_avg = (velocity_min + velocity_max) / 2
# Person density (persons per square meter)
density_min = 3
density_max = 4
density_avg = (density_min + density_max) / 2
# Duration (seconds)
duration_minutes = 29
duration_seconds = duration_minutes * 60
# Calculations
# Minimum flow rate (persons per second)
flow_rate_min = width_min * velocity_min * density_min
# Average flow rate (persons per second)
flow_rate_avg = width_avg * velocity_avg * density_avg
# Maximum flow rate (persons per second)
flow_rate_max = width_max * velocity_max * density_max
# Total number of people
# Minimum estimate
total_people_min = flow_rate_min * duration_seconds
# Average estimate
total_people_avg = flow_rate_avg * duration_seconds
# Maximum estimate
total_people_max = flow_rate_max * duration_seconds
# Output results
print("Crowd Size Estimation Results:")
print(f"Duration: {duration_minutes} minutes ({duration_seconds} seconds)\n")
print("Minimum Estimate:")
print(f" Flow Rate: {flow_rate_min:.2f} persons/second")
print(f" Total People: {int(total_people_min):,}\n")
print("Average Estimate:")
print(f" Flow Rate: {flow_rate_avg:.2f} persons/second")
print(f" Total People: {int(total_people_avg):,}\n")
print("Maximum Estimate:")
print(f" Flow Rate: {flow_rate_max:.2f} persons/second")
print(f" Total People: {int(total_people_max):,}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment