Пример #1
0
        private static TimeSpan CalculateTime(MachineTask task)
        {
            AddressData addressData   = new AddressData();
            var         dist          = addressData.GetDistanceToRefPoint(task.SourceAddress, task.TargetAddress);
            var         totalDistance =
                Math.Abs(dist[0] - dist[1])//source - target -
                - Convert.ToDouble(lstTimeParameters.First(x => x.MachineType == "ASRS" && x.MovementType == "ACCELERATION").MeasureValue)
                - Convert.ToDouble(lstTimeParameters.First(x => x.MachineType == "ASRS" && x.MovementType == "DECELERATION").MeasureValue);

            var      velocity = lstTimeParameters.First(x => x.MachineType == "ASRS" && x.MovementType == "MOVEMENT").MeasureValue;//1 saniyede kat ettiği mesafe
            TimeSpan timeSpan = TimeSpan.FromSeconds(totalDistance / Convert.ToDouble(velocity));

            return(timeSpan);
        }