fzj-iek3-vsa / fine Goto Github PK
View Code? Open in Web Editor NEWThe FINE python package provides a framework for modeling, optimizing and assessing energy systems
Home Page: https://vsa-fine.readthedocs.io
License: Other
The FINE python package provides a framework for modeling, optimizing and assessing energy systems
Home Page: https://vsa-fine.readthedocs.io
License: Other
I installed FINE using conda environment file and then through pip install .
on a Windows machine. I am able to run this example except for visualization where I get a following error when calling fig, ax = fn.plotLocations('regions.shp', indexColumn='regionName', plotLocNames=True)
:
File "_proj.pyx", line 129, in _proj.Proj.__cinit__
RuntimeError: b'no arguments in initialization list'
I have tried several suggestions given here for this error, including deleteting pyproj
and installing it through pip, which gives a new error that says CRSError: Invalid project: : ...
. I tried several other suggestions given here, but nothing worked. I also deleted and reinstalled the environment/package after those suggestions and I get the same errors.
It would be helpful to have a boolean that activates and deactivates all the logging done by FINE itself
Hello, can I use FINE for multi-objective optimization of energy systems? I now want to make a calculation example that targets cost and carbon dioxide emissions. Thank you
Update constraint formulation for a more generic fixed and maximum operation rate, for example with:
if opRateName is None:
rate = getattr(compDict[compName], 'operationRateFix')
else:
rate = getattr(compDict[compName], opRateName)
return opVar[loc, compName, p, t] == capVar[loc, compName] * rate[loc][p, t] * factor
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)
The time-dependent cost which were introduced in the last pull request are not considered in the optimization summary of the output.
This Example file does not work. The Optimization takes approx. 20 minutes and raises the following error. I am using Python 3.8.11 and Windows 10.
esM.optimize(timeSeriesAggregation=True, optimizationSpecs='OptimalityTol=1e-3 method=2 cuts=0')
Time series aggregation specifications:
Number of typical periods:7, number of time steps per period:24
Declaring sets, variables and constraints for SourceSinkModel
declaring sets...
declaring variables...
declaring constraints...
(0.7239 sec)
Declaring sets, variables and constraints for ConversionModel
declaring sets...
declaring variables...
declaring constraints...
(0.2105 sec)
Declaring sets, variables and constraints for StorageModel
declaring sets...
declaring variables...
declaring constraints...
(2.3284 sec)
Declaring sets, variables and constraints for TransmissionModel
declaring sets...
declaring variables...
declaring constraints...
show more (open the raw output data in a text editor) ...
Sense: minimize
Solve time: 1248.9299240112305 sec.
Processing optimization output...
ValueError Traceback (most recent call last)
C:\Users\J5F46~1.BEL\AppData\Local\Temp/ipykernel_11072/1441548777.py in
----> 1 esM.optimize(timeSeriesAggregation=True, optimizationSpecs='OptimalityTol=1e-3 method=2 cuts=0')
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 (9,0) could not be broadcast to indexing result of shape (9,8)
It would be great if the two steps of the pyomo.Concrete model initialization and parameterization could be separated from the model solving. Such, it would be possible to add custom constraints after the initialization process, or to output the resulting model without the requirement to solve it
phaseAngleVariablesOptimum is overwritten by operationVariablesOptimum in LOPF subclass.
In the setOptimalValues function under lopf, "self.operationVariablesOptimum" should be changed to "self.phaseAngleVariablesOptimum"
Hi there,
I created a new python project in PyCharm with Virtualenv + Python 3.7 and installed FINE with pip install fine
.
That ran successfully:
...\pythonTestProject> pip install fine
[...]
Installing collected packages: numpy, urllib3, threadpoolctl, six, scipy, pytz, pyparsing, MarkupSafe, joblib, idna, decorator, charset-normalizer, certifi, sphinxcontrib-serializinghtml, sphinxcontrib-qthelp, sphinxcontrib-jsmath, sphinxcontrib-htmlhelp, sphinxcontrib-devhelp, sphinxcontrib-applehelp, snowball
stemmer, scikit-learn, requests, python-dateutil, Pygments, ply, paramz, packaging, Jinja2, imagesize, docutils, cython, colorama, babel, alabaster, sphinx, sklearn, pyomo, pyDOE, pillow, pandas, networkx, kiwisolver, GPy, et-xmlfile, cycler, xlrd, tsam, sphinx-rtd-theme, shapely, pwlf, openpyxl, matplotlib, GP
yOpt, fine
Successfully installed GPy-1.10.0 GPyOpt-1.2.6 Jinja2-3.0.2 MarkupSafe-2.0.1 Pygments-2.10.0 alabaster-0.7.12 babel-2.9.1 certifi-2021.10.8 charset-normalizer-2.0.7 colorama-0.4.4 cycler-0.10.0 cython-0.29.24 decorator-5.1.0 docutils-0.17.1 et-xmlfile-1.1.0 fine-2.2.1 idna-3.3 imagesize-1.2.0 joblib-1.1.0 kiwis
olver-1.3.2 matplotlib-3.4.3 networkx-2.6.3 numpy-1.21.3 openpyxl-3.0.9 packaging-21.0 pandas-1.3.4 paramz-0.9.5 pillow-8.4.0 ply-3.11 pwlf-2.0.4 pyDOE-0.3.8 pyomo-6.1.2 pyparsing-3.0.1 python-dateutil-2.8.2 pytz-2021.3 requests-2.26.0 scikit-learn-1.0 scipy-1.7.1 shapely-1.7.1 six-1.16.0 sklearn-0.0 snowballst
emmer-2.1.0 sphinx-4.2.0 sphinx-rtd-theme-1.0.0 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-2.0.0 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.3 sphinxcontrib-serializinghtml-1.1.5 threadpoolctl-3.0.0 tsam-1.1.2 urllib3-1.26.7 xlrd-2.0.1
I created a simple main.py
script:
import FINE
if __name__ == '__main__':
print("Hello World!")
Outputs:
...\pythonTestProject\venv\Scripts\python.exe .../pythonTestProject/main.py
Traceback (most recent call last):
File "C:/Users/Paul/Git/EWI/pythonTestProject/main.py", line 3, in <module>
import FINE
File "...\pythonTestProject\venv\lib\site-packages\FINE\__init__.py", line 6, in <module>
from .energySystemModel import EnergySystemModel
File "...\pythonTestProject\venv\lib\site-packages\FINE\energySystemModel.py", line 6, in <module>
from FINE.component import Component, ComponentModel
File "...\pythonTestProject\venv\lib\site-packages\FINE\component.py", line 2, in <module>
from FINE import utils
File "...\pythonTestProject\venv\lib\site-packages\FINE\utils.py", line 9, in <module>
import pwlf
File "...\pythonTestProject\venv\lib\site-packages\pwlf\__init__.py", line 1, in <module>
from .pwlf import PiecewiseLinFit # noqa F401
File "...\pythonTestProject\venv\lib\site-packages\pwlf\pwlf.py", line 27, in <module>
from scipy.optimize import differential_evolution
File "...\pythonTestProject\venv\lib\site-packages\scipy\__init__.py", line 136, in <module>
from . import _distributor_init
File "...\pythonTestProject\venv\lib\site-packages\scipy\_distributor_init.py", line 61, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Das angegebene Modul wurde nicht gefunden
Process finished with exit code 1
I tried multiple combinations of different versions of scipy and pwlf.
Also including the minimum of scipy==1.4.1
and pwlf==1.1.5
mentioned in requirements.txt
.
But this still raises an error.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.