#################################################### # Functions #################################################### def find_com_conical_frustum(h, R1, R2): # Calculating denominator and numerator # of COM formula separately. denom = h * (pow(R1, 2) + 2*R1*R2 + 3*pow(R2, 2)) numer = 4 * (pow(R1, 2) + R1*R2 + pow(R2, 2)) # Calculating conical frustum COM distance from # a point and returning it return (denom / numer) def find_struct_com(m1, r1, m2, r2, m3, r3): # Double check with textbook - it should has a similar # to example situation. denom = m1*r1 + m2*r2 + m3*r3 numer = m1 + m2 + m3 # Total mass of structure # Calculating structure COM distance from a point # and returning it return (denom / numer) #################################################### # Calculations #################################################### # Masses of objects in the structure. mass_poly_base = 0.01 #kg mass_cone = 0.3 #kg mass_egg = 0.1 #kg # Geometry of Conical Frustum h = 0.5 #m R1 = 0.1 #m R2 = 0.2 #m # Measurements of COM distance from some point for each object. # Perhaps choose this point as the absolute bottom of the structure. # You can come up with estimates knowing object symmetry and or com # formulas for cones, spheres, cubes, etc, or by doing experiments. r_com_poly_base = 0.05 #m r_com_cone = find_com_conical_frustum(h, R1, R2) #m r_com_egg = 0.5 #m struct_com = find_struct_com(mass_poly_base, r_com_poly_base, mass_cone, r_com_cone, mass_egg, r_com_egg) print "COM Distance of Structure from My Chosen Point is %f." % struct_com
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question