Skip to content

Commit

Permalink
Update ElectrolyzerPlant to use kW
Browse files Browse the repository at this point in the history
  • Loading branch information
genevievestarke committed Nov 23, 2024
1 parent a5b13ec commit 6ebde39
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions hercules/python_simulators/electrolyzer_plant.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ def __init__(self, input_dict, dt):
self.n_stacks = self.elec_sys.n_stacks

# Right now, the plant initialization power and the initial condition power are the same
# power_in is always in MW
power_in = input_dict["electrolyzer"]["initial_power_kW"] / 1e3
# power_in is always in kW
power_in = input_dict["electrolyzer"]["initial_power_kW"]
self.needed_inputs = {"available_power": power_in}

# Run Electrolyzer two steps to get outputs
for i in range(2):
H2_produced, H2_mfr, power_left, power_curtailed = self.elec_sys.run_control(
power_in * 1e6
power_in * 1e3
)
# Initialize outputs for controller step
self.stacks_on = sum([self.elec_sys.stacks[i].stack_on for i in range(self.n_stacks)])
self.stacks_waiting = [False] * self.n_stacks
# # TODO: How should these be initialized? - Should we do one electrolyzer step?
# will that make it out of step of with the other sources?
self.curtailed_power = power_curtailed / 1e6
self.curtailed_power = power_curtailed / 1e3
self.H2_output = H2_produced

def return_outputs(self):
Expand All @@ -42,13 +42,13 @@ def step(self, inputs):
# Gather inputs
power_in = inputs["py_sims"]["inputs"][
"available_power"
] # TODO check what units this is in
] # TODO Update to have electrolyzer and battery able to run together and NOT use available power
# Run electrolyzer forward one step
######## Electrolyzer needs input in Watts ########
H2_produced, H2_mfr, power_left, power_curtailed = self.elec_sys.run_control(power_in * 1e3)

# Collect outputs from electrolyzer step
self.curtailed_power = power_curtailed / 1e6
self.curtailed_power = power_curtailed / 1e3
self.stacks_on = sum([self.elec_sys.stacks[i].stack_on for i in range(self.n_stacks)])
self.stacks_waiting = [self.elec_sys.stacks[i].stack_waiting for i in range(self.n_stacks)]
self.H2_output = H2_produced
Expand Down

0 comments on commit 6ebde39

Please sign in to comment.