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();
}