Difference between revisions of "User:Muhammad.ihsan13"

From ccitonlinewiki
Jump to: navigation, search
(Final Report Hydrogen Storage Optimization)
(Final Report Hydrogen Storage Optimization)
Line 41: Line 41:
 
Dengan optimasi hidrogen yang memiliki kapasitas maksimal 1 liter dan biaya maksimal produksi sebesar Rp. 500.000, maka pemrograman untuk menghitung ukuran tabung yang optimal :
 
Dengan optimasi hidrogen yang memiliki kapasitas maksimal 1 liter dan biaya maksimal produksi sebesar Rp. 500.000, maka pemrograman untuk menghitung ukuran tabung yang optimal :
  
<syntaxhighlight lang="xml"> import numpy as np
+
<syntaxhighlight lang="xml">
 +
import numpy as np
 
from scipy.optimize import minimize
 
from scipy.optimize import minimize
 
def calculateSurfaceArea(radius, height):
 
def calculateSurfaceArea(radius, height):
Line 74: Line 75:
 
print('Optimal Radius:', optimal_radius, 'cm')
 
print('Optimal Radius:', optimal_radius, 'cm')
 
print('Optimal Height:', optimal_height, 'cm')
 
print('Optimal Height:', optimal_height, 'cm')
print('Optimal Surface Area:', optimal_surface_area, 'cm^2')<syntaxhighlight lang="xml">
+
print('Optimal Surface Area:', optimal_surface_area, 'cm^2')
 +
<syntaxhighlight lang="xml">
  
 
Optimal Radius: 5.419262767614773 cm
 
Optimal Radius: 5.419262767614773 cm

Revision as of 18:36, 12 June 2023

Bio Data


Nama : Muhammad Ihsan

NPM : 2106728225

Program Studi : Teknik Mesin

Hydrogen Storage Optimization

In this study case i will use a commonly used numerical method called "particle swarm optimization" (PSO):

1. Define the Problem: Clearly state the objective function that represents the performance criteria of the hydrogen storage system. It could be maximizing the storage capacity, minimizing the weight or volume, or optimizing any other relevant parameter.

2. Define Variables and Constraints: Identify the variables that can be adjusted to optimize the system, such as tank dimensions, materials, operating conditions, etc. Also, define any constraints that need to be satisfied, such as pressure limits, safety requirements, or cost considerations.

3. Initialize the Swarm: Create a population of potential solutions (particles) that represent different configurations of the hydrogen storage system. Randomly initialize their positions and velocities within the search space.

4. Evaluate Fitness: Evaluate the fitness of each particle by applying the objective function to its corresponding configuration. This step involves performing calculations and simulations to determine the system's performance for each particle.

5. Update Particle's Best Position: For each particle, compare its fitness with the best fitness achieved by that particle so far. If the current fitness is better, update the particle's best position accordingly.

6. Update Global Best Position: Identify the particle with the best fitness among all the particles and record its position as the global best position found so far.

7. Update Velocities and Positions: Update the velocities and positions of each particle based on its own best position and the global best position. This step involves using mathematical equations that incorporate inertia, cognitive, and social parameters to guide the particles' movement.

8. Repeat: Repeat steps 4 to 7 until a termination criterion is met. This criterion could be a maximum number of iterations, reaching a desired fitness threshold, or other convergence criteria.

9. Extract Optimal Solution: Once the algorithm terminates, the particle with the best fitness (global best) represents the optimized design and configuration of the hydrogen storage system. Extract the corresponding parameters and evaluate their values.

10. Validate and Refine: Validate the optimal solution obtained by implementing it in practical applications or conducting further simulations. Refine the solution if necessary based on additional constraints or considerations.

Particle swarm optimization is just one of many numerical methods available for optimization problems. Depending on the specific characteristics of the hydrogen storage system and the optimization goals, other methods like genetic algorithms, simulated annealing, or gradient-based optimization techniques may also be applicable.


Final Report Hydrogen Storage Optimization

Dengan optimasi hidrogen yang memiliki kapasitas maksimal 1 liter dan biaya maksimal produksi sebesar Rp. 500.000, maka pemrograman untuk menghitung ukuran tabung yang optimal :

<syntaxhighlight lang="xml"> import numpy as np from scipy.optimize import minimize def calculateSurfaceArea(radius, height):

   return 2 * np.pi * radius * height + 2 * np.pi * radius**2

def calculateVolume(radius, height):

   return np.pi * radius**2 * height
  1. Set constant variables

target_volume = 1000 # Constant volume (in cubic centimeters)

  1. Define the objective function to minimize

def objectiveFunction(x):

   radius, height = x
   surface_area = calculateSurfaceArea(radius, height)
   return surface_area
  1. Define the constraint function

def constraintFunction(x):

   radius, height = x
   volume = calculateVolume(radius, height)
   return volume - target_volume
  1. Set initial guess for optimization variables

initial_guess = [1.0, 1.0]

  1. Define the bounds for the variables

bounds = [(0, None), (0, None)]

  1. Define the optimization problem

constraint = {'type': 'eq', 'fun': constraintFunction}

  1. Solve the optimization problem

result = minimize(objectiveFunction, initial_guess, method='SLSQP', bounds=bounds, constraints=constraint)

  1. Extract the optimized variables

optimal_radius, optimal_height = result.x

  1. Calculate the optimized surface area

optimal_surface_area = calculateSurfaceArea(optimal_radius, optimal_height)

  1. Display the results

print('Optimal Radius:', optimal_radius, 'cm') print('Optimal Height:', optimal_height, 'cm') print('Optimal Surface Area:', optimal_surface_area, 'cm^2') <syntaxhighlight lang="xml">

Optimal Radius: 5.419262767614773 cm

Optimal Height: 10.83851313481415 cm

Optimal Surface Area: 553.5810444881138 cm^2