Skip to content

Commit

Permalink
Matouqin: little modification on preparing data
Browse files Browse the repository at this point in the history
  • Loading branch information
Zadie-Zhang committed Apr 27, 2024
1 parent c2e16db commit 9197edb
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions models/matouqin/dat_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def set_elec(self):
# annuity factor used to generate annualized investment cost (pay at the end of year)
invshare = (((1 + self.ydis) ** self.elec_df['n'] * self.ydis)
/ ((1 + self.ydis) ** self.elec_df['n'] - 1))

# annuity factor used to generate annualized investment cost (pay at the beginning of year)
# invshare = (((1 + self.ydis) ** (self.elec_df['n']+1) * self.ydis)
# / ((1 + self.ydis) ** self.elec_df['n'] - 1))
Expand Down Expand Up @@ -172,9 +173,11 @@ def set_fcell(self):
# annuity factor used to generate annualized investment cost (pay at the end of year)
invshare = (((1 + self.ydis) ** self.fcell_df['n'] * self.ydis)
/ ((1 + self.ydis) ** self.fcell_df['n'] - 1))

# annuity factor used to generate annualized investment cost (pay at the beginning of year)
# invshare = (((1 + self.ydis) ** (self.fcell_df['n'] + 1) * self.ydis)
# / ((1 + self.ydis) ** self.fcell_df['n'] - 1))

# sinv = invshare * self.fcell_df['sInvcost']
sinv = invshare * self.fcell_df['sInvcost'] / 8760 * self.T
omc = self.fcell_df['sOmc'] / 8760 * self.T
Expand Down Expand Up @@ -222,6 +225,7 @@ def to_ampl(self):

eprice_str += f'{self.ePrice} \n'
ebprice_str += f'{self.eBprice.round(4)} \n'
# ebprice_str += f'{self.eBprice} \n'
eover_str += f'{self.eOver} \n'
# hcost_str += f'{self.hCost} \n'

Expand All @@ -234,10 +238,12 @@ def to_ampl(self):
mxcap_str += f'{row["name"]} {row["mxCap"]} \n'

eh2_str += f'{row["name"]} {round(row["eh2"], 4)} \n'
# eh2_str += f'{row["name"]} {row["eh2"]} \n'

sinv_str += f'{row["name"]} {round(row["sInv"], 4)} \n'
# somc_str += f'{row["name"]} {round(row["sOmc"], 4)} \n'
somc_str += f'{row["name"]} {round(row["OMC"], 4)} \n'
# sinv_str += f'{row["name"]} {row["sInv"]}\n'
# somc_str += f'{row["name"]} {row["OMC"]} \n'

for index, row in self.hytank_df.iterrows():
sh_str += f'{row["name"]} \n'
Expand All @@ -251,21 +257,29 @@ def to_ampl(self):
eph2_str += f'{row["name"]} {round(row["eph2"], 4)} \n'
h2res_str += f'{row["name"]} {round(row["h2Res"], 4)} \n'

# eph2_str += f'{row["name"]} {row["eph2"]} \n'
# h2res_str += f'{row["name"]} {row["h2Res"]} \n'

sinv_str += f'{row["name"]} {round(row["sInv"], 4)} \n'
# somc_str += f'{row["name"]} {round(row["sOmc"], 4)} \n'
somc_str += f'{row["name"]} {round(row["OMC"], 4)} \n'

# sinv_str += f'{row["name"]} {row["sInv"]}\n'
# somc_str += f'{row["name"]} {row["OMC"]} \n'

for index, row in self.fcell_df.iterrows():
sc_str += f'{row["name"]} \n'

mxcap_str += f'{row["name"]} {row["mxCap"]} \n'

h2e_str += f'{row["name"]} {round(row["h2e"], 2)} \n'
# h2e_str += f'{row["name"]} {row["h2e"]} \n'

sinv_str += f'{row["name"]} {round(row["sInv"], 4)} \n'
# somc_str += f'{row["name"]} {round(row["sOmc"], 4)} \n'
somc_str += f'{row["name"]} {round(row["OMC"], 4)} \n'

# sinv_str += f'{row["name"]} {row["sInv"]}\n'
# somc_str += f'{row["name"]} {row["OMC"]} \n'

nhrs_str += ';\n'
se_str += ';\n'
sh_str += ';\n'
Expand Down Expand Up @@ -330,16 +344,16 @@ def write_to_excel(self):
dat_dir = f'{path}/Data/'

# select the data file
# f_data = f'{dat_dir}Raw/dat1.xlsx'
# af_name = f'dat1'
f_data = f'{dat_dir}Raw/dat1.xlsx'
af_name = f'dat1'

# preparing test data
f_data = f'{dat_dir}Raw/test1.xlsx'
af_name = f'test1'
# f_data = f'{dat_dir}Raw/test1.xlsx'
# af_name = f'test3'

# data processing: select the number of hours the model runs by changing n_periods
# par = Params(dat_dir, f_data, af_name, 8760) # prepare all model parameters
par = Params(dat_dir, f_data, af_name, 240) # prepare model parameters for testing, 30days
par = Params(dat_dir, f_data, af_name, 8670) # prepare model parameters for testing, 30days

par.write_to_ampl() # write model parameters to ampl format file
par.write_to_excel() # write model parameters to Excel file

0 comments on commit 9197edb

Please sign in to comment.