RCS · Physics

// Roller Coaster Simulator — AP Physics Edition  ·  v3.0
Author: Sheldon K. Salmon × ALBEDO
For: Saleem Raja Haja
Ref: Tony Wayne AP Physics Guide
// Module 1 — Energy Conservation
ET(1) = ET(2)
KE + PE = KE + PE
½v₁² + gh₁ = ½v₂² + gh₂   ← mass cancels
Enter values and press Calculate.
PDF Ex 1: v1=8.8, h1=95, h2=0 → 44.04 m/s
PDF Ex 2: v1=8.8, h1=95, h2=65 → 25.80 m/s
// Module 2 — Work-Energy Theorem
ET(start) + Work = ET(end)
KE₁ + PE₁ + F·d = KE₂ + PE₂
// Braking Force Calculator
PDF Note: Source document contains a typo in Example 5c. PDF states a = 37.018 m/s² but correct math gives a = 27.018 m/s² (= 81054N ÷ 3000kg). This simulator uses the correct value.
// Module 3 — G-Force Calculator
Bottom of loop: g_felt = v²/(R·g) + 1
Top of loop: g_felt = v²/(R·g) − 1
At angle θ above horizontal: g_felt = v²/(R·g) − sin(θ)
At angle θ below horizontal: g_felt = v²/(R·g) + sin(θ)
// Module 4 — Irregular Loop Designer
R_bottom = v² / ((g_limit_bottom − 1) × g)
R_top = v_top² / ((g_limit_top + 1) × g)
v_top = √(v_entry² − 2·g·h_loop)
Sources: Clothoid loop shape — University of Gothenburg / Liseberg Physics (2005)
// Module 5 — Free-Fall Hill Designer
Hill shape (projectile path): x = √(2h · v² / g)
Angle at drop: θ = arctan(v_vertical / v_horizontal)
Where v_vertical = √(2gh) at drop depth h
// Module 6 — Banked Curve Designer
Ideal bank angle: tan(θ) = v² / (R × g)
G-felt on ideal bank: g_felt = 1 / cos(θ)
No friction required at design speed.
// Design for Target G-Force
// Module 7 — Spring Launch System
Hooke's Law: F = k × x
Spring energy: E = ½kx²
Launch velocity: v = x × √(k/m)
Constraint: average acceleration ≤ 5.5g → max accel = 11g = 107.8 m/s²
Therefore: k × x_max = m × 107.8
// Module 8 — Physiological Safety Reference
LimitValueEffectStatus
Max positive g's (inside loop)8.0 gBlood drains from brain → blackoutBLACKOUT
Max negative g's (outside loop)-3.0 gBlood floods brain → red-out, vessel ruptureREDOUT
Linear acceleration warning20.0 gEar bleeding riskDANGER
Instantaneous impact limit40.0 gInstantaneous deathFATAL
Design ceiling (Tony Wayne AP source)5.0 g"Most roller coasters keep g's under 5g" — Tony Wayne Physics GuideDESIGN LIMIT
Typical operating range3–4 gWikipedia / CoasterForce: "coasters typically don't exceed ~3g"NORMAL
// G-Force Safety Checker
// Module 9 — Full Track Simulator
// Module 10 — Real Coaster Comparison
Ideal v = √(2 · g · h_drop)   ← frictionless, mass cancels
Energy retained % = (v_actual² / v_ideal²) × 100
Sources: [R] RCDB (Roller Coaster DataBase) · Official park specs · CoasterForce
// Red Team Report — Full Audit History
✓ FINDING 1 — FIXED: Loop Test Height Calculation Error
Python version test computed h = 2×R×sin(45°)+R = 24.14m instead of correct R + R×sin(45°) = 17.07m. Core calculation logic was correct — only the test setup had the wrong height. HTML version uses correct height formula throughout.
✓ FINDING 2 — DOCUMENTED: PDF Typo in Example 5c
Source PDF states a = 37.018 m/s² for braking deceleration, but correct math is: 81054 N ÷ 3000 kg = 27.018 m/s² = 2.76g. This simulator uses the mathematically correct value.
✓ FINDING 3 — FIXED: Banked Curve Domain Error
Math.acos(1/g_felt) crashes when g_felt < 1.0. Fixed: validates g_felt ≥ 1.001 before executing arccos.
✓ FINDING 4 — FIXED: Spring Division by Zero
spring_constant = (mass × 107.8) / x_max crashes on x_max = 0. Fixed: validates x_max > 0.
⚠ FINDING 5 — KNOWN LIMITATION: Friction Not Modeled
Ideal energy conservation only (no friction losses). Real coasters lose ~5–15% to friction. Module 10 demonstrates this gap explicitly with three documented coasters.
⚠ FINDING 6 — KNOWN LIMITATION: Train Length Effects
Physics calculated at center of mass only. Rear-car g-forces on hills are approximately 1.2–1.4× higher than calculated.
Red team pass 1: March 2026 — 4 bugs fixed  ·  Red team pass 2 (citation-backed): March 2026 — 6 issues fixed  ·  Module 10 added: March 2026  ·  Red team pass 3: March 2026 — 5 bugs fixed + 2 features  ·  Architect: Sheldon K. Salmon × ALBEDO  ·  Status: 15 total issues resolved.
// PASS 2 — CITATION-BACKED PEER REVIEW
✓ PASS-2 FINDING 1 — FIXED: getGStatus() called 7.99g “SAFE”
Fixed: Three-tier system. SAFE (≤5g) | CAUTION (5–6.5g) | BLACKOUT-RISK (6.5–8g) | BLACKOUT (8g+). Sources: Tony Wayne AP Physics Guide · CoasterForce (NASA Bioastronautics Data Book 1964) · Coasterpedia.
✓ PASS-2 FINDING 2 — FIXED: Track Builder brake distance was hardcoded
Brake zone length is now a required user input field (default 10m). Fabricated precision over a hidden estimate is a reliability failure.
✓ PASS-2 FINDING 3 — FIXED: Negative g intermediate zone missing
Three zones: AIRTIME (0 to -1g) | NEG-G caution (-1g to -2g) | REDOUT-RISK (-2g to -3g) | REDOUT (-3g+). Source: CoasterForce (NASA).
✓ PASS-2 FINDING 4 — FIXED: Formula notation ambiguous (v²/Rg)
All formula displays now use unambiguous dot notation: v²/(R·g). Citation added: University of Gothenburg / Liseberg Physics (2005).
✓ PASS-2 FINDING 5 — FIXED: Safety table labeled 5g as “SAFE”
Row now reads Design ceiling (Tony Wayne): 5.0g → DESIGN LIMIT. Separate row for typical 3–4g operating range.
✓ PASS-2 FINDING 6 — FIXED: Track Builder loop labeled as generic “LOOP”
Segment now labeled “LOOP (CIRC)” with note directing users to Module 4 for irregular loop design.
// PASS 3 — RT-PASS3 CODE AUDIT & FEATURE ADDITIONS (March 2026)
✓ RT-PASS3-FIX1 — FIXED: designLoop() division by zero when gb=1.0
R_bottom = v² / ((gb−1) × g). If gb=1.0, denominator = 0, result = Infinity. Input HTML had min="1" but no runtime guard. User entering exactly 1.0 would produce Infinity radius with no error. Fixed: guard added at top of designLoop() — if(gb ≤ 1.0) exit with explicit error explaining the physics (at 1g, radius is infinite — the track would be flat).
✓ RT-PASS3-FIX2 — FIXED: designHill() canvas crash when v=0
maxX = √(2 × maxH × v² / g). When v=0, maxX=0. Then sX = (W × 0.4) / 0 = Infinity. All canvas coordinates become NaN. Canvas draws nothing, no error shown. Fixed: guard added — if(v ≤ 0) exit with explicit error: “At v=0 the hill has infinite width (train falls straight down).”
✓ RT-PASS3-FIX3 — FIXED: calcWork() division by zero when mass=0
v2 = √(2 × ke2 / m). When m=0, result = NaN. Previously guarded with safeVal(id, 1) as fallback, but user could type 0 explicitly. Fixed: explicit guard — if(m ≤ 0) exit with error message.
✓ RT-PASS3-FIX4 — FIXED: calcBrake() silent fallback to d=0.001 when distance=0
Previous: const d = safeVal('bf-dist', 0.001). If user entered 0, d silently became 0.001. Braking force output appeared precise (81,054 N) but was computed over an invented 0.001m distance. A simulator presenting fabricated precision over a hidden override is a reliability failure. Fixed: explicit guard — if(d ≤ 0) exit with error.
✓ RT-PASS3-FIX5 — FIXED: applyToEnergy() / applyToGForce() fragile tab activation
applyToGForce() used document.querySelectorAll('.tab-btn')[2].classList.add('active'). Correct as of v2 (index 2 = G-Forces), but any tab order change would silently activate the wrong tab. Fixed: new activateTab(id) helper uses document.querySelector('[data-tabid=“id”]') — looks up by data attribute, not position. Order-independent.
★ RT-PASS3-FEATURE1 — ADDED: Unit Toggle (SI Metric / Imperial)
Full bidirectional unit conversion across all 11 tabs. Implementation: global UNITS flag + rH/rV/rM/rF/rD input readers (always return SI internally) + fmH/fmV/fmM/fmF output formatters + toggleUnits() converts all data-utype tagged inputs on switch. Internal physics always runs in SI. Zero precision loss on round-trip conversion. All labels update dynamically via updateAllLabels(). Results always show both primary and alternate unit where useful.
★ RT-PASS3-FEATURE2 — ADDED: Export to PDF (Lab Report Generator)
Zero-dependency implementation. exportPDF() collects all currently displayed result-box elements from the active tab, constructs a clean white-background lab report HTML with: student name / class / date fields, calculated results in a formatted table, AION certification footer, date/time stamp. Opens in new window, auto-triggers window.print() after 400ms. Browser 'Save as PDF' produces a clean lab handout. No external library. Works offline.
AION · VERIFIED · SIMULATOR · SHELDON K. SALMON VERIFIED SIMULATION v3.0 · 2026 · AION STACK
AION Verified Simulator · v3.0
Authored by Sheldon K. Salmon × ALBEDO
Citation-backed  ·  Red-teamed (3 passes, 15 issues resolved)  ·  Unit Toggle: SI/Imperial  ·  PDF Export
Ref: Tony Wayne Roller Coaster (AP) Physics — Abridged Edition
For: Saleem Raja Haja · AI Governance, Energy Sector · Kuwait  ·  March 2026