rl-institut / multi-vector-simulator

Multi-vector Simulation Tool assessing and optimizing Local Energy Systems (LES) for the E-LAND project
GNU General Public License v2.0
21 stars 10 forks source link

[Simulation Error] ValueError: No value for uninitialized NumericValue object InvestmentFlow #766

Closed Bachibouzouk closed 3 years ago

Bachibouzouk commented 3 years ago

This issue is to potentially be used as FAQ for future users who might encounter similar errors when creating a scenario from scratch and also to make sure the error and warning message are understandable for someone trying to setup an energy system model.

Here is the energy model graph:

energy_system_graph

10:06:43-WARNING-You are not using the parameter 'scenario_description' for asset group 'project_data', which allows giving a description for the scenario being simulatedThis parameter is set to it's default value (), which can influence the results.In the next release, this parameter will required.

mvs_eland/src/multi_vector_simulator/C0_data_processing.py:1756: UserWarning: The stated maximumCap in energyConversion Transformer_station_(DSO)_feedin is smaller than the installedCap (0/1250). Please enter a greater maximumCap.For this simulation, the maximumCap will be disregarded and not be used in the simulation
  warnings.warn(UserWarning(message))
10:06:43-WARNING-The stated maximumCap in energyConversion Transformer_station_(DSO)_feedin is smaller than the installedCap (0/1250). Please enter a greater maximumCap.For this simulation, the maximumCap will be disregarded and not be used in the simulation
mvs_eland/src/multi_vector_simulator/C0_data_processing.py:1766: UserWarning: The stated maximumCap of zero in energyConversion solar_inverter_(mono) is invalid.For this simulation, the maximumCap will be disregarded and not be used in the simulation.
  warnings.warn(UserWarning(message))
10:06:43-WARNING-The stated maximumCap of zero in energyConversion solar_inverter_(mono) is invalid.For this simulation, the maximumCap will be disregarded and not be used in the simulation.
mvs_eland/src/multi_vector_simulator/C0_data_processing.py:1756: UserWarning: The stated maximumCap in energyConversion transformer_station_(DSO)_consumption is smaller than the installedCap (0/1250). Please enter a greater maximumCap.For this simulation, the maximumCap will be disregarded and not be used in the simulation
  warnings.warn(UserWarning(message))
10:06:43-WARNING-The stated maximumCap in energyConversion transformer_station_(DSO)_consumption is smaller than the installedCap (0/1250). Please enter a greater maximumCap.For this simulation, the maximumCap will be disregarded and not be used in the simulation
10:06:43-WARNING-Feed-in tariff of Electricity (0.005) > levelized costs of generation for energy asset 'PV_plant_(Halle 18)' with 0.0002. This will cause the optimization to result into the maximum capacity of this asset.
10:06:43-ERROR-timeseries of non-dispatchable source PV_plant_(Halle 18) contains values out of bounds [0, 1].
10:06:43-WARNING-When the maximum emissions constraint is used and no production asset with zero emissions is optimized without maximum capacity this could result into an unbound problem. If this happens you can either raise the allowed maximum emissions or make sure you have enough production capacity with low emissions to cover the demand.
10:06:43-ERROR-Energy system bus DSO bus_pdp has too few assets connected to it. The minimal number of assets that need to be connected so that the bus is not a dead end should be two, excluding the excess sink. These are the connected assets: Electricity_grid_DSO_consumption

WARNING: Loading a SolverResults object with a warning status into
    model=Model;
        message from solver=<undefined>
10:07:44-WARNING-Loading a SolverResults object with a warning status into model=Model;
    message from solver=<undefined>
.virtualenvs/mvs-eland/lib/python3.7/site-packages/oemof/solph/models.py:220: UserWarning: Optimization ended with status warning and termination condition infeasible
  UserWarning)
ERROR: evaluating object as numeric value:
    InvestmentFlow.invest[solar_inverter_(mono),AC bus]
        (object: <class 'pyomo.core.base.var._GeneralVarData'>)
    No value for uninitialized NumericValue object
    InvestmentFlow.invest[solar_inverter_(mono),AC bus]
10:07:48-ERROR-evaluating object as numeric value: InvestmentFlow.invest[solar_inverter_(mono),AC bus]
    (object: <class 'pyomo.core.base.var._GeneralVarData'>)
No value for uninitialized NumericValue object InvestmentFlow.invest[solar_inverter_(mono),AC bus]
Traceback (most recent call last):
  File ".virtualenvs/mvs-eland/bin/mvs_tool", line 33, in <module>
    sys.exit(load_entry_point('multi-vector-simulator', 'console_scripts', 'mvs_tool')())
  File "mvs_eland/src/multi_vector_simulator/cli.py", line 170, in main
    save_lp_file=True,
  File "mvs_eland/src/multi_vector_simulator/D0_modelling_and_optimization.py", line 108, in run_oemof
    dict_values, model, local_energy_system
  File "mvs_eland/src/multi_vector_simulator/D0_modelling_and_optimization.py", line 300, in simulating
    results_meta = processing.meta_results(local_energy_system)
  File ".virtualenvs/mvs-eland/lib/python3.7/site-packages/oemof/solph/processing.py", line 206, in meta_results
    meta_res = {'objective': om.objective()}
  File ".virtualenvs/mvs-eland/lib/python3.7/site-packages/pyomo/core/base/expression.py", line 54, in __call__
    return self.expr(exception=exception)
  File "pyomo/core/expr/numeric_expr.pyx", line 224, in pyomo.core.expr.numeric_expr.ExpressionBase.__call__
  File ".virtualenvs/mvs-eland/lib/python3.7/site-packages/pyomo/core/expr/visitor.py", line 1057, in evaluate_expression
    return visitor.dfs_postorder_stack(exp)
  File ".virtualenvs/mvs-eland/lib/python3.7/site-packages/pyomo/core/expr/visitor.py", line 587, in dfs_postorder_stack
    flag, value = self.visiting_potential_leaf(_sub)
  File ".virtualenvs/mvs-eland/lib/python3.7/site-packages/pyomo/core/expr/visitor.py", line 965, in visiting_potential_leaf
    return True, value(node)
  File "pyomo/core/expr/numvalue.pyx", line 244, in pyomo.core.expr.numvalue.value
  File "pyomo/core/expr/numvalue.pyx", line 231, in pyomo.core.expr.numvalue.value
ValueError: No value for uninitialized NumericValue object InvestmentFlow.invest[solar_inverter_(mono),AC bus]

Unfortunately I cannot share the input data publicly

Checklist to make sure that the bug report ist complete:

smartie2076 commented 3 years ago

Hi @Bachibouzouk! Can you share the energy system graph? This is always the first step to check: Is the energy syste set up correctly. Second, one needs to make sure that there are no bottlenecks, ie. if all assets that are necessary are being optimized.

Then, these are the issues I would concencrate on next:

mvs_eland/src/multi_vector_simulator/C0_data_processing.py:1756: UserWarning: The stated maximumCap in energyConversion Transformer_station_(DSO)_feedin is smaller than the installedCap (0/1250). Please enter a greater maximumCap.For this simulation, the maximumCap will be disregarded and not be used in the simulation
  warnings.warn(UserWarning(message))
10:06:43-WARNING-The stated maximumCap in energyConversion Transformer_station_(DSO)_feedin is smaller than the installedCap (0/1250). Please enter a greater maximumCap.For this simulation, the maximumCap will be disregarded and not be used in the simulation
mvs_eland/src/multi_vector_simulator/C0_data_processing.py:1766: UserWarning: The stated maximumCap of zero in energyConversion solar_inverter_(mono) is invalid.For this simulation, the maximumCap will be disregarded and not be used in the simulation.
  warnings.warn(UserWarning(message))
10:06:43-WARNING-The stated maximumCap of zero in energyConversion solar_inverter_(mono) is invalid.For this simulation, the maximumCap will be disregarded and not be used in the simulation.
mvs_eland/src/multi_vector_simulator/C0_data_processing.py:1756: UserWarning: The stated maximumCap in energyConversion transformer_station_(DSO)_consumption is smaller than the installedCap (0/1250). Please enter a greater maximumCap.For this simulation, the maximumCap will be disregarded and not be used in the simulation
  warnings.warn(UserWarning(message))
10:06:43-WARNING-The stated maximumCap in energyConversion transformer_station_(DSO)_consumption is smaller than the installedCap (0/1250). Please enter a greater maximumCap.For this simulation, the maximumCap will be disregarded and not be used in the simulation

maximumCap should be None or a value > 0. If maximumCap=0, you could also set optimizeCap=False, as oemof is not allowed to install anything of the asset anyway. Check this first.

10:06:43-WARNING-Feed-in tariff of Electricity (0.005) > levelized costs of generation for energy asset 'PV_plant_(Halle 18)' with 0.0002. This will cause the optimization to result into the maximum capacity of this asset.

I am not sure if this would result in an unbound solution or an unitalized value, could be both. Is the PV asset of fix capacity (ok) or being optimized (dangerous)?

10:06:43-ERROR-timeseries of non-dispatchable source PV_plant_(Halle 18) contains values out of bounds [0, 1].

Do you have a timeseries of specific generation, ie. is the value only marginally over 1, indicating a very very good PV location? I think the simulation runs though anyway, but not using the specific generation will cause errors in the KPI.

smartie2076 commented 3 years ago

@mahendrark maybe this is also inspiration for #754

mahendrark commented 3 years ago

@Bachibouzouk

ValueError: No value for uninitialized NumericValue object InvestmentFlow.invest[solar_inverter_(mono),AC bus]

Check your energy system setup again. This might be because of wrong connections between the components.

Bachibouzouk commented 3 years ago

The problem was that the sum of the max capacites in the energyConversion.csv were smaller than the demand and the demand could not be met. Increasing the capacities solved the issue

smartie2076 commented 3 years ago

We are implementing a check for sufficient capacities, this should help debugging: #782