Skip to content

Commit

Permalink
Merge pull request #216 from mbehr1/pr211_2
Browse files Browse the repository at this point in the history
Fix power calculation, proportional to impulses
  • Loading branch information
andig committed Nov 10, 2015
2 parents 5bbd31b + 074d340 commit 61c43f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/protocols/MeterS0.cpp
Expand Up @@ -322,7 +322,7 @@ ssize_t MeterS0::read(std::vector<Reading> &rds, size_t n) {

if (_send_zero || t_imp > 0) {
if (!_first_impulse) {
double value = 3600000 / ((t2-t1) * (_resolution * t_imp));
double value = (3600000 / ((t2-t1) * _resolution)) * t_imp;
rds[ret].identifier(new StringIdentifier("Power"));
rds[ret].time(req);
rds[ret].value(value);
Expand All @@ -336,7 +336,7 @@ ssize_t MeterS0::read(std::vector<Reading> &rds, size_t n) {

if (_send_zero || t_imp_neg > 0) {
if (!_first_impulse) {
double value = 3600000 / ((t2-t1) * (_resolution * t_imp_neg));
double value = (3600000 / ((t2-t1) * _resolution)) * t_imp_neg;
rds[ret].identifier(new StringIdentifier("Power_neg"));
rds[ret].time(req);
rds[ret].value(value);
Expand Down

0 comments on commit 61c43f7

Please sign in to comment.