/** * Inverse calculation * * Calculation is done for HR in [bpm] and time is transformed from [s] to [min]. * * @param int $bpm [bpm] * @param int $trimp value to reach */ protected function calculate($bpm, $trimp) { $Factor = new Factor($this->Athlete->gender()); $max = $this->Athlete->knowsMaximalHeartRate() ? $this->Athlete->maximalHR() : Calculator::DEFAULT_HR_MAX; $rest = $this->Athlete->knowsRestingHeartRate() ? $this->Athlete->restingHR() : Calculator::DEFAULT_HR_REST; $hr = max(0, ($bpm - $rest) / ($max - $rest)); $sum = $trimp / ($hr * exp($Factor->B() * $hr)); $this->value = 1 / $Factor->A() * $sum * 60; }
/** * Calculate * * Calculation is done for HR in [bpm] and time is transformed from [s] to [min]. */ protected function calculate() { $Factor = new Factor($this->Athlete->gender()); $max = $this->Athlete->knowsMaximalHeartRate() ? $this->Athlete->maximalHR() : self::DEFAULT_HR_MAX; $rest = $this->Athlete->knowsRestingHeartRate() ? $this->Athlete->restingHR() : self::DEFAULT_HR_REST; $sum = 0; $B = $Factor->B(); foreach ($this->Data as $bpm => $t) { $hr = max(0, ($bpm - $rest) / ($max - $rest)); $sum += $t / 60 * $hr * exp($B * $hr); } $this->value = $Factor->A() * $sum; }