Giraldy Muhammad M S

From ccitonlinewiki
Jump to: navigation, search

Introduction

Giraldy Muhammad.jpg

Assalamu'alaikum Wr. Wb.

Halo semua! Perkenalkan, saya Giraldy Muhammad M S, dengan NPM 2006574111. Saya adalah mahasiswa Program Studi S1 Teknik Mesin angkatan 2020.

"Our greatest human adventure is the evolution of consciousness. We are in this life to enlarge the soul, liberate the spirit, and light up the brain." -Tom Robbins

Tugas Hydrogen Storage Optimization

Method To Optimaze Hydrogen Storage Design

1. Define the Problem: Clearly define the objective function that represents the efficiency and capacity of the hydrogen storage system. The objective function should take relevant parameters as input and output a value that quantifies the system's performance.

2. Initialize Particle Swarm: Generate a swarm of particles, where each particle represents a potential solution. Initialize the position and velocity of each particle randomly within the search space. The position represents the candidate solution, while the velocity determines the particle's movement during optimization.

3. Evaluate Fitness: Calculate the fitness value of each particle by evaluating the objective function using the particle's position.

4. Update Particle's Best Position: Update the best position (pbest) for each particle based on the fitness value. If the current position yields a better fitness value than the previous best position, update pbest accordingly.

5. Update Swarm's Global Best Position: Identify the particle with the best fitness value among all particles in the swarm. This position is considered the global best (gbest) and represents the optimal solution found so far.

6. Update Particle Velocities and Positions: Update the velocity and position of each particle based on its current position, velocity, pbest, and gbest. The update equations typically involve the particle's inertia, cognitive component, and social component.

7. Repeat Steps 3 to 6: Repeat the fitness evaluation, updating of pbest and gbest, and updating of velocities and positions for a predefined number of iterations or until convergence criteria are met.

8. Output the Optimized Solution: Once the optimization process completes, the gbest position represents the optimized solution. Extract the values of relevant parameters from the gbest position and evaluate the efficiency and capacity of the hydrogen storage system using the objective function.

9. Fine-tuning: Perform additional iterations or apply modifications to the PSO algorithm parameters (e.g., inertia weight, acceleration coefficients) to improve the optimization results if necessary.

Final Project progress Case Study Optimization of Hydrogen Storage

import numpy as np
from scipy.optimize import minimize

def objective(x):
    # x[0] represents the radius, x[1] represents the height
    radius = x[0]
    height = x[1]

    # Calculate the surface area of the cylindrical structure
    surface_area = 2 * np.pi * radius * (radius + height)

    return surface_area

def constraint(x):
    # x[0] represents the radius, x[1] represents the height
    radius = x[0]
    height = x[1]

    # Calculate the internal volume of the cylindrical structure
    volume = np.pi * radius**2 * height

    # Return the difference between the volume and the desired value (1000 cm^3)
    return volume - 1000

# Guess the initial values for radius and height
x0 = [1.0, 10.0]

# Set the bounds for radius and height
bounds = [(0, None), (0, None)]

# Define the constraint as an equality constraint
constraint_dict = {'type': 'eq', 'fun': constraint}

# Use the minimize function from scipy for optimization
result = minimize(objective, x0, method='SLSQP', bounds=bounds, constraints=constraint_dict)

# Print the optimized results
print("Optimization Results:")
print("Radius: {:.2f} cm".format(result.x[0]))
print("Height: {:.2f} cm".format(result.x[1]))
print("Surface Area: {:.2f} cm^2".format(result.fun))


Optimization Results:
Radius: 5.42 cm
Height: 10.84 cm
Surface Area: 553.58 cm^2