fixed units for power meters
This commit is contained in:
parent
c4c34308d3
commit
dfea55a173
2 changed files with 18 additions and 8 deletions
|
@ -49,7 +49,7 @@
|
|||
"required" : ["title", "resolution"],
|
||||
"optional" : ["description", "details:", "owner:", "address:", "tolerance", "port", "cuuid", "public", "active"],
|
||||
"icon" : "", // TODO look for an icon
|
||||
"unit" : "kW",
|
||||
"unit" : "W",
|
||||
"interpreter" : "Volkszaehler\\Interpreter\\MeterInterpreter",
|
||||
"model" : "Volkszaehler\\Model\\Channel",
|
||||
"translation" : { "de" : "Stromzähler" }
|
||||
|
@ -59,7 +59,7 @@
|
|||
"required" : ["title"],
|
||||
"optional" : ["description", "details:", "owner:", "address:", "tolerance", "port", "cuuid", "public", "active"],
|
||||
"icon" : "", // TODO look for an icon
|
||||
"unit" : "kW",
|
||||
"unit" : "W",
|
||||
"interpreter" : "Volkszaehler\\Interpreter\\SensorInterpreter",
|
||||
"model" : "Volkszaehler\\Model\\Channel",
|
||||
"translation" : { "de" : "Stromsensor" }
|
||||
|
@ -69,7 +69,7 @@
|
|||
"required" : ["title", "resolution"],
|
||||
"optional" : ["description", "details:", "owner:", "address:", "tolerance", "port", "cuuid", "public", "active"],
|
||||
"icon" : "", // TODO look for an icon
|
||||
"unit" : "m³/h",
|
||||
"unit" : "m³",
|
||||
"interpreter" : "Volkszaehler\\Interpreter\\MeterInterpreter",
|
||||
"model" : "Volkszaehler\\Model\\Channel",
|
||||
"translation" : { "de" : "Gas" }
|
||||
|
@ -79,7 +79,7 @@
|
|||
"required" : ["title", "resolution"],
|
||||
"optional" : ["description", "details:", "owner:", "address:", "tolerance", "port", "cuuid", "public", "active"],
|
||||
"icon" : "", // TODO look for an icon
|
||||
"unit" : "m³/h",
|
||||
"unit" : "m³",
|
||||
"interpreter" : "Volkszaehler\\Interpreter\\MeterInterpreter",
|
||||
"model" : "Volkszaehler\\Model\\Channel",
|
||||
"translation" : { "de" : "Wasser" }
|
||||
|
@ -143,5 +143,15 @@
|
|||
"interpreter" : "Volkszaehler\\Interpreter\\SensorInterpreter",
|
||||
"model" : "Volkszaehler\\Model\\Channel",
|
||||
"translation" : { "de" : "Lichtstärke" }
|
||||
},
|
||||
{
|
||||
"name" : "workinghours",
|
||||
"required" : ["title", "resolution"],
|
||||
"optional" : ["description", "details:", "owner:", "address:", "tolerance", "public", "active"],
|
||||
"icon" : "", // TODO look for an icon
|
||||
"unit" : "h", // TODO add unit
|
||||
"interpreter" : "Volkszaehler\\Interpreter\\MeterInterpreter",
|
||||
"model" : "Volkszaehler\\Model\\Channel",
|
||||
"translation" : { "de" : "Betriebsstundenzähler" }
|
||||
}
|
||||
]
|
||||
|
|
|
@ -42,12 +42,12 @@ class MeterInterpreter extends Interpreter {
|
|||
|
||||
/**
|
||||
* Calculates the consumption
|
||||
* @return float total consumption
|
||||
* @return float total consumption in Wh
|
||||
*/
|
||||
public function getConsumption() {
|
||||
if (is_null($this->tupleCount)) throw new \Exception('Data has to be processed first!');
|
||||
|
||||
return $this->pulseCount / $this->resolution;
|
||||
return 1000 * $this->pulseCount / $this->resolution;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,8 +75,8 @@ class MeterInterpreter extends Interpreter {
|
|||
* @return float
|
||||
*/
|
||||
public function getAverage() {
|
||||
// 3600: 3600 s/h; 1000: ms -> s; 1000: KW -> W
|
||||
return (3600 * 1000 * 1000 * $this->getConsumption()) / ($this->to - $this->from);
|
||||
// 3600: 3600 s/h; 1000: ms -> s
|
||||
return (3600 * 1000 * $this->getConsumption()) / ($this->to - $this->from);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue