quintel / etengine

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

Floating point error in hydrogen storage calculation #1331

Open mabijkerk opened 1 year ago

mabijkerk commented 1 year ago

The energy_hydrogen_storage does not have any loss specified on the node:

V(energy_hydrogen_storage,loss_output_conversion)

0.0

However when I subtract the sum of the hydrogen output curve from the sum of the hydrogen input curve to confirm that the annual loss is 0, the result instead is a negative loss:

SUM(V(energy_hydrogen_storage,hydrogen_input_curve)) -
  SUM(V(energy_hydrogen_storage,hydrogen_output_curve))

-8.493661880493164e-07

@noracato this seems like a floating point error in the hourly calculation for hydrogen storage. Can you look into this? We're using this query in the new storage export and it is strange to see a negative loss in the export.

github-actions[bot] commented 1 year ago

This issue has had no activity for 60 days and will be closed in 7 days. Removing the "Stale" label or posting a comment will prevent it from being closed automatically. You can also add the "Pinned" label to ensure it isn't marked as stale in the future.

mabijkerk commented 1 year ago

Floating point errors also occur for the forecasting algorithm. For a flow battery with 500 MW installed output capacity and 250 MW input capacity, I get the following results:

MAX(V(energy_flexibility_flow_batteries_electricity,electricity_input_curve)

250.00000000000003