Skip to main content

Quickstart

Get SimulationBank up and running in minutes. This guide assumes you have Python 3.x and Node.js installed.
For detailed installation instructions, see the Installation Guide.

Prerequisites

1

Check Python

python3 --version
# Should show Python 3.7+
2

Check Node.js

node --version
# Should show Node 16+

Installation

1

Navigate to backend directory

cd backend
2

Create virtual environment

python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
3

Install dependencies

pip install -r requirements.txt
This installs:
  • flask - Web framework
  • flask-cors - CORS support
4

Start the Flask server

python app.py
Server will start at http://localhost:5000

Running Your First Simulation

1

Open the application

Navigate to http://localhost:5173 in your browser.
2

Configure simulation parameters

You’ll see configuration sliders for:
  • Number of Tellers: Start with 3
  • Arrival Rate (λ): Try 1.0 customers per second
  • Service Mean (μ): Try 5.0 seconds per customer
  • Simulation Duration: Set to 3600 seconds (1 hour)
For your first run, use default values to see a balanced system.
3

Start the simulation

Click the “Start Simulation” button.You’ll immediately see:
  • Events being processed in the event queue
  • Customers appearing in the priority queue
  • Tellers transitioning between IDLE and BUSY states
  • Metrics updating in real-time
4

Observe the queue visualization

The queue visualizer shows:
  • Red nodes: High-priority customers (Priority 1)
  • Yellow nodes: Medium-priority customers (Priority 2)
  • Green nodes: Low-priority customers (Priority 3)
Notice how high-priority customers are served first, regardless of arrival order.
5

Monitor metrics

The metrics dashboard displays:
  • Wait Time Chart: Average time customers spend waiting
  • Queue Length: Number of customers waiting over time
  • Throughput: Customers served per time unit
  • Saturation Report: Teller utilization percentage
6

Control the simulation

Use the control buttons:
  • Pause: Freeze the simulation at current clock time
  • Resume: Continue from paused state
  • Stop: End simulation and finalize metrics

Example Simulation Run

Here’s what a typical simulation looks like:
# Configuration (backend/src/simulation/domain/simulation_config.py)
config = SimulationConfig(
    num_tellers=3,
    arrival_config={
        "arrival_rate": 1.0,           # 1 customer per second average
        "arrival_dist": "exponential",  # Poisson process
        "priority_weights": [0.1, 0.3, 0.6]  # 10% high, 30% medium, 60% low
    },
    service_config={
        "service_mean": 5.0,            # 5 seconds average service time
        "service_dist": "exponential",
        "service_stddev": 1.0
    },
    max_simulation_time=3600.0,      # 1 hour simulation
    max_queue_capacity=100
)

Expected Results

With λ = 1.0 (arrival rate) and μ = 0.2 (service rate = 1/5.0), and c = 3 tellers:
  • Traffic Intensity (ρ): ρ = λ/(c×μ) = 1.0/(3×0.2) = 1.67
  • Since ρ > 1, the system is overloaded - queue will grow unbounded
This configuration will create a growing queue! Try increasing tellers to 6 or reducing arrival_rate to 0.5 for a stable system.

Understanding the Output

Event Processing

The simulation processes three event types:
# Customer crosses the door
# - Generate customer with priority and service time
# - Add to waiting queue (sorted by priority)
# - Schedule next arrival
# - Try to assign idle teller

Queue Dynamics

Customers in the waiting_queue are sorted by:
  1. Priority (ascending): 1 (High) < 2 (Medium) < 3 (Low)
  2. Arrival time (ascending): FIFO within same priority
# From simulation.py:118
self.waiting_queue.sort(key=lambda c: (c.priority, c.arrival_time))

Next Steps

Configure Parameters

Learn how to tune simulation parameters

Interpret Metrics

Understand wait times, throughput, and saturation

Simulation Engine

Deep dive into the DiscreteEventSimulation class

Advanced Scenarios

Explore high-load and optimization scenarios

Troubleshooting

Kill the process using port 5000:
# Linux/Mac
lsof -ti:5000 | xargs kill -9

# Windows
netstat -ano | findstr :5000
taskkill /PID <PID> /F
Verify:
  1. Backend is running at http://localhost:5000
  2. CORS is enabled (flask-cors installed)
  3. Check browser console for CORS errors
Your arrival rate is too high for the number of tellers!
  • Increase num_tellers
  • Decrease arrival_rate
  • Decrease service_mean (faster service)
Rule: Ensure ρ = λ/(c×μ) < 1 for system stability
Check your arrival_rate:
  • Very low rates (< 0.1) mean long intervals between customers
  • Increase to 1.0 or higher for visible activity
For a balanced system where queues remain manageable, aim for ρ ≈ 0.7-0.8 (70-80% teller utilization).

Build docs developers (and LLMs) love