Changeset 91 for trunk/Modules


Ignore:
Timestamp:
Apr 7, 2020, 11:43:11 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Sum cumulative values.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Measure/Measure.php

    r89 r91  
    105105      if($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0;  // non continuous
    106106        else $this->Data['ContinuityEnabled'] = 2;    // continuous graph
    107     } else die('Měřená veličina nenalezena');
     107    } else die('Měřená veličina '.$Id.' nenalezena.');
    108108  }
    109109
     
    235235        if($ValueType == 'Avg')
    236236        {
    237           if($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled']);
     237          if ($this->Data['Cumulative'])
     238          {
     239            $NewValue[$ValueType] = $NewValue[$ValueType] + $Values[$I][$ValueType];
     240          } else
     241          {
     242            if($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled']);
    238243            else if($this->Differential == 0)
    239244            {
    240245              $NewValue[$ValueType] = $NewValue[$ValueType] + ($Values[$I + 1]['Time'] - $Values[$I]['Time']) *
    241                 (($Values[$I + 1][$ValueType] - $Values[$I][$ValueType]) / 2 + $Values[$I][$ValueType]);
     246              (($Values[$I + 1][$ValueType] - $Values[$I][$ValueType]) / 2 + $Values[$I][$ValueType]);
    242247            } else {
    243248              $NewValue[$ValueType] = $NewValue[$ValueType] + ($Values[$I + 1]['Time'] - $Values[$I]['Time']) *
    244249               (($Values[$I + 1][$ValueType] - $Values[$I][$ValueType]) / 2);
    245250            }
     251          }
    246252        }
    247253        else if($ValueType == 'Max')
     
    445451      $EndTime = $this->AlignTime($TimeRange['Right'], $TimeSegment);
    446452      $BurstCount = 500;
    447       echo('For 0 to '.round(($EndTime - $StartTime) / $TimeSegment / $BurstCount)."<br>\n");
    448       for($I = 0; $I <= round(($EndTime - $StartTime) / $TimeSegment / $BurstCount); $I++)
     453      $Count = round(($EndTime - $StartTime) / $TimeSegment / $BurstCount);
     454      echo('For 0 to '.$Count."<br>\n");
     455      for($I = 0; $I <= $Count; $I++)
    449456      {
    450457        echo($I.' ');
Note: See TracChangeset for help on using the changeset viewer.