Skip to content

Commit

Permalink
Create grid_optimizer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 5, 2024
1 parent 5d94552 commit 6aad46d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions infrastructure/grid_management/grid_optimizer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pulp
import numpy as np

# Define grid parameters
GRID_VOLTAGE = 120 # kV
GRID_FREQ = 60 # Hz
GRID_CAPACITY = 100 # MW

# Define optimization problem
prob = pulp.LpProblem("Grid Optimization", pulp.LpMinimize)

# Define variables
x = pulp.LpVariable("x", lowBound=0, upBound=GRID_CAPACITY, cat=pulp.LpContinuous)

# Define objective function
prob += x # Minimize energy loss

# Define constraints
prob += x <= GRID_CAPACITY # Do not exceed grid capacity
prob += x >= 0 # Do not go below 0 MW

# Define IEEE 1547 standard constraints
prob += x * GRID_VOLTAGE * GRID_FREQ <= 100 # Do not exceed 100 MW

# Solve optimization problem
prob.solve()

# Print results
print("Optimal energy distribution:", x.value())

0 comments on commit 6aad46d

Please sign in to comment.