|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<title>Hyperscan: Global SDR Radar(Simul)</title> |
|
<style> |
|
|
|
body { |
|
margin: 0; |
|
padding: 20px; |
|
background: #000; |
|
color: #0f0; |
|
font-family: monospace; |
|
overflow: hidden; |
|
} |
|
.container { |
|
display: grid; |
|
grid-template-columns: 300px 1fr; |
|
gap: 20px; |
|
} |
|
.sidebar { |
|
background: #111; |
|
padding: 15px; |
|
border-radius: 8px; |
|
height: calc(100vh - 40px); |
|
overflow-y: auto; |
|
} |
|
#map { |
|
background: #111; |
|
border-radius: 8px; |
|
height: calc(100vh - 40px); |
|
} |
|
|
|
|
|
.receiver { |
|
margin: 10px 0; |
|
padding: 10px; |
|
background: #1a1a1a; |
|
border-radius: 4px; |
|
position: relative; |
|
} |
|
.status { |
|
display: flex; |
|
align-items: center; |
|
margin-bottom: 5px; |
|
} |
|
.led { |
|
width: 8px; |
|
height: 8px; |
|
border-radius: 50%; |
|
margin-right: 8px; |
|
} |
|
.active { |
|
background: #0f0; |
|
box-shadow: 0 0 10px #0f0; |
|
animation: pulse 2s infinite; |
|
} |
|
@keyframes pulse { |
|
0% { opacity: 1; } |
|
50% { opacity: 0.5; } |
|
100% { opacity: 1; } |
|
} |
|
.inactive { |
|
background: #f00; |
|
} |
|
.signal-strength { |
|
height: 4px; |
|
background: #222; |
|
margin-top: 5px; |
|
border-radius: 2px; |
|
} |
|
.signal-bar { |
|
height: 100%; |
|
background: #0f0; |
|
width: 50%; |
|
transition: width 0.3s; |
|
} |
|
|
|
|
|
.detection { |
|
padding: 5px; |
|
margin: 5px 0; |
|
font-size: 12px; |
|
border-left: 2px solid #0f0; |
|
} |
|
|
|
|
|
.alert { |
|
background: #911; |
|
padding: 5px; |
|
margin: 5px 0; |
|
border-left: 2px solid #f00; |
|
color: #f66; |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<div class="container"> |
|
|
|
<div class="sidebar"> |
|
<h2>Hyperscan: Global SDR Radar(Simul)</h2> |
|
|
|
<h3>SDR Receivers</h3> |
|
<div id="receivers"></div> |
|
|
|
<h3>Real-time Detections</h3> |
|
<div id="detections"></div> |
|
|
|
<h3>Events</h3> |
|
<div id="events"></div> |
|
</div> |
|
|
|
|
|
<canvas id="map"></canvas> |
|
</div> |
|
|
|
<script> |
|
|
|
const sdrStations = [ |
|
{ |
|
name: "Twente WebSDR", |
|
url: "websdr.ewi.utwente.nl:8901", |
|
location: [52.2389, 6.8343], |
|
frequency: "0-29.160 MHz", |
|
range: 200, |
|
active: true |
|
}, |
|
{ |
|
name: "KiwiSDR Switzerland", |
|
url: "hb9ryz.no-ip.org:8073", |
|
location: [47.3769, 8.5417], |
|
frequency: "0-30 MHz", |
|
range: 160, |
|
active: true |
|
}, |
|
{ |
|
name: "SUWS WebSDR UK", |
|
url: "websdr.suws.org.uk", |
|
location: [51.2785, -0.7642], |
|
frequency: "0-30 MHz", |
|
range: 150, |
|
active: true |
|
} |
|
]; |
|
|
|
class RadarSystem { |
|
constructor() { |
|
|
|
this.canvas = document.getElementById('map'); |
|
this.ctx = this.canvas.getContext('2d'); |
|
|
|
|
|
this.targets = new Set(); |
|
|
|
|
|
this.trails = new Map(); |
|
|
|
|
|
this.eventsLog = []; |
|
|
|
|
|
this.stormActive = false; |
|
this.stormCenter = { lat: 50.5, lon: 5.0 }; |
|
this.stormRadius = 200; |
|
|
|
this.setupCanvas(); |
|
this.renderReceivers(); |
|
this.startTracking(); |
|
} |
|
|
|
|
|
setupCanvas() { |
|
this.canvas.width = this.canvas.offsetWidth; |
|
this.canvas.height = this.canvas.offsetHeight; |
|
window.addEventListener('resize', () => { |
|
this.canvas.width = this.canvas.offsetWidth; |
|
this.canvas.height = this.canvas.offsetHeight; |
|
}); |
|
} |
|
|
|
|
|
renderReceivers() { |
|
const container = document.getElementById('receivers'); |
|
container.innerHTML = sdrStations.map(st => ` |
|
<div class="receiver" id="rx-${st.url.split(':')[0]}"> |
|
<div class="status"> |
|
<div class="led ${st.active ? 'active' : 'inactive'}"></div> |
|
<strong>${st.name}</strong> |
|
</div> |
|
<div>π‘ ${st.url}</div> |
|
<div>π» ${st.frequency}</div> |
|
<div>π ${st.location.join(', ')}</div> |
|
<div>Range: ${st.range}km</div> |
|
<div class="signal-strength"> |
|
<div class="signal-bar"></div> |
|
</div> |
|
</div> |
|
`).join(''); |
|
} |
|
|
|
|
|
generateTarget() { |
|
const lat = 51.5 + (Math.random()-0.5)*4; |
|
const lon = 5.0 + (Math.random()-0.5)*8; |
|
return { |
|
id: Math.random().toString(36).substr(2, 6).toUpperCase(), |
|
type: Math.random() > 0.7 ? 'aircraft' : 'vehicle', |
|
lat, |
|
lon, |
|
speed: (Math.random()*200 + 100).toFixed(0), |
|
altitude: (Math.random()*30000 + 1000).toFixed(0), |
|
heading: Math.random()*360, |
|
signalStrength: Math.random() |
|
}; |
|
} |
|
|
|
|
|
moveTarget(target) { |
|
const speedKnots = parseFloat(target.speed); |
|
|
|
const speedFactor = 0.00005; |
|
const rad = (target.heading * Math.PI) / 180; |
|
|
|
target.lat += Math.cos(rad) * speedKnots * speedFactor; |
|
target.lon += Math.sin(rad) * speedKnots * speedFactor; |
|
} |
|
|
|
|
|
toggleStorm() { |
|
this.stormActive = !this.stormActive; |
|
const msg = this.stormActive |
|
? "νν λ°μ! μμ κ΅λ μ°λ €" |
|
: "νν μλ©Έ. μν μ μν"; |
|
this.addEventLog(msg); |
|
} |
|
|
|
|
|
addEventLog(msg) { |
|
this.eventsLog.push(msg); |
|
const eventsDiv = document.getElementById('events'); |
|
|
|
eventsDiv.innerHTML += `<div class="alert">${msg}</div>`; |
|
|
|
if (this.eventsLog.length > 10) { |
|
this.eventsLog.shift(); |
|
eventsDiv.removeChild(eventsDiv.firstChild); |
|
} |
|
} |
|
|
|
|
|
latLongToXY(lat, lon) { |
|
const centerLat = 51.5; |
|
const centerLon = 5.0; |
|
const scale = 100; |
|
const x = (lon - centerLon) * scale + this.canvas.width / 2; |
|
const y = (centerLat - lat) * scale + this.canvas.height / 2; |
|
return { x, y }; |
|
} |
|
|
|
|
|
distanceKm(lat1, lon1, lat2, lon2) { |
|
const R = 6371; |
|
const dLat = (lat2 - lat1) * Math.PI/180; |
|
const dLon = (lon2 - lon1) * Math.PI/180; |
|
const a = Math.sin(dLat/2)*Math.sin(dLat/2) |
|
+ Math.cos(lat1*Math.PI/180)*Math.cos(lat2*Math.PI/180) |
|
* Math.sin(dLon/2)*Math.sin(dLon/2); |
|
return R * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); |
|
} |
|
|
|
|
|
drawBackground() { |
|
this.ctx.fillStyle = '#111'; |
|
this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height); |
|
|
|
this.ctx.strokeStyle = '#1a1a1a'; |
|
this.ctx.lineWidth = 1; |
|
|
|
for (let i=0; i<this.canvas.width; i+=50) { |
|
this.ctx.beginPath(); |
|
this.ctx.moveTo(i, 0); |
|
this.ctx.lineTo(i, this.canvas.height); |
|
this.ctx.stroke(); |
|
} |
|
|
|
for (let i=0; i<this.canvas.height; i+=50) { |
|
this.ctx.beginPath(); |
|
this.ctx.moveTo(0, i); |
|
this.ctx.lineTo(this.canvas.width, i); |
|
this.ctx.stroke(); |
|
} |
|
} |
|
|
|
|
|
drawStations() { |
|
|
|
if (this.stormActive) { |
|
const sc = this.latLongToXY(this.stormCenter.lat, this.stormCenter.lon); |
|
this.ctx.beginPath(); |
|
this.ctx.arc(sc.x, sc.y, this.stormRadius, 0, Math.PI*2); |
|
this.ctx.fillStyle = 'rgba(255,0,0,0.1)'; |
|
this.ctx.fill(); |
|
this.ctx.strokeStyle = 'rgba(255,0,0,0.5)'; |
|
this.ctx.stroke(); |
|
} |
|
|
|
|
|
sdrStations.forEach(st => { |
|
const pos = this.latLongToXY(st.location[0], st.location[1]); |
|
|
|
this.ctx.beginPath(); |
|
this.ctx.arc(pos.x, pos.y, st.range, 0, Math.PI*2); |
|
this.ctx.strokeStyle = st.active |
|
? 'rgba(0,255,0,0.2)' |
|
: 'rgba(255,0,0,0.2)'; |
|
this.ctx.stroke(); |
|
|
|
|
|
this.ctx.beginPath(); |
|
this.ctx.arc(pos.x, pos.y, 4, 0, Math.PI*2); |
|
this.ctx.fillStyle = st.active ? '#0f0' : '#f00'; |
|
this.ctx.fill(); |
|
|
|
|
|
this.ctx.fillStyle = '#0f0'; |
|
this.ctx.font = '10px monospace'; |
|
this.ctx.fillText(st.name, pos.x+8, pos.y+4); |
|
}); |
|
} |
|
|
|
|
|
drawTargets() { |
|
this.targets.forEach(target => { |
|
|
|
this.moveTarget(target); |
|
|
|
|
|
if (this.stormActive) { |
|
const distStorm = this.distanceKm( |
|
target.lat, target.lon, |
|
this.stormCenter.lat, this.stormCenter.lon |
|
); |
|
if (distStorm <= this.stormRadius) { |
|
target.signalStrength = Math.max(0, target.signalStrength - 0.01); |
|
} |
|
} |
|
|
|
|
|
const pos = this.latLongToXY(target.lat, target.lon); |
|
|
|
|
|
if (!this.trails.has(target.id)) { |
|
this.trails.set(target.id, []); |
|
} |
|
const trail = this.trails.get(target.id); |
|
trail.push({x: pos.x, y: pos.y}); |
|
if (trail.length > 100) { |
|
trail.shift(); |
|
} |
|
|
|
|
|
sdrStations.forEach(st => { |
|
if (st.active) { |
|
const dist = this.distanceKm( |
|
target.lat, target.lon, |
|
st.location[0], st.location[1] |
|
); |
|
if (dist <= st.range) { |
|
const sp = this.latLongToXY(st.location[0], st.location[1]); |
|
this.ctx.beginPath(); |
|
this.ctx.moveTo(sp.x, sp.y); |
|
this.ctx.lineTo(pos.x, pos.y); |
|
this.ctx.strokeStyle = `rgba(0,255,0,${target.signalStrength*0.3})`; |
|
this.ctx.stroke(); |
|
} |
|
} |
|
}); |
|
|
|
|
|
this.ctx.beginPath(); |
|
this.ctx.strokeStyle = (target.type==='aircraft') |
|
? 'rgba(255,255,0,0.3)' |
|
: 'rgba(0,255,255,0.3)'; |
|
for (let i=0; i<trail.length-1; i++) { |
|
this.ctx.moveTo(trail[i].x, trail[i].y); |
|
this.ctx.lineTo(trail[i+1].x, trail[i+1].y); |
|
} |
|
this.ctx.stroke(); |
|
|
|
|
|
this.ctx.beginPath(); |
|
this.ctx.arc(pos.x, pos.y, 3, 0, Math.PI*2); |
|
this.ctx.fillStyle = (target.type==='aircraft') ? '#ff0' : '#0ff'; |
|
this.ctx.fill(); |
|
|
|
|
|
this.ctx.fillStyle = '#666'; |
|
this.ctx.font = '10px monospace'; |
|
this.ctx.fillText(`${target.id} (${target.type})`, pos.x+8, pos.y+4); |
|
}); |
|
} |
|
|
|
|
|
updateDetections() { |
|
const detections = document.getElementById('detections'); |
|
let html = ''; |
|
this.targets.forEach(t => { |
|
html += ` |
|
<div class="detection"> |
|
${t.type==='aircraft' ? 'βοΈ' : 'π'} |
|
${t.id} |
|
Speed: ${t.speed}kts |
|
${t.type==='aircraft' ? 'Alt: '+t.altitude+'ft' : ''} |
|
Sig: ${(t.signalStrength*100).toFixed(0)}% |
|
</div> |
|
`; |
|
}); |
|
detections.innerHTML = html; |
|
} |
|
|
|
|
|
updateSignalStrengths() { |
|
sdrStations.forEach(st => { |
|
const bar = document.querySelector(`#rx-${st.url.split(':')[0]} .signal-bar`); |
|
if (bar) { |
|
const strength = 40 + Math.random()*60; |
|
bar.style.width = `${strength}%`; |
|
} |
|
}); |
|
} |
|
|
|
|
|
startTracking() { |
|
|
|
setInterval(() => { |
|
if (Math.random() < 0.2) { |
|
this.toggleStorm(); |
|
} |
|
}, 10000); |
|
|
|
|
|
setInterval(() => { |
|
|
|
if (Math.random() < 0.1 && this.targets.size < 15) { |
|
const newT = this.generateTarget(); |
|
this.targets.add(newT); |
|
this.addEventLog(`μ νκ² μΆν: ${newT.id}`); |
|
} |
|
|
|
if (Math.random() < 0.1 && this.targets.size > 0) { |
|
const first = Array.from(this.targets)[0]; |
|
this.targets.delete(first); |
|
this.addEventLog(`νκ² μλ©Έ: ${first.id}`); |
|
} |
|
|
|
|
|
this.drawBackground(); |
|
this.drawStations(); |
|
this.drawTargets(); |
|
|
|
|
|
this.updateDetections(); |
|
this.updateSignalStrengths(); |
|
}, 100); |
|
} |
|
} |
|
|
|
|
|
window.addEventListener('load', () => { |
|
new RadarSystem(); |
|
}); |
|
</script> |
|
</body> |
|
</html> |
|
|