Skip to content

Commit

Permalink
Fixed bug related to sets of sets with missing inputs or outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek0208 committed May 12, 2021
1 parent fa2e992 commit fe98533
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/preprocess_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,13 @@ def file_output_function(if_dict, str_dict, set_list, set_name, extra_char):
line = line.replace(',','').replace(':=[',':= ').replace(']*','').replace("'","")
else:
line = line.replace('),',')').replace('[(',' (').replace(')]',')').replace("'","")
file_out.write(line + ';' + '\n')
else:
line = set_name + str(each) + ']:='

file_out.write(line + ';' + '\n')

storage_list_len = {'otoole': 0,
'momani': 1}

# Append lines at the end of the data file
with open(data_outfile, 'w') as file_out: # 'a' to open in 'append' mode
Expand All @@ -295,7 +301,8 @@ def file_output_function(if_dict, str_dict, set_list, set_name, extra_char):
file_output_function(dict_inp, dict_inp, fuel_list, 'set MODExTECHNOLOGYperFUELin[', '')
file_output_function(dict_all, dict_all, tech_list, 'set MODEperTECHNOLOGY[', '*')

if len(storage_list) > 0:
if len(storage_list) > storage_list_len[data_format]:
print(len(storage_list))
file_output_function(dict_stt, dict_stt, storage_list, 'set MODExTECHNOLOGYperSTORAGEto[', '')
file_output_function(dict_stf, dict_stf, storage_list, 'set MODExTECHNOLOGYperSTORAGEfrom[', '')

Expand Down

0 comments on commit fe98533

Please sign in to comment.