Ejemplo n.º 1
0
        public void HardTyre_CalculationCorrect()
        {
            _tyreInformation = new TyreInformation
            {
                Type = TyreCompound.Hard,
                DegradationCoefficient = 10
            };
            var result = _calculator.Calculate(_tyreInformation, _trackPoints, _temperature);

            result.Average.Should().BeApproximately(704, 1);
            result.Range.Should().BeApproximately(2224, 1);
        }
Ejemplo n.º 2
0
        public DegradationResults Calculate(TyreInformation tyreInformation, IEnumerable <int> trackPoints,
                                            double temperature)
        {
            var coefficient           = _degradationCoefficients[tyreInformation.Type];
            var pointTyreDegradations = trackPoints.Select(trackPoint =>
                                                           trackPoint * temperature / (tyreInformation.DegradationCoefficient * coefficient)).ToList();

            return(new DegradationResults
            {
                Average = pointTyreDegradations.Average(),
                Range = pointTyreDegradations.Max() - pointTyreDegradations.Min()
            });
        }
 public void SetSelectedTyre(TyrePlacement placement, TyreInformation tyreInformation)
 {
     _selectedTyres[placement] = tyreInformation;
     RecalculateForEachTyre();
 }