1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 """A module loading the Tjaereborg airfoils.
23 C{Airfoil} instances are created from the L{windSimSuite.sections} module.
24 All the airfoils are then stored in the L{AIRFOILS} dictionary.
25 """
26 import os
27
28 from windSimSuite.common import Angle
29 from windSimSuite.sections import Airfoil, Curve
30
32 """Return an C{Airfoil} instance from its filename"""
33 fid = open(file_name)
34 lines = fid.readlines()
35 fid.close()
36
37 airfoil = Airfoil()
38 attached_lift_curve = Curve()
39 separated_lift_curve = Curve()
40 drag_curve = Curve()
41
42 for line in lines:
43 values = map(float, line.split())
44 angle = Angle(values[0], "deg")
45 attached_lift_curve.add_point(angle,
46 values[1])
47 drag_curve.add_point(angle, values[2])
48 separated_lift_curve.add_point(angle,
49 values[-1])
50 airfoil.set_lift(attached_lift_curve,
51 separated_lift_curve)
52 airfoil.set_drag(drag_curve)
53 return airfoil
54
55
56
57 AIR_DIR = os.path.join(os.path.dirname(__file__), "datas")
58
59 AIRFOILS = {}
60 for idx in range(4, 15):
61 key = "%02d" % idx
62 filename = "tjaere%s_ds.dat" % key
63 airfoil_obj = load_airfoil(os.path.join(AIR_DIR, filename))
64 airfoil_obj.set_name(key)
65 AIRFOILS[key] = airfoil_obj
66