Error when running MUSE with multiple agents

63 views
Skip to first unread message

Lennart Morlock

unread,
Feb 13, 2024, 9:16:24 AM2/13/24
to MUSE
Hi all,

I want to run the attached model with four residential demand sectors. However, I get the error message ValueError: Failed to group data. Are you grouping by a variable that is all NaN? (Full error message below) when the model is running the residential_hot_water sector in 2040 (according to the log).

Similar to this previous post, the error does not occur if I add some existing capacity to one technology in the hot water sector until the end of the model run. However, I would like to know what causes the error.

I have tried a few things. The error does not occur if ...
  • I switch the agents used in the residential_hot_water sector with the agents used in the residential_non_heat sector (by switching the paths in the settings file), so it seems to be caused by the interplay of the chosen agents and the technology definition in the residential_hot_water sector
  • I remove any one of the three technologies present in the residential_hot_water sector (so every combination of two of the technologies works)

Does anybody have an idea?

Best
Lennart

Log + Error Message:

-- 2024-02-13 13:32:10 - muse.mca - INFO
Finish simulation year 2035 (6/9)!

-- 2024-02-13 13:32:10 - muse.mca - INFO
Running simulation year 2040...

-- 2024-02-13 13:32:10 - muse.sectors.sector - INFO
Running residential_hot_water for year 2040

-- 2024-02-13 13:32:10 - muse.interactions - INFO
Net new_to_retro of 3 interactions interacting via transfer

-- 2024-02-13 13:32:10 - muse.hooks - INFO
Computing initial_asset_transform: default

-- 2024-02-13 13:32:10 - muse.hooks - INFO
Computing initial_asset_transform: clean

-- 2024-02-13 13:32:10 - muse.hooks - INFO
Computing initial_asset_transform: default

-- 2024-02-13 13:32:10 - muse.hooks - INFO
Computing initial_asset_transform: clean

-- 2024-02-13 13:32:10 - muse.hooks - INFO
Computing initial_asset_transform: default

-- 2024-02-13 13:32:10 - muse.hooks - INFO
Computing initial_asset_transform: clean

-- 2024-02-13 13:32:10 - muse.demand_share - INFO
Computing demand_share: default

-- 2024-02-13 13:32:10 - muse.production - INFO
Computing production: max

-- 2024-02-13 13:32:10 - muse.production - INFO
Computing production: max

-- 2024-02-13 13:32:10 - muse.filters - INFO
Computing initial search-space: from_techs

-- 2024-02-13 13:32:10 - muse.filters - INFO
Computing filter: all

-- 2024-02-13 13:32:10 - muse.filters - INFO
Computing filter: with_asset_technology

-- 2024-02-13 13:32:10 - muse.filters - INFO
Computing filter: compress

-- 2024-02-13 13:32:10 - muse.objectives - INFO
Computing objective: comfort

-- 2024-02-13 13:32:10 - muse.objectives - INFO
Computing objective: emissions

-- 2024-02-13 13:32:10 - muse.objectives - INFO
Computing objective: LCOE

-- 2024-02-13 13:32:11 - muse.objectives - INFO
Computing objective: capacity

-- 2024-02-13 13:32:11 - muse.decisions - INFO
Computing decision: weighted_sum

-- 2024-02-13 13:32:11 - muse.investments - INFO
Computing investment: adhoc

Traceback (most recent call last):
  File "C:\Users\lenna\anaconda3\envs\muse_env\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\lenna\anaconda3\envs\muse_env\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\lenna\anaconda3\envs\muse_env\Scripts\muse.exe\__main__.py", line 7, in <module>
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\__main__.py", line 60, in run
    muse_main(args.settings, args.model, args.copy)
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\__main__.py", line 55, in muse_main
    MCA.factory(settings).run()
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\mca.py", line 346, in run
    _, new_market, self.sectors = self.find_equilibrium(new_market)
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\mca.py", line 209, in find_equilibrium
    return find_equilibrium(
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\mca.py", line 561, in find_equilibrium
    market, equilibrium_sectors = single_year_iteration(market, sectors)
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\mca.py", line 468, in single_year_iteration
    sector_market = sector.next(
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\sectors\sector.py", line 236, in next
    subsector.invest(
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\sectors\subsector.py", line 74, in invest
    lp_problem = self.aggregate_lp(
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\sectors\subsector.py", line 147, in aggregate_lp
    result = agent.next(
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\agents\agent.py", line 421, in next
    investments = self.invest(
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\investments.py", line 168, in compute_investment
    return investment(
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\registration.py", line 172, in decorated
    result = inner_decorated(*args, **kwargs)
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\investments.py", line 99, in decorated
    result = function(costs, search_space, technologies, constraints, **kwargs)
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\investments.py", line 286, in adhoc_match_demand
    production = demand_matching(
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\demand_matching.py", line 249, in demand_matching
    result = demand_matching(  # type: ignore
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\demand_matching.py", line 255, in demand_matching
    return _demand_matching_impl(demand, cost, *constraints)
  File "C:\Users\lenna\MUSE_test2\MUSE_OS\src\muse\demand_matching.py", line 297, in _demand_matching_impl
    for _, same_cost in data.groupby("cost") if cost.dims else [(cost, data)]:
  File "C:\Users\lenna\anaconda3\envs\muse_env\lib\site-packages\xarray\core\common.py", line 721, in groupby
    return self._groupby_cls(
  File "C:\Users\lenna\anaconda3\envs\muse_env\lib\site-packages\xarray\core\groupby.py", line 385, in __init__
    raise ValueError(
ValueError: Failed to group data. Are you grouping by a variable that is all NaN?
 

base_model_nopowse_errorsearch.zip

Lennart Morlock

unread,
Mar 11, 2024, 10:32:56 AM3/11/24
to MUSE
I think I found the cause of this error and a possible solution. For more details, see the related bug report on Github.

Best
Lennart

Reply all
Reply to author
Forward
0 new messages