@@ -46,19 +46,19 @@ public class PowerSystemUnits extends Units {
46
46
47
47
/** Euro / km */
48
48
public static final Unit <PricePerLength > EURO_PER_KILOMETRE =
49
- new ProductUnit <>(EURO .divide (MetricPrefix . KILO ( METRE ) ));
49
+ new ProductUnit <>(EURO .divide (KILOMETRE ));
50
50
51
51
/** Euro / Wh */
52
52
public static final Unit <EnergyPrice > EURO_PER_WATTHOUR =
53
- new ProductUnit <>(EURO .divide (Units . WATT .multiply (Units . HOUR )));
53
+ new ProductUnit <>(EURO .divide (WATT .multiply (HOUR )));
54
54
55
55
/** Euro / kWh */
56
56
public static final Unit <EnergyPrice > EURO_PER_KILOWATTHOUR =
57
- MetricPrefix . MILLI ( EURO_PER_WATTHOUR );
57
+ new TransformedUnit <>( "€/kWh" , EURO_PER_WATTHOUR , MultiplyConverter . of ( 1E-3 ) );
58
58
59
59
/** Euro / MWh */
60
60
public static final Unit <EnergyPrice > EURO_PER_MEGAWATTHOUR =
61
- MetricPrefix . MICRO ( EURO_PER_WATTHOUR );
61
+ new TransformedUnit <>( "€/MWh" , EURO_PER_WATTHOUR , MultiplyConverter . of ( 1E-6 ) );
62
62
63
63
/** Degree */
64
64
public static final Unit <Angle > DEGREE_GEOM =
@@ -83,11 +83,12 @@ public class PowerSystemUnits extends Units {
83
83
public static final Unit <Energy > KILOVARHOUR = MetricPrefix .KILO (VARHOUR );
84
84
85
85
/** Watthour per metre */
86
- public static final Unit <SpecificEnergy > WATTHOUR_PER_METRE = new BaseUnit <>("Wh/m" );
86
+ public static final Unit <SpecificEnergy > WATTHOUR_PER_METRE =
87
+ new ProductUnit <>(WATTHOUR .divide (METRE ));
87
88
88
89
/** Kilowatthour per Kilometre */
89
90
public static final Unit <SpecificEnergy > KILOWATTHOUR_PER_KILOMETRE =
90
- new AlternateUnit <>(WATTHOUR_PER_METRE , "kWh/km" );
91
+ new TransformedUnit <>("kWh/km" , WATTHOUR_PER_METRE , MultiplyConverter . of ( 1d ) );
91
92
92
93
/** Watthour per squaremetre */
93
94
public static final Unit <Irradiation > WATTHOUR_PER_SQUAREMETRE =
@@ -159,7 +160,8 @@ public class PowerSystemUnits extends Units {
159
160
new ProductUnit <>(MetricPrefix .MICRO (SIEMENS ).divide (KILOMETRE ));
160
161
161
162
/** Farad per metre */
162
- public static final Unit <SpecificCapacitance > FARAD_PER_METRE = new BaseUnit <>("F/m" );
163
+ public static final Unit <SpecificCapacitance > FARAD_PER_METRE =
164
+ new ProductUnit <>(FARAD .divide (METRE ));
163
165
164
166
/** F / km */
165
167
public static final Unit <SpecificCapacitance > FARAD_PER_KILOMETRE =
@@ -181,9 +183,10 @@ public class PowerSystemUnits extends Units {
181
183
/* ==== Thermal Conductance ==== */
182
184
183
185
/** kW/K */
184
- public static final Unit <ThermalConductance > KILOWATT_PER_KELVIN = new BaseUnit <>("kW/K" );
186
+ public static final Unit <ThermalConductance > KILOWATT_PER_KELVIN =
187
+ new ProductUnit <>(KILOWATT .divide (KELVIN ));
185
188
186
- private static final HashSet <String > registeredLabels = new HashSet <>();
189
+ private static final HashSet <String > REGISTERED_LABELS = new HashSet <>();
187
190
188
191
static {
189
192
addUnit (WATTHOUR , "Wh" );
@@ -221,12 +224,13 @@ public class PowerSystemUnits extends Units {
221
224
* return-value is null, the unit was already registered
222
225
*/
223
226
private static Unit <?> addUnit (Unit <?> unit , String label ) {
224
- if (registeredLabels .contains (label )) {
227
+ if (REGISTERED_LABELS .contains (label )) {
225
228
logger .log (Level .FINE , "Label {} is already registered. Ignoring" , label );
226
229
return null ;
227
230
}
228
231
229
232
SimpleUnitFormat .getInstance ().label (unit , label );
233
+ REGISTERED_LABELS .add (label );
230
234
return unit ;
231
235
}
232
236
}
0 commit comments