예제 #1
0
        public JsonResult SolutionTestCase()
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            var graph = NereidUtilities.BuildNetworkGraph(HttpRequestStorage.DatabaseEntities);

            // this subgraph is 23 nodes deep
            var single   = graph.Nodes.Single(x => x.ID == "RSB_42");
            var subgraph = graph.GetUpstreamSubgraph(single);

            var allLoadingInputs = HttpRequestStorage.DatabaseEntities.vNereidLoadingInputs.ToList();
            var allModelingBMPs  = NereidUtilities.ModelingTreatmentBMPs(HttpRequestStorage.DatabaseEntities).ToList();
            var allWaterqualityManagementPlanNodes = NereidUtilities.GetWaterQualityManagementPlanNodes(HttpRequestStorage.DatabaseEntities).ToList();
            var allModelingQuickBMPs = HttpRequestStorage.DatabaseEntities.QuickBMPs.Include(x => x.TreatmentBMPType)
                                       .Where(x => x.PercentOfSiteTreated != null && x.TreatmentBMPType.IsAnalyzedInModelingModule).ToList();

            var responseContent = NereidUtilities.SolveSubgraph(subgraph, allLoadingInputs, allModelingBMPs, allWaterqualityManagementPlanNodes, allModelingQuickBMPs, out _, NereidController.HttpClient, true);

            var stopwatchElapsedMilliseconds = stopwatch.ElapsedMilliseconds;

            stopwatch.Stop();

            return(Json(new { elapsed = stopwatchElapsedMilliseconds, responseContent }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public JsonResult TreatmentFacility()
        {
            var treatmentFacilityUrl = $"{NeptuneWebConfiguration.NereidUrl}/api/v1/treatment_facility/validate?state=ca&region=soc";

            var treatmentFacilities = NereidUtilities.ModelingTreatmentBMPs(HttpRequestStorage.DatabaseEntities)
                                      .ToList().Where(x => x.IsFullyParameterized())
                                      .Select(x => x.ToTreatmentFacility(false)).ToList();

            var treatmentFacilityTable = new TreatmentFacilityTable()
            {
                TreatmentFacilities = treatmentFacilities
            };

            var stopwatch = new Stopwatch();

            stopwatch.Start();
            NereidUtilities.RunJobAtNereid <TreatmentFacilityTable, object>(treatmentFacilityTable, treatmentFacilityUrl,
                                                                            out var responseContent, HttpClient);
            var stopwatchElapsedMilliseconds = stopwatch.ElapsedMilliseconds;

            return(Json(
                       new
            {
                rpcTime = stopwatchElapsedMilliseconds,
                responseContent,
                requestContent = JsonConvert.SerializeObject(treatmentFacilityTable)
            }, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public ContentResult TreatmentFacilityTable()
        {
            var treatmentFacilities = NereidUtilities.ModelingTreatmentBMPs(HttpRequestStorage.DatabaseEntities)
                                      .ToList()
                                      .Select(x => x.ToTreatmentFacility(false)).ToList();

            var treatmentFacilityTable = new TreatmentFacilityTable()
            {
                TreatmentFacilities = treatmentFacilities
            };

            var serializeObject = JsonConvert.SerializeObject(treatmentFacilityTable);

            return(Content(serializeObject, "application/json"));
        }