quintel / etengine

Calculation engine for the Energy Transition Model
https://energytransitionmodel.com/
MIT License
14 stars 7 forks source link

Updates to heat in built environment has caused PVT to break #1400

Closed mabijkerk closed 4 months ago

mabijkerk commented 5 months ago

Setting households_heater_heatpump_pvt_electricity_share to 100.0 on production increases final demand for solar thermal PVT, which determines the demand of the households_solar_pvt_solar_radiation node:

Screenshot 2024-02-07 at 10 06 45

On master, the same demand is passed to the outgoing solar_thermal edge of the households_solar_pvt_solar_radiation node, but the demand on the node itself is not picked up:

Screenshot 2024-02-07 at 10 07 52

This issue has arised since the latest changes to heat in the built environment. No changes have been made to the graph structure, though the inputs have been changed. From: ...

    EACH(
      UPDATE(EDGE(households_space_heater_heatpump_pvt_electricity_aggregator,households_useful_demand_for_space_heating_after_insulation), share, DIVIDE(USER_INPUT(),100)),
      UPDATE(EDGE(households_water_heater_heatpump_pvt_electricity_aggregator,households_useful_demand_for_hot_water_after_solar_heater), share, DIVIDE(USER_INPUT(),100)),
      )

... to ...

    EACH(
      UPDATE(V(households_space_heater_heatpump_pvt_electricity, fever), share_in_group, DIVIDE(USER_INPUT(),100.0)),
      UPDATE(V(households_water_heater_heatpump_pvt_electricity, fever), share_in_group, DIVIDE(USER_INPUT(),100.0))
    )

@noracato is this something you (and I) can look into?

noracato commented 4 months ago

No changes have been made to the graph structure

Correct me if I'm wrong, but the edge from the solar PVT towards the local available electricity seems to have changed from share to flexible.

Maybe it has nothing to do with it at all. I can check what is happening inside the calculation to give us more insight!

mabijkerk commented 4 months ago

Unfortunately it is not related to the edge type, apparently this was something I had tested locally and not commited, because every else the type is share instead of flexible. With both types the problem persists.

In short, the exact same demand for solar thermal from the households_solar_pvt_solar_radiation is allocated on production and on heat-final-fixes (or on master) but on heat-final-fixes it is not picked up by the demand of the node itself, nor by the electricity output.

noracato commented 4 months ago

This issue had the same cause as #1390. Instead of adding even more manual install checks for Merit participants, I decided to pull Fever's share/pair calculations (between consumers and producers) forward to an early setup stage.

This means the Causality and graph calculations are now in the following order:

  1. User values are set on the graph
  2. Causality: early setup for Fever. Fever calculates and sets consumer/producer shares based on share_in_group and number_of_units as per usual
  3. Yearly graph calculations: set all demands and shares that could be calulated - this means all basic heat demands are now known throughout the graph
  4. Causality: setup all other participants
  5. Causality: run calculations per hour
  6. Yearly graph calculations: fill in rest of flows
  7. Causality: reconciliation

Before 2 was part of 4, which meant not all demands were known and Merit did not know whether some participants should be joining the calculation.

The fix I did initially for #1390 has been reversed.

mabijkerk commented 4 months ago

Good stuff! This fixes the PVT behaviour:

Screenshot 2024-02-15 at 17 23 31

However, it does not seem to work entirely, as it also seems to duplicate heat supply in deficits... Screenshot 2024-02-15 at 17 25 07

This deficit duplication also happens for heat network: Screenshot 2024-02-15 at 17 25 35

Even 'normal' technologies, such as the electric boiler, now produce more deficits: Screenshot 2024-02-15 at 17 26 19

noracato commented 4 months ago

Ah interesting! I'll look into it! Maybe this is still not the perfect spot for the Fever setup, and should it be inside step 3 somehow...

noracato commented 4 months ago

Done!

mabijkerk commented 4 months ago

The PVT (and other technologies) now work as expected, very nice work!

Is there an easy way to set a minimum unit to round to in tables? In a blank nl2019 scenario the deficits are in the Joules. I would like to set the minimum unit to MJ, since we typically do not view anything smaller in the ETM.

Screenshot 2024-02-19 at 09 01 11