Package windSimSuite :: Module nacelle
[hide private]

Source Code for Module windSimSuite.nacelle

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  # 
 4  # This file is part of MBDyn sim suite. 
 5  # Copyright (C) 2007 André ESPAZE, as part of a Master thesis supervised by 
 6  # Martin O.L.Hansen (DTU) and Nicolas Chauvat (Logilab) 
 7   
 8  # MBDyn sim suite is free software; you can redistribute it and/or modify 
 9  # it under the terms of the GNU General Public License as published by 
10  # the Free Software Foundation; either version 2 of the License, or 
11  # (at your option) any later version. 
12  # 
13  # This program is distributed in the hope that it will be useful, 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  # GNU General Public License for more details. 
17  # 
18  # You should have received a copy of the GNU General Public License 
19  # along with this program; if not, write to the Free Software 
20  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
21  # 
22  """The nacelle definition""" 
23  import numpy as N 
24  from windSimSuite.common import ObjectWithNodesAndElems, Angle 
25  from windSimSuite.references import REFERENCE_FRAME, ReferenceFrames 
26   
27   
28 -class AerodynamicsNacelle:
29 """A nacelle for unsteady BEM calculations. 30 """ 31
32 - def __init__(self):
33 self.angle = {"yaw" : Angle(0., "deg"), 34 "tilt" : Angle(0., "deg")} 35 self.length = 0. 36 self.local_vector = N.zeros((3, 1)) 37 38 self.references = ReferenceFrames() 39 self._add_reference_frames()
40
41 - def _add_reference_frames(self):
42 """Add the yaw and tilt reference frames""" 43 for key in ["yaw", "tilt"]: 44 ref = REFERENCE_FRAME[key]() 45 ref.set_angle(self.angle[key]) 46 ref.calculate() 47 self.references.add(ref)
48
49 - def set_yaw_angle(self, value, unit_key="deg"):
50 """Set the yaw angle for the nacelle and recalculate 51 the corresponding reference frame. 52 53 @type value: a float 54 @param value: the yaw value 55 56 @type unit_key: a string 57 @param unit_key: the 'rad' or 'deg' value""" 58 self.angle["yaw"][unit_key] = value 59 self.references["yaw"].calculate()
60
61 - def set_tilt_angle(self, value, unit_key="deg"):
62 """Set the tilt angle for the nacelle and recalculate 63 the corresponding reference frame. 64 65 @type value: a float 66 @param value: the tilt value 67 68 @type unit_key: a string 69 @param unit_key: the 'rad' or 'deg' value""" 70 self.angle["tilt"][unit_key] = value 71 self.references["tilt"].calculate()
72
73 - def set_length(self, value):
74 """Set the nacelle length in M{m}""" 75 self.length = value 76 self.local_vector = N.array([ [-self.length], 77 [0.], 78 [0.] ])
79
80 - def get_abs_vector(self):
81 """Return the nacelle vector in the absolute reference frame""" 82 matrix = self.references.get_matrix_from("tilt") 83 return matrix * self.local_vector
84 85
86 -class Nacelle(AerodynamicsNacelle, ObjectWithNodesAndElems):
87 """The nacelle class. Gather the aerodynamics calculations 88 and the nodes and elements of MBDyn. 89 """ 90
91 - def __init__(self, name="nacelle"):
94