Plot 11 resources treemap
In [1]:
Copied!
"""
Resources usage
===================================
Treemap of resources used by category.
"""
# mkdocs_gallery_thumbnail_path = '_static/plot_11_resources_treemap.png'
"""
Resources usage
===================================
Treemap of resources used by category.
"""
# mkdocs_gallery_thumbnail_path = '_static/plot_11_resources_treemap.png'
Out[1]:
'\nResources usage\n===================================\n\nTreemap of resources used by category.\n'
In [2]:
Copied!
from energyscope.energyscope import Energyscope
from energyscope.models import core
from energyscope.result import postprocessing
from energyscope.plots import plot_resources_use
from energyscope.energyscope import Energyscope
from energyscope.models import core
from energyscope.result import postprocessing
from energyscope.plots import plot_resources_use
In [3]:
Copied!
es_core = Energyscope(model=core)
results_core = postprocessing(es_core.calc(), df_monthly=False)
es_core = Energyscope(model=core)
results_core = postprocessing(es_core.calc(), df_monthly=False)
[INFO] Activating AMPL license with UUID
--------------------------------------------------------------------------- SystemError Traceback (most recent call last) File /builds/energyscope/energyscope/src/energyscope/energyscope.py:41, in Energyscope.es_model(self) 40 modules.activate(ampl_uuid) ---> 41 self.__es_model = AMPL() 42 except SystemError: 43 # Try to create the object a second time to prevent errors when starting `ampl_lic` File ~/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/amplpy/ampl.py:105, in AMPL.__init__(self, environment) 104 if environment is None: --> 105 self._impl = amplpython.AMPL() 106 else: SystemError: License not valid. Message: License file /root/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/ampl_module_base/bin/ampl.lic: Today = 20260223; found license file "/root/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/ampl_module_base/bin/ampl.lic": # Bundle #7221.7759 expiring 20260215: ME-409 Energy conversion and renewable energy, Prof. Fran?ois Mar?chal, EPFL 699c7af5 a69bd8d7 d03721ce 46b5d845 b5e07cac c0fdbf9c 20b62279 e5a50a6f 038d9f13 27adab69 375207be 40876394 c0411508 7069198b 170d5c87 2123901e 93dc9d28 c64bc277 5513a11a 2470be16 85560215 e6f7cdf4 771bc24d 712276de 2284225a d5dae4cf 4361faf4 33fa17ca 717a4852 7372752a e1716011 3055d6b9 179d4e58 a6d31d80 e7bbb7c4 150689af 373f22a6 57c46b47 877a6322 e7740e96 8708de3f 06517667 15eeb355 0309c3a8 a301bf0a 13f31636 c2709bd4 e2f0909d 472cf049 d18b831d 313947c0 e55d35d7 54fcddb6 e032cce7 e35a2055 443b4f8b f5bb060a d14e40d4 a309c008 873f2a23 920e69c6 65a3b5f2 54b05113 d4bb33e6 3103460d e620d26b 272af949 41d8c456 220ec475 f6d7592f a334e688 e47b780a a181ca40 6fa6b5ba 18cde424 1bfe6fb0 c09e2432 036f2f84 c208b135 c04d6445 5e73fc07 9fa5d207 a20a14a2 ea536897 e07771be bfc40ad7 e90dd733 b56eab30 4ecbd7fd baaf3d18 b2 Computed 1-1-0-eb4da5d1 runner--pdbxrphm-project-62195384-concurrent-0 32:6C:CD:60:38:18 HOSTINFO.NPROC.4 HOSTINFO.CORES.4 HOSTINFO.PLATFORM.linux64 No ampl license for this machine. During handling of the above exception, another exception occurred: SystemError Traceback (most recent call last) Cell In[3], line 2 1 es_core = Energyscope(model=core) ----> 2 results_core = postprocessing(es_core.calc(), df_monthly=False) File /builds/energyscope/energyscope/src/energyscope/energyscope.py:83, in Energyscope.calc(self, ds, parser) 79 def calc(self, ds: Dataset = None, parser: Callable[[AMPL], Result] = parse_result) -> Result: 80 """ 81 Calls AMPL with `df` as .dat and returns the parsed result. 82 """ ---> 83 if self.es_model.getSets().__len__() == 0: # Check if AMPL instance is empty 84 self._initial_run(ds=ds) 86 # Solve the model File /builds/energyscope/energyscope/src/energyscope/energyscope.py:44, in Energyscope.es_model(self) 41 self.__es_model = AMPL() 42 except SystemError: 43 # Try to create the object a second time to prevent errors when starting `ampl_lic` ---> 44 self.__es_model = AMPL() 45 return self.__es_model File ~/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/amplpy/ampl.py:105, in AMPL.__init__(self, environment) 103 environment = Environment() 104 if environment is None: --> 105 self._impl = amplpython.AMPL() 106 else: 107 self._impl = amplpython.AMPL(environment._impl) SystemError: License not valid. Message: License file /root/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/ampl_module_base/bin/ampl.lic: Today = 20260223; found license file "/root/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/ampl_module_base/bin/ampl.lic": # Bundle #7221.7759 expiring 20260215: ME-409 Energy conversion and renewable energy, Prof. Fran?ois Mar?chal, EPFL 699c7af5 a69bd8d7 d03721ce 46b5d845 b5e07cac c0fdbf9c 20b62279 e5a50a6f 038d9f13 27adab69 375207be 40876394 c0411508 7069198b 170d5c87 2123901e 93dc9d28 c64bc277 5513a11a 2470be16 85560215 e6f7cdf4 771bc24d 712276de 2284225a d5dae4cf 4361faf4 33fa17ca 717a4852 7372752a e1716011 3055d6b9 179d4e58 a6d31d80 e7bbb7c4 150689af 373f22a6 57c46b47 877a6322 e7740e96 8708de3f 06517667 15eeb355 0309c3a8 a301bf0a 13f31636 c2709bd4 e2f0909d 472cf049 d18b831d 313947c0 e55d35d7 54fcddb6 e032cce7 e35a2055 443b4f8b f5bb060a d14e40d4 a309c008 873f2a23 920e69c6 65a3b5f2 54b05113 d4bb33e6 3103460d e620d26b 272af949 41d8c456 220ec475 f6d7592f a334e688 e47b780a a181ca40 6fa6b5ba 18cde424 1bfe6fb0 c09e2432 036f2f84 c208b135 c04d6445 5e73fc07 9fa5d207 a20a14a2 ea536897 e07771be bfc40ad7 e90dd733 b56eab30 4ecbd7fd baaf3d18 b2 Computed 1-1-0-eb4da5d1 runner--pdbxrphm-project-62195384-concurrent-0 32:6C:CD:60:38:18 HOSTINFO.NPROC.4 HOSTINFO.CORES.4 HOSTINFO.PLATFORM.linux64 No ampl license for this machine.
In [4]:
Copied!
fig = plot_resources_use(results_core)
fig.show(renderer="notebook")
fig = plot_resources_use(results_core)
fig.show(renderer="notebook")
--------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[4], line 1 ----> 1 fig = plot_resources_use(results_core) 2 fig.show(renderer="notebook") NameError: name 'results_core' is not defined