Merging Buildup Weight Models, Solid Materials Classes#212
Merging Buildup Weight Models, Solid Materials Classes#212JTrentSmart merged 39 commits intosuavecode:developfrom
Conversation
Contains the Solids Attribute classes, as well as "first drafts" of the weight correlations methods, which have not yet been tested and debugged.
Fixed a few errors that came from first startup of SUAVE following previous commit
Rib and Epoxy Classes now create proper versions of themselves. Prop NACA plotting was missing a coordinate value
Debugged and tested methods against Vahana original. Confirmed proper methodology and results accuracy
Changed eStopped_Rotor empty weight method to accomodate SUAVE vehicle structure Changed Methods organization structure to differentiate Correlation Methods from Buildup Methods
Finished Empty Weight Models for All Vehicle Types.
timdmacdo
left a comment
There was a problem hiding this comment.
The inline documentation is good, but the documentation needed for doxygen is mostly missing. Also, at least one of the weight functions is duplicated, and the others look at least very similar. These should be condensed to a single function in a common folder and called as needed.
| @@ -0,0 +1,53 @@ | |||
| # Weights_eStopped_Rotor.py | |||
| @@ -0,0 +1,53 @@ | |||
| # Weights_eStopped_Rotor.py | |||
There was a problem hiding this comment.
File needs doxygen tags and documentation.
| @@ -0,0 +1,29 @@ | |||
| # Acrylic.py | |||
There was a problem hiding this comment.
File needs doxygen tags and documentation.
| @@ -0,0 +1,29 @@ | |||
| # Aluminum.py | |||
There was a problem hiding this comment.
File needs doxygen tags and documentation.
|
|
||
| def __defaults__(self): | ||
|
|
||
| self.UTS = 75e6 # Ultimate Tensile Strength |
There was a problem hiding this comment.
Since these variables can be used outside of the class they must have verbose names.
There was a problem hiding this comment.
Changed to e.g. ultimate_tensile_strength
| # | ||
| # Created: Aug 2017, J. Smart | ||
|
|
||
| # !! CURRENTLY NON-FUNCTIONAL !! |
There was a problem hiding this comment.
I hope it's functional now?
There was a problem hiding this comment.
Deleted the file, realized the functionality I planned to add was already available elsewhere.
| thrust_motor.omega(conditions) | ||
| # link | ||
| lift_prop.inputs.omega = lift_motor.outputs.omega | ||
| lift_prop.thrust_angle = 90 |
There was a problem hiding this comment.
Change this to radians if possible to avoid confusion later on.
There was a problem hiding this comment.
Change obsoleted by file deletion.
| @@ -0,0 +1,10 @@ | |||
| """SUAVE.Methods.Weights.Correlations.eHelicopter | |||
There was a problem hiding this comment.
Use verbose names for classes and functions.
There was a problem hiding this comment.
Using this to ask generally about verbose names - would "electricHelicopter", etc. be sufficiently verbose?
There was a problem hiding this comment.
Also, our naming convention in SUAVE would be "Electric_Helicopter" for the folder, and "electric_helicopter" if this is the method name.
There was a problem hiding this comment.
Changed to comply with naming convention
|
|
||
| """ | ||
|
|
||
| weight = {} |
There was a problem hiding this comment.
Use the SUAVE Data class here.
planes
left a comment
There was a problem hiding this comment.
Echo what Tim said about using common folders. There's a ton of repeated code. We try to minimize repeated code in SUAVE. If you find a bug in one script then it's hard to be sure that bug doesn't exist in others.
You also need to create a regression script. I expect coveralls to send us all an email about this...
| self.features = Earth() | ||
| ## @ingroup Analyses-Planets |
There was a problem hiding this comment.
Why is this showing as different?
There was a problem hiding this comment.
For some reason it had three extra lines of whitespace at the bottom. They've been deleted.
|
|
||
| self.UTS = 75e6 # Ultimate Tensile Strength | ||
| self.USS = 55.2e6 # Ultimate Shear Strength | ||
| self.UBS = 0.0 # Ultimate Bearing Strength |
There was a problem hiding this comment.
Please use units, for example * Units.Pascals.
Echo what Tim said, you need descriptive names. Leaving a comment next to it isn't enough, when i'm viewing the results in another script I won't know what UBS is.
There was a problem hiding this comment.
Changed to verbose names in compliance with naming convention and added units
trunk/SUAVE/Attributes/Solids/Rib.py
Outdated
| @@ -0,0 +1,30 @@ | |||
| # Rib.py | |||
There was a problem hiding this comment.
What is rib?
Is this a component or a material?
There was a problem hiding this comment.
It's actually just Aluminum with an added minimum width. Suggest changing it to inherit from Aluminum rather than directly from Solid and adding the minimum width.
There was a problem hiding this comment.
Naming is a bit wierd...is there a better name?
| # ---------------------------------------------------------------------- | ||
| # Network | ||
| # ---------------------------------------------------------------------- | ||
| class Battery_Propeller(Propulsor): |
There was a problem hiding this comment.
Change obsoleted by file deletion.
| # Assumed Weights | ||
| #------------------------------------------------------------------------------- | ||
|
|
||
| weight['Payload'] = mPayload |
| @@ -0,0 +1,225 @@ | |||
| # prop.py | |||
There was a problem hiding this comment.
Propellers are already a thing in SUAVE. They are fully defined except weights. I suggest you input a propeller class and obtain all information from the provided class.
There was a problem hiding this comment.
The input can be within the method or the empty script. Chefs choice.
There was a problem hiding this comment.
Changed to take propeller class as function input.
| # Airfoil | ||
| #------------------------------------------------------------------------------- | ||
|
|
||
| NACA = np.multiply(5 * toc, [0.2969, -0.1260, -0.3516, 0.2843, -0.1015]) |
There was a problem hiding this comment.
I wish you asked me about all of this. I have all this stuff figured out for you. Ask me in the meeting tomorrow.
There was a problem hiding this comment.
Change was discussed in meeting, functionality unaltered.
|
|
||
| # Calculate Skin Weight Based on Torsion | ||
|
|
||
| tTorsion = My/(2*Solids.BiCF().USS*enclosedArea) # Torsion Skin Thickness |
There was a problem hiding this comment.
Changed to unpack.
| weight: Wing Mass [kg] | ||
| """ | ||
|
|
||
| N = 10 # Number of spanwise points |
There was a problem hiding this comment.
Allow these assumptions to be inputted or defaulted.
There was a problem hiding this comment.
Changed to function input with default value.
| dragInertia = 0 | ||
| dragLength = 0 | ||
|
|
||
| for i in range(0,4): |
There was a problem hiding this comment.
Changed to xrange throughout the project.
|
Hey Jordan. Finish this |
Still needs doxygen/docstring updates to reflect changes to functional code
Package of Changes for Pull Request
| @@ -0,0 +1,352 @@ | |||
| # eVTOL_Weights_Buildup_Regression.py | |||
| # | |||
| # Author: Jordan Smart, Feb. 2018 | |||
There was a problem hiding this comment.
Example:
Created: Mar, 2014, SUAVE Team
Modified: Jan, 2016, M. Vegh
There was a problem hiding this comment.
Changed throughout project to comply with style guide.
| # eVTOL_Weights_Buildup_Regression.py | ||
| # | ||
| # Author: Jordan Smart, Feb. 2018 | ||
|
|
| vehicle.mass_properties.operating_empty = 640. * Units.kg | ||
| vehicle.mass_properties.max_takeoff = 1000. * Units.kg | ||
|
|
||
| vehicle.reference_area = 12. |
| fuselage = SUAVE.Components.Fuselages.Fuselage() | ||
| fuselage.tag = 'fuselage' | ||
|
|
||
| fuselage.lengths.total = 5.5 |
There was a problem hiding this comment.
Units? Not necessary, but might look more consistent.
| # Planet.py | ||
| # | ||
| # Created: | ||
| # Modified: Feb 2016, Andrew Wendorff |
There was a problem hiding this comment.
I didn't actually modify it, for some reason at one point my version had three extra lines of whitespace at the bottom which have been removed
There was a problem hiding this comment.
Put it back! Do:
git checkout develop trunk/SUAVE/Analyses/Planets/Planet.py
| @@ -0,0 +1,31 @@ | |||
| ## @ingroup Attributes-Solids | |||
|
|
|||
| # BiCF.py | |||
There was a problem hiding this comment.
I would change this to a more verbose name, so it's more clear what it is from just the variable name
There was a problem hiding this comment.
Changed to Bidirectional_Carbon_Fiber
|
|
||
| def __defaults__(self): | ||
|
|
||
| self.ultimateTensileStrength = 0.0 *Units.Pa |
There was a problem hiding this comment.
attributes don't match our naming convention.
should be:
self.ultimate_tensile_strength
There was a problem hiding this comment.
Changed to comply with style guide.
|
|
||
| def __defaults__(self): | ||
|
|
||
| self.ultimateTensileStrength = 600e6 *Units.Pa |
There was a problem hiding this comment.
Changed to comply with style guide.
|
|
||
| def __defaults__(self): | ||
|
|
||
| self.ultimateTensileStrength = 75e6 *Units.Pa |
There was a problem hiding this comment.
attribute naming conventions are off. should be
self.ultimate_tensile_strength
There was a problem hiding this comment.
Changed to comply with style guide.
| @@ -0,0 +1,31 @@ | |||
| ## @ingroup Attributes-Solids | |||
|
|
|||
| # UniCF.py | |||
There was a problem hiding this comment.
Have a more verbose name for the file. See BiCF.py
There was a problem hiding this comment.
Changed to comply with style guide.
| #------------------------------------------------------------------------------- | ||
|
|
||
| def prop(prop, | ||
| maximumThrust, |
There was a problem hiding this comment.
Changed to comply with style guide.
|
|
||
| def wing(wing, | ||
| config, | ||
| maxThrust, |
There was a problem hiding this comment.
Still need to update naming convention for instantiating class
There was a problem hiding this comment.
Changed to comply with style guide.
| config SUAVE Config Data Structure | ||
| speedOfSound Local Speed of Sound [m/s] | ||
| maximumTipMach Allowable Tip Mach Number [Unitless] | ||
| diskAreaFactor Disk Area Factor [Unitless] |
There was a problem hiding this comment.
be more clear in documentation what Disk Area Factor is
There was a problem hiding this comment.
Added more descriptive documentation.
| tTorsion = My*dx/(2*BiCF().ultimateShearStrength*torsionArea) # Torsion Skin Thickness | ||
| tTorsion = np.maximum(tTorsion,BiCF().minimumGageThickness*np.ones(N)) # Gage Constraint | ||
| mTorsion = tTorsion * torsionLength * BiCF().density # Torsion Mass | ||
| mCore = Honeycomb().minimumGageThickness*torsionLength*Honeycomb().density*np.ones(N) # Core Mass |
There was a problem hiding this comment.
update attribute naming convention
There was a problem hiding this comment.
Change obsoleted by switch to unpack of material properties.
planes
left a comment
There was a problem hiding this comment.
One other thing to do, make sure to add periods to force float data types.
| @@ -0,0 +1,352 @@ | |||
| # eVTOL_Weights_Buildup_Regression.py | |||
| # | |||
| # Author: Jordan Smart, Feb. 2018 | |||
There was a problem hiding this comment.
Example:
Created: Mar, 2014, SUAVE Team
Modified: Jan, 2016, M. Vegh
| # Planet.py | ||
| # | ||
| # Created: | ||
| # Modified: Feb 2016, Andrew Wendorff |
There was a problem hiding this comment.
Put it back! Do:
git checkout develop trunk/SUAVE/Analyses/Planets/Planet.py
|
|
||
| # Weights_electricHelicopter.py | ||
| # | ||
| # Created: Mar 2017, J. Smart |
There was a problem hiding this comment.
Wrong style:
# Created: Mar, 2014, SUAVE Team
# Modified: Jan, 2016, M. Vegh
There was a problem hiding this comment.
Changed throughout project to comply with style guide.
|
|
||
| # Weights_electricStoppedRotor.py | ||
| # | ||
| # Created: Aug 2017, J. Smart |
There was a problem hiding this comment.
Updated to correct titles.
| @@ -0,0 +1,53 @@ | |||
| # Weights_electricTiltrotor.py | |||
| # | |||
| # Created: Mar 2017, J. Smart | |||
There was a problem hiding this comment.
Updated to correct titles.
| boltDiam = 2 * np.sqrt(boltArea/np.pi) # Bolt Diameter | ||
| lamThk = F_landing/(boltDiam*bidirectional_carbon_fiber().ultimate_bearing_strength) # Laminate Thickness | ||
| lamVol = (np.pi*(20*lamThk)**2)*(lamThk/3) # Laminate Pad volume | ||
| massKeel += 4*lamVol*bidirectional_carbon_fiber().density # Mass of 4 Pads |
There was a problem hiding this comment.
Changed to unpack of material properties.
|
|
||
| # Calculate Skin Weight Based on Torsion | ||
|
|
||
| tTorsion = My/(2*bidirectional_carbon_fiber().ultimate_shear_strength*enclosedArea) # Torsion Skin Thickness |
There was a problem hiding this comment.
Changed to unpack of material properties.
| # Core Mass | ||
|
|
||
| mCore = coreArea*honeycomb().density*np.ones(N) | ||
| mGlue += epoxy().minimum_gage_thickness*epoxy().density*skinLength*np.ones(N) |
There was a problem hiding this comment.
Changed to unpack of material properties.
|
|
||
| box = coord * chord | ||
| rRoot = (np.amax(box[:,1])-np.amin(box[:,1]))/2 | ||
| t = np.amax(CF)/(2*np.pi*rRoot*aluminum().ultimate_tensile_strength) + \ |
There was a problem hiding this comment.
Changed to unpack of material properties.
|
|
||
| # Calculate Skin Weight Based on Torsion | ||
|
|
||
| tTorsion = My*dx/(2*bidirectional_carbon_fiber().ultimate_shear_strength*torsionArea) # Torsion Skin Thickness |
There was a problem hiding this comment.
Changed to unpack of material properties.
| @@ -0,0 +1,55 @@ | |||
| ## @ ingroup Analyses-Weights | |||
There was a problem hiding this comment.
Have you tested that @ ingroup works with the space?
timdmacdo
left a comment
There was a problem hiding this comment.
these are documentation update requests
| # Analysis | ||
| # ---------------------------------------------------------------------- | ||
|
|
||
| class Weights_electric_helicopter(Weights): |
| class Weights_electric_helicopter(Weights): | ||
| """ SUAVE.Analyses.Weights.Weights_electricHelicopter() | ||
| """ | ||
| def __defaults__(self): |
There was a problem hiding this comment.
Functions need documentation
There was a problem hiding this comment.
Documentation added.
| # Analysis | ||
| # ---------------------------------------------------------------------- | ||
|
|
||
| class Weights_electric_stopped_rotor(Weights): |
There was a problem hiding this comment.
Doxygen and function documentation
There was a problem hiding this comment.
Tag and documentation added.
| # Analysis | ||
| # ---------------------------------------------------------------------- | ||
|
|
||
| class Weights_electric_tiltrotor(Weights): |
There was a problem hiding this comment.
Doxygen and function docs
There was a problem hiding this comment.
Tag and documentation added.
| # Acrylic Solid Class | ||
| #------------------------------------------------------------------------------- | ||
|
|
||
| class acrylic(solid): |
There was a problem hiding this comment.
Doxygen and function docs
There was a problem hiding this comment.
Tag and documentation added.
| # Wing | ||
| #------------------------------------------------------------------------------- | ||
|
|
||
| def wing(wing, |
There was a problem hiding this comment.
Doxygen and function doc format update
There was a problem hiding this comment.
Tag and documentation added.
| # Wiring | ||
| #------------------------------------------------------------------------------- | ||
|
|
||
| def wiring(config, |
There was a problem hiding this comment.
Doxygen and function docs format update
There was a problem hiding this comment.
Tag and documentation added.
| # Empty | ||
| #------------------------------------------------------------------------------- | ||
|
|
||
| def empty(config, |
There was a problem hiding this comment.
Doxygen and function docs format update
There was a problem hiding this comment.
Tag and documentation added.
| # Empty | ||
| #------------------------------------------------------------------------------- | ||
|
|
||
| def empty(config, |
There was a problem hiding this comment.
Doxygen and function docs format update
There was a problem hiding this comment.
Tag and documentation added.
| # Empty | ||
| #------------------------------------------------------------------------------- | ||
|
|
||
| def empty(config, |
There was a problem hiding this comment.
Doxygen and function docs format update
There was a problem hiding this comment.
Tag and documentation added.
| wing.sweeps.leading_edge = 0. * Units.degrees | ||
| wing.sweeps.half_chord = 0. * Units.degrees | ||
|
|
||
| wing.xMotor = [0.5, 0.5] |
There was a problem hiding this comment.
Changed to motor_spanwise_locations
| # ---------------------------------------------------------------------- | ||
|
|
||
| class Weights_electric_helicopter(Weights): | ||
| """ SUAVE.Analyses.Weights.Weights_electricHelicopter() |
There was a problem hiding this comment.
Tag and documentation added.
| # ---------------------------------------------------------------------- | ||
|
|
||
| class Weights_electric_stopped_rotor(Weights): | ||
| """ SUAVE.Analyses.Weights.Weights_electricStoppedRotor() |
There was a problem hiding this comment.
Tag and documentation added.
| #------------------------------------------------------------------------------- | ||
|
|
||
| def prop(prop, | ||
| maximum_thrust, |
There was a problem hiding this comment.
a lot of this data can be gathered from the propeller: Number of blades and some ratios.
There was a problem hiding this comment.
Number of blades changed to reference propeller data. User can override defaults to use propeller data if desired, but since the method depends on an assumed and approximate geometry for the prop, I prefer to leave them with default values to remain workable.
|
|
||
| # Calculate Skin Weight Based on Torsion | ||
|
|
||
| tTorsion = My*dx/(2*BiCF_USS*torsionArea) # Torsion Skin Thickness |
There was a problem hiding this comment.
Comments aligned.
| @@ -3,7 +3,10 @@ | |||
| ## @ingroup Analyses | |||
There was a problem hiding this comment.
Is this correct tag? (I don't know)
| @@ -0,0 +1,65 @@ | |||
| ## @ingroup Attributes-Solids | |||
|
|
|||
| # Honeycomb.py | |||
There was a problem hiding this comment.
Would it be better to make this "Carbon_Fiber_Honeycomb"? Im curious if there will ever be aluminum honeycomb?
There was a problem hiding this comment.
Good idea. Changed.
trunk/SUAVE/Attributes/Solids/Rib.py
Outdated
| @@ -0,0 +1,30 @@ | |||
| # Rib.py | |||
There was a problem hiding this comment.
Naming is a bit wierd...is there a better name?
| maximum_g_load = 3.8, | ||
| landing_impact_factor = 3.5, | ||
| safety_factor = 1.5): | ||
| """ weight = SUAVE.Methods.Weights.Buildups.Common.fuselage( |
There was a problem hiding this comment.
Is this part of comment necessary?
There was a problem hiding this comment.
I believe so. The Documentation guide only says that this section should be a description of the function, and I think a full location of the function and the default values are good, immediate references that someone would want to be able to quickly check on the documentation.
| shear_center = 0.25, | ||
| speed_of_sound = 340.294, | ||
| tip_max_mach_number = 0.65): | ||
| """weight = SUAVE.Methods.Weights.Buildups.Common.prop( |
| shear_center_location = 0.25, | ||
| margin_factor = 1.2): | ||
|
|
||
| """weight = SUAVE.Methods.Weights.Buildups.Common.wing( |
| def wiring(config, | ||
| motor_spanwise_locations, | ||
| max_power_draw): | ||
| """ weight = SUAVE.Methods.Weights.Buildups.Common.wiring( |
| disk_area_factor = 1.15, | ||
| max_thrust_to_weight_ratio = 1.1, | ||
| motor_efficiency = 0.85 * 0.98): | ||
| """weight = SUAVE.Methods.Weights.Buildups.Electric_Helicopter.empty( |
Includes buildup weight models intended for eVTOL aircraft and general purpose solid materials classes