/// <summary>
        /// Generates speed limits for the rndf segments
        /// </summary>
        /// <param name="rndfNetwork"></param>
        private static List <SpeedInformation> generateSpeedLimits(RndfNetwork rndfNetwork)
        {
            List <SpeedInformation> speedLimits = new List <SpeedInformation>();

            foreach (Segment segment in rndfNetwork.Segments.Values)
            {
                SpeedInformation speedLimit = new SpeedInformation(segment.SegmentID, 0, 8.8);
                speedLimits.Add(speedLimit);
            }

            return(speedLimits);
        }
Example #2
0
        /// <summary>
        /// Transfers an mdf from mph to mps
        /// </summary>
        /// <param name="mdf"></param>
        /// <returns></returns>
        public static Mdf TransferMdfToMs(Mdf mdf)
        {
            // create converted speed list
            List <SpeedInformation> convertedSpeeds = new List <SpeedInformation>();

            // loop through speed limit
            foreach (SpeedInformation limit in mdf.SpeedLimits)
            {
                // create new speed information
                SpeedInformation speedInfo = new SpeedInformation();

                // transform them from mph to m/s
                speedInfo.MaxSpeed = limit.MaxSpeed * 0.44704;
                speedInfo.MinSpeed = limit.MinSpeed * 0.44704;

                // set id info
                speedInfo.SegmentID = limit.SegmentID;
            }

            // create updated mdf
            return(new Mdf(mdf.Goals, convertedSpeeds));
        }