public async Task <ActionResult> GetDuctResultList(DuctDesignViewModel ddvm) { ddvm.RelativeRoughness = ddvm.RelativeRoughness / 1000.0; ddvm.Temperature = Calculations.ToKelvin(ddvm.Temperature); ddvm.RectangularDuctHeight = ddvm.RectangularDuctHeight / 1000.0; DuctDesigner ductDesigner = new DuctDesigner(); DuctSelectionResultViewModel model = ductDesigner.GetDuctSelectionResultViewModel(ddvm); return(PartialView("_DructSeletionResultView", model)); }
public DuctSelectionResultViewModel GetDuctSelectionResultViewModel(DuctDesignViewModel ddvm) { DuctSelectionResultViewModel model = new DuctSelectionResultViewModel(); model.SelectionType = ddvm.SelectionType; model.TargetValue = ddvm.TargetValue; model.RoundDucts = (new RoundDuctDesigner()).GetRoundDuctList(ddvm); model.RectangularDucts = (new RectangularDuctDesigner()).GetRoundDuctList(ddvm); return(model); }
public ActionResult Index(DuctDesignViewModel ddvm) { if (ModelState.IsValid) { return(View(ddvm)); } else { return(View(ddvm)); } }
public ActionResult Index() { DuctDesignViewModel ddvm = new DuctDesignViewModel() { AirFlow = 100.0, ApproximationType = HVAC.FluidMechanics.DarcyFrictionFactorApproximation.GoudarSonnad, Temperature = 20.0, Pressure = 101325, DuctLenght = 1.0, RectangularDuctHeight = 200.0, RelativeRoughness = 0.01, SelectionType = SelectionType.Velocity, TargetValue = 3.5 }; return(View(ddvm)); }
public List <RectangularDuct> GetRoundDuctList(DuctDesignViewModel ddvm) { AirFlow airFlow = new AirFlow(ddvm.Temperature, ddvm.Pressure, ddvm.AirFlow); List <RectangularDuct> ductList = new List <RectangularDuct>(); foreach (var ductSize in rectangularDuctSizes) { ductList.Add(new RectangularDuct(ddvm.ApproximationType, ddvm.RelativeRoughness, ductSize, ddvm.RectangularDuctHeight, ddvm.DuctLenght, airFlow)); } if (ddvm.SelectionType == SelectionType.Velocity) { return(ductList.OrderBy(x => Math.Abs(x.Velocity - ddvm.TargetValue)).Take(10).OrderByDescending(x => x.Velocity).ToList()); } else { return(ductList.OrderBy(x => Math.Abs(x.FrictionLoss - ddvm.TargetValue)).Take(10).OrderByDescending(x => x.FrictionLoss).ToList()); } }