Skip to content

Commit

Permalink
fixing issue with how generators are indexed to initial state files
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-g committed Nov 23, 2022
1 parent 16911f1 commit f40efd3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions vatic/data/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,21 @@ def __init__(self,
tgens = list()
rgens = list()

first_states = pd.read_csv(self.init_state_file).iloc[0].to_dict()
if init_state_file:
init_states = pd.read_csv(init_state_file).iloc[0].to_dict()
else:
init_states = pd.read_csv(self.init_state_file).iloc[0].to_dict()
init_states = first_states

for gen in self.generators:
if gen.Fuel in self.thermal_gen_types and gen.ID in init_states:
tgens += [gen]
tgen_bus_map[bus_name_mapping[gen.Bus]] += [gen.ID]

if gen.Fuel in self.renew_gen_types:
rgens += [gen]
rgen_bus_map[bus_name_mapping[gen.Bus]] += [gen.ID]
if gen.ID in first_states:
if gen.Fuel in self.thermal_gen_types:
tgens += [gen]
tgen_bus_map[bus_name_mapping[gen.Bus]] += [gen.ID]

if gen.Fuel in self.renew_gen_types and gen:
rgens += [gen]
rgen_bus_map[bus_name_mapping[gen.Bus]] += [gen.ID]

template.update({
'ThermalGenerators': [gen.ID for gen in tgens],
Expand Down

0 comments on commit f40efd3

Please sign in to comment.