public void DisplayCalculations(CalculationResults results) { layout.GetControlFromPosition(1, 0).Text = results.totalFlow.ToString(); layout.GetControlFromPosition(1, 1).Text = results.numberOfFixtures.ToString(); layout.GetControlFromPosition(1, 2).Text = results.coeffecient.ToString(); layout.GetControlFromPosition(1, 3).Text = results.possibleflow.ToString(); layout.GetControlFromPosition(1, 4).Text = Utilities.speed.ToString(); layout.GetControlFromPosition(1, 5).Text = results.diameter.ToString(); layout.GetControlFromPosition(1, 6).Text = MaterialsList.SelectedItem.ToString(); layout.GetControlFromPosition(1, 7).Text = results.commercialInternalDiameter.ToString() + "/" + results.commercialExternalDiameter.ToString(); layout.GetControlFromPosition(1, 8).Text = results.realSpeed.ToString(); }
//copy constructor public CalculationResults(CalculationResults copy) { pipe = copy.pipe; fixtures = copy.fixtures; totalFlow = copy.totalFlow; numberOfFixtures = copy.numberOfFixtures; coeffecient = copy.coeffecient; possibleflow = copy.possibleflow; section = copy.section; diameter = copy.diameter; material = copy.material; commercialExternalDiameter = copy.commercialExternalDiameter; commercialInternalDiameter = copy.commercialInternalDiameter; realSpeed = copy.realSpeed; }
public Main(CalculationResults results) { InitializeComponent(); currentResults = results; //setting the pipe name PipeName.Text = "Nom Du Tube Sélectionné: " + results.pipe.Name; //displaying the list of fixturs connected to the pipe Utilities.AssignElementsToListBox(listOfFixtures, results.fixtures); //assigning list of available materials to the materials combobox Utilities.AssignElementsToComboBox(MaterialsList, new List <string>(Utilities.materials.Keys)); //assigning the default value of the combobox MaterialsList.DropDownStyle = ComboBoxStyle.DropDownList; MaterialsList.SelectedIndex = 0; //disabling the apply button before doing the calculations Apply.Enabled = false; }
/// <summary> /// Traverse the system recursively by analyzing each element /// </summary> /// <param name="elementNode">The element to be analyzed</param> public void Traverse(TreeNode elementNode, ref List <Element> ends) { List <Element> localEnds = new List <Element>(); // Find all child nodes and analyze them recursively AppendChildren(elementNode, ref localEnds); foreach (TreeNode node in elementNode.ChildNodes) { //use this code to find a specific elemnt /*if(targetPipe.Id.IntegerValue == node.Id.IntegerValue) * { * targetNode = node; * return; * }*/ /*Element element = doc.GetElement(node.Id); * if (element.Category.Id.IntegerValue == (int)BuiltInCategory.OST_PlumbingFixtures) * { * ends.Add(element); * continue; * }*/ Traverse(node, ref localEnds); } if ((GetElementById(elementNode.Id).Category.Id.IntegerValue == (int)BuiltInCategory.OST_PipeFitting)) { if (localEnds.Count == 0) { return; } if (GetElementById(elementNode.InputConnector.Owner.Id) is Pipe) { CalculationResults result = Utilities.Calculate(localEnds); result.pipe = GetElementById(elementNode.InputConnector.Owner.Id) as Pipe; allResults.Add(result); } } ends.AddRange(localEnds); }
//Calculate everything public static CalculationResults Calculate(List <Element> fixtures) { CalculationResults r = new CalculationResults(); r.fixtures = fixtures; r.totalFlow = Utilities.CalculateTotalFlow(fixtures, out r.numberOfFixtures); if (r.numberOfFixtures > 5) { r.coeffecient = Utilities.CalculateCoeffecient(r.numberOfFixtures); r.possibleflow = r.totalFlow * r.coeffecient; r.section = Utilities.CalculateSection(r.possibleflow); r.diameter = Utilities.GetDiameterFromSection(r.section); } else { r.coeffecient = Utilities.CalculateCoeffecient(fixtures); r.diameter = Utilities.GetMinimumDiameterFromCoeff(r.coeffecient); } return(r); }
public static void ChangePipeType(CalculationResults cr) { PipeType newPipeType = pipeTypes.FirstOrDefault(x => x.Name.Contains(cr.material.Remove(0, 5))); cr.pipe.ChangeTypeId(newPipeType.Id); }