Exemple #1
0
        public KalmanPredictionResult Predict(KalmanTripSegment lastVehicleSegment, List <KalmanTripSegment> historicalSegments, double lastError)
        {
            double average  = HistoricalAverage(historicalSegments);
            double variance = HistoricalVariance(historicalSegments, average);
            double gain     = Gain(average, variance, lastError);
            double loopGain = 1 - gain;

            KalmanPredictionResult result = new KalmanPredictionResult(Prediction(gain, loopGain, historicalSegments, lastVehicleSegment, average), FilterError(variance, gain));

            return(result);
        }
Exemple #2
0
        private double Prediction(double gain, double loopGain, List <KalmanTripSegment> historicalSegments, KalmanTripSegment lastSegment, double averageDuration)
        {
            double historicalDuration = averageDuration;

            long   lastVehicleDuration = lastSegment.GetDestination().GetTime() - lastSegment.GetOrigin().GetTime();
            double prediction          = (loopGain * lastVehicleDuration) + (gain * historicalDuration);

            return(prediction);
        }