# 24x7 Surveillance & Armed Guard Rotation Simulator

## PURPOSE
A discrete-event simulation (SimPy + NumPy) of a strong-room premises guarded by
two layers the transcript names: **constant 24-hour CCTV surveillance** and
**armed police protection**. The simulator runs a full day of camera uptime
(random failures and recovery) alongside a rotating armed-guard roster, then
reports the minutes where a site was left with neither a working camera nor an
armed guard on duty — the true measure of the SP's "full-scale protection".

## WHY THIS MATTERS
The video's directive joins two mechanisms: cameras for continuous surveillance and
armed personnel for physical protection. Officials assume each alone is enough, but
**coverage is only real when the gaps don't overlap**. This project teaches
discrete-event modelling: how to represent unreliable components (camera MTBF/MTTR)
and shift-based resources (guards) and measure the residual exposure window.

## HOW TO BUILD
1. Model a `GuardRoster` that keeps at least one armed guard on post at all times
   via shift rotation (e.g. 8-hour shifts, relief handover).
2. Model each camera as a SimPy resource with a mean-time-between-failures and a
   repair process driven by NumPy RNG.
3. Each simulated minute, record whether `any_camera_active or guard_on_post`.
4. Aggregate: total unguarded minutes, longest contiguous exposure, and availability.

Key snippet:
```python
import simpy, numpy as np

def camera(env, rng, mtbf, mttr, state, cid):
    while True:
        yield env.timeout(rng.exponential(mtbf))
        state[cid] = False                 # camera down
        yield env.timeout(rng.exponential(mttr))
        state[cid] = True                  # repaired

def guard_roster(env, shift_minutes, on_post):
    while True:
        on_post[0] = True
        yield env.timeout(shift_minutes)
        on_post[0] = False
        yield env.timeout(shift_minutes)   # relief gap
```

## WHEN TO USE IN PRODUCTION
Use it to stress-test security plans before deployment: how many cameras and guards
are needed to hold exposure under a threshold, and how sensitive is the result to
camera reliability? It fits planning for strong rooms, vaults, and evidence stores.
Do NOT use it to drive live operations — it is a planning model, not a monitor — and
do not feed it unaudited MTBF numbers, or its reassurance is fiction.

## HOW IT HELPS STUDENTS
Students learn SimPy process modelling, resource contention, stochastic simulation
with NumPy, and how to express a security policy as a measurable objective.

## STARTER CODE
See `starter/main.py` for a runnable SimPy model with camera-failure processes, a
guard roster, deterministic seeding, and `# TODO` markers.
