Mental Health Sleep Hygiene Simulation

Sleep pressure and the body clock over three days: change bedtime, caffeine and screen light.

Presets

Controls

Readouts

Independent check

...
The science

Borbely two-process model. Process S (sleep pressure) rises while awake, dS/dt = (1 - S)/tau_i with tau_i = 18.2 h, and falls during sleep, dS/dt = -S/tau_d with tau_d = 4.2 h (typical textbook values, not individual measurements). Process C is the body clock: the sleep-onset threshold H+(t) = 0.62 + 0.10 cos(2 pi (t - 19.5 - delay)/24) is highest in the evening (the "wake maintenance zone"), and the wake-up threshold is H+ - 0.40.

Habits. Caffeine blocks adenosine receptors; it is modelled as a concentration with a 5 h half-life (typical 3-7 h) that raises the threshold by 0.10 per 200 mg present. Evening screen light is modelled only as a phase delay of the body clock of 0.75 h per level. You stay awake until your chosen bedtime, fall asleep once S reaches the threshold, and wake at the alarm or when S drops to the lower threshold.

Check. With a constant threshold, the time for S to climb from S0 to U is -tau_i ln((1 - U)/(1 - S0)); the page compares this and the exponential solutions with the numerical integrator.

Honest limits: a teaching model with illustrative constants, not medical advice. No sleep stages, naps, age, light-dose curves, alcohol or sleep disorders. If you struggle to sleep, talk to a doctor.