Package io.openems.common.channel
Enum Class Unit
- All Implemented Interfaces:
Serializable
,Comparable<Unit>
,Constable
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionUnit of Current [A].Unit of Electric Charge.Unit of Pressure [bar].Unit of cumulated time [s].Unit of cumulated Energy [Wh_Σ].Unit of Temperature [C].Unit of Temperature [dC].Unit of Frequency [Hz].Unit of Time.Unit of Electric Charge.Unit of Resistance [kOhm].Unit of Apparent Power [kVA].Unit of Reactive Power [kvar].Unit of Reactive Energy [kVArh].Unit of Active Power [kW].Unit of Energy [kWh].Unit of Current [uA].Unit of Resistance [uOhm].Unit of Voltage [uV].Unit of Current [mA].Unit of Electric Charge.Unit of Frequency [mHz].Unit of Resistance [mOhm].Unit of Time [ms].Unit of Voltage [mV].Unit of Active Power [mW].Unit of Time.Unit of Energy Price, e.g.No Unit.Unit of Resistance [Ohm].On or Off.Percentage [%], 0-100.Unit of Time [s].Thousandth [‰], 0-1000.Unit of Voltage [V].Unit of Apparent Power [VA].Unit of Apparent Energy [VAh].Unit of Reactive Power [var].Unit of Reactive Energy [varh].Unit of Active Power [W].Unit of Energy [Wh].Unit of Energy [Wh/Wp]. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionformat
(Object value, OpenemsType type) Formats the value in the given type.static Unit
fromSymbolOrElse
(String symbol, Unit defaultUnit) Finds a Unit by its Symbol.int
getAsBaseUnit
(int value) Gets the value in its base unit, e.g.Get the corresponding aggregate function of currentUnit
.boolean
Returns true if this is a cumulated unit.toString()
static Unit
Returns the enum constant of this class with the specified name.static Unit[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
No Unit. -
PERCENT
Percentage [%], 0-100. -
THOUSANDTH
Thousandth [‰], 0-1000. -
ON_OFF
On or Off. -
WATT
Unit of Active Power [W]. -
MILLIWATT
Unit of Active Power [mW]. -
KILOWATT
Unit of Active Power [kW]. -
VOLT_AMPERE_REACTIVE
Unit of Reactive Power [var]. -
KILOVOLT_AMPERE_REACTIVE
Unit of Reactive Power [kvar]. -
VOLT_AMPERE
Unit of Apparent Power [VA]. -
KILOVOLT_AMPERE
Unit of Apparent Power [kVA]. -
VOLT
Unit of Voltage [V]. -
MILLIVOLT
Unit of Voltage [mV]. -
MICROVOLT
Unit of Voltage [uV]. -
AMPERE
Unit of Current [A]. -
MILLIAMPERE
Unit of Current [mA]. -
MICROAMPERE
Unit of Current [uA]. -
AMPERE_HOURS
Unit of Electric Charge. -
MILLIAMPERE_HOURS
Unit of Electric Charge. -
KILOAMPERE_HOURS
Unit of Electric Charge. -
WATT_HOURS
Unit of Energy [Wh]. -
KILOWATT_HOURS
Unit of Energy [kWh]. -
VOLT_AMPERE_REACTIVE_HOURS
Unit of Reactive Energy [varh]. -
KILOVOLT_AMPERE_REACTIVE_HOURS
Unit of Reactive Energy [kVArh]. -
WATT_HOURS_BY_WATT_PEAK
Unit of Energy [Wh/Wp]. -
VOLT_AMPERE_HOURS
Unit of Apparent Energy [VAh]. -
CUMULATED_WATT_HOURS
Unit of cumulated Energy [Wh_Σ]. -
MONEY_PER_MEGAWATT_HOUR
Unit of Energy Price, e.g. [€/MWh]. (see Meta.ChannelId#CURRENCY). -
HERTZ
Unit of Frequency [Hz]. -
MILLIHERTZ
Unit of Frequency [mHz]. -
DEGREE_CELSIUS
Unit of Temperature [C]. -
DEZIDEGREE_CELSIUS
Unit of Temperature [dC]. -
SECONDS
Unit of Time [s]. -
MILLISECONDS
Unit of Time [ms]. -
MINUTE
Unit of Time. -
HOUR
Unit of Time. -
CUMULATED_SECONDS
Unit of cumulated time [s]. -
OHM
Unit of Resistance [Ohm]. -
KILOOHM
Unit of Resistance [kOhm]. -
MILLIOHM
Unit of Resistance [mOhm]. -
MICROOHM
Unit of Resistance [uOhm]. -
BAR
Unit of Pressure [bar].
-
-
Field Details
-
symbol
-
baseUnit
-
scaleFactor
public final int scaleFactor -
discreteUnit
-
-
Method Details
-
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
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 nameNullPointerException
- 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
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 valueObject
type
- theOpenemsType
- Returns:
- the formatted value as String
-
toString
-
fromSymbolOrElse
Finds a Unit by its Symbol.- Parameters:
symbol
- the SymboldefaultUnit
- 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
Get the corresponding aggregate function of currentUnit
.- 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
-