-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathpropeller_builder.py
More file actions
149 lines (134 loc) · 5.5 KB
/
propeller_builder.py
File metadata and controls
149 lines (134 loc) · 5.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
from aviary.subsystems.propulsion.propeller.propeller_performance import PropellerPerformance
from aviary.subsystems.subsystem_builder import SubsystemBuilder
from aviary.utils.named_values import NamedValues
from aviary.variable_info.variables import Aircraft, Dynamic, Mission
class PropellerBuilder(SubsystemBuilder):
"""
Define the builder for a propeller model using the Hamilton Standard methodology that provides
methods to define the propeller subsystem's states, design variables, fixed values, initial
guesses, and mass names. It also provides methods to build OpenMDAO systems for the pre-mission
and mission computations of the subsystem, to get the constraints for the subsystem, and to
preprocess the inputs for
the subsystem.
Attributes
----------
name : str ('propeller')
Object label.
data : NamedVaues (<empty>), optional
Propeller performance data (optional). If provided, used instead of tabular data file
(Aircraft.Engine.Propeller.DATA_FILE).
"""
def __init__(self, name='propeller', data: NamedValues = None):
"""Initializes the PropellerBuilder object with a given name."""
super().__init__(name)
self.data = data
def build_pre_mission(self, aviary_inputs):
"""Builds an OpenMDAO system for the pre-mission computations of the subsystem."""
return
def build_mission(self, num_nodes, aviary_inputs):
"""Builds an OpenMDAO system for the mission computations of the subsystem."""
return PropellerPerformance(
num_nodes=num_nodes, aviary_options=aviary_inputs, propeller_data=self.data
)
def mission_inputs(self, **kwargs):
inputs = [
Dynamic.Atmosphere.MACH,
Aircraft.Engine.Propeller.TIP_SPEED_MAX,
Aircraft.Engine.Propeller.TIP_MACH_MAX,
Dynamic.Atmosphere.DENSITY,
Dynamic.Mission.VELOCITY,
Aircraft.Engine.Propeller.DIAMETER,
Aircraft.Engine.Propeller.ACTIVITY_FACTOR,
Aircraft.Engine.Propeller.INTEGRATED_LIFT_COEFFICIENT,
Aircraft.Nacelle.AVG_DIAMETER,
Dynamic.Atmosphere.SPEED_OF_SOUND,
Dynamic.Vehicle.Propulsion.RPM,
]
return inputs
def mission_outputs(self, **kwargs):
outputs = [Dynamic.Vehicle.Propulsion.THRUST]
return outputs
def get_design_vars(self):
"""
Design vars are only tested to see if they exist in pre_mission
Returns a dictionary of design variables for the propeller subsystem, where the keys are the
names of the design variables, and the values are dictionaries that contain the units for
the design variable, the lower and upper bounds for the design variable, and any
additional keyword arguments required by OpenMDAO for the design variable.
Returns
-------
parameters : dict
A dict of names for the propeller subsystem.
"""
# TODO bounds are rough placeholders
DVs = {
Aircraft.Engine.Propeller.ACTIVITY_FACTOR: {
'units': 'unitless',
'lower': 100,
'upper': 200,
# 'val': 100, # initial value
},
Aircraft.Engine.Propeller.DIAMETER: {
'units': 'ft',
'lower': 0.0,
'upper': None,
# 'val': 8, # initial value
},
Aircraft.Engine.Propeller.INTEGRATED_LIFT_COEFFICIENT: {
'units': 'unitless',
'lower': 0.0,
'upper': 0.5,
# 'val': 0.5,
},
}
return DVs
def get_parameters(self, aviary_inputs=None, phase_info=None):
"""
Parameters are only tested to see if they exist in mission.
The value doesn't change throughout the mission.
Returns a dictionary of fixed values for the propeller subsystem, where the keys
are the names of the fixed values, and the values are dictionaries that contain
the fixed value for the variable, the units for the variable, and any additional
keyword arguments required by OpenMDAO for the variable.
Returns
-------
parameters : dict
A dict of names for the propeller subsystem.
"""
parameters = {
Aircraft.Engine.Propeller.TIP_MACH_MAX: {
'val': 1.0,
'units': 'unitless',
},
Aircraft.Engine.Propeller.TIP_SPEED_MAX: {
'val': 0.0,
'units': 'ft/s',
},
Aircraft.Engine.Propeller.INTEGRATED_LIFT_COEFFICIENT: {
'val': 0.0,
'units': 'unitless',
},
Aircraft.Engine.Propeller.ACTIVITY_FACTOR: {
'val': 0.0,
'units': 'unitless',
},
Aircraft.Engine.Propeller.DIAMETER: {
'val': 0.0,
'units': 'ft',
},
Aircraft.Nacelle.AVG_DIAMETER: {
'val': 0.0,
'units': 'ft',
},
}
return parameters
def get_mass_names(self):
return []
def get_timeseries(self):
return [
Dynamic.Vehicle.Propulsion.SHAFT_POWER,
# Dynamic.Vehicle.Propulsion.SHAFT_POWER_MAX + '_out',
Dynamic.Vehicle.Propulsion.RPM,
Dynamic.Vehicle.Propulsion.TORQUE,
# Mission.Constraints.GEARBOX_SHAFT_POWER_RESIDUAL,
]