Updated pet calcs to be more accurate
Fixed some layout issues
Updated profile popup
This commit is contained in:
fraxle
2026-07-30 00:01:51 +01:00
parent f356954f40
commit b10e0da25f
8 changed files with 150 additions and 33 deletions
+19 -5
View File
@@ -620,11 +620,25 @@ export function calcShadeAirTemp(Ta, effectiveRad, va, elev, shade) {
// A breed-specific multiplier (brachycephalic/senior) is deliberately not
// modelled - this profile targets cats and small dogs as the reference animal.
// -------------------------------------------------------------------------
export function calcFurSurfaceTemp(Ta, globalRad, windSpeed, solElev, furAlbedo = 0.15) {
export function calcFurSurfaceTemp(Ta, globalRad, windSpeed, solElev, furAlbedo = 0.15, uv, cloudCat) {
if (globalRad == null || Ta == null) return null;
const elevDeg = (solElev != null) ? Math.max(5, solElev) : 45;
const angleCorrection = Math.sin(elevDeg * Math.PI / 180);
const absorbed = globalRad * (1 - furAlbedo) * angleCorrection;
// Same cloud/UV-clarity derating calcConcreteTemp() applies on top of the
// raw radiation figure - both models share the same input array
// (hourlyRows.effectiveRad), so without these fur was absorbing the full
// beam while concrete was further discounted for haze/cloud, making fur
// read hotter than pavement on anything but a clear sky (backwards from
// the "never bakes as hot as dead concrete" intent above).
const cloudTransmit = cloudCat === 'clear' ? 1.00
: cloudCat === 'wispy' ? 0.92
: cloudCat === 'scattered' ? 0.72
: cloudCat === 'overcast' ? 0.28
: 1.00;
const uvClarity = (uv && uv > 0)
? 0.85 + 0.15 * Math.min(1, uv / 8)
: 1.0;
const absorbed = globalRad * (1 - furAlbedo) * angleCorrection * cloudTransmit * uvClarity;
// Lower convective coefficient than bare concrete (hc=10+4.5*sqrt(v)) -
// trapped air in the coat insulates, running the surface hotter for a
// given wind speed than pavement, but not as insulated as a thick double
@@ -639,13 +653,13 @@ export function calcFurSurfaceTemp(Ta, globalRad, windSpeed, solElev, furAlbedo
export const LAG_HOURS_FUR = 0.4; // ~24 min - low thermal mass, animal moves in/out of sun
export function calcFurSurfaceTempPass(TaArr, radArr, vaArr, elevArr, furAlbedo = 0.15) {
export function calcFurSurfaceTempPass(TaArr, radArr, vaArr, elevArr, furAlbedo = 0.15, uvArr, cloudCatArr) {
const n = TaArr.length;
const result = new Array(n);
const alpha = 1 - Math.exp(-1 / LAG_HOURS_FUR);
let Tf = calcFurSurfaceTemp(TaArr[0], radArr[0], vaArr[0], elevArr[0], furAlbedo) ?? TaArr[0];
let Tf = calcFurSurfaceTemp(TaArr[0], radArr[0], vaArr[0], elevArr[0], furAlbedo, uvArr?.[0], cloudCatArr?.[0]) ?? TaArr[0];
for (let i = 0; i < n; i++) {
const target = calcFurSurfaceTemp(TaArr[i], radArr[i], vaArr[i], elevArr[i], furAlbedo) ?? TaArr[i];
const target = calcFurSurfaceTemp(TaArr[i], radArr[i], vaArr[i], elevArr[i], furAlbedo, uvArr?.[i], cloudCatArr?.[i]) ?? TaArr[i];
Tf = Tf + alpha * (target - Tf);
result[i] = Math.max(TaArr[i], Tf);
}