Closed Tristan22400 closed 1 month ago
Thanks, Tristan. Indeed, there are several comments in the code saying that electricity is in kWh/day rather than mmBtu/day, but this isn't correct. All energy carriers are stored in units of mmBtu/day. The value of electricity can be set in units of kWh/day, but will be converted and stored in mmBtu/day. I've just written a test for this, which I'll commit later to the repo.
In summary, the use of sum()
is correct, though the conversion factor used by pint
must includes we should document, e.g., LHV vs HHV.
And the comments in the energy.py should be updated.
Okay, so this documentation needs to removed from the repository. We try to do it in the week if I have time. So, I just have a question. What convention do you choose to convert the electricity in thermal unit ? P.S : I don't know if you see but I answered your questions in the closed pull request. I have created.
We're using the pint
package to represent quantities with units, and we use its built-in conversion, which appears to be 293.071111 kWh/mmBtu :
> rate
Out[1]: 123.45 <Unit('kilowatt_hour / day')>
> e.set_rate(EN_ELECTRICITY, rate)
> e.rates()[EN_ELECTRICITY]
Out[4]: 0.42122882576849 <Unit('mmBtu / day')>
> rate / e.rates()[EN_ELECTRICITY]
Out[5]: 293.0711111111111 <Unit('kilowatt_hour / mmBtu')>
To compute the sum of the energy consumed in a field, the model is currently using the function sum. As you can noticed in the python file field.py l 699 :
https://github.com/msmasnadi/OPGEEv4/blob/fee0be3db4b01bc189f94e1dbb89c943b4e8ea1a/opgee/field.py#L680-L701
Even though, the energy rate are not in the same unit as written in the energy.py file.
https://github.com/msmasnadi/OPGEEv4/blob/fee0be3db4b01bc189f94e1dbb89c943b4e8ea1a/opgee/energy.py#L62-L81
A conversation factor need to be added in my opinion. But then, we enter in a complex topic of energy analysis where no obvious solution can be chosen for the conversion of electricity in thermal energy.