예제 #1
0
파일: Data.php 프로젝트: guancio/Runalyze
 /**
  * Recalculate maximal values for CTL/ATL/Trimp
  */
 public function recalculateMaxValues()
 {
     $Query = new Performance\ModelQuery();
     $Query->execute(\DB::getInstance());
     $Calc = new Performance\MaximumCalculator(function (array $array) {
         return new Performance\TSB($array, Configuration::Trimp()->daysForCTL(), Configuration::Trimp()->daysForATL());
     }, $Query->data());
     $this->updateMaxCTL($Calc->maxFitness());
     $this->updateMaxATL($Calc->maxFatigue());
     $this->updateMaxTrimp($Calc->maxTrimp());
 }
    /**
     * Get fieldset for TRIMP
     * @return \FormularFieldset
     */
    public function getFieldsetTRIMP()
    {
        $ModelQuery = new Performance\ModelQuery();
        $ModelQuery->execute(DB::getInstance());
        $TSBmodel = new Performance\TSB($ModelQuery->data(), Configuration::Trimp()->daysForCTL(), Configuration::Trimp()->daysForATL());
        $TSBmodel->calculate();
        $maxATL = Configuration::Data()->maxATL();
        $maxCTL = Configuration::Data()->maxCTL();
        $ATL = $TSBmodel->fatigueAt(0);
        $CTL = $TSBmodel->fitnessAt(0);
        $TrimpValues = array('ATL' => round(100 * $ATL / $maxATL), 'CTL' => round(100 * $CTL / $maxCTL), 'TSB' => $TSBmodel->performanceAt(0));
        $Table = '
			<table class="fullwidth zebra-style">
				<thead>
					<tr>
						<th></th>
						<th>' . __('Name') . '</th>
						<th>' . __('in &#37;') . '</th>
						<th>' . __('Time range') . '</th>
						<th>' . __('&oslash; value/day') . '</th>
						<th>' . __('max. value') . '</th>
						<th class="small">' . __('Description') . '</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td class="b">ATL</td>
						<td>' . __('Actual Training Load') . '</td>
						<td class="c">' . $TrimpValues['ATL'] . ' &#37;</td>
						<td class="c small">' . sprintf(__('%s days'), Configuration::Trimp()->daysForATL()) . '</td>
						<td class="c">' . $ATL . '</td>
						<td class="c">' . $maxATL . '</td>
						<td class="small">' . __('Training impulse over a short period') . '</td>
					</tr>
					<tr>
						<td class="b">CTL</td>
						<td>' . __('Chronical Training Load') . '</td>
						<td class="c">' . $TrimpValues['CTL'] . ' &#37;</td>
						<td class="c small">' . sprintf(__('%s days'), Configuration::Trimp()->daysForCTL()) . '</td>
						<td class="c">' . $CTL . '</td>
						<td class="c">' . $maxCTL . '</td>
						<td class="small">' . __('Training impulse over a long period') . '</td>
					</tr>
					<tr>
						<td class="b">TSB</td>
						<td>' . __('Training Stress Balance') . '</td>
						<td class="c">' . $TrimpValues['TSB'] . '</td>
						<td colspan="3" class="c">' . $CTL . ' - ' . $ATL . ' = ' . $TrimpValues['TSB'] . '</td>
						<td class="small">' . __('Current impulse<br>positive: recovery<br>negative: hard training') . '
						</td>
					</tr>
				</tbody>
			</table>';
        $Fieldset = new FormularFieldset('ATL/CTL/TSB');
        $Fieldset->addBlock(__('ATL/CTL are based on the TRIMP-concept, which adresses an impulse value to every activity. ' . 'ATL and CTL are averaged values over a given time range.'));
        $Fieldset->addBlock($Table);
        $Fieldset->addInfo(__('see <a href="http://www.netzathleten.de/fitness/richtig-trainieren/item/1481-trainingstagebuch-sinnvoll-oder-nicht" title="Das TRIMP-Konzept">The TRIMP-concept</a> (german, netzathleten.de)'));
        $Fieldset->addInfo(__('see <a href="http://fellrnr.com/wiki/TRIMP">TRIMP</a> and <a href="http://fellrnr.com/wiki/Modeling_Human_Performance#The_TSB_Formulas">Modeling Human Performance</a> on fellrnr.com'));
        return $Fieldset;
    }