Skip to content

Commit

Permalink
Update energy.py
Browse files Browse the repository at this point in the history
Some propositions to the issue coddingtonbear#68
  • Loading branch information
GPanthou authored Jul 1, 2022
1 parent 2fb3b95 commit 1ede9bc
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion measurement/measures/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ class Energy(AbstractMeasure):
["electronvolt"],
)
tonne_tnt = Unit("4184000000")


watthour = MetricUnit(
"3600",
["wh", "watthour", "watt-hour"],
["wh"],
["watthour"],
)


Heat = Energy

class Power(AbstractMeasure, metaclass=FractionMeasureBase):
__numerator__ = Energy
__denominator__ = Time

watt = MetricUnit("1", ["W", "w", "Watt"], ["W"], ["Watt"])


@classmethod
def _attr_to_unit(cls, name):
return super()._attr_to_unit(name.replace("__", "/"))

0 comments on commit 1ede9bc

Please sign in to comment.