public override FTableCalculator Clone() { FTableCalcOCWeirBroad lClone = new FTableCalcOCWeirBroad(); lClone.myExit = this.myExit; lClone.WeirWidth = this.WeirWidth; lClone.WeirInvert = this.WeirInvert; lClone.DischargeCoefficient = this.DischargeCoefficient; return(lClone); }
/** * *<P>Get the control device result form the calculators by calling the GenerateFTable method in each of them. </P> *<P><B>Limitations:</B> </P> * @return The result vector from the calcualtion.s */ public ArrayList getControlDeviceResult() { ArrayList cdResult = new ArrayList(); string lInput1 = ""; string lInput2 = ""; string lInput3 = ""; string lInput4 = ""; if (myCalcType == FTableCalculator.ControlDeviceType.WeirBroadCrest) { FTableCalcOCWeirBroad bft = new FTableCalcOCWeirBroad(); lInput1 = (string)calcInputs[calcInputDefs[0]]; lInput2 = (string)calcInputs[calcInputDefs[1]]; lInput3 = (string)calcInputs[calcInputDefs[2]]; lInput4 = (string)calcInputs[calcInputDefs[3]]; cdResult = bft.GenerateFTable( double.Parse(lInput1), double.Parse(lInput2), double.Parse(lInput3), double.Parse(lInput4)); } else if (myCalcType == FTableCalculator.ControlDeviceType.WeirTrapeCipolletti) { FTableCalcOCWeirTrapeCipolletti cft = new FTableCalcOCWeirTrapeCipolletti(); lInput1 = (string)calcInputs[calcInputDefs[0]]; lInput2 = (string)calcInputs[calcInputDefs[1]]; lInput3 = (string)calcInputs[calcInputDefs[2]]; lInput4 = (string)calcInputs[calcInputDefs[3]]; cdResult = cft.GenerateFTable( double.Parse(lInput1), double.Parse(lInput2), double.Parse(lInput3), double.Parse(lInput4)); } else if (myCalcType == FTableCalculator.ControlDeviceType.WeirRectangular) { FTableCalcOCWeirRectangular rft = new FTableCalcOCWeirRectangular(); lInput1 = (string)calcInputs[calcInputDefs[0]]; lInput2 = (string)calcInputs[calcInputDefs[1]]; lInput3 = (string)calcInputs[calcInputDefs[2]]; lInput4 = (string)calcInputs[calcInputDefs[3]]; cdResult = rft.GenerateFTable( double.Parse(lInput1), double.Parse(lInput2), double.Parse(lInput3), double.Parse(lInput4)); } else if (myCalcType == FTableCalculator.ControlDeviceType.OrificeRiser) { FTableCalcOCOrificeRiser rft = new FTableCalcOCOrificeRiser(); lInput1 = (string)calcInputs[calcInputDefs[0]]; lInput2 = (string)calcInputs[calcInputDefs[1]]; lInput3 = (string)calcInputs[calcInputDefs[2]]; cdResult = rft.GenerateFTable( double.Parse(lInput1), double.Parse(lInput2), double.Parse(lInput3)); } else if (myCalcType == FTableCalculator.ControlDeviceType.OrificeUnderdrain) { FTableCalcOCOrificeUnderflow uft = new FTableCalcOCOrificeUnderflow(); lInput1 = (string)calcInputs[calcInputDefs[0]]; lInput2 = (string)calcInputs[calcInputDefs[1]]; lInput3 = (string)calcInputs[calcInputDefs[2]]; cdResult = uft.GenerateFTable( double.Parse(lInput1), double.Parse(lInput2), double.Parse(lInput3)); } else if (myCalcType == FTableCalculator.ControlDeviceType.WeirTriVNotch) { FTableCalcOCWeirTriVNotch vft = new FTableCalcOCWeirTriVNotch(); //this should still work as long as the string array input defs are still in order. lInput1 = (string)calcInputs[calcInputDefs[0]]; lInput2 = (string)calcInputs[calcInputDefs[1]]; lInput3 = (string)calcInputs[calcInputDefs[2]]; lInput4 = (string)calcInputs[calcInputDefs[3]]; cdResult = vft.GenerateFTable( double.Parse(lInput1), double.Parse(lInput2), double.Parse(lInput3), double.Parse(lInput4)); } return(cdResult); }
private FTableCalculator GetControlDeviceFromForm() { List <FTableCalculator.ControlDeviceType> listOCTypes = FTableCalculator.OCTypeNames.Keys.ToList <FTableCalculator.ControlDeviceType>(); List <string> listOCCommonNames = FTableCalculator.OCTypeNames.Values.ToList <string>(); FTableCalculator.ControlDeviceType lSelectedOCType = FTableCalculator.ControlDeviceType.None; for (int i = 0; i < listOCTypes.Count; i++) { if (cboOCTypes.SelectedItem.ToString() == listOCCommonNames[i]) { lSelectedOCType = listOCTypes[i]; break; } } int lSelectedExit = SelectedExit(); double lParam0 = 0; double lParam1 = 0; double lDisCoe = 0; double.TryParse(txtOCParm_0.Text, out lParam0); double.TryParse(txtOCParm_1.Text, out lParam1); double.TryParse(txtOCDisCoeff.Text, out lDisCoe); FTableCalculator lCalc = null; switch (lSelectedOCType) { case FTableCalculator.ControlDeviceType.OrificeRiser: lCalc = new FTableCalcOCOrificeRiser(); ((FTableCalcOCOrificeRiser)lCalc).myExit = lSelectedExit; ((FTableCalcOCOrificeRiser)lCalc).OrificePipeDiameter = lParam0; ((FTableCalcOCOrificeRiser)lCalc).OrificeDepth = lParam1; ((FTableCalcOCOrificeRiser)lCalc).OrificeDischargeCoefficient = lDisCoe; break; case FTableCalculator.ControlDeviceType.OrificeUnderdrain: lCalc = new FTableCalcOCOrificeUnderflow(); ((FTableCalcOCOrificeUnderflow)lCalc).myExit = lSelectedExit; ((FTableCalcOCOrificeUnderflow)lCalc).OrificePipeDiameter = lParam0; ((FTableCalcOCOrificeUnderflow)lCalc).OrificeInvertDepth = lParam1; ((FTableCalcOCOrificeUnderflow)lCalc).OrificeDischargeCoefficient = lDisCoe; break; case FTableCalculator.ControlDeviceType.WeirBroadCrest: lCalc = new FTableCalcOCWeirBroad(); ((FTableCalcOCWeirBroad)lCalc).myExit = lSelectedExit; ((FTableCalcOCWeirBroad)lCalc).WeirWidth = lParam0; ((FTableCalcOCWeirBroad)lCalc).WeirInvert = lParam1; ((FTableCalcOCWeirBroad)lCalc).DischargeCoefficient = lDisCoe; break; case FTableCalculator.ControlDeviceType.WeirRectangular: lCalc = new FTableCalcOCWeirRectangular(); ((FTableCalcOCWeirRectangular)lCalc).myExit = lSelectedExit; ((FTableCalcOCWeirRectangular)lCalc).WeirWidth = lParam0; ((FTableCalcOCWeirRectangular)lCalc).WeirInvert = lParam1; ((FTableCalcOCWeirRectangular)lCalc).DischargeCoefficient = lDisCoe; break; case FTableCalculator.ControlDeviceType.WeirTrapeCipolletti: lCalc = new FTableCalcOCWeirTrapeCipolletti(); ((FTableCalcOCWeirTrapeCipolletti)lCalc).myExit = lSelectedExit; ((FTableCalcOCWeirTrapeCipolletti)lCalc).WeirWidth = lParam0; ((FTableCalcOCWeirTrapeCipolletti)lCalc).WeirInvert = lParam1; ((FTableCalcOCWeirTrapeCipolletti)lCalc).DischargeCoefficient = lDisCoe; break; case FTableCalculator.ControlDeviceType.WeirTriVNotch: lCalc = new FTableCalcOCWeirTriVNotch(); ((FTableCalcOCWeirTriVNotch)lCalc).myExit = lSelectedExit; ((FTableCalcOCWeirTriVNotch)lCalc).WeirAngle = lParam0; ((FTableCalcOCWeirTriVNotch)lCalc).WeirInvert = lParam1; ((FTableCalcOCWeirTriVNotch)lCalc).DischargeCoefficient = lDisCoe; break; } return(lCalc); }
private void cboOCTypes_SelectedIndexChanged(object sender, EventArgs e) { if (!pLoaded) { return; } string lSelectedOCName = cboOCTypes.SelectedItem.ToString(); if (lSelectedOCName == "None") { return; } string lName = ""; FTableCalculator.ControlDeviceType lSelectedOCType = FTableCalculator.ControlDeviceType.None; foreach (FTableCalculator.ControlDeviceType lOCType in FTableCalculator.OCTypeNames.Keys) { if (FTableCalculator.OCTypeNames.TryGetValue(lOCType, out lName)) { if (lSelectedOCName == lName) { lSelectedOCType = lOCType; break; } } } Dictionary <string, double> lDefaults = null; FTableCalculator lCalc = null; switch (lSelectedOCType) { case FTableCalculator.ControlDeviceType.WeirTriVNotch: lCalc = new FTableCalcOCWeirTriVNotch(); lDefaults = ((FTableCalcOCWeirTriVNotch)lCalc).ParamValueDefaults(); break; case FTableCalculator.ControlDeviceType.WeirTrapeCipolletti: lCalc = new FTableCalcOCWeirTrapeCipolletti(); lDefaults = ((FTableCalcOCWeirTrapeCipolletti)lCalc).ParamValueDefaults(); break; case FTableCalculator.ControlDeviceType.WeirRectangular: lCalc = new FTableCalcOCWeirRectangular(); lDefaults = ((FTableCalcOCWeirRectangular)lCalc).ParamValueDefaults(); break; case FTableCalculator.ControlDeviceType.WeirBroadCrest: lCalc = new FTableCalcOCWeirBroad(); lDefaults = ((FTableCalcOCWeirBroad)lCalc).ParamValueDefaults(); break; case FTableCalculator.ControlDeviceType.OrificeUnderdrain: lCalc = new FTableCalcOCOrificeUnderflow(); lDefaults = ((FTableCalcOCOrificeUnderflow)lCalc).ParamValueDefaults(); break; case FTableCalculator.ControlDeviceType.OrificeRiser: lCalc = new FTableCalcOCOrificeRiser(); lDefaults = ((FTableCalcOCOrificeRiser)lCalc).ParamValueDefaults(); break; } ; List <string> lParamLbls = lDefaults.Keys.ToList <string>(); List <double> lParamVals = lDefaults.Values.ToList <double>(); lblOCParm0.Text = lParamLbls[0]; lblOCParm1.Text = lParamLbls[1]; txtOCParm_0.Text = lParamVals[0].ToString(); txtOCParm_1.Text = lParamVals[1].ToString(); txtOCDisCoeff.Text = lParamVals[2].ToString(); //if (clsGlobals.gToolType == clsGlobals.ToolType.Gray) //{ // rdoExit2.Checked = true; //} //else //{ // rdoExit1.Checked = true; //} }