Package windSimSuite :: Module tower
[hide private]

Source Code for Module windSimSuite.tower

 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 tower definition""" 
23  import numpy as N 
24  from windSimSuite.common import ObjectWithNodesAndElems 
25   
26   
27 -class AerodynamicsTower:
28 """The tower definition for aerodynamics calculation. 29 """ 30
31 - def __init__(self):
32 self.aero_height = 0. 33 self.correction_height = 0. 34 self.radius = 0. 35 self.local_vector = N.zeros((3, 1))
36
37 - def set_radius(self, radius):
38 """Set the tower radius""" 39 self.radius = radius
40
41 - def get_radius_at(self, aero_height):
42 """Return the tower radius from a height position. 43 User using a tower model different from a cylinder 44 will have to override that method by defining 45 their own tower.""" 46 return self.radius
47
48 - def set_aero_height(self, aero_height):
49 """Set the height of the tower for aerodynamic 50 calculations. The nacelle is in that case seen 51 as a point""" 52 self.aero_height = aero_height 53 self.local_vector = N.array([ [0.], 54 [0.], 55 [self.aero_height] ])
56
57 - def set_correction_height(self, height):
58 """Set a height for the tower shadow correction. 59 Currently not used because the correction 60 is in development""" 61 self.correction_height = height
62
63 - def get_abs_vector(self):
64 """Return the tower vector in the absolute 65 reference frame. This is direct in that case.""" 66 return self.local_vector
67 68
69 -class Tower(AerodynamicsTower, ObjectWithNodesAndElems):
70 """The tower defition. This class gathers the aerodynamics 71 calculation and the MBDyn part. 72 """ 73
74 - def __init__(self, name="tower"):
75 AerodynamicsTower.__init__(self) 76 ObjectWithNodesAndElems.__init__(self, name) 77 self.own_para_names += ["aero_height", 78 "correction_height"]
79