|
|
|
@ -138,7 +138,8 @@ class WindSimulation {
|
|
|
|
|
if(this.simulation) {
|
|
|
|
|
var i = this.wms.indexOf(wm);
|
|
|
|
|
var follower = document.getElementById("follower");
|
|
|
|
|
follower.innerHTML = "Aerogenerador Nº" + (i + 1) + "<br />" + (Math.round(this.simulationPot[i] * 100) / 100) + " GWh (" + Math.round(this.simulationPot[i] * 100 / 14.95) + "%)";
|
|
|
|
|
var perc = Math.round(this.simulationPot[i] * 100 / 14.95);
|
|
|
|
|
follower.innerHTML = "<h3>Aerogenerador Nº" + (i + 1) + "</h4>" + (Math.round(this.simulationPot[i] * 100) / 100) + ' GWh<br /><div class="bar" style="background: linear-gradient(to right, ' + (perc >= 80 ? '#fff' : '#f00') + ' ' + perc + '%, #000 ' + perc + '%);"></div><br />' + perc + '% ' + (perc < 50 ? '⚠️' : '');
|
|
|
|
|
follower.style.display = "block";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -178,6 +179,7 @@ class WindSimulation {
|
|
|
|
|
this.wms[i].lowPower(false);
|
|
|
|
|
document.getElementById("follower").style.display = "none";
|
|
|
|
|
document.getElementById("results").style.display = "none";
|
|
|
|
|
document.getElementById("numbers").innerHTML = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setRotation(dir) {
|
|
|
|
@ -230,7 +232,6 @@ class WindSimulation {
|
|
|
|
|
if(this.xhr != xhr) return;
|
|
|
|
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
|
|
|
var json = JSON.parse(xhr.responseText);
|
|
|
|
|
console.log(json.pot)
|
|
|
|
|
this.add_simulation(json.ws, json.pot);
|
|
|
|
|
this.xhr = null;
|
|
|
|
|
}
|
|
|
|
@ -265,6 +266,18 @@ class WindSimulation {
|
|
|
|
|
results.innerHTML = innerHTML;
|
|
|
|
|
results.style.display = "block";
|
|
|
|
|
|
|
|
|
|
if(Screen.isMobile) {
|
|
|
|
|
var numbers = "";
|
|
|
|
|
for(let i = 0; i < pot.length; i++) {
|
|
|
|
|
var p = new THREE.Vector3(this.wms[i].position.x, this.wms[i].position.y, 1);
|
|
|
|
|
p.project(screen.camera);
|
|
|
|
|
p.x = (p.x + 1) / 2 * window.innerWidth;
|
|
|
|
|
p.y = -(p.y - 1) / 2 * window.innerHeight;
|
|
|
|
|
numbers += '<div style="left: ' + p.x + 'px; top: ' + p.y + 'px;">' + (i + 1) + '</div>';
|
|
|
|
|
}
|
|
|
|
|
document.getElementById("numbers").innerHTML = numbers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var geometry = new THREE.PlaneGeometry(this.width, this.height, 10 * this.width, 10 * this.height);
|
|
|
|
|
var colors = new three.BufferAttribute(new Float32Array(geometry.attributes.position.count * 4), 4);
|
|
|
|
|
geometry.setAttribute('color', colors);
|
|
|
|
|