diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9011b02d..3da3a492 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,10 @@ Change Log ============= +[4.15.1] - 2023-12-27 +---------------------- +- [CHANGED] avoid some future warnings in output results + [4.15.0] - 2023-12-27 ---------------------- - [CHANGED] introduce the variable emission cost file diff --git a/doc/rst/conf.py b/doc/rst/conf.py index 900f3825..e93d461b 100644 --- a/doc/rst/conf.py +++ b/doc/rst/conf.py @@ -8,7 +8,7 @@ # -- Project information ----------------------------------------------------- project = 'openTEPES' -copyright = '2023, Universidad Pontificia Comillas' +copyright = '2024, Universidad Pontificia Comillas' author = 'Andres Ramos' # The short X.Y version diff --git a/openTEPES/__init__.py b/openTEPES/__init__.py index ed197b02..f2bb261d 100644 --- a/openTEPES/__init__.py +++ b/openTEPES/__init__.py @@ -14,7 +14,7 @@ >>> import openTEPES as oT >>> oT.routine("9n", "C:\\Users\\UserName\\Documents\\GitHub\\openTEPES", "glpk") """ -__version__ = "4.15.0" +__version__ = "4.15.1" from .openTEPES_Main import main from .openTEPES import * diff --git a/openTEPES/openTEPES.py b/openTEPES/openTEPES.py index dfbd70e6..36e87ceb 100644 --- a/openTEPES/openTEPES.py +++ b/openTEPES/openTEPES.py @@ -1,5 +1,5 @@ """ -Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - December 20, 2023 +Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - January 02, 2024 """ import math @@ -38,8 +38,8 @@ def openTEPES_run(DirName, CaseName, SolverName, pIndOutputResults, pIndLogConso idxDict['y' ] = 1 #%% model declaration - mTEPES = ConcreteModel('Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - Version 4.15.0 - December 27, 2023') - print( 'Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - Version 4.15.0 - December 27, 2023', file=open(_path+'/openTEPES_version_'+CaseName+'.log','a')) + mTEPES = ConcreteModel('Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - Version 4.15.1 - January 02, 2024') + print( 'Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - Version 4.15.1 - January 02, 2024', file=open(_path+'/openTEPES_version_'+CaseName+'.log','a')) pIndOutputResults = [j for i,j in idxDict.items() if i == pIndOutputResults][0] pIndLogConsole = [j for i,j in idxDict.items() if i == pIndLogConsole ][0] diff --git a/openTEPES/openTEPES_OutputResults.py b/openTEPES/openTEPES_OutputResults.py index fc1d280c..78fedb2c 100644 --- a/openTEPES/openTEPES_OutputResults.py +++ b/openTEPES/openTEPES_OutputResults.py @@ -1,5 +1,5 @@ """ -Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - December 27, 2023 +Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES) - January 02, 2024 """ import time @@ -752,7 +752,7 @@ def oT_selecting_data(p,sc,n): loc_df = pd.Series(data=[mTEPES.pNodeLat[i] for i in mTEPES.nd], index=mTEPES.nd).to_frame(name='Lat') loc_df['Lon' ] = 0.0 - loc_df['Zone' ] = 0.0 + loc_df['Zone' ] = '' loc_df['Demand'] = 0.0 loc_df['Size' ] = 15.0 @@ -983,7 +983,7 @@ def OperationSummaryResults(DirName, CaseName, OptModel, mTEPES): OutputToFile05 = pd.Series(data=[a2g[0][g] for p,sc,n,g in mTEPES.psng], index=pd.Index(mTEPES.psng)).to_frame(name='Area' ) OutputToFile06 = pd.Series(data=[r2g[0][g] for p,sc,n,g in mTEPES.psng], index=pd.Index(mTEPES.psng)).to_frame(name='Region' ) OutputToFile07 = pd.Series(data=[t2g[0][g] for p,sc,n,g in mTEPES.psng], index=pd.Index(mTEPES.psng)).to_frame(name='Technology' ) - OutputToFile08 = pd.Series(data=[OptModel.vTotalOutput [p,sc,n,g]()*mTEPES.pLoadLevelDuration[n]()*mTEPES.pEmissionVarCost[p,sc,n,g]/mTEPES.pCO2Cost() for p,sc,n,g in mTEPES.psng], index=pd.Index(mTEPES.psng)).to_frame(name='Emissions [MtCO2]' ) + OutputToFile08 = pd.Series(data=[OptModel.vTotalOutput [p,sc,n,g]()*mTEPES.pLoadLevelDuration[n]()*mTEPES.pEmissionVarCost[p,sc,n,g]/mTEPES.pCO2Cost() for p,sc,n,g in mTEPES.psng], index=pd.Index(mTEPES.psng)).to_frame(name='Emissions [MtCO2]' ) OutputToFile09 = pd.Series(data=[OptModel.vTotalOutput [p,sc,n,g].ub for p,sc,n,g in mTEPES.psng], index=pd.Index(mTEPES.psng)).to_frame(name='MaxPower [MW]' ) OutputToFile10 = pd.Series(data=[OptModel.vTotalOutput [p,sc,n,g].lb for p,sc,n,g in mTEPES.psng], index=pd.Index(mTEPES.psng)).to_frame(name='MinPower [MW]' ) OutputToFile11 = pd.Series(data=[mTEPES.pLoadLevelDuration[n]() for p,sc,n,g in mTEPES.psng], index=pd.Index(mTEPES.psng)).to_frame(name='LoadLevelDuration [h]' ) @@ -1193,9 +1193,8 @@ def MarginalResults(DirName, CaseName, OptModel, mTEPES, pIndPlotOutput): OutputToFile = OutputToFile.to_frame(name='EUR/MWh').reset_index().pivot_table(index=['level_0','level_1','level_2'], columns='level_3', values='EUR/MWh') OutputToFile.rename_axis(['Period', 'Scenario', 'LoadLevel'], axis=0).rename_axis([None], axis=1).to_csv(_path+'/oT_Result_MarginalIncrementalVariableCost_'+CaseName+'.csv', sep=',') - IncrementalGens = pd.Series(0, index=pd.Index(mTEPES.psn)).to_frame(name='Generating unit') + IncrementalGens = pd.Series('N/A', index=pd.Index(mTEPES.psn)).to_frame(name='Generating unit') for p,sc,n in mTEPES.psn: - # warnings IncrementalGens['Generating unit'][p,sc,n] = OutputToFile.loc[[(p,sc,n)]].squeeze().idxmin() IncrementalGens.rename_axis(['Period', 'Scenario', 'LoadLevel'], axis=0).to_csv(_path+'/oT_Result_MarginalIncrementalGenerator_'+CaseName+'.csv', index=True, sep=',') @@ -1320,10 +1319,8 @@ def ReliabilityResults(DirName, CaseName, OptModel, mTEPES): OutputToFile1 = pd.Series(data=[0.0 for p,sc in mTEPES.ps], index=mTEPES.ps) OutputToFile2 = pd.Series(data=[0.0 for p,sc in mTEPES.ps], index=mTEPES.ps) for p,sc in mTEPES.ps: - # warnings - OutputToFile1[p,sc] = pMaxPower.loc[(p,sc)].reset_index().pivot_table(index=['level_0'], values=0, aggfunc='sum').max() - # warnings - OutputToFile2[p,sc] = pDemand.loc[(p,sc)].reset_index().pivot_table(index=['level_0'], values=0, aggfunc='sum').max() + OutputToFile1[p,sc] = pMaxPower.loc[(p,sc)].reset_index().pivot_table(index=['level_0'], values=0, aggfunc='sum').max().iloc[0] + OutputToFile2[p,sc] = pDemand.loc[(p,sc)].reset_index().pivot_table(index=['level_0'], values=0, aggfunc='sum').max().iloc[0] ReserveMargin1 = OutputToFile1 - OutputToFile2 ReserveMargin2 = (OutputToFile1 - OutputToFile2)/OutputToFile2 ReserveMargin1.to_frame(name='MW' ).rename_axis(['Period', 'Scenario'], axis=0).to_csv(_path+'/oT_Result_ReserveMarginPower_' +CaseName+'.csv', sep=',') @@ -1332,8 +1329,7 @@ def ReliabilityResults(DirName, CaseName, OptModel, mTEPES): # Determination of the index: Largest Unit OutputToFile = pd.Series(data=[0.0 for p,sc in mTEPES.ps], index=mTEPES.ps) for p,sc in mTEPES.ps: - # warnings - OutputToFile[p,sc] = pMaxPower.loc[(p,sc)].reset_index().pivot_table(index=['level_1'], values=0, aggfunc=max).max() + OutputToFile[p,sc] = pMaxPower.loc[(p,sc)].reset_index().pivot_table(index=['level_1'], values=0, aggfunc='sum').max().iloc[0] LargestUnit = ReserveMargin1/OutputToFile LargestUnit.to_frame(name='p.u.').rename_axis(['Period', 'Scenario'], axis=0).to_csv(_path+'/oT_Result_LargestUnitPerUnit_'+CaseName+'.csv', index=True, sep=',') @@ -1652,7 +1648,7 @@ def oT_selecting_data(p,sc,n): loc_df = pd.Series(data=[mTEPES.pNodeLat[i] for i in mTEPES.nd], index=mTEPES.nd).to_frame(name='Lat') loc_df['Lon' ] = 0.0 - loc_df['Zone' ] = 0.0 + loc_df['Zone' ] = '' loc_df['Demand'] = 0.0 loc_df['Size' ] = 15.0 @@ -1714,7 +1710,6 @@ def oT_selecting_data(p,sc,n): if 50.0 < line_df['utilization'][ni,nf] <= 60.0: line_df['color'][ni,nf] = colors[5] if 60.0 < line_df['utilization'][ni,nf] <= 70.0: - # warnings line_df['color'][ni,nf] = colors[6] if 70.0 < line_df['utilization'][ni,nf] <= 80.0: line_df['color'][ni,nf] = colors[7]