コード例 #1
0
        public static List <DepthReadingModel> GenerateDepthReadings(
            double dipTrend, double azimuthTrend,
            int numberOfDrillSites      = DefaultNumberOfDrillSites,
            int maxDepthReadingsPerSite = DefaultNumberOfDepthReadings)
        {
            var config = DrillConfigService.GetInstance().DrillConfigModel;
            var random = new Random();
            // random number of depth readings, between 1 and 100
            var nDepthReadings       = (int)(random.NextDouble() * maxDepthReadingsPerSite) + 1;
            var orderedDepthReadings = new List <DepthReadingModel>();

            for (var j = 0; j < nDepthReadings; j++)
            {
                // create random depth reading, with dip and azimuth in between bounds
                var reading = CreateRandomDepthReading(j, random, dipTrend, config.DipMarginOfError, azimuthTrend, config.AzimuthMarginOfError);

                orderedDepthReadings.Add(reading); // add to ordered list
                // retrieve number of records (as configured) to create dip average
                var records = DrillSiteService.RetrieveXRecordsBefore(
                    orderedDepthReadings,
                    j + 1,
                    config.NumberOfRecordsToQueryDip);
                dipTrend = records.Sum(x => x.Dip) / records.Count();
                // retrieve number of records (as configured) to create azimuth average
                records = DrillSiteService.RetrieveXRecordsBefore(
                    orderedDepthReadings,
                    j + 1,
                    config.NumberOfRecordsToQueryAzimuth);
                azimuthTrend = records.Sum(x => x.Azimuth) / records.Count();
            }

            return(orderedDepthReadings);
        }
コード例 #2
0
        public static List <DrillSiteService> GenerateDrillSitesWithDepthReadings(
            int numberOfDrillSites      = DefaultNumberOfDrillSites,
            int maxDepthReadingsPerSite = DefaultNumberOfDepthReadings)
        {
            var random     = new Random();
            var drillSites = new List <DrillSiteService>();
            var config     = DrillConfigService.GetInstance().DrillConfigModel;

            for (var i = 0; i < numberOfDrillSites; i++)
            {
                var drillSite = CreateRandomDrillSite(config, random);
                drillSites.Add(drillSite);
            }

            return(drillSites);
        }
コード例 #3
0
        /// <summary>
        ///     Recursive function that will cycle through the readings, starting at
        ///     indexToUpdate until it reaches the end of the readings list, updating
        ///     the trustworthiness as it goes along.
        /// </summary>
        /// <param name="readings"></param>
        /// <param name="indexToUpdate"></param>
        /// <param name="config">If left null, will use config from database - optional for unit testing purposes</param>
        public static void UpdateReadingsTrustworthiness(List <DepthReadingModel> readings, int indexToUpdate, DrillConfigModel config = null)
        {
            if (indexToUpdate >= readings.Count)
            {
                return; // end of list
            }
            if (config == null)
            {
                config = Config ?? (Config = DrillConfigService.GetInstance().DrillConfigModel);
            }

            var azimuthRecordsToQuery =
                RetrieveXRecordsBefore(readings, indexToUpdate, config.NumberOfRecordsToQueryAzimuth).ToList();
            var dipRecordsToQuery = config.NumberOfRecordsToQueryAzimuth == config.NumberOfRecordsToQueryDip
                ? azimuthRecordsToQuery // no need to calculate new list, if they're both going to be the same
                : RetrieveXRecordsBefore(readings, indexToUpdate, config.NumberOfRecordsToQueryDip).ToList();

            CalculateTrustWorthiness(config, readings[indexToUpdate], dipRecordsToQuery, azimuthRecordsToQuery);
            UpdateReadingsTrustworthiness(readings, indexToUpdate + 1, config);
        }