oemof / demandlib

Creating heat and power demand profiles from annual values.
https://oemof.org
MIT License
55 stars 38 forks source link

annual_heat_demand and sum of demand as result of bdew.HeatBuilding() differ slightly #33

Open MaGering opened 3 years ago

MaGering commented 3 years ago

If you check the result, which is returned by bdew.HeatBuilding(), you'll find that its sum differs slightly from your input in annual_heat_demand.

To reproduce this, you can add these two lines to heat_demand_example.py here after calling bdew.HeatBuilding() for a single family housing ('efh'):

    result_annual_heat_demand = sum(demand["efh"])
    print("Sum of heat demand 'efh': ", result_annual_heat_demand)
p-snft commented 3 years ago

To simplify discussion for those who cannot run the code right away: What are the numbers?

MaGering commented 3 years ago

If you pass annual_heat_demand=25000 and shlp_type='EFH', then you'll get sum(demand["efh"]) = 25001.458160603575

p-snft commented 3 years ago

I think, this inaccuracy is quite expected when using floating point numbers. If it's really necessary, it might be mitigated but not avoided.

p-snft commented 3 years ago

I found that the results in this area in the code are pretty sensitive to code changes. Maybe, it is possible to reduce the inaccuracy.