Direcciones

main
Sebastián Santisi 1 year ago
parent 8e023cb28a
commit 262ec12a5f

Binary file not shown.

Binary file not shown.

@ -31,7 +31,7 @@ function hide() {
function help() {
show('<h4>Simulador de Aerogeneradores y Parques Eólicos (SAPE)</h4>' +
'<div class="l s"><p>Desarrollado por:</p><ul><li>Dimas Barile (CSC-CONICET)</li><li>José Alberto Martínez Trespalacios (Universidad Tecnológica de Bolivar)</li><li>Sebastián Santisi (CSC-CONICET)</li></ul></div>');
'<div class="l s"><p>Desarrollado por:</p><ul><li>Dimas Barile (CSC-CONICET)</li><li>José Alberto Martínez Trespalacios (Universidad Tecnológica de Bolívar)</li><li>Sebastián Santisi (CSC-CONICET)</li></ul></div>');
}
function up() { light.shadow.camera.top += 1; light.shadow.camera.updateProjectionMatrix(); helper.update()}
@ -51,7 +51,15 @@ function up() { light.shadow.camera.top += 1; light.shadow.camera.updateProjecti
</div>
</div>
<div id="button" onclick="ws.simulate();">¡SIMULAR!</div>
<div id="help" onclick="help();">?</div>
<div id="help">
<ul>
<li onclick="ws.setRotation(0);"></li>
<li onclick="ws.setRotation(315);"></li>
<li onclick="ws.setRotation(270);"></li>
<li onclick="ws.setRotation(225);"></li>
<li onclick="help();" style="cursor: help">?</li>
</ul>
</div>
<div id="copyright">&copy;2024 Centro de Simulación Computacional para Aplicaciones Tecnológicas (CSC) - CONICET</div>
<div id="rotate"><img src="assets/rotar_telefono.png" /><p>Rotá tu<br />dispositivo</p></div>
<div id="logo"><a href="http://www.csc.gob.ar"><img src="assets/logooscuro.png" /></a></div>

@ -28,6 +28,10 @@ class WindSimulation {
this.simulation = null;
this.xhr = null;
this.rotation = Math.PI;
this.targetRotation = Math.PI;
this.dir = 0;
this.checkBoard = checkBoard(width, height);
scene.add(this.checkBoard);
@ -59,7 +63,7 @@ class WindSimulation {
}
for(var i = 0; i < this.mills; i++) {
var wm = new WindMill();
wm.position.set(i + 0.5, i + 0.5, 0);
wm.position.set(4 + 0.5, i + 5 - Math.ceil(this.mills / 2) + 0.5, 0);
wm.rotation.z = Math.PI;
scene.add(wm);
this.wms.push(wm);
@ -114,17 +118,41 @@ class WindSimulation {
}
}
for(var i = 0; i < this.wms.length; i++) {
for(var i = 0; i < this.wms.length; i++)
this.wms[i].animate();
//this.wms[i].rotation.z += 0.01;
var speed = 0.02;
if(Math.abs(this.targetRotation - this.rotation) > speed) {
var step = speed * Math.sign(this.targetRotation - this.rotation);
this.rotation += step;
for(var i = 0; i < this.wms.length; i++) {
this.wms[i].animate();
this.wms[i].rotation.z += step;
}
this.flag.rotation.z += step;
}
//this.flag.rotation.z += 0.01;
this.flag.animate();
renderer.render(scene, camera);
}
setRotation(dir) {
if(this.simulation) {
scene.remove(this.simulation);
this.simulation = null;
}
var rotations = {};
rotations[0] = Math.PI;
rotations[270] = Math.PI / 2;
rotations[270 + 45] = Math.PI * 3 / 4;
rotations[270 - 45] = Math.PI / 4;
if(! (dir in rotations)) return false;
this.dir = dir;
this.targetRotation = rotations[dir];
}
simulate() {
if(this.xhr != null)
this.xhr.abort();
@ -144,7 +172,7 @@ class WindSimulation {
var pos = [];
for(var i = 0; i < this.wms.length; i++)
pos.push([this.wms[i].position.y, this.wms[i].position.x]);
var data = JSON.stringify({"pos": pos});
var data = JSON.stringify({"pos": pos, "dir": this.dir});
xhr.send(data);
}

@ -12,7 +12,8 @@ class WindMill extends THREE.Group {
loader.load('assets/aspas_126m_85.stl', function(geometry) {
WindMill.geometryBlades = geometry;
});
loader.load('assets/cuerpo_126m_50.stl', function(geometry) {
loader.load('assets/nacele_126m_90.stl', function(geometry) {
//loader.load('assets/cuerpo_126m_50.stl', function(geometry) {
WindMill.geometryBody = geometry;
});
}
@ -41,7 +42,15 @@ class WindMill extends THREE.Group {
this.meshBody.scale.set(0.0075, 0.0075, 0.0075);
this.meshBody.position.z = 90/126;
var geometry = new THREE.CircleGeometry(0.5, 20);
var geometry = new THREE.CylinderGeometry(0.02, 0.025, 90/126, 15);
this.meshPole = new THREE.Mesh(geometry, this.material);
this.meshPole.castShadow = true;
this.meshPole.receiveShadow = true;
this.meshPole.rotateX(Math.PI/2);
this.meshPole.position.z = 90/126/2;
this.meshPole.position.x = 0.02;
geometry = new THREE.CircleGeometry(0.5, 20);
this.meshCircle = new THREE.Mesh(geometry, this.materialCircle);
this.meshCircle.receiveShadow = true;
this.meshCircle.position.z = 0.001;
@ -49,6 +58,7 @@ class WindMill extends THREE.Group {
this.add(this.meshBlades);
this.add(this.meshBody);
this.add(this.meshPole);
this.add(this.meshCircle);
this.spring1 = new Spring(0.5, 2, 20, 6, 1, new THREE.MeshBasicMaterial({color: 0xff0000}));

@ -10,11 +10,13 @@ def index():
if request.method != 'POST' or not request.data:
return abort(400);
params = json.loads(request.data.decode(encoding='utf-8'))
pos = params['pos'];
ws = xxx.run(pos);
pos = params['pos']
direction = params['dir']
ws = xxx.run(direction, pos);
return {
'pos': pos,
'ws': ws,
'dir': direction,
}
if __name__ == "__main__":

@ -26,7 +26,7 @@ body {
overflow-x: hidden;
overflow-y: scroll;
width: auto;
border: solid #fff 5px;
border: solid #fff .5vh;
height: auto;
background: #00000088;
padding: 4vh;
@ -73,13 +73,21 @@ body {
#help {
position: absolute;
right: 4vh;
top: 18vh;
border: solid white 3px;
top: 16vh;
font-weight: 800;
font-size: .8em;
}
#help li {
display: block;
float: left;
border: solid white .5vh;
padding: .1vh 1vh;
border-radius: 1vh;
font-size: .8em;
cursor: help;
cursor: pointer;
margin-left: 1vh;
width: 2.5vh;
text-align: center;
}
#copyright {

@ -71,20 +71,20 @@ def py_wake_Initial_Cong(D,name,h,U_ref,initial_position=initial_position):
windTurbines = py_wake_Initial_Cong(D, 'NREL_5MW', h, U_ref)
def run(initial_position=initial_position, U_ref=U_ref):
def run(direction=0, initial_position=initial_position, U_ref=U_ref):
initial_position = np.array(initial_position);
#site = UniformSite(p_wd=[1],
# ws=U_ref,
# initial_position=initial_position*D)
ds = xr.Dataset(
data_vars={'P': ('wd', [1])},
coords={'wd': [0]})
ds['TI'] = 0.1
site = XRSite(ds, interp_method='nearest', initial_position=initial_position*D, default_ws=np.atleast_1d(U_ref))
site = UniformSite(p_wd=[1] * 8,
ws=U_ref,
initial_position=initial_position*D)
#ds = xr.Dataset(
# data_vars={'P': ('wd', [1, 1, 1, 1])},
# coords={'wd': [0, 90, 180, 270]})
#ds['TI'] = 0.1
#site = XRSite(ds, interp_method='nearest', initial_position=initial_position*D, default_ws=np.atleast_1d(U_ref))
wt_x, wt_y = site.initial_position.T/D
wfm = PropagateDownwind(site, windTurbines, wake_deficitModel=TurboGaussianDeficit())
grid = XYGrid(x=np.arange(0, 10.01, 0.1)*126, y=np.arange(0, 10.01, 0.1)*126)
xa = wfm(x=wt_x*126, y=wt_y*126, wd=0, yaw=0).flow_map(grid)
xa = wfm(x=wt_x*126, y=wt_y*126, wd=direction, yaw=0).flow_map(grid)
ws = xa.WS_eff
return ws[:,:,0,0].values[:,:,0].tolist()

Loading…
Cancel
Save