/** * @param \Runalyze\Data\Laps\Lap $Lap * @param array $AdditionalData */ protected function addVDOTToDataFrom(Lap $Lap, array &$AdditionalData) { $VDOT = new Calculation\JD\VDOT(); $VDOT->fromPaceAndHR($Lap->distance()->kilometer(), $Lap->duration()->seconds(), $Lap->HRavg()->inPercent() / 100); if ($VDOT->value() > 0) { $AdditionalData[Activity\Entity::VDOT] = $VDOT->value(); } }
/** * Calculate VDOT by heart rate * @param float $distance [optional] * @return float */ public function calculateVDOTbyHeartRate($distance = null) { if (is_null($distance)) { $distance = $this->Activity->distance(); } $VDOT = new JD\VDOT(); $VDOT->fromPaceAndHR($distance, $this->Activity->duration(), $this->Activity->hrAvg() / Configuration::Data()->HRmax()); return $VDOT->value(); }
/** * Display with corrector */ protected function displayWithElevation() { if ($this->Context->hasRoute() && ($this->Context->route()->elevationUp() > 0 || $this->Context->route()->elevationDown())) { $up = $this->Context->route()->elevationUp(); $down = $this->Context->route()->elevationDown(); } else { $up = $this->Context->activity()->elevation(); $down = $up; } $Modifier = new Elevation\DistanceModifier($this->Context->activity()->distance(), $up, $down, Configuration::Vdot()); $VDOT = new JD\VDOT(0, new JD\VDOTCorrector(Configuration::Data()->vdotFactor())); $VDOT->fromPaceAndHR($Modifier->correctedDistance(), $this->Context->activity()->duration(), $this->Context->activity()->hrAvg() / Configuration::Data()->HRmax()); $Fieldset = new FormularFieldset(__('Correction: considering elevation')); $Fieldset->setHtmlCode(' <p class="warning small ' . (Configuration::Vdot()->useElevationCorrection() ? 'hide' : '') . '"> ' . __('This correction method is currently unused.') . ' </p> <div class="w50"> <label>' . __('Up/Down') . '</label> <span class="as-input">+' . $up . '/-' . $down . ' m</span> </div> <div class="w50 double-height-right"> <label>⇒ ' . __('VDOT') . '</label> <span class="as-input ' . (!Configuration::Vdot()->useElevationCorrection() ? '' : 'highlight') . '">' . $VDOT->value() . '</span> </div> <div class="w50"> <label>' . __('Influence') . '</label> <span class="as-input">' . sprintf("%+d", 1000 * $Modifier->additionalDistance()) . 'm = ' . Distance::format($Modifier->correctedDistance(), false, 3) . '</span> </div> '); $Fieldset->display(); }