FZJ-IEK3-VSA / FINE

The FINE python package provides a framework for modeling, optimizing and assessing energy systems
https://vsa-fine.readthedocs.io
Other
68 stars 39 forks source link

EnergyLand Example doesent work #38

Closed julianbelina closed 2 years ago

julianbelina commented 2 years ago

The EnergyLand Example does not work. When running the file Energyland.ipynb the following Error occurs at esM.optimize(timeSeriesAggregation=True, solver='gurobi')

I use Python 3.8.11 on Windows 10

Time series aggregation specifications: Number of typical periods:48, number of time steps per period:24

Declaring sets, variables and constraints for SourceSinkModel declaring sets... declaring variables... declaring constraints... (1.6530 sec)

Declaring sets, variables and constraints for ConversionModel declaring sets... declaring variables... declaring constraints... (1.1363 sec)

Declaring sets, variables and constraints for StorageModel declaring sets... declaring variables... declaring constraints... (0.8182 sec)

Declaring shared potential constraint... (0.0000 sec)

Declaring linked component quantity constraint... show more (open the raw output data in a text editor) ...

Sense: minimize

Solve time: 47.232340574264526 sec.

Processing optimization output...


ValueError Traceback (most recent call last) C:\Users\J5F46~1.BEL\AppData\Local\Temp/ipykernel_3660/4170142563.py in ----> 1 esM.optimize(timeSeriesAggregation=True, solver='gurobi')

C:\ProgramData\Anaconda3\envs\FINE-Example\lib\site-packages\FINE\energySystemModel.py in optimize(self, declaresOptimizationProblem, relaxIsBuiltBinary, timeSeriesAggregation, logFileName, threads, solver, timeLimit, optimizationSpecs, warmstart) 1139 for key, mdl in self.componentModelingDict.items(): 1140 t = time.time() -> 1141 mdl.setOptimalValues(self, self.pyM) 1142 outputString = ('for {:' + w + '}').format(key + ' ...') + "(%.4f" % (time.time() - t) + "sec)" 1143 utils.output(outputString, self.verbose, 0)

C:\ProgramData\Anaconda3\envs\FINE-Example\lib\site-packages\FINE\sourceSink.py in setOptimalValues(self, esM, pyM) 723 724 # Set optimal design dimension variables and get basic optimization summary --> 725 optSummaryBasic = super().setOptimalValues(esM, pyM, esM.locations, 'commodityUnit') 726 727 # Set optimal operation variables and append optimization summary

C:\ProgramData\Anaconda3\envs\FINE-Example\lib\site-packages\FINE\component.py in setOptimalValues(self, esM, pyM, indexColumns, plantUnit, unitApp) 1707 1708 # Summarize all annualized contributions to the total annual cost -> 1709 optSummary.loc[optSummary.index.get_level_values(1) == 'TAC'] = \ 1710 optSummary.loc[(optSummary.index.get_level_values(1) == 'capexCap') | 1711 (optSummary.index.get_level_values(1) == 'opexCap') |

~\AppData\Roaming\Python\Python38\site-packages\pandas\core\indexing.py in setitem(self, key, value) 721 722 iloc = self if self.name == "iloc" else self.obj.iloc --> 723 iloc._setitem_with_indexer(indexer, value, self.name) 724 725 def _validate_key(self, key, axis: int):

~\AppData\Roaming\Python\Python38\site-packages\pandas\core\indexing.py in _setitem_with_indexer(self, indexer, value, name) 1730 self._setitem_with_indexer_split_path(indexer, value, name) 1731 else: -> 1732 self._setitem_single_block(indexer, value, name) 1733 1734 def _setitem_with_indexer_split_path(self, indexer, value, name: str):

~\AppData\Roaming\Python\Python38\site-packages\pandas\core\indexing.py in _setitem_single_block(self, indexer, value, name) 1966 1967 # actually do the set -> 1968 self.obj._mgr = self.obj._mgr.setitem(indexer=indexer, value=value) 1969 self.obj._maybe_update_cacher(clear=True) 1970

~\AppData\Roaming\Python\Python38\site-packages\pandas\core\internals\managers.py in setitem(self, indexer, value) 353 354 def setitem(self: T, indexer, value) -> T: --> 355 return self.apply("setitem", indexer=indexer, value=value) 356 357 def putmask(self, mask, new, align: bool = True):

~\AppData\Roaming\Python\Python38\site-packages\pandas\core\internals\managers.py in apply(self, f, align_keys, ignore_failures, kwargs) 325 applied = b.apply(f, kwargs) 326 else: --> 327 applied = getattr(b, f)(**kwargs) 328 except (TypeError, NotImplementedError): 329 if not ignore_failures:

~\AppData\Roaming\Python\Python38\site-packages\pandas\core\internals\blocks.py in setitem(self, indexer, value) 982 values, len(values[indexer]), value # type: ignore[arg-type] 983 ) --> 984 values[indexer] = value 985 986 if transpose:

ValueError: shape mismatch: value array of shape (17,0) could not be broadcast to indexing result of shape (17,1)

t-gross commented 2 years ago

Thanks for reporting. It seems there is an issue with pandas version 1.3.2 Please, update pandas and try it again. If there is still an error occuring, please open a new issue. Thanks.