Units conversion

units.conversion.POWER_IN_TW = <esdl.esdl.QuantityAndUnitType object>

Power in TW [QuantityAndUnitType]

units.conversion.POWER_IN_GW = <esdl.esdl.QuantityAndUnitType object>

Power in GW [QuantityAndUnitType]

units.conversion.POWER_IN_MW = <esdl.esdl.QuantityAndUnitType object>

Power in MW [QuantityAndUnitType]

units.conversion.POWER_IN_kW = <esdl.esdl.QuantityAndUnitType object>

Power in kW [QuantityAndUnitType]

units.conversion.POWER_IN_W = <esdl.esdl.QuantityAndUnitType object>

Power in W [QuantityAndUnitType]

units.conversion.ENERGY_IN_PJ = <esdl.esdl.QuantityAndUnitType object>

Energy in PJ [QuantityAndUnitType]

units.conversion.ENERGY_IN_TJ = <esdl.esdl.QuantityAndUnitType object>

Energy in TJ [QuantityAndUnitType]

units.conversion.ENERGY_IN_GJ = <esdl.esdl.QuantityAndUnitType object>

Energy in GJ [QuantityAndUnitType]

units.conversion.ENERGY_IN_MJ = <esdl.esdl.QuantityAndUnitType object>

Energy in MJ [QuantityAndUnitType]

units.conversion.ENERGY_IN_kJ = <esdl.esdl.QuantityAndUnitType object>

Energy in kJ [QuantityAndUnitType]

units.conversion.ENERGY_IN_J = <esdl.esdl.QuantityAndUnitType object>

Energy in J [QuantityAndUnitType]

units.conversion.ENERGY_IN_TWh = <esdl.esdl.QuantityAndUnitType object>

Energy in TWh [QuantityAndUnitType]

units.conversion.ENERGY_IN_GWh = <esdl.esdl.QuantityAndUnitType object>

Energy in GWh [QuantityAndUnitType]

units.conversion.ENERGY_IN_MWh = <esdl.esdl.QuantityAndUnitType object>

Energy in MWh [QuantityAndUnitType]

units.conversion.ENERGY_IN_kWh = <esdl.esdl.QuantityAndUnitType object>

Energy in kWh [QuantityAndUnitType]

units.conversion.ENERGY_IN_Wh = <esdl.esdl.QuantityAndUnitType object>

Energy in Wh [QuantityAndUnitType]

units.conversion.COST_IN_MEur = <esdl.esdl.QuantityAndUnitType object>

Cost in Million Euro [QuantityAndUnitType]

units.conversion.COST_IN_Eur_per_MWh = <esdl.esdl.QuantityAndUnitType object>

Cost in Euro per MWh [QuantityAndUnitType]

units.conversion.COST_IN_Eur_per_GJ = <esdl.esdl.QuantityAndUnitType object>

Cost in Euro per GigaJoule [QuantityAndUnitType]

units.conversion.COST_IN_MEur_per_GW_per_year = <esdl.esdl.QuantityAndUnitType object>

Operational costs (OPEX) in MEUR/GW/yr [QuantityAndUnitType]

units.conversion.COST_IN_MEur_per_GW = <esdl.esdl.QuantityAndUnitType object>

Installation cost (CAPEX) in MEUR/GW [QuantityAndUnitType]

units.conversion.COST_IN_MEur_per_PJ = <esdl.esdl.QuantityAndUnitType object>

Variable cost in MEUR/PJ [QuantityAndUnitType]

units.conversion.equals(base_unit: QuantityAndUnitType, other: QuantityAndUnitType) bool

Checks if two units are equal based on physical quantity, multiplier, perMultiplier and perUnit attributes

units.conversion.convertable(source: UnitEnum[EOrderedSet([NONE=0, JOULE=1, WATTHOUR=2, WATT=3, VOLT=4, BAR=5, PSI=6, DEGREES_CELSIUS=7, KELVIN=8, GRAM=9, EURO=10, DOLLAR=11, SECOND=12, MINUTE=13, QUARTER=14, HOUR=15, DAY=16, WEEK=17, MONTH=18, YEAR=19, METRE=20, SQUARE_METRE=21, CUBIC_METRE=22, LITRE=23, WATTSECOND=24, ARE=25, HECTARE=26, PERCENT=27, VOLT_AMPERE=28, VOLT_AMPERE_REACTIVE=29, PASCAL=30, NEWTON=31, AMPERE=32, DEGREES=33])], target: UnitEnum[EOrderedSet([NONE=0, JOULE=1, WATTHOUR=2, WATT=3, VOLT=4, BAR=5, PSI=6, DEGREES_CELSIUS=7, KELVIN=8, GRAM=9, EURO=10, DOLLAR=11, SECOND=12, MINUTE=13, QUARTER=14, HOUR=15, DAY=16, WEEK=17, MONTH=18, YEAR=19, METRE=20, SQUARE_METRE=21, CUBIC_METRE=22, LITRE=23, WATTSECOND=24, ARE=25, HECTARE=26, PERCENT=27, VOLT_AMPERE=28, VOLT_AMPERE_REACTIVE=29, PASCAL=30, NEWTON=31, AMPERE=32, DEGREES=33])]) bool

Checks if a unit can be converted to another unit, e.g. Joule -> Wh or Kelvin -> Celsius

units.conversion.same_physical_quantity(source: QuantityAndUnitType, target: QuantityAndUnitType) bool

Returns if two esdl.QuantityAndUnitType are equal or if the unit is convertable (e.g. J to Wh)

units.conversion.convert_to_unit(value: float, source_unit: AbstractQuantityAndUnit, target_unit: AbstractQuantityAndUnit) float

Converts a value from the source_unit into a target_unit

example: converted_value: float = convert_to_unit(10, ENERGY_IN_J, ENERGY_IN_MWh)

Parameters:
  • value – the value that needs to be converted

  • source_unit – the QuantityAndUnit of the source (can also be a reference)

  • target_unit – the QuantityAndUnit of the target (can also be a reference, they are resolved to a Type)

Returns:

the converted value

units.conversion.convert_multiplier(source: QuantityAndUnitType, target: QuantityAndUnitType) float

Calculates the factor between the source unit and the target unit

units.conversion.multipier_value(multiplier: MultiplierEnum[EOrderedSet([NONE=0, ATTO=1, FEMTO=2, PICO=3, NANO=4, MICRO=5, MILLI=6, CENTI=7, DECI=8, DEKA=9, HECTO=10, KILO=11, MEGA=12, GIGA=13, TERA=14, TERRA=15, PETA=16, EXA=17])])

Converts ESDL MultiplierEnum into a numeric value.

units.conversion.convert_unit(value: float, source_quantity_unit: UnitEnum[EOrderedSet([NONE=0, JOULE=1, WATTHOUR=2, WATT=3, VOLT=4, BAR=5, PSI=6, DEGREES_CELSIUS=7, KELVIN=8, GRAM=9, EURO=10, DOLLAR=11, SECOND=12, MINUTE=13, QUARTER=14, HOUR=15, DAY=16, WEEK=17, MONTH=18, YEAR=19, METRE=20, SQUARE_METRE=21, CUBIC_METRE=22, LITRE=23, WATTSECOND=24, ARE=25, HECTARE=26, PERCENT=27, VOLT_AMPERE=28, VOLT_AMPERE_REACTIVE=29, PASCAL=30, NEWTON=31, AMPERE=32, DEGREES=33])], target_quantity_unit: UnitEnum[EOrderedSet([NONE=0, JOULE=1, WATTHOUR=2, WATT=3, VOLT=4, BAR=5, PSI=6, DEGREES_CELSIUS=7, KELVIN=8, GRAM=9, EURO=10, DOLLAR=11, SECOND=12, MINUTE=13, QUARTER=14, HOUR=15, DAY=16, WEEK=17, MONTH=18, YEAR=19, METRE=20, SQUARE_METRE=21, CUBIC_METRE=22, LITRE=23, WATTSECOND=24, ARE=25, HECTARE=26, PERCENT=27, VOLT_AMPERE=28, VOLT_AMPERE_REACTIVE=29, PASCAL=30, NEWTON=31, AMPERE=32, DEGREES=33])]) float

Does some basic unit conversion, only Joule to Wh, Wh to Joule and °C to Kelvin and vice versa. Can only convert units when physical quantities are the same (e.g. Energy, Temperature)

exception units.conversion.UnitException

Thrown when two esdl.QuantityAndUnitTypes can not be converted

units.conversion.get_attribute_unit(esdl_class: EClass | EObject | Type | str, attribute: str) str

Retrieves the unit defined in the ESDL ecore schema for a specific attribute

example: get_attribute_unit(“PowerPlant”, “power”), or

get_attribute_unit(esdl.PowerPlant, “power”), or get_attribute_unit(myPowerPlant, “power”)

Parameters:
  • esdl_class – the ESDL class (as string, ESDL class or ESDL Object)

  • attribute – string describing the attribute of the esdl_class

Returns:

a string with the unit (e.g. W, m, years)