public PWXDataExtractor(pwx data) { _file = data; if (data.workout.Length > 1) throw new ArgumentException("No support for more than 1 workout per PWX file"); if ((_file != null) && (_file.workout.Length >0) && (_file.workout[0].sample !=null)) numSamples = _file.workout[0].sample.Length; }
public static IWorkout MapExtendedCycleWorkout(pwx pwx, IWorkout shortWorkout) { pwxWorkout pwxWo = pwx.workout[0]; IAthlete athlete = new Athlete(); athlete.FTBikePower = 231; shortWorkout.TrainingStressScore = pwxWo.summarydata.tss; ICycleWorkout cycleWorkout = shortWorkout as ICycleWorkout; if (cycleWorkout == null) return shortWorkout; PWXDataExtractor dataExtractor = new PWXDataExtractor(pwx); var workoutSamples = dataExtractor.ExtractData(); WorkoutSamplesCalculator calc = new WorkoutSamplesCalculator(workoutSamples, athlete); cycleWorkout.IntensityFactor = calc.CalcualteIntensityFactor(); cycleWorkout.NormalizedPower = (int)calc.GetNormalizedPower(); return shortWorkout; }
public void Initialise() { if (_test == null) _test = GetPwxDataFromXml(GetSamplePwxFile(@"c:\Dev\Autocoach\TestXMLData\TestTurboPowerCyclePWX.xml")); }