STREETLIGHTING / STREET LIGHTING.HTML
DP1110's picture
Update STREET LIGHTING.HTML
6656d4a verified
Raw History Blame Contribute Delete
13.1 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>LumiAI Automatic Prediction Dashboard</title>
<style>
*{box-sizing:border-box}body{margin:0;background:#08111f;color:#eef5ff;font-family:Arial,sans-serif}
header{background:#101c30;padding:18px 25px;border-bottom:1px solid #293b58;display:flex;justify-content:space-between}
.logo{font-size:26px;font-weight:800;color:#67d5ff}.sub{font-size:12px;color:#9db0ca;margin-top:4px}.live{background:#123b2d;color:#65e6ae;padding:8px 13px;border-radius:20px;font-weight:bold}
main{max-width:1450px;margin:auto;padding:20px}.panel,.card{background:#101c30;border:1px solid #293b58;border-radius:12px;padding:18px}
.editor{margin-bottom:18px}.editor h2{margin-top:0}.inputs{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
label{font-size:12px;color:#9db0ca;display:block;margin-bottom:5px}
input,select{width:100%;padding:10px;background:#17263e;color:#fff;border:1px solid #3a4e6c;border-radius:7px}
button{padding:11px 18px;border:0;border-radius:8px;background:#1597d4;color:#fff;font-weight:bold;cursor:pointer;margin:14px 8px 0 0}
button:hover{background:#087db5}.grid{display:grid;grid-template-columns:repeat(5,1fr);gap:13px}
.label{font-size:11px;color:#8fa5c2;text-transform:uppercase}.value{font-size:28px;font-weight:800;margin-top:8px}.unit{font-size:11px;color:#8fa5c2}
.layout{display:grid;grid-template-columns:1.15fr .85fr;gap:15px;margin-top:15px}h2{font-size:17px}
.road{height:245px;background:#1a263a;position:relative;overflow:hidden;border-radius:10px}
.road:before{content:"";position:absolute;left:38%;width:24%;height:100%;background:#303c50}
.lane{position:absolute;left:49%;height:100%;width:2%;background:repeating-linear-gradient(#f4d35e 0 25px,transparent 25px 45px)}
.light{position:absolute;width:8px;height:8px;border-radius:50%;background:#fff19a;box-shadow:0 0 18px 8px #fff19a88}
.l1{left:34%;top:20%}.l2{left:63%;top:42%}.l3{left:34%;top:70%}.l4{left:63%;top:82%}
.car{position:absolute;width:14px;height:25px;background:#58a6ff;border-radius:5px;left:46%;top:70%;animation:move 4s linear infinite}
.car2{left:53%;top:80%;background:#fb7185;animation-delay:1.5s}@keyframes move{to{transform:translateY(-280px)}}
.bar{height:27px;background:#1d2b42;border-radius:7px;overflow:hidden}.fill{height:100%;width:40%;background:#27b9ef;transition:.4s}
.big{width:145px;height:145px;border-radius:50%;margin:10px auto 18px;background:#334155;display:flex;align-items:center;justify-content:center;font-size:28px;font-weight:bold;transition:.4s}
table{width:100%;border-collapse:collapse}td,th{padding:10px;border-bottom:1px solid #293b58;text-align:left;font-size:13px}th{color:#91a6c2}
.good{color:#68e5ac}.warn{color:#facc15}.high{color:#fb7185}.note{font-size:13px;color:#b8c7db;line-height:1.6}
.auto{background:#173b59;border:1px solid #23618a;padding:10px;border-radius:8px;color:#8ddcff;font-size:13px;margin-top:10px}
.footer{text-align:center;color:#71829b;font-size:11px;margin:20px}
@media(max-width:950px){.inputs,.grid{grid-template-columns:repeat(2,1fr)}.layout{grid-template-columns:1fr}}
</style>
</head>
<body>
<header><div><div class="logo">πŸ’‘ LumiAI</div><div class="sub">AI-Based Adaptive Smart Street Lighting System</div></div><div class="live">● LIVE DEMO</div></header>
<main>
<div class="panel editor">
<h2>βš™οΈ Input Data</h2>
<div class="inputs">
<div><label>Current Vehicle Count</label><input id="vehiclesIn" type="number" value="38" min="0" oninput="autoPredict()"></div>
<div><label>Pedestrian Count</label><input id="peopleIn" type="number" value="12" min="0" oninput="autoPredict()"></div>
<div><label>Streetlight Rating (W)</label><input id="lampIn" type="number" value="100" min="1" oninput="autoPredict()"></div>
<div><label>Time Interval (minutes)</label><input id="minutesIn" type="number" value="15" min="1" oninput="autoPredict()"></div>
<div><label>Road</label><select id="roadIn" onchange="autoPredict()"><option>Road A – Main Corridor</option><option>Road B – Market Road</option><option>Road C – Residential Road</option><option>Road D – Highway Link</option></select></div>
<div><label>Weather Factor</label><select id="weatherIn" onchange="autoPredict()"><option value="1">Clear</option><option value="1.08">Cloudy</option><option value="1.18">Rain</option><option value="1.25">Fog</option></select></div>
<div><label>Hour of Day</label><input id="hourIn" type="number" value="19" min="0" max="23" oninput="autoPredict()"></div>
<div><label>Auto Update</label><select id="autoIn" onchange="toggleAuto()"><option value="off">Manual</option><option value="on">Automatic</option></select></div>
</div>
<div class="auto">βœ“ <b>Automatic Prediction Enabled:</b> Changing vehicle count, pedestrians, time, weather or road automatically recalculates predicted traffic, brightness and energy saving.</div>
<button onclick="autoPredict()">Apply / Recalculate</button>
<button onclick="demoPeak()">Morning Peak Demo</button>
<button onclick="demoLow()">Low Traffic Demo</button>
</div>
<section class="grid">
<div class="card"><div class="label">Current Vehicles</div><div class="value" id="vehicles">38</div><div class="unit">camera / YOLO input</div></div>
<div class="card"><div class="label">Pedestrians</div><div class="value" id="people">12</div><div class="unit">camera / YOLO input</div></div>
<div class="card"><div class="label">Traffic Level</div><div class="value warn" id="traffic">MEDIUM</div><div class="unit">AI classification</div></div>
<div class="card"><div class="label">Predicted Traffic</div><div class="value" id="prediction">44</div><div class="unit">next interval</div></div>
<div class="card"><div class="label">Energy Saving</div><div class="value good" id="saving">30%</div><div class="unit">vs 100% lighting</div></div>
</section>
<div class="layout">
<div class="card"><h2>πŸ›£οΈ Live Road Visualization</h2><div class="road">
<div class="lane"></div><div class="light l1"></div><div class="light l2"></div><div class="light l3"></div><div class="light l4"></div>
<div class="car"></div><div class="car car2"></div></div>
<h2>Predicted Traffic Density</h2><div class="bar"><div class="fill" id="bar"></div></div>
<p class="note">Selected road: <b id="road">Road A – Main Corridor</b></p></div>
<div class="card"><h2>πŸ’‘ Automatic AI Lighting Decision</h2><div class="big" id="bigLight">70%</div>
<table>
<tr><th>Parameter</th><th>Automatic Result</th></tr>
<tr><td>Predicted vehicles</td><td id="tPred">44 vehicles</td></tr>
<tr><td>Traffic classification</td><td id="tTraffic">MEDIUM</td></tr>
<tr><td>Optimal brightness</td><td id="tBright">70%</td></tr>
<tr><td>Power consumption</td><td id="power">70 W</td></tr>
<tr><td>Interval energy</td><td id="energy">0.0175 kWh</td></tr>
<tr><td>Energy saving</td><td id="tSaving">30%</td></tr>
</table></div>
</div>
<div class="layout">
<div class="card"><h2>⚑ Energy Comparison</h2><table>
<tr><th>Mode</th><th>Brightness</th><th>Power</th><th>Energy</th></tr>
<tr><td>Conventional</td><td>100%</td><td id="convPower">100 W</td><td id="convEnergy">0.0250 kWh</td></tr>
<tr><td>LumiAI</td><td id="aiBright">70%</td><td id="aiPower">70 W</td><td id="aiEnergy">0.0175 kWh</td></tr>
</table></div>
<div class="card"><h2>🧠 Automatic Prediction Logic</h2><p class="note" id="explanation">Current traffic is analyzed with pedestrian activity, time and weather. The system predicts the next traffic state and automatically selects a safety-aware brightness level.</p></div>
</div>
<div class="card" style="margin-top:15px"><h2>πŸ”„ LumiAI AI Pipeline</h2><table>
<tr><td>1. Camera / Video Input</td><td class="good">● Active</td></tr>
<tr><td>2. YOLO Vehicle + Pedestrian Detection</td><td class="good">● Running</td></tr>
<tr><td>3. Current Traffic Count</td><td class="good">● Updated</td></tr>
<tr><td>4. LSTM Traffic Prediction</td><td class="good" id="lstmStatus">● Automatic</td></tr>
<tr><td>5. Q-Learning Brightness Optimization</td><td class="good">● Automatic</td></tr>
<tr><td>6. Energy Optimization</td><td class="good">● Calculated</td></tr>
</table></div>
<div class="footer">LumiAI SIH 2026 β€’ Front-end demonstration β€’ Prediction is calculated automatically from dashboard inputs.</div>
</main>
<script>
let timer=null;
function predictTraffic(v,p,h,w){
// Demo approximation of an LSTM-style prediction.
// It intentionally uses current inputs so the dashboard reacts automatically.
let timeFactor=1;
if((h>=7&&h<=10)||(h>=17&&h<=21)) timeFactor=1.18;
else if(h>=23||h<=5) timeFactor=0.72;
else timeFactor=0.95;
let pedestrianFactor=1+(p*0.006);
let prediction=Math.round(v*timeFactor*pedestrianFactor*w);
return Math.max(0,prediction);
}
function brightnessForTraffic(pred){
if(pred>=60)return ["HIGH",100];
if(pred>=25)return ["MEDIUM",70];
if(pred>0)return ["LOW",50];
return ["EMPTY",30];
}
function autoPredict(){
const v=Math.max(0,Number(document.getElementById("vehiclesIn").value)||0);
const p=Math.max(0,Number(document.getElementById("peopleIn").value)||0);
const lamp=Math.max(1,Number(document.getElementById("lampIn").value)||100);
const minutes=Math.max(1,Number(document.getElementById("minutesIn").value)||15);
const h=Math.min(23,Math.max(0,Number(document.getElementById("hourIn").value)||0));
const w=Number(document.getElementById("weatherIn").value)||1;
const pred=predictTraffic(v,p,h,w);
const result=brightnessForTraffic(pred);
const level=result[0], bright=result[1];
const hours=minutes/60;
const power=lamp*bright/100;
const aiEnergy=power*hours/1000;
const conventional=lamp*hours/1000;
const saving=conventional?((1-aiEnergy/conventional)*100):0;
document.getElementById("vehicles").textContent=v;
document.getElementById("people").textContent=p;
document.getElementById("prediction").textContent=pred;
document.getElementById("traffic").textContent=level;
document.getElementById("traffic").className="value "+(level==="HIGH"?"high":level==="MEDIUM"?"warn":"good");
document.getElementById("saving").textContent=saving.toFixed(0)+"%";
document.getElementById("tPred").textContent=pred+" vehicles";
document.getElementById("tTraffic").textContent=level;
document.getElementById("tBright").textContent=bright+"%";
document.getElementById("power").textContent=power.toFixed(1)+" W";
document.getElementById("energy").textContent=aiEnergy.toFixed(4)+" kWh";
document.getElementById("tSaving").textContent=saving.toFixed(0)+"%";
document.getElementById("convPower").textContent=lamp+" W";
document.getElementById("convEnergy").textContent=conventional.toFixed(4)+" kWh";
document.getElementById("aiBright").textContent=bright+"%";
document.getElementById("aiPower").textContent=power.toFixed(1)+" W";
document.getElementById("aiEnergy").textContent=aiEnergy.toFixed(4)+" kWh";
document.getElementById("road").textContent=document.getElementById("roadIn").value;
document.getElementById("bar").style.width=Math.min(100,pred)+"%";
document.getElementById("bigLight").textContent=bright+"%";
document.getElementById("bigLight").style.boxShadow="0 0 "+Math.max(10,bright/2)+"px "+Math.max(4,bright/10)+"px rgba(255,241,154,.65)";
let reason="";
if(level==="HIGH") reason="The automatic prediction indicates high traffic. LumiAI increases lighting to 100% to prioritize road safety.";
else if(level==="MEDIUM") reason="The automatic prediction indicates medium traffic. LumiAI selects 70% brightness as a balance between safety and energy efficiency.";
else if(level==="LOW") reason="The automatic prediction indicates low traffic. LumiAI reduces lighting to 50% while retaining a safety baseline.";
else reason="The automatic prediction indicates almost no activity. LumiAI selects minimum 30% brightness.";
document.getElementById("explanation").textContent=reason+
" Prediction uses vehicle count, pedestrian count, time-of-day and weather factor in this demo.";
}
function toggleAuto(){
clearInterval(timer);
if(document.getElementById("autoIn").value==="on"){
timer=setInterval(()=>{
// Small simulated change in camera counts for live demonstration
let v=Number(document.getElementById("vehiclesIn").value)||0;
let p=Number(document.getElementById("peopleIn").value)||0;
v=Math.max(0,Math.round(v+(Math.random()*10-5)));
p=Math.max(0,Math.round(p+(Math.random()*6-3)));
document.getElementById("vehiclesIn").value=v;
document.getElementById("peopleIn").value=p;
autoPredict();
},3000);
}
}
function demoPeak(){
document.getElementById("vehiclesIn").value=75;
document.getElementById("peopleIn").value=28;
document.getElementById("hourIn").value=19;
document.getElementById("weatherIn").value="1";
autoPredict();
}
function demoLow(){
document.getElementById("vehiclesIn").value=8;
document.getElementById("peopleIn").value=2;
document.getElementById("hourIn").value=2;
document.getElementById("weatherIn").value="1";
autoPredict();
}
autoPredict();
</script>
</body>
</html>