Commit 42d95d47 authored by Michael Ott's avatar Michael Ott
Browse files

Add unit conversions for J and Wh

parent 1c499f77
...@@ -47,6 +47,8 @@ typedef enum { ...@@ -47,6 +47,8 @@ typedef enum {
Unit_Watt, Unit_Watt,
Unit_Volt, Unit_Volt,
Unit_Hertz, Unit_Hertz,
Unit_Joules,
Unit_WattHours,
/* Others */ /* Others */
Unit_Celsius, Unit_Celsius,
...@@ -55,10 +57,14 @@ typedef enum { ...@@ -55,10 +57,14 @@ typedef enum {
/* 1e3 */ /* 1e3 */
Unit_KiloHertz, Unit_KiloHertz,
Unit_KiloWatt, Unit_KiloWatt,
Unit_KiloJoules,
Unit_KiloWattHours,
/* 1e6 */ /* 1e6 */
Unit_MegaHertz, Unit_MegaHertz,
Unit_MegaWatt, Unit_MegaWatt,
Unit_MegaJoules,
Unit_MegaWattHours,
/* 1e9 */ /* 1e9 */
Unit_GigaHertz, Unit_GigaHertz,
......
...@@ -113,7 +113,12 @@ ConversionTableEntry conversionTable[] = { ...@@ -113,7 +113,12 @@ ConversionTableEntry conversionTable[] = {
/* 28 */ { Unit_Hertz, "Hz", Unit_Hertz, 1, 0}, /* 28 */ { Unit_Hertz, "Hz", Unit_Hertz, 1, 0},
/* 29 */ { Unit_KiloHertz, "kHz", Unit_Hertz, 1000, 0}, /* 29 */ { Unit_KiloHertz, "kHz", Unit_Hertz, 1000, 0},
/* 30 */ { Unit_MegaHertz,"MHz", Unit_Hertz, 1000000, 0}, /* 30 */ { Unit_MegaHertz,"MHz", Unit_Hertz, 1000000, 0},
/* 31 */ { Unit_GigaHertz, "GHz", Unit_Hertz, 1000000000, 0}, /* 31 */ { Unit_Joules, "J", Unit_Joules, 3600, 0},
/* 32 */ { Unit_KiloJoules, "kJ", Unit_Joules, 1000, 0},
/* 33 */ { Unit_MegaJoules, "MJ", Unit_Joules, 1000000, 0},
/* 34 */ { Unit_WattHours, "Wh", Unit_Joules, 3600, 0},
/* 35 */ { Unit_KiloWattHours, "kWh", Unit_WattHours, 1000, 0},
/* 36 */ { Unit_MegaWattHours, "MWh", Unit_WattHours, 1000000, 0},
}; };
#define ConversionTableSize ((int)(sizeof(conversionTable)/sizeof(ConversionTableEntry))) #define ConversionTableSize ((int)(sizeof(conversionTable)/sizeof(ConversionTableEntry)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment