private string GetLocationString(TopographicLocation loc) { string ShapeStr = ""; switch (loc) { case TopographicLocation.UpwindOfCrest: ShapeStr = "upwind of crest"; break; case TopographicLocation.DownwindOfCrest: ShapeStr = "downwind of crest"; break; } return ShapeStr; }
//µ: Horizontal attenuation factor. public double GetMu(TopographyType TopographyType, TopographicLocation TopographicLocation) { #region Read Table var SampleValue = new { TopographyType = "", TopographicLocation = "", Mu = "" }; // sample var MuList = ListFactory.MakeList(SampleValue); using (StringReader reader = new StringReader(Resources.ASCE7_10F26_8_1Mu)) { string line; while ((line = reader.ReadLine()) != null) { string[] Vals = line.Split(','); if (Vals.Count() == 3) { string thisTopographyType = (string)Vals[0]; string thisTopographicLocation = (string)Vals[1]; string thisMu = (string)Vals[2]; MuList.Add(new { TopographyType = thisTopographyType, TopographicLocation = thisTopographicLocation, Mu = thisMu }); } } } #endregion var tableValues = from muEntry in MuList where (muEntry.TopographyType == TopographyType.ToString() && muEntry.TopographicLocation == TopographicLocation.ToString()) select muEntry; var result = (tableValues.ToList()).FirstOrDefault().Mu; double mu =0.0; if (result!=null) { mu = Double.Parse(result, CultureInfo.InvariantCulture); } else { throw new ParameterNotFoundInTableException("Mu"); } return mu; }
private string GetLocationString(TopographicLocation loc) { string ShapeStr = ""; switch (loc) { case TopographicLocation.UpwindOfCrest: ShapeStr = "upwind of crest"; break; case TopographicLocation.DownwindOfCrest: ShapeStr = "downwind of crest"; break; } return(ShapeStr); }
//µ: Horizontal attenuation factor. public double GetMu(TopographyType TopographyType, TopographicLocation TopographicLocation) { #region Read Table var SampleValue = new { TopographyType = "", TopographicLocation = "", Mu = "" }; // sample var MuList = ListFactory.MakeList(SampleValue); using (StringReader reader = new StringReader(Resources.ASCE7_10F26_8_1Mu)) { string line; while ((line = reader.ReadLine()) != null) { string[] Vals = line.Split(','); if (Vals.Count() == 3) { string thisTopographyType = (string)Vals[0]; string thisTopographicLocation = (string)Vals[1]; string thisMu = (string)Vals[2]; MuList.Add(new { TopographyType = thisTopographyType, TopographicLocation = thisTopographicLocation, Mu = thisMu }); } } } #endregion var tableValues = from muEntry in MuList where (muEntry.TopographyType == TopographyType.ToString() && muEntry.TopographicLocation == TopographicLocation.ToString()) select muEntry; var result = (tableValues.ToList()).FirstOrDefault().Mu; double mu = 0.0; if (result != null) { mu = Double.Parse(result, CultureInfo.InvariantCulture); } else { throw new ParameterNotFoundInTableException("Mu"); } return(mu); }
public double GetKzt( double x, double z, double H, double Lh, WindExposureCategory windExposureCategory, TopographicLocation TopographicLocation, TopographyType TopographyType ) { double HToLh = H/Lh; double Mu = this.GetMu(TopographyType,TopographicLocation); double gamma = Getgamma(TopographyType); double K1OverHToLh = GetK1OverHToLh(windExposureCategory, TopographyType, HToLh); double K1 = GetK1(K1OverHToLh, HToLh); double K2 = GetK2(x,Mu,Lh); double K3 = GetK3(gamma, z, Lh); double Kzt = Math.Pow(1.0 + K1 * K2 * K3, 2.0); #region Kzt ICalcLogEntry KztEntry = new CalcLogEntry(); KztEntry.ValueName = "Kzt"; KztEntry.AddDependencyValue("WindExposureCategory", windExposureCategory.ToString() ); KztEntry.AddDependencyValue("HillShape", GetHillShapeString(TopographyType)); KztEntry.AddDependencyValue("LocationRelativeToCrest",GetLocationString(TopographicLocation) ); KztEntry.AddDependencyValue("HToLh", Math.Round(HToLh, 3)); KztEntry.AddDependencyValue("z", Math.Round(z, 3)); KztEntry.AddDependencyValue("x", Math.Round(x, 3)); KztEntry.AddDependencyValue("Lh", Math.Round(Lh, 3)); KztEntry.AddDependencyValue("mu", Math.Round(Mu, 3)); KztEntry.AddDependencyValue("gamma", Math.Round(gamma, 3)); KztEntry.AddDependencyValue("K1OverHToLh", Math.Round(K1OverHToLh, 3)); KztEntry.AddDependencyValue("K1", Math.Round(K1, 3)); KztEntry.AddDependencyValue("K2", Math.Round(K2, 3)); KztEntry.AddDependencyValue("K3", Math.Round(K3, 3)); KztEntry.Reference = ""; KztEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Wind/WindTopographicFactor.docx"; KztEntry.FormulaID = null; //reference to formula from code KztEntry.VariableValue = Math.Round(Kzt, 3).ToString(); #endregion this.AddToLog(KztEntry); return Kzt; }
public double GetKzt( double x, double z, double H, double Lh, WindExposureCategory windExposureCategory, TopographicLocation TopographicLocation, TopographyType TopographyType ) { double HToLh = H / Lh; double Mu = this.GetMu(TopographyType, TopographicLocation); double gamma = Getgamma(TopographyType); double K1OverHToLh = GetK1OverHToLh(windExposureCategory, TopographyType, HToLh); double K1 = GetK1(K1OverHToLh, HToLh); double K2 = GetK2(x, Mu, Lh); double K3 = GetK3(gamma, z, Lh); double Kzt = Math.Pow(1.0 + K1 * K2 * K3, 2.0); #region Kzt ICalcLogEntry KztEntry = new CalcLogEntry(); KztEntry.ValueName = "Kzt"; KztEntry.AddDependencyValue("WindExposureCategory", windExposureCategory.ToString()); KztEntry.AddDependencyValue("HillShape", GetHillShapeString(TopographyType)); KztEntry.AddDependencyValue("LocationRelativeToCrest", GetLocationString(TopographicLocation)); KztEntry.AddDependencyValue("HToLh", Math.Round(HToLh, 3)); KztEntry.AddDependencyValue("z", Math.Round(z, 3)); KztEntry.AddDependencyValue("x", Math.Round(x, 3)); KztEntry.AddDependencyValue("Lh", Math.Round(Lh, 3)); KztEntry.AddDependencyValue("mu", Math.Round(Mu, 3)); KztEntry.AddDependencyValue("gamma", Math.Round(gamma, 3)); KztEntry.AddDependencyValue("K1OverHToLh", Math.Round(K1OverHToLh, 3)); KztEntry.AddDependencyValue("K1", Math.Round(K1, 3)); KztEntry.AddDependencyValue("K2", Math.Round(K2, 3)); KztEntry.AddDependencyValue("K3", Math.Round(K3, 3)); KztEntry.Reference = ""; KztEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Wind/WindTopographicFactor.docx"; KztEntry.FormulaID = null; //reference to formula from code KztEntry.VariableValue = Math.Round(Kzt, 3).ToString(); #endregion this.AddToLog(KztEntry); return(Kzt); }