@@ -56,7 +56,7 @@ def viccall(vars):
5656 resname = lines [1 ].split ('\t ' )[8 ]
5757 seepage = float (lines [3 ].split ('\t ' )[0 ])
5858 infil = float (lines [3 ].split ('\t ' )[1 ])
59- opt = int (lines [5 ].split ('\t ' )[0 ])
59+ opt = int (lines [8 ].split ('\t ' )[0 ])
6060 if (opt == 3 ):
6161 D4demand = float (lines [6 ].split ('\t ' )[0 ])
6262 elif (opt == 5 ):
@@ -68,6 +68,9 @@ def viccall(vars):
6868 my_csv .write ("%f\t %f\t %f\t %f\t %f\t %f\t %i\t %f\t %s\n " % (hmax ,hmin ,volume ,dvolume ,height ,discharge ,yearopt ,initialvolume ,resname ))
6969 my_csv .write ("SEEPAGE INFILTRATION\n " )
7070 my_csv .write ("%f\t %f\n " % (seepage ,infil ))
71+ my_csv .write ("IRRIGATION\n " )
72+ my_csv .write ("%d\n " % 0 )
73+ my_csv .write ("DUMMY\n " )
7174 my_csv .write ("OPERATION STRATEGY\n " )
7275 my_csv .write (str (opt )+ "\n " )
7376 if (opt == 1 ):
@@ -100,7 +103,7 @@ def viccall(vars):
100103 x3 = temp
101104 my_csv .write ("%f\t %f\t %f\t %f\t %f\n " % (D5demand [j ],x1 ,x2 ,x3 ,x4 ))
102105 countrow += 4
103- totalinstallcapcity += 0.9 * 9.81 * height * discharge
106+ totalinstallcapcity += 0.9 * 9.81 * height * discharge * 10 ^ ( - 3 ) #MW
104107 # 9.81 is the gravitational acceleration; 0.9 is turbine coefficient (change if needed but remember to change in routing model - reservoir.f)
105108
106109 # Run routing model
@@ -117,7 +120,7 @@ def viccall(vars):
117120 waterdeficit = 0.0
118121 peakds = 0.0
119122 waterdeviation = 0.0
120- hydrofirm = totalinstallcapcity * 30 * 24 * 1000 # In a month: 30 days x 24h x 1000 (MWh) - just for a cap value; not important
123+ hydrofirm = totalinstallcapcity * 30 * 24 # In a month: 30 days x 24h (MWh) - just for a cap value; not important
121124 VICdata = [[0 for x in range (4 )] for y in range (number_of_days )]
122125 for line in lines :
123126 try :
@@ -208,8 +211,8 @@ def viccall(vars):
208211 for i in range (monthth ): # ignore the last month which is normally in the wet season
209212 if (temphydrofirm [i ]< hydrofirm ):
210213 hydrofirm = temphydrofirm [i ]
211- hydrofirm = 1 - hydrofirm / 30 / 24 / 1000 / totalinstallcapcity # normalize the value smallest montlhy value of the firm hydropower
212- totalproduction = 1 - totalproduction / totalinstallcapcity / 24 * 1000 / countrow # calculate annual average and normalize
214+ hydrofirm = 1 - ( hydrofirm / 30 ) / totalinstallcapcity # normalize the smallest monthly value of the firm hydropower
215+ totalproduction = 1 - ( totalproduction / countrow ) / totalinstallcapcity # calculate daily average and normalize
213216 # - Calculate water deficit for the whole system
214217 countrow2 = 0
215218 for i in range (spinning_period ,countrow ):
@@ -305,7 +308,7 @@ def viccall(vars):
305308 lines = text_file .read ().split ('\n ' )
306309 hmax = float (lines [1 ].split ('\t ' )[0 ])
307310 hmin = float (lines [1 ].split ('\t ' )[1 ])
308- opt = int (lines [5 ].split ('\t ' )[0 ])
311+ opt = int (lines [8 ].split ('\t ' )[0 ])
309312 vcap = float (lines [1 ].split ('\t ' )[2 ]) #vcapacity
310313 vd = float (lines [1 ].split ('\t ' )[3 ]) #vdead
311314 text_file .close ()
@@ -362,4 +365,4 @@ def viccall(vars):
362365np .savetxt ("optimization_objectives.txt" ,[s .objectives [:] for s in nondominated_solutions ],fmt = "%s" )
363366np .savetxt ("optimization_variables.txt" ,[s .variables [:] for s in nondominated_solutions ],fmt = "%s" )
364367# END OF FILE
365- # ------------------------------------------------------------------------------------------------------------------------------------------------
368+ # ------------------------------------------------------------------------------------------------------------------------------------------------
0 commit comments