Improved scope
Improved profiles
This commit is contained in:
fraxle
2026-05-15 09:40:42 +01:00
parent f024fd0c2d
commit 5b0e62d1b5
6 changed files with 372 additions and 108 deletions
+12 -8
View File
@@ -7,11 +7,14 @@
// solarElevationDeg(lat, lon, dateUTC) NOAA simplified solar position
// calcTmrt(Ta, dirRad, diffRad, globalRad, solElev) Mean radiant temp
// utciApprox(Ta, Tmrt, va10, ehPa) Bröde et al. 2012 polynomial
// calcVehicleInteriorTemp(Ta, globalRad, solElev, vehicleType)
//
// Nothing in here should need editing unless the underlying science
// changes. All numbers are peer-reviewed constants or coefficients.
// ════════════════════════════════════════════════════════════════════════
import { VEHICLE_TYPES } from './utils.js';
// ═══════════════════════════════════════════════════════════════════
// PHYSICAL CONSTANTS
// ───────────────────────────────────────────────────────────────────
@@ -262,12 +265,14 @@ export function calcManagedIndoorTempPass(TaArr, globArr, elevArr) {
// 3545 °C — dangerous for children/pets (hyperthermia risk)
// > 45 °C — potentially fatal within minutes
// ═══════════════════════════════════════════════════════════════════
export function calcVehicleInteriorTemp(Ta, globalRad, solElev) {
export function calcVehicleInteriorTemp(Ta, globalRad, solElev, vehicleType = 'car') {
if (globalRad == null || Ta == null) return null;
// Look up vehicle preset; fall back to a standard car if key unknown.
const preset = VEHICLE_TYPES[vehicleType] || VEHICLE_TYPES.car;
// ── 1. Panel conduction ──────────────────────────────────────────
const albedoPanel = 0.25; // typical mixed fleet
const panelAbsorbed = globalRad * (1 - albedoPanel); // W/m² absorbed by bodywork
const panelAbsorbed = globalRad * (1 - preset.albedo); // W/m² absorbed by bodywork
// Panel surface temp: absorbed solar / convective loss to outside air
// hOut ~10 W/m²K (light breeze over panel surface even when parked)
const hOut = 10;
@@ -277,8 +282,8 @@ export function calcVehicleInteriorTemp(Ta, globalRad, solElev) {
const conductionGain = hCabin * (panelSurfaceTemp - Ta); // W/m²
// ── 2. Side-window glazing gain (angle-dependent) ─────────────────
// Glazing transmission for auto glass ~0.70
const tau = 0.70;
// Glazing transmission for auto glass ~0.70; scaled by vehicle glazing area.
const tau = 0.70 * preset.glazingArea;
let glazingGain = 0;
if (solElev != null && solElev > 10 && solElev < 60) {
// Scale factor: peaks around 3040° elevation (sun cuts squarely
@@ -298,9 +303,8 @@ export function calcVehicleInteriorTemp(Ta, globalRad, solElev) {
// ── Combine into cabin air temperature ───────────────────────────
// Total heat input per m² of cabin surface
const totalGain = conductionGain + glazingGain;
// Cabin heat loss: poor natural ventilation in sealed car ~2.0 W/m²K
const hCabinLoss = 2.0;
const Ti = Ta + totalGain / hCabinLoss;
// Cabin heat loss: varies by vehicle type (motorhomes insulated, cars not)
const Ti = Ta + totalGain / preset.hCabinLoss;
// Clamp: can't be cooler than outside air; physical cap at 90 °C
return Math.max(Ta, Math.min(Ti, 90));