world-sdr / index.html
kolaslab's picture
Update index.html
0e4238b verified
raw
history blame
3.4 kB
updateDetections() {
const detections = document.getElementById('detections');
detections.innerHTML = Array.from(this.targets)
.map(target => `
<div class="detection">
${target.type === 'aircraft' ? 'โœˆ๏ธ' : '๐Ÿš—'}
${target.id}
${target.speed.toFixed(0)}kts
${target.type === 'aircraft' ? `${target.altitude.toFixed(0)}ft` : ''}
Signal: ${(target.signalStrength * 100).toFixed(0)}%
Position: ${target.position.lat.toFixed(2)}ยฐ, ${target.position.lon.toFixed(2)}ยฐ
</div>
`).join('');
}
updateSignalStrengths() {
sdrStations.forEach(station => {
const bar = document.querySelector(`#rx-${station.url.split(':')[0]} .signal-bar`);
if(bar) {
const strength = 40 + Math.random() * 60;
bar.style.width = `${strength}%`;
}
});
}
startTracking() {
setInterval(() => {
// ํƒ€๊ฒŸ ์ถ”๊ฐ€/์ œ๊ฑฐ
if(Math.random() < 0.1 && this.targets.size < 15) {
this.targets.add(this.generateTarget());
}
if(Math.random() < 0.1 && this.targets.size > 0) {
this.targets.delete(Array.from(this.targets)[0]);
}
// ๊ธฐ์กด ํƒ€๊ฒŸ ์—…๋ฐ์ดํŠธ (์›€์ง์ž„ ์‹œ๋ฎฌ๋ ˆ์ด์…˜)
this.targets.forEach(target => {
// ํ˜„์žฌ ๋ฐฉํ–ฅ์œผ๋กœ ์ด๋™
const speed = target.speed / 3600; // kts to degrees per second (approximate)
const radians = target.heading * Math.PI / 180;
target.position.lon += Math.sin(radians) * speed;
target.position.lat += Math.cos(radians) * speed;
// ํ™”๋ฉด ๊ฒฝ๊ณ„ ์ฒ˜๋ฆฌ
if(target.position.lon > 180) target.position.lon -= 360;
if(target.position.lon < -180) target.position.lon += 360;
if(target.position.lat > 75) target.position.lat = 75;
if(target.position.lat < -75) target.position.lat = -75;
// ๊ฐ€๋” ๋ฐฉํ–ฅ ๋ณ€๊ฒฝ
if(Math.random() < 0.05) {
target.heading += (Math.random() - 0.5) * 30;
target.heading = (target.heading + 360) % 360;
}
// ์‹ ํ˜ธ ๊ฐ•๋„ ๋ณ€๋™
target.signalStrength = Math.max(0.1, Math.min(1, target.signalStrength + (Math.random() - 0.5) * 0.1));
});
this.drawWorldMap();
this.drawStations();
this.drawTargets();
this.updateDetections();
this.updateSignalStrengths();
}, 100);
}
}
// Initialize global radar system
const radar = new GlobalRadarSystem();
</script>
</body>
</html>