BesAsm.Swsp.PacSizingTool.PacExecutor.PerformCalculations C# (CSharp) Метод

PerformCalculations() статический приватный Метод

Executes the calculator and returns a PacResults.
static private PerformCalculations ( Catchment catchment, Catchment preCatchment, Facility facility, HierarchyCategory category, DischargePoint dischargePoint ) : PacResults
catchment Catchment A catchment object defining the hydrologic parameters of the post-developed catchment area to be evaluated.
preCatchment Catchment A catchment object defining the hydrologic parameters of the pre-developed catchment area to be evaluated.
facility Facility A Facility object defining the stormwater management facility to be evaluated.
category HierarchyCategory Identifies the HierarchyCategory the proposed facility will be evaluated against.
dischargePoint DischargePoint Identifies the DischargePoint of the proposed facility.
Результат PacResults
        internal static PacResults PerformCalculations(Catchment catchment, Catchment preCatchment, Facility facility, HierarchyCategory category, DischargePoint dischargePoint)
        {
            //Define design storms
              RainfallEvent pollutionReduction = RainfallEvent.GetScsOneAEvent("Pollution Reduction", 0.83);
              RainfallEvent twoYear = RainfallEvent.GetScsOneAEvent("Two-Year", 2.4);
              RainfallEvent fiveYear = RainfallEvent.GetScsOneAEvent("Five-Year", 2.9);
              RainfallEvent tenYear = RainfallEvent.GetScsOneAEvent("Ten-Year", 3.4);
              RainfallEvent twentyFiveYear = RainfallEvent.GetScsOneAEvent("Twentyfive-Year", 3.9);

              PacResults results = new PacResults();

              //Calculate hydrographs for the most important design storms
              Hydrograph imperviousHydrographPR = SantaBarbaraUrbanHydrograph.CalculateHydrograph
            (catchment, pollutionReduction);
              Hydrograph imperviousHydrographTwoYear = SantaBarbaraUrbanHydrograph.CalculateHydrograph
            (catchment, twoYear);
              Hydrograph imperviousHydrographFiveYear = SantaBarbaraUrbanHydrograph.CalculateHydrograph
            (catchment, fiveYear);
              Hydrograph imperviousHydrographTenYear = SantaBarbaraUrbanHydrograph.CalculateHydrograph
            (catchment, tenYear);
              Hydrograph imperviousHydrographTwentyfiveYear = SantaBarbaraUrbanHydrograph.CalculateHydrograph
            (catchment, twentyFiveYear);

              results.PollutionReductionResults =
            ReservoirRouter.PerformCalculations(facility, category, catchment, imperviousHydrographPR);
              results.PollutionReductionPeakOverflow = results.PollutionReductionResults.PeakOverflow;
              results.PollutionReductionTotalOverflowVolume = results.PollutionReductionResults.OverflowVolume;
              results.PollutionReductionSurfaceCapacity = results.PollutionReductionResults.PercentSurfaceCapacityUsed;
              results.PollutionReductionPercentRockCapacity = results.PollutionReductionResults.PercentRockCapacityUsed;

              results.PollutionReductionInflowVolume = results.PollutionReductionResults.InflowVolume;
              results.PollutionReductionPeakInflow = results.PollutionReductionResults.PeakInflowRate;

              results.TwoYearResults =
            ReservoirRouter.PerformCalculations(facility, category, catchment, imperviousHydrographTwoYear);
              results.TwoYearPeakOverflow = results.TwoYearResults.PeakOverflow;
              results.TwoYearTotalOverflowVolume = results.TwoYearResults.OverflowVolume;

              results.TwoYearInflowVolume = results.TwoYearResults.InflowVolume;
              results.TwoYearPeakInflow = results.TwoYearResults.PeakInflowRate;

              results.FiveYearResults =
            ReservoirRouter.PerformCalculations(facility, category, catchment, imperviousHydrographFiveYear);
              results.FiveYearPeakOverflow = results.FiveYearResults.PeakOverflow;
              results.FiveYearTotalOverflowVolume = results.FiveYearResults.OverflowVolume;

              results.FiveYearInflowVolume = results.FiveYearResults.InflowVolume;
              results.FiveYearPeakInflow = results.FiveYearResults.PeakInflowRate;

              results.TenYearResults =
            ReservoirRouter.PerformCalculations(facility, category, catchment, imperviousHydrographTenYear);
              results.TenYearPeakOverflow = results.TenYearResults.PeakOverflow;
              results.TenYearTotalOverflowVolume = results.TenYearResults.OverflowVolume;
              results.TenYearSurfaceCapacity = results.TenYearResults.PercentSurfaceCapacityUsed;
              results.TenYearPercentRockCapacity = results.TenYearResults.PercentRockCapacityUsed;

              results.TenYearInflowVolume = results.TenYearResults.InflowVolume;
              results.TenYearPeakInflow = results.TenYearResults.PeakInflowRate;

              results.TwentyfiveYearResults =
            ReservoirRouter.PerformCalculations(facility, category, catchment, imperviousHydrographTwentyfiveYear);
              results.TwentyfiveYearPeakOverflow = results.TwentyfiveYearResults.PeakOverflow;
              results.TwentyfiveYearTotalOverflowVolume = results.TwentyfiveYearResults.OverflowVolume;

              results.TwentyfiveYearInflowVolume = results.TwentyfiveYearResults.InflowVolume;
              results.TwentyfiveYearPeakInflow = results.TwentyfiveYearResults.PeakInflowRate;

              results.TenYearScore = PacScore.NotUsed; // Defaults
              results.FlowControlScore = PacScore.NotUsed;
              results.TwoYearFlowControlScore = PacScore.NotUsed;
              results.FiveYearFlowControlScore = PacScore.NotUsed;
              results.TenYearFlowControlScore = PacScore.NotUsed;
              results.TwentyfiveYearFlowControlScore = PacScore.NotUsed;

              switch (category)
              {
              case HierarchyCategory.Category1:
              case HierarchyCategory.Category2:
              results.TenYearScore = results.TenYearPeakOverflow > 0 ? PacScore.Fail : PacScore.Pass;
              break;
              case HierarchyCategory.Category3:
              //Define preliminary catchment runoff results
              results.PreDevelopedTwoYearPeakInflow = ReservoirRouter.PerformCalculations(facility, category, preCatchment, SantaBarbaraUrbanHydrograph.CalculateHydrograph(preCatchment, twoYear)).PeakInflowRate;
              results.PreDevelopedFiveYearPeakInflow = ReservoirRouter.PerformCalculations(facility, category, preCatchment, SantaBarbaraUrbanHydrograph.CalculateHydrograph(preCatchment, fiveYear)).PeakInflowRate;
              results.PreDevelopedTenYearPeakInflow = ReservoirRouter.PerformCalculations(facility, category, preCatchment, SantaBarbaraUrbanHydrograph.CalculateHydrograph(preCatchment, tenYear)).PeakInflowRate;
              results.PreDevelopedTwentyfiveYearPeakInflow = ReservoirRouter.PerformCalculations(facility, category, preCatchment, SantaBarbaraUrbanHydrograph.CalculateHydrograph(preCatchment, twentyFiveYear)).PeakInflowRate;

              switch (dischargePoint)
              {
                  case DischargePoint.A:
                      results.FlowControlScore = PacScore.NotUsed;
                      break;
                  case DischargePoint.B:
                      if (results.TwoYearPeakOverflow <= results.PreDevelopedTwoYearPeakInflow / 2)
                          results.TwoYearFlowControlScore = PacScore.Pass;
                      else
                          results.TwoYearFlowControlScore = PacScore.Fail;
                      if (results.FiveYearPeakOverflow <= results.PreDevelopedFiveYearPeakInflow)
                          results.FiveYearFlowControlScore = PacScore.Pass;
                      else
                          results.FiveYearFlowControlScore = PacScore.Fail;
                      if (results.TenYearPeakOverflow <= results.PreDevelopedTenYearPeakInflow)
                          results.TenYearFlowControlScore = PacScore.Pass;
                      else
                          results.TenYearFlowControlScore = PacScore.Fail;
                      if (results.TwentyfiveYearPeakOverflow <= results.PreDevelopedTwentyfiveYearPeakInflow)
                          results.TwentyfiveYearFlowControlScore = PacScore.Pass;
                      else
                          results.TwentyfiveYearFlowControlScore = PacScore.Fail;
                      if (results.TwoYearPeakOverflow <= results.PreDevelopedTwoYearPeakInflow / 2 &&
                              results.FiveYearPeakOverflow <= results.PreDevelopedFiveYearPeakInflow &&
                              results.TenYearPeakOverflow <= results.PreDevelopedTenYearPeakInflow &&
                              results.TwentyfiveYearPeakOverflow <= results.PreDevelopedTwentyfiveYearPeakInflow)
                          results.FlowControlScore = PacScore.Pass;
                      else
                          results.FlowControlScore = PacScore.Fail;
                      break;
                  case DischargePoint.C:
                      if (results.TwoYearPeakOverflow <= results.PreDevelopedTwoYearPeakInflow)
                          results.TwoYearFlowControlScore = PacScore.Pass;
                      else
                          results.TwoYearFlowControlScore = PacScore.Fail;
                      if (results.FiveYearPeakOverflow <= results.PreDevelopedFiveYearPeakInflow)
                          results.FiveYearFlowControlScore = PacScore.Pass;
                      else
                          results.FiveYearFlowControlScore = PacScore.Fail;
                      if (results.TenYearPeakOverflow <= results.PreDevelopedTenYearPeakInflow)
                          results.TenYearFlowControlScore = PacScore.Pass;
                      else
                          results.TenYearFlowControlScore = PacScore.Fail;

                      if (results.TwoYearPeakOverflow <= results.PreDevelopedTwoYearPeakInflow &&
                              results.FiveYearPeakOverflow <= results.PreDevelopedFiveYearPeakInflow &&
                              results.TenYearPeakOverflow <= results.PreDevelopedTenYearPeakInflow)
                          results.FlowControlScore = PacScore.Pass;
                      else
                          results.FlowControlScore = PacScore.Fail;
                      break;
                  default:
                      break;
              }
              break;
              case HierarchyCategory.Category4:
              //Define preliminary catchment runoff results
              results.PreDevelopedTwoYearPeakInflow = ReservoirRouter.PerformCalculations(facility, category, preCatchment, SantaBarbaraUrbanHydrograph.CalculateHydrograph(preCatchment, twoYear)).PeakInflowRate;
              results.PreDevelopedFiveYearPeakInflow = ReservoirRouter.PerformCalculations(facility, category, preCatchment, SantaBarbaraUrbanHydrograph.CalculateHydrograph(preCatchment, fiveYear)).PeakInflowRate;
              results.PreDevelopedTenYearPeakInflow = ReservoirRouter.PerformCalculations(facility, category, preCatchment, SantaBarbaraUrbanHydrograph.CalculateHydrograph(preCatchment, tenYear)).PeakInflowRate;
              results.PreDevelopedTwentyfiveYearPeakInflow = ReservoirRouter.PerformCalculations(facility, category, preCatchment, SantaBarbaraUrbanHydrograph.CalculateHydrograph(preCatchment, twentyFiveYear)).PeakInflowRate;
              if (results.TwentyfiveYearPeakOverflow <= results.PreDevelopedTenYearPeakInflow)
              {
                  results.FlowControlScore = PacScore.Pass;
                  results.TwentyfiveYearFlowControlScore = PacScore.Pass;
              }
              else
              {
                  results.FlowControlScore = PacScore.Fail;
                  results.TwentyfiveYearFlowControlScore = PacScore.Fail;
              }
              break;
              default:
              break;
              }

              results.PollutionReductionScore = results.PollutionReductionResults.PeakSurfaceOverflow > 0 ?
            PacScore.Fail : PacScore.Pass;

              return results;
        }

Same methods

PacExecutor::PerformCalculations ( Catchment catchment, Catchment preCatchment, Facility facility, int category ) : PacResults
PacExecutor::PerformCalculations ( Catchment catchment, Catchment preCatchment, Facility facility, int category, char dischargePoint ) : PacResults
PacExecutor::PerformCalculations ( Catchment catchment, Catchment preCatchment, SlopedFacility slopedFacility, int category ) : PacResults
PacExecutor::PerformCalculations ( Catchment catchment, Catchment preCatchment, SlopedFacility slopedFacility, int category, char dischargePoint ) : PacResults
PacExecutor::PerformCalculations ( Catchment catchment, Facility facility, int category ) : PacResults
PacExecutor::PerformCalculations ( Catchment catchment, SlopedFacility slopedFacility, int category ) : PacResults

Usage Example

Пример #1
0
        private void PerformCalculations()
        {
            Facility facility       = ValidateFacility(cmbHierachy.Text, cmbFacilityType.Text, cmbFacilityConfiguration.Text);
            double   preCurveNumber = Convert.ToDouble(txtPreCurveNumber.Text);

            int hierarchyNumber = Convert.ToInt32(cmbHierachy.Text);

            PacResults results = PacExecutor.PerformCalculations(facility.Catchment, facility, hierarchyNumber);

            txtPrPassFail.Text          = results.PollutionReductionScore.ToString();
            txt10YrPassFail.Text        = results.TenYearScore.ToString();
            txtPrPercentCapacity.Text   = string.Format("{0:0.0}%", results.PollutionReductionSurfaceCapacity * 100);
            txt10YrPercentCapacity.Text = string.Format("{0:0.0}%", results.TenYearSurfaceCapacity * 100);
            txt2YrPeakInFlow.Text       = string.Format("{0:0.000}", results.TwoYearPeakInflow);
            txt5YrPeakInFlow.Text       = string.Format("{0:0.000}", results.FiveYearPeakInflow);
            txt10YrPeakInFlow.Text      = string.Format("{0:0.000}", results.TenYearPeakInflow);
            txt25YrPeakInFlow.Text      = string.Format("{0:0.000}", results.TwentyfiveYearPeakInflow);
            txt2YrPeakFlow.Text         = string.Format("{0:0.000}", results.TwoYearPeakOverflow);
            txt5YrPeakFlow.Text         = string.Format("{0:0.000}", results.FiveYearPeakOverflow);
            txt10YrPeakFlow.Text        = string.Format("{0:0.000}", results.TenYearPeakOverflow);
            txt25YrPeakFlow.Text        = string.Format("{0:0.000}", results.TwentyfiveYearPeakOverflow);

            txtPrRockCap.Text         = string.Format("{0:0.0}%", results.PollutionReductionPercentRockCapacity * 100);
            txt10YrRockCap.Text       = string.Format("{0:0.0}%", results.TenYearPercentRockCapacity * 100);
            txtTotalFacilityArea.Text = string.Format("{0:0}", facility.TotalFacilityAreaSqFt);
            txtSizingFactor.Text      = string.Format("{0:0.0}%", facility.FacilitySizingRatio * 100);

            txt10YrOverflowCuFt.Text = string.Format("{0:0.000}", results.TenYearTotalOverflowVolume);
            txtPROverflowCuFt.Text   = string.Format("{0:0.000}", results.PollutionReductionTotalOverflowVolume);

            PlotResults(chartPollutionReductionAboveGrade, results.PollutionReductionResults.AboveGradePrimaryResults, results.PollutionReductionResults.AboveGradeSecondaryResults);
            PlotResults(chartPollutionReductionBelowGrade, results.PollutionReductionResults.BelowGradePrimaryResults, results.PollutionReductionResults.BelowGradeSecondaryResults);
            PlotResults(chartTenYearAboveGrade, results.TenYearResults.AboveGradePrimaryResults, results.TenYearResults.AboveGradeSecondaryResults);
            PlotResults(chartTenYearBelowGrade, results.TenYearResults.BelowGradePrimaryResults, results.TenYearResults.BelowGradeSecondaryResults);

            String selected = this.cmbHierachy.SelectedItem as String;
            InfiltrationTestType infiltrationTestType;

            switch (cmbInfiltrationProcedure.SelectedIndex)
            {
            case (0):
                infiltrationTestType = InfiltrationTestType.OpenPitFallingHead;
                break;

            case (1):
                infiltrationTestType = InfiltrationTestType.EncasedFallingHead;
                break;

            case (2):
                infiltrationTestType = InfiltrationTestType.DoubleRingInfiltometer;
                break;

            default:
                infiltrationTestType = InfiltrationTestType.OpenPitFallingHead;
                break;
            }

            if (selected.Equals("3") || selected.Equals("4"))
            {
                Catchment preCatchment = new Catchment("Pre-Developed Catchment A")
                {
                    ImperviousAreaSquareFeet            = facility.Catchment.ImperviousAreaSquareFeet,
                    AcceptableSeparationFromGroundwater = chkMeetsGroundwaterRequirements.Checked,
                    CurveNumber = preCurveNumber,
                    TimeOfConcentrationMinutes          = facility.Catchment.TimeOfConcentrationMinutes,
                    TestedInfiltrationRateInchesPerHour = facility.Catchment.DesignInfiltrationNativeInchesPerHour,
                    InfiltrationTestType = infiltrationTestType
                };

                char dischargePoint = 'A';
                switch (this.cmbDischargePoint.SelectedIndex)
                {
                case 0:
                    dischargePoint = 'A';
                    break;

                case 1:
                    dischargePoint = 'B';
                    break;

                case 2:
                    dischargePoint = 'C';
                    break;

                default:
                    dischargePoint = 'A';
                    break;
                }

                results = PacExecutor.PerformCalculations(facility.Catchment, preCatchment, facility, hierarchyNumber, dischargePoint);

                txtPre2YrPeakFlow.Text             = string.Format("{0:0.000}", results.PreDevelopedTwoYearPeakInflow);
                txtPre5YrPeakFlow.Text             = string.Format("{0:0.000}", results.PreDevelopedFiveYearPeakInflow);
                txtPre10YrPeakFlow.Text            = string.Format("{0:0.000}", results.PreDevelopedTenYearPeakInflow);
                txtPre25YrPeakFlow.Text            = string.Format("{0:0.000}", results.PreDevelopedTwentyfiveYearPeakInflow);
                tblPeakTable.RowStyles[1].SizeType = SizeType.AutoSize;
                if (selected.Equals("3"))
                {
                    switch (this.cmbDischargePoint.SelectedIndex)
                    {
                    case 0:
                        lbl2YrPassFail.Text  = "N/A";
                        lbl5YrPassFail.Text  = "N/A";
                        lbl10YrPassFail.Text = "N/A";
                        lbl25YrPassFail.Text = "N/A";
                        break;

                    case 1:
                        lbl2YrPassFail.Text  = results.TwoYearPeakOverflow <= (results.PreDevelopedTwoYearPeakInflow / 2) ? "Pass" : "Fail";
                        lbl5YrPassFail.Text  = results.FiveYearPeakOverflow <= results.PreDevelopedFiveYearPeakInflow ? "Pass" : "Fail";
                        lbl10YrPassFail.Text = results.TenYearPeakOverflow <= results.PreDevelopedTenYearPeakInflow ? "Pass" : "Fail";
                        lbl25YrPassFail.Text = results.TwentyfiveYearPeakOverflow <= results.PreDevelopedTwentyfiveYearPeakInflow ? "Pass" : "Fail";
                        break;

                    case 2:
                        lbl2YrPassFail.Text  = results.TwoYearPeakOverflow <= results.PreDevelopedTwoYearPeakInflow ? "Pass" : "Fail";
                        lbl5YrPassFail.Text  = results.FiveYearPeakOverflow <= results.PreDevelopedFiveYearPeakInflow ? "Pass" : "Fail";
                        lbl10YrPassFail.Text = results.TenYearPeakOverflow <= results.PreDevelopedTenYearPeakInflow ? "Pass" : "Fail";
                        lbl25YrPassFail.Text = "N/A";
                        break;

                    default:
                        lbl2YrPassFail.Text  = "N/A";
                        lbl5YrPassFail.Text  = "N/A";
                        lbl10YrPassFail.Text = "N/A";
                        lbl25YrPassFail.Text = "N/A";
                        break;
                    }
                }
                else
                {
                    lbl2YrPassFail.Text  = "N/A";
                    lbl5YrPassFail.Text  = "N/A";
                    lbl10YrPassFail.Text = "N/A";
                    lbl25YrPassFail.Text = results.TwentyfiveYearPeakOverflow <= results.PreDevelopedTenYearPeakInflow ? "Pass" : "Fail";
                }
            }
            else
            {
                tblPeakTable.RowStyles[1].SizeType = SizeType.Absolute;
                tblPeakTable.RowStyles[1].Height   = 0;
                lbl2YrPassFail.Text  = "N/A";
                lbl5YrPassFail.Text  = "N/A";
                lbl10YrPassFail.Text = "N/A";
                lbl25YrPassFail.Text = "N/A";
            }
            lblFlowControlScore.Text = results.FlowControlScore.ToString();
            lbl2YrPassFail.Text      = results.TwoYearFlowControlScore.ToString();
            lbl5YrPassFail.Text      = results.FiveYearFlowControlScore.ToString();
            lbl10YrPassFail.Text     = results.TenYearFlowControlScore.ToString();
            lbl25YrPassFail.Text     = results.TwentyfiveYearFlowControlScore.ToString();
        }