Last active
July 3, 2017 11:52
-
-
Save ryanjdillon/0bdc65966e364cb9c7b490602beaaf12 to your computer and use it in GitHub Desktop.
Example routine for calculating modified body density of seals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calc_mod_density(mass_kg, dens_kgm3, n_blocks, block_type): | |
'''Calculate the modified density with attached blocks | |
Args | |
---- | |
mass_kg: float | |
mass of the seal (kg) | |
dens_kgm3: float | |
mass of the seal (kg/m^3) | |
block_type: str | |
Type of modification block for experiment (`weight` or `float`) | |
n_blocks: int | |
number of modifying blocks attached | |
Returns | |
------- | |
total_dens: float | |
combined density of seal and attached blocks | |
Notes | |
----- | |
All blocks dimensions were manually measured and then drawn in FreeCAD and | |
the volumes calculated using the FCInfo macro. | |
FLOAT: | |
Float blocks were made from ____ foam. They were attached with a neoprene | |
pouch but were not compensated by a lead strip. The effect of the pouch | |
buoyancy was not measured by considered to be negligible. | |
Float block dimensions (with and without sailcloth) | |
L:150mm, W:40mm, H:30mm (41, 29) | |
shaved 45deg on all edges, 5.5 mm from edge | |
Volume float - 0.000174510114214 m³ | |
Mass float - 0.034 kg | |
Mass float w/sailcloth - 0.042 kg | |
WEIGHT AND NEUTRAL: | |
Neutral and weight blocks were made from PE plastic with 2 16mm diameter | |
holes drilled length-wise to a depth of 144mm. These holes were | |
left empty for neutral blocks. For weight blocks, these holes were filled | |
with 140mm long ____ bars. | |
The buoyancy of the neoprene pouch with which they were attached was | |
compensated by a thin strip of lead that allowed the pouch to be neutral | |
at surface. As the neoprene compresses with depth, this strip should overcompensate | |
to a small degree. | |
PE block dimensions: | |
L:150mm, W:41mm, H:30mm | |
rounded on one width edge - 15mm from edge length-wise and height-wise | |
Hole dimensions (2 holes): | |
L:144mm length, D:16mm | |
Weight rod dimensions (one rod per hole): | |
L:140mm, D:15mm | |
Mass block w/holes - 0.118 kg | |
Mass weight bar - 0.260 kg | |
Mass weight block - 0.118 kg + 2(0.260 kg) = 0.638 kg | |
Volume block w/holes - 0.00012016274768 m³ | |
Volume weight bar - 0.00000176714586764 m³ | |
Volume weight+2bars - 1.202e-4 + 2(1.767e-6) = 1.237e-4 | |
4 weight tubes = 2 weights | |
''' | |
# Modifier block attributes | |
block_types = ['weight', 'float', 'neutral'] | |
mod_vol_m3 = {'weight':1.237e-4, 'float':1.745e-4, 'neutral':1.202e-4} | |
mod_mass_kg = {'weight': 0.638, 'float': 0.034, 'neutral':0.118} | |
# Calculate combined density | |
if block_type in block_types: | |
seal_vol_m3 = mass_kg / dens_kgm3 | |
total_mass = (mass_kg + (n_blocks * mod_mass_kg[block_type])) | |
total_vol = (seal_vol_m3 + (n_blocks * mod_vol_m3[block_type])) | |
total_dens = total_mass / total_vol | |
# Raise error if incorrect `block_type` passed | |
else: | |
raise KeyError("`block_type` must be 'weight', 'float', or 'neutral'" | |
return total_dens |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment