openTEPES 4.17.8__py3-none-any.whl → 4.17.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
openTEPES/__init__.py CHANGED
@@ -14,7 +14,7 @@ Open Generation, Storage, and Transmission Operation and Expansion Planning Mode
14
14
  >>> import openTEPES as oT
15
15
  >>> oT.routine("9n", "C:\\Users\\UserName\\Documents\\GitHub\\openTEPES", "glpk")
16
16
  """
17
- __version__ = "4.17.8"
17
+ __version__ = "4.17.9"
18
18
 
19
19
  from .openTEPES_Main import main
20
20
  from .openTEPES import *
openTEPES/openTEPES.py CHANGED
@@ -1,5 +1,5 @@
1
1
  """
2
- Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - October 30, 2024
2
+ Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - November 19, 2024
3
3
  """
4
4
 
5
5
  # import dill as pickle
@@ -39,8 +39,8 @@ def openTEPES_run(DirName, CaseName, SolverName, pIndOutputResults, pIndLogConso
39
39
  idxDict['y' ] = 1
40
40
 
41
41
  #%% model declaration
42
- mTEPES = ConcreteModel('Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - Version 4.17.8 - October 30, 2024')
43
- print( 'Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - Version 4.17.8 - October 30, 2024', file=open(_path+'/openTEPES_version_'+CaseName+'.log','w'))
42
+ mTEPES = ConcreteModel('Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - Version 4.17.9 - November 19, 2024')
43
+ print( 'Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - Version 4.17.9 - November 19, 2024', file=open(_path+f'/openTEPES_version_{CaseName}.log','w'))
44
44
 
45
45
  pIndOutputResults = [j for i,j in idxDict.items() if i == pIndOutputResults][0]
46
46
  pIndLogConsole = [j for i,j in idxDict.items() if i == pIndLogConsole ][0]
@@ -115,7 +115,7 @@ def openTEPES_run(DirName, CaseName, SolverName, pIndOutputResults, pIndLogConso
115
115
  else:
116
116
  mTEPES.na = mTEPES.na | mTEPES.n
117
117
 
118
- print('Period '+str(p)+', Scenario '+str(sc)+', Stage '+str(st))
118
+ print(f'Period {p}, Scenario {sc}, Stage {st}')
119
119
 
120
120
  # operation model objective function and constraints by stage
121
121
  GenerationOperationModelFormulationObjFunct (mTEPES, mTEPES, pIndLogConsole, p, sc, st)
@@ -142,7 +142,7 @@ def openTEPES_run(DirName, CaseName, SolverName, pIndOutputResults, pIndLogConso
142
142
 
143
143
  if pIndLogConsole == 1:
144
144
  StartTime = time.time()
145
- mTEPES.write(_path+'/openTEPES_'+CaseName+'_'+str(p)+'_'+str(sc)+'_'+str(st)+'.lp', io_options={'symbolic_solver_labels': True})
145
+ mTEPES.write(_path+f'/openTEPES_{CaseName}_{p}_{sc}_{st}.lp', io_options={'symbolic_solver_labels': True})
146
146
  WritingLPFileTime = time.time() - StartTime
147
147
  StartTime = time.time()
148
148
  print('Writing LP file ... ', round(WritingLPFileTime), 's')
@@ -187,7 +187,7 @@ def openTEPES_run(DirName, CaseName, SolverName, pIndOutputResults, pIndLogConso
187
187
 
188
188
  if pIndLogConsole == 1:
189
189
  StartTime = time.time()
190
- mTEPES.write(_path+'/openTEPES_'+CaseName+'_'+str(p)+'_'+str(sc)+'_'+str(st)+'.lp', io_options={'symbolic_solver_labels': True})
190
+ mTEPES.write(_path+f'/openTEPES_{CaseName}_{p}_{sc}_{st}.lp', io_options={'symbolic_solver_labels': True})
191
191
  WritingLPFileTime = time.time() - StartTime
192
192
  StartTime = time.time()
193
193
  print('Writing LP file ... ', round(WritingLPFileTime), 's')
@@ -230,7 +230,7 @@ def openTEPES_run(DirName, CaseName, SolverName, pIndOutputResults, pIndLogConso
230
230
  mTEPES.pScenProb[p,sc] = 1.0
231
231
 
232
232
  # pickle the case study data
233
- # with open(dump_folder+'/oT_Case_'+CaseName+'.pkl','wb') as f:
233
+ # with open(dump_folder+f'/oT_Case_{CaseName}.pkl','wb') as f:
234
234
  # pickle.dump(mTEPES, f, pickle.HIGHEST_PROTOCOL)
235
235
 
236
236
  # output results only for every unit (0), only for every technology (1), or for both (2)
@@ -261,7 +261,7 @@ def openTEPES_run(DirName, CaseName, SolverName, pIndOutputResults, pIndLogConso
261
261
  pIndEconomicResults = 1
262
262
  else:
263
263
  pIndDumpRawResults = 0
264
- pIndInvestmentResults = 0
264
+ pIndInvestmentResults = 1
265
265
  pIndGenerationOperationResults = 0
266
266
  pIndESSOperationResults = 0
267
267
  pIndReservoirOperationResults = 0
@@ -271,8 +271,8 @@ def openTEPES_run(DirName, CaseName, SolverName, pIndOutputResults, pIndLogConso
271
271
  pIndReliabilityResults = 0
272
272
  pIndNetworkOperationResults = 0
273
273
  pIndNetworkMapResults = 0
274
- pIndOperationSummaryResults = 0
275
- pIndCostSummaryResults = 0
274
+ pIndOperationSummaryResults = 1
275
+ pIndCostSummaryResults = 1
276
276
  pIndMarginalResults = 0
277
277
  pIndEconomicResults = 0
278
278
 
@@ -1,5 +1,5 @@
1
1
  """
2
- Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - October 30, 2024
2
+ Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - November 12, 2024
3
3
  """
4
4
 
5
5
  import datetime
@@ -1076,7 +1076,7 @@ def InputData(DirName, CaseName, mTEPES, pIndLogConsole):
1076
1076
  pDemandElecPeak = pd.Series([0.0 for p,ar in mTEPES.par], index=mTEPES.par)
1077
1077
  for p,ar in mTEPES.par:
1078
1078
  # values < 1e-5 times the maximum demand for each area (an area is related to operating reserves procurement, i.e., country) are converted to 0
1079
- pDemandElecPeak[p,ar] = pDemandElec[[nd for nd in d2a[ar]]].sum(axis=1).max()
1079
+ pDemandElecPeak[p,ar] = pDemandElec.loc[p,:,:][[nd for nd in d2a[ar]]].sum(axis=1).max()
1080
1080
  pEpsilon = pDemandElecPeak[p,ar]*1e-5
1081
1081
 
1082
1082
  # these parameters are in GW
@@ -660,7 +660,7 @@
660
660
  # For more information on this, and how to apply and follow the GNU AGPL, see
661
661
  # <https://www.gnu.org/licenses/>.
662
662
 
663
- # Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - October 30, 2024
663
+ # Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - November 19, 2024
664
664
  # simplicity and transparency in power systems planning
665
665
 
666
666
  # Developed by
@@ -685,7 +685,7 @@ import time
685
685
  # import pkg_resources
686
686
  from .openTEPES import openTEPES_run
687
687
 
688
- print('\033[1;32mOpen Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - Version 4.17.8 - October 30, 2024\033[0m')
688
+ print('\033[1;32mOpen Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - Version 4.17.9 - November 19, 2024\033[0m')
689
689
  print('\033[34m#### Academic research license - for non-commercial use only ####\033[0m \n')
690
690
 
691
691
  parser = argparse.ArgumentParser(description='Introducing main parameters...')
@@ -733,16 +733,18 @@ def main():
733
733
  import sys
734
734
  print(sys.argv)
735
735
  print(args)
736
- openTEPES_run(args.dir, args.case, args.solver, args.result, args.log)
736
+ model = openTEPES_run(args.dir, args.case, args.solver, args.result, args.log)
737
737
  # Computing the elapsed time
738
738
  ElapsedTime = round(time.time() - StartTime)
739
739
  print('Total time ... {} s'.format(ElapsedTime))
740
- path_to_write_time = os.path.join(args.dir,args.case,'openTEPES_time_'+args.case+'.log')
740
+ path_to_write_time = os.path.join(args.dir,args.case,f'openTEPES_time_{args.case}.log')
741
741
  with open(path_to_write_time, 'w') as f:
742
- f.write('Elapsed time '+str(ElapsedTime)+' s')
742
+ f'Elapsed time {ElapsedTime} s'
743
743
  # Final message
744
744
  print('End of the run ************')
745
745
  print('\033[34m#### Academic research license - for non-commercial use only ####\033[0m')
746
746
 
747
+ return model
748
+
747
749
  if __name__ == '__main__':
748
- main()
750
+ model = main()