bcgov / lcfs

An online application for fuel suppliers to manage their compliance obligations under the Low Carbon Fuels Act
Apache License 2.0
5 stars 3 forks source link

LCFS - Compliance report "Energy content" calculation #1051

Closed Grulin closed 1 month ago

Grulin commented 1 month ago

Describe the Bug There is an inconsistency in the compliance report calculation for the energy content column. The calculation should be based on the formula: quantity x energy density. However, it appears that the system is incorrectly calculating the energy content. For example, a supplier who has supplied 1,000 L of biodiesel at the default carbon intensity should have an energy content calculation of 1,000 L x 35.4 MJ/L = 35,400 MJ. Instead, the energy content is showing as 38,270 MJ, which is incorrect.

Image

Expected Behaviour The energy content calculation should be based on the formula: quantity x energy density. For an example with biodiesel, the energy density is 35.4 MJ/L, so if a supplier provides 1,000 L, the energy content should be calculated as 1,000 L x 35.4 MJ/L = 35,400 MJ.

Actual Behaviour The energy content calculation is incorrect. For example, an input of 1,000 L of biodiesel, the energy content is incorrectly displayed as 38,270 MJ instead of the correct value of 35,400 MJ.

Implications

Steps To Reproduce Steps to reproduce the behaviour: User/Role: BCeID

  1. Go to the Compliance Report and input a quantity of 1,000 L of biodiesel with the default carbon intensity.
  2. Check the energy content column for the biodiesel line item.
  3. Observe that the energy content is incorrectly calculated and displayed as 38,270 MJ instead of 35,400 MJ.

Notes:

I initially tested this on only the biodiesel fuel type, but am concerned this might be a bigger issue for all calculations of in the "Energy" column of the compliance reports

dhaselhan commented 1 month ago

This moved all the calculations to the backend, so this also includes a fix where selecting a fuel code should now show the fuel codes CI in the table.