Units of energy MJ and MWh added.

This commit is contained in:
Milan Hanajik 2016-08-22 16:01:34 +02:00
parent 0f7790e538
commit 1dbe9890f3

View File

@ -44,8 +44,10 @@ namespace Config
J, /// * 1 Joul
kJ, /// 1 kJ = 1000 J
MJ, /// 1 MJ = 1000000 J
Wh, /// 1 Wh = 3600 J
kWh, /// 1 kWh = 3600000 J
MWh, /// 1 MWh = 3600000000 J
Count
}
@ -112,9 +114,11 @@ namespace Config
case Unit.J:
case Unit.kJ:
case Unit.Wh:
case Unit.MJ:
case Unit.Wh:
case Unit.kWh:
return Config.Quantity.Energy;
case Unit.MWh:
return Config.Quantity.Energy;
default:
return Config.Quantity.Number;
@ -183,8 +187,10 @@ namespace Config
/// Energy, internal representation in Joul
case Unit.J: return v; /// 1 Joul
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
case Unit.MJ: return 0.000001 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
case Unit.MWh: return v / 3600000000.0;/// 1 MWh = 3600000000 J
default: return v;
}
@ -237,8 +243,10 @@ namespace Config
/// Energy, internal representation in Joul
case Unit.J: return v; /// 1 Joul
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
case Unit.MJ: return 1000000 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
default: return v;
}