Enum Class Unit

java.lang.Object
java.lang.Enum<Unit>
io.openems.common.channel.Unit
All Implemented Interfaces:
Serializable, Comparable<Unit>, Constable

public enum Unit extends Enum<Unit>
Units of measurement used in OpenEMS.

Units marked as 'cumulated' are per definition steadily increasing, i.e. Value(t + 1) >= Value(t). This applies e.g. to consumed energy in [Wh_Σ]. To calculate the 'discrete' consumed energy in [Wh] for a certain period, subtract first cumulated value from last cumulated value.

  • Enum Constant Details

    • NONE

      public static final Unit NONE
      No Unit.
    • PERCENT

      public static final Unit PERCENT
      Percentage [%], 0-100.
    • THOUSANDTH

      public static final Unit THOUSANDTH
      Thousandth [‰], 0-1000.
    • ON_OFF

      public static final Unit ON_OFF
      On or Off.
    • WATT

      public static final Unit WATT
      Unit of Active Power [W].
    • MILLIWATT

      public static final Unit MILLIWATT
      Unit of Active Power [mW].
    • KILOWATT

      public static final Unit KILOWATT
      Unit of Active Power [kW].
    • VOLT_AMPERE_REACTIVE

      public static final Unit VOLT_AMPERE_REACTIVE
      Unit of Reactive Power [var].
    • KILOVOLT_AMPERE_REACTIVE

      public static final Unit KILOVOLT_AMPERE_REACTIVE
      Unit of Reactive Power [kvar].
    • VOLT_AMPERE

      public static final Unit VOLT_AMPERE
      Unit of Apparent Power [VA].
    • KILOVOLT_AMPERE

      public static final Unit KILOVOLT_AMPERE
      Unit of Apparent Power [kVA].
    • VOLT

      public static final Unit VOLT
      Unit of Voltage [V].
    • MILLIVOLT

      public static final Unit MILLIVOLT
      Unit of Voltage [mV].
    • MICROVOLT

      public static final Unit MICROVOLT
      Unit of Voltage [uV].
    • AMPERE

      public static final Unit AMPERE
      Unit of Current [A].
    • MILLIAMPERE

      public static final Unit MILLIAMPERE
      Unit of Current [mA].
    • MICROAMPERE

      public static final Unit MICROAMPERE
      Unit of Current [uA].
    • AMPERE_HOURS

      public static final Unit AMPERE_HOURS
      Unit of Electric Charge.
    • MILLIAMPERE_HOURS

      public static final Unit MILLIAMPERE_HOURS
      Unit of Electric Charge.
    • KILOAMPERE_HOURS

      public static final Unit KILOAMPERE_HOURS
      Unit of Electric Charge.
    • WATT_HOURS

      public static final Unit WATT_HOURS
      Unit of Energy [Wh].
    • KILOWATT_HOURS

      public static final Unit KILOWATT_HOURS
      Unit of Energy [kWh].
    • VOLT_AMPERE_REACTIVE_HOURS

      public static final Unit VOLT_AMPERE_REACTIVE_HOURS
      Unit of Reactive Energy [varh].
    • KILOVOLT_AMPERE_REACTIVE_HOURS

      public static final Unit KILOVOLT_AMPERE_REACTIVE_HOURS
      Unit of Reactive Energy [kVArh].
    • WATT_HOURS_BY_WATT_PEAK

      public static final Unit WATT_HOURS_BY_WATT_PEAK
      Unit of Energy [Wh/Wp].
    • VOLT_AMPERE_HOURS

      public static final Unit VOLT_AMPERE_HOURS
      Unit of Apparent Energy [VAh].
    • CUMULATED_WATT_HOURS

      public static final Unit CUMULATED_WATT_HOURS
      Unit of cumulated Energy [Wh_Σ].
    • EUROS_PER_MEGAWATT_HOUR

      public static final Unit EUROS_PER_MEGAWATT_HOUR
      Unit of Energy Price [€/MWh].
    • HERTZ

      public static final Unit HERTZ
      Unit of Frequency [Hz].
    • MILLIHERTZ

      public static final Unit MILLIHERTZ
      Unit of Frequency [mHz].
    • DEGREE_CELSIUS

      public static final Unit DEGREE_CELSIUS
      Unit of Temperature [C].
    • DEZIDEGREE_CELSIUS

      public static final Unit DEZIDEGREE_CELSIUS
      Unit of Temperature [dC].
    • SECONDS

      public static final Unit SECONDS
      Unit of Time [s].
    • MILLISECONDS

      public static final Unit MILLISECONDS
      Unit of Time [ms].
    • MINUTE

      public static final Unit MINUTE
      Unit of Time.
    • HOUR

      public static final Unit HOUR
      Unit of Time.
    • CUMULATED_SECONDS

      public static final Unit CUMULATED_SECONDS
      Unit of cumulated time [s].
    • OHM

      public static final Unit OHM
      Unit of Resistance [Ohm].
    • KILOOHM

      public static final Unit KILOOHM
      Unit of Resistance [kOhm].
    • MILLIOHM

      public static final Unit MILLIOHM
      Unit of Resistance [mOhm].
    • MICROOHM

      public static final Unit MICROOHM
      Unit of Resistance [uOhm].
    • BAR

      public static final Unit BAR
      Unit of Pressure [bar].
  • Field Details

    • symbol

      public final String symbol
    • baseUnit

      public final Unit baseUnit
    • scaleFactor

      public final int scaleFactor
    • discreteUnit

      public final Unit discreteUnit
  • Method Details

    • values

      public static Unit[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Unit valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getAsBaseUnit

      public int getAsBaseUnit(int value)
      Gets the value in its base unit, e.g. converts [kW] to [W].
      Parameters:
      value - the value
      Returns:
      the converted value
    • format

      public String format(Object value, OpenemsType type)
      Formats the value in the given type.

      For most cases this adds the unit symbol to the value, like "123 kW". Booleans are converted to "ON" or "OFF".

      Parameters:
      value - the value Object
      type - the OpenemsType
      Returns:
      the formatted value as String
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Unit>
    • fromSymbolOrElse

      public static Unit fromSymbolOrElse(String symbol, Unit defaultUnit)
      Finds a Unit by its Symbol.
      Parameters:
      symbol - the Symbol
      defaultUnit - the defaultUnit; this value is returned if no Unit with the given Symbol exists
      Returns:
      the Unit; or the defaultUnit if it was not found
    • getChannelAggregateFunction

      public Function<DoubleStream,OptionalDouble> getChannelAggregateFunction()
      Get the corresponding aggregate function of current Unit.
      Returns:
      corresponding aggregate function
    • isCumulated

      public boolean isCumulated()
      Returns true if this is a cumulated unit.
      Returns:
      true if this Unit is cumulated, otherwise false