|
2 | 2 | import os
|
3 | 3 | import numpy as np
|
4 | 4 |
|
| 5 | +from .GeoPHIRESUtils import quantity |
5 | 6 | from .OptionList import EndUseOptions, PlantType
|
6 | 7 | from .Parameter import floatParameter, intParameter, strParameter, OutputParameter, ReadParameter, \
|
7 | 8 | coerce_int_params_to_enum_values
|
@@ -486,7 +487,7 @@ def __init__(self, model: Model):
|
486 | 487 | Name="First Law Efficiency",
|
487 | 488 | UnitType=Units.PERCENT,
|
488 | 489 | PreferredUnits=PercentUnit.PERCENT,
|
489 |
| - CurrentUnits=PercentUnit.PERCENT, |
| 490 | + CurrentUnits=PercentUnit.PERCENT, # FIXME default values are actually in tenths, not percent. |
490 | 491 | ToolTipText='Net electricity produced divided by heat extracted towards electricity'
|
491 | 492 | )
|
492 | 493 | self.heat_to_power_conversion_efficiency = self.OutputParameterDict[self.heat_to_power_conversion_efficiency.Name] = OutputParameter(
|
@@ -657,6 +658,8 @@ def _calculate_derived_outputs(self, model: Model) -> None:
|
657 | 658 | """
|
658 | 659 |
|
659 | 660 | if self.FirstLawEfficiency is not None:
|
660 |
| - avg_efficiency = np.average(model.surfaceplant.FirstLawEfficiency.value) * 100 # TODO proper unit conversion |
| 661 | + fle_unit = PercentUnit.TENTH # See FIXME on self.FirstLawEfficiency re: CurrentUnit being incorrect. |
| 662 | + avg_efficiency = quantity(np.average(model.surfaceplant.FirstLawEfficiency.value), fle_unit).to( |
| 663 | + convertible_unit(self.heat_to_power_conversion_efficiency.CurrentUnits)).magnitude |
661 | 664 | if avg_efficiency > 0: # 0 is presumed to mean N/A
|
662 | 665 | self.heat_to_power_conversion_efficiency.value = avg_efficiency
|
0 commit comments