Difference between revisions of "Final Report of Hydrogen Storage Optimization Project, Darell Jeremia Sitompul, 6 Juni 2023"
Darell0306 (talk | contribs) m |
Darell0306 (talk | contribs) m |
||
Line 5: | Line 5: | ||
− | + | ---- | |
+ | ---- | ||
+ | |||
+ | |||
+ | We need to optimize the storage surface area to a minimum and keep the volume at 1 liter. The storage space volume is fixed at 1 liter, but there are many combinations of radius and flat tube height. We can use programming to help us save alot of calculation time. | ||
+ | |||
+ | Below is the code: | ||
Finding Smallest Surface Area of the capsule with radius from 0 to 20 centimeters | Finding Smallest Surface Area of the capsule with radius from 0 to 20 centimeters | ||
import numpy as np | import numpy as np | ||
− | + | ||
− | + | ||
print(": Radius : Surface Area :") | print(": Radius : Surface Area :") | ||
r_max = 20 | r_max = 20 | ||
a = np.zeros((r_max, 2)) | a = np.zeros((r_max, 2)) | ||
+ | |||
for r in range (1, r_max + 1): | for r in range (1, r_max + 1): | ||
flat_tube_height = (1000-((4*np.pi*r**3)/3))/(np.pi*(r)**2) | flat_tube_height = (1000-((4*np.pi*r**3)/3))/(np.pi*(r)**2) | ||
Line 23: | Line 30: | ||
print(": ", a[r-1][0], " "*(6 - len(str(a[r-1][0]))), | print(": ", a[r-1][0], " "*(6 - len(str(a[r-1][0]))), | ||
" : ", a[r-1][1], " "*(12 - len(str(a[r-1][1]))), " :") | " : ", a[r-1][1], " "*(12 - len(str(a[r-1][1]))), " :") | ||
− | + | b = a | |
− | for i in range(len( | + | |
− | for j in range (len( | + | for i in range(len(b)): |
− | if | + | for j in range (len(b)): |
+ | if b[i][1] < b[j][1]: | ||
for n in range (2): | for n in range (2): | ||
− | temp = | + | temp = b[i][n] |
− | + | b[i][n] = b[j][n] | |
− | + | b[j][n] = temp | |
print("Minimum surface area will be found when") | print("Minimum surface area will be found when") | ||
− | print("Radius = ", | + | print("Radius = ", b[0][0]) |
− | print("Surface Area : ", | + | print("Surface Area : ", b[0][1]) |
+ | |||
Revision as of 16:25, 11 June 2023
Requirement:
- Capacity = 1 Liter - Budget = Rp.500.000,00 (Lima ratus ribu rupiah)
We need to optimize the storage surface area to a minimum and keep the volume at 1 liter. The storage space volume is fixed at 1 liter, but there are many combinations of radius and flat tube height. We can use programming to help us save alot of calculation time.
Below is the code:
Finding Smallest Surface Area of the capsule with radius from 0 to 20 centimeters
import numpy as np
print(": Radius : Surface Area :") r_max = 20 a = np.zeros((r_max, 2))
for r in range (1, r_max + 1): flat_tube_height = (1000-((4*np.pi*r**3)/3))/(np.pi*(r)**2) sur_area = ((2*np.pi*r) * flat_tube_height) + ((2*np.pi*r**2)*2) a[r-1][0] = int(r) a[r-1][1] = np.round(sur_area, 5) print(": ", a[r-1][0], " "*(6 - len(str(a[r-1][0]))), " : ", a[r-1][1], " "*(12 - len(str(a[r-1][1]))), " :") b = a
for i in range(len(b)): for j in range (len(b)): if b[i][1] < b[j][1]: for n in range (2): temp = b[i][n] b[i][n] = b[j][n] b[j][n] = temp print("Minimum surface area will be found when") print("Radius = ", b[0][0]) print("Surface Area : ", b[0][1])
When we run the program, the result will be shown like this
: Radius : Surface Area : : 1.0 : 2004.18879 : : 2.0 : 1016.75516 : : 3.0 : 704.36578 : : 4.0 : 567.02064 : : 5.0 : 504.71976 : : 6.0 : 484.12978 : : 7.0 : 490.96501 : : 8.0 : 518.08257 : : 9.0 : 561.51423 : : 10.0 : 618.87902 : : 11.0 : 688.6618 : : 12.0 : 769.85246 : : 13.0 : 861.7517 : : 14.0 : 963.86002 : : 15.0 : 1075.81113 : : 16.0 : 1197.33029 : : 17.0 : 1328.20743 : : 18.0 : 1468.27914 : : 19.0 : 1617.41642 : : 20.0 : 1775.51608 : Minimum surface area will be found when Radius = 6.0 Surface Area : 484.12978