Exemple #1
0
 /**
  * Calculate JD intensity
  * @return int
  */
 public function calculateJDintensity()
 {
     JD\Intensity::setVDOTshape(Configuration::Data()->vdot());
     JD\Intensity::setHRmax(Configuration::Data()->HRmax());
     $Intensity = new JD\Intensity();
     if ($this->knowsTrackdata() && $this->Trackdata->has(Model\Trackdata\Object::HEARTRATE) && $this->Trackdata->has(Model\Trackdata\Object::TIME)) {
         return $Intensity->calculateByHeartrate(new TimeSeries($this->Trackdata->heartRate(), $this->Trackdata->time()));
     } elseif ($this->Activity->hrAvg() > 0) {
         return $Intensity->calculateByHeartrateAverage($this->Activity->hrAvg(), $this->Activity->duration());
     } else {
         return $Intensity->calculateByPace($this->Activity->distance(), $this->Activity->duration());
     }
 }
Exemple #2
0
 public function testTrackdataWithTime()
 {
     $trackdata = new Trackdata\Object(array(Trackdata\Object::HEARTRATE => array(140, 150), Trackdata\Object::TIME => array(1800, 3600)));
     $expected = $this->object->calculateByHeartrateAverage(140, 1800) + $this->object->calculateByHeartrateAverage(150, 1800);
     $this->assertEquals($expected, $this->object->calculateByTrackdata($trackdata));
 }