quintel / etengine

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

Deficits show up in hourly calculations but not in yearly node #1389

Closed mabijkerk closed 4 months ago

mabijkerk commented 5 months ago

Background When I open a blank nl2019 scenario on master, the deficits for households and buildings are 0.0 PJ. See the households_space_heater_deficit:

Screenshot 2024-01-25 at 13 28 49

When I however open the deficits table, it shows that there are deficits for apartments between 2005 and present:

Deficits in space heating per residence type and construction period 2526230

Issue This means that the FEVER_DEMAND_CURVE and the FEVER_PRODUCTION_CURVE for households_useful_demand_for_space_heating_apartments_2005_present are not equal. These are subtracted from each other in the query absolute_deficit_useful_demand_for_space_heating_apartments_2005_present.

Solution I am not sure how this should be solved. Some interesting points to note:

mabijkerk commented 5 months ago

Data-initialisation now shows 0 deficits in a blank scenario, nice work @noracato! I do still spot a minor issue however. Opening a blank scenario now produces -0 deficits:

image
mabijkerk commented 5 months ago

Additionally, when I introduce deficits and then set the amount of decimals to 1, this seems to have no affect. For example:

      %td{:data => {:decimals => 1, :gquery => "relative_deficit_useful_demand_for_space_heating_apartments_before_1945", :graph => :future}}
      %td{:data => {:decimals => 1, :gquery => "relative_deficit_useful_demand_for_space_heating_detached_houses_before_1945", :graph => :future}}
      %td{:data => {:decimals => 1, :gquery => "relative_deficit_useful_demand_for_space_heating_semi_detached_houses_before_1945", :graph => :future}}
      %td{:data => {:decimals => 1, :gquery => "relative_deficit_useful_demand_for_space_heating_terraced_houses_before_1945", :graph => :future}}

This still produces:

Screenshot 2024-01-30 at 16 58 33
noracato commented 5 months ago

Additionally, when I introduce deficits and then set the amount of decimals to 1, this seems to have no affect.

That is because the unit of the values is unknown, so the table does not (know how to) scale the values and keeps them as the are.

mabijkerk commented 5 months ago

How can the table know the unit of the values? Especially when there are two unit type values in the same table?

noracato commented 5 months ago

Sorry, that was unclear of me.

In the interface file, your table does not specify a unit, and therefore the table will not rescale values as it does not what the rules are for the conversion. Hence, giving the table cell a precision of 1 decimal will not do anything, as the table is not doing anything with the number.

mabijkerk commented 5 months ago

So is it possible to set a unit for part of the table?

noracato commented 5 months ago

Not at the moment unfortunately

noracato commented 5 months ago

Or we have to rebuild the table in a different way, like for example the plant profitability table

mabijkerk commented 5 months ago

Table is looking great! There is however still an interesting thing going on with the data-initialisation in a blank nl2019 scenario. A tiny amount of deficits occur:

V(households_space_heater_deficit,demand)

0.0001087188720703125

The table then looks like this:

Screenshot 2024-01-31 at 15 20 33

Should I open a new issue for this? The negative deficit is strange enough that it should be solved at some point. The issue however seems so marginal that is more of a nice-to-solve at some point than a must-have now.

mabijkerk commented 5 months ago

It is still something worth investigating in my opinion, because in a blank DE_germany scenario, some deficits are quite significant:

Screenshot 2024-01-31 at 15 27 05

If is set any of the technologies at 100% in that scenario, no deficits occur. This suggests that it is not related to the technology capacities, but to the initialisation.

V(households_space_heater_deficit,demand)

5,096,004,925.676771
noracato commented 5 months ago

Interesting!