Beispiel #1
0
 public MainViewModel()
 {
     Fuels = new ObservableCollection<FuelType>();
     Car = new Vehicle();
 }
Beispiel #2
0
        public float FuelYield(Vehicle vehicle)
        {
            var PercentEthanols = new List<float>();
            var MPGs = new List<float>();

            foreach (var dp in vehicle.MPGDataPoints)
            {
                PercentEthanols.Add(dp.PercentEthanol);
                MPGs.Add(dp.Efficiency);
            }
            float r2;
            float baseline;
            float slope;
            LinearRegression(PercentEthanols.ToArray(), MPGs.ToArray(), 0, MPGs.Count, out r2, out baseline, out slope);

            var estMPG = PercentEthanol * slope + baseline;
            return estMPG;
        }