diff --git a/setup.py b/setup.py index b43b94c..88cc534 100644 --- a/setup.py +++ b/setup.py @@ -12,11 +12,11 @@ # The UnitNet definition version that the current package is based on to generate units classes # see -definition_version = '5.56.0' +definition_version = '5.57.0' setup_kwargs = { 'name': 'unitsnet-py', - 'version': '0.1.121', + 'version': '0.1.122', 'license': 'MIT', 'keywords': 'conversion, units-of-measure, units, quantities, unit-converter, converter, unit, measure, measures, measurement, measurements', 'description': 'A better way to hold unit variables and easily convert to the destination unit', diff --git a/unitsnet_py/units/power.py b/unitsnet_py/units/power.py index 7164dfc..bcb65de 100644 --- a/unitsnet_py/units/power.py +++ b/unitsnet_py/units/power.py @@ -50,6 +50,11 @@ class PowerUnits(Enum): """ + TonOfRefrigeration = 'TonOfRefrigeration' + """ + + """ + Femtowatt = 'Femtowatt' """ @@ -222,6 +227,8 @@ def __init__(self, value: float, from_unit: PowerUnits = PowerUnits.Watt): self.__joules_per_hour = None + self.__tons_of_refrigeration = None + self.__femtowatts = None self.__picowatts = None @@ -337,6 +344,9 @@ def __convert_from_base(self, from_unit: PowerUnits) -> float: if from_unit == PowerUnits.JoulePerHour: return (value * 3600) + if from_unit == PowerUnits.TonOfRefrigeration: + return (value / 3516.853) + if from_unit == PowerUnits.Femtowatt: return ((value) / 1e-15) @@ -420,6 +430,9 @@ def __convert_to_base(self, value: float, to_unit: PowerUnits) -> float: if to_unit == PowerUnits.JoulePerHour: return (value / 3600) + if to_unit == PowerUnits.TonOfRefrigeration: + return (value * 3516.853) + if to_unit == PowerUnits.Femtowatt: return ((value) * 1e-15) @@ -602,6 +615,21 @@ def from_joules_per_hour(joules_per_hour: float): return Power(joules_per_hour, PowerUnits.JoulePerHour) + @staticmethod + def from_tons_of_refrigeration(tons_of_refrigeration: float): + """ + Create a new instance of Power from a value in tons_of_refrigeration. + + + + :param meters: The Power value in tons_of_refrigeration. + :type tons_of_refrigeration: float + :return: A new instance of Power. + :rtype: Power + """ + return Power(tons_of_refrigeration, PowerUnits.TonOfRefrigeration) + + @staticmethod def from_femtowatts(femtowatts: float): """ @@ -960,6 +988,17 @@ def joules_per_hour(self) -> float: return self.__joules_per_hour + @property + def tons_of_refrigeration(self) -> float: + """ + + """ + if self.__tons_of_refrigeration != None: + return self.__tons_of_refrigeration + self.__tons_of_refrigeration = self.__convert_from_base(PowerUnits.TonOfRefrigeration) + return self.__tons_of_refrigeration + + @property def femtowatts(self) -> float: """ @@ -1197,6 +1236,9 @@ def to_string(self, unit: PowerUnits = PowerUnits.Watt, fractional_digits: int = if unit == PowerUnits.JoulePerHour: return f"""{super()._truncate_fraction_digits(self.joules_per_hour, fractional_digits)} J/h""" + if unit == PowerUnits.TonOfRefrigeration: + return f"""{super()._truncate_fraction_digits(self.tons_of_refrigeration, fractional_digits)} TR""" + if unit == PowerUnits.Femtowatt: return f"""{super()._truncate_fraction_digits(self.femtowatts, fractional_digits)} fW""" @@ -1285,6 +1327,9 @@ def get_unit_abbreviation(self, unit_abbreviation: PowerUnits = PowerUnits.Watt) if unit_abbreviation == PowerUnits.JoulePerHour: return """J/h""" + if unit_abbreviation == PowerUnits.TonOfRefrigeration: + return """TR""" + if unit_abbreviation == PowerUnits.Femtowatt: return """fW"""