public void ReturnsValue() { Structure s = new Structure(); BuildingRiskCategory cat = s.GetRiskCategory("Commercial building"); Assert.AreEqual(BuildingRiskCategory.II, cat); }
public partial class SnowStructure { public double GetImportanceFactor(BuildingRiskCategory RiskCategory) { double Is = 1.0; switch (RiskCategory) { case BuildingRiskCategory.I: Is = 0.8; break; case BuildingRiskCategory.II: Is = 1.0; break; case BuildingRiskCategory.III: Is = 1.1; break; case BuildingRiskCategory.IV: Is = 1.2; break; } #region Is ICalcLogEntry IsEntry = new CalcLogEntry(); IsEntry.ValueName = "Is"; IsEntry.AddDependencyValue("RiskCategory", RiskCategory.ToString()); IsEntry.Reference = ""; IsEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Snow/SnowImportanceFactorIs.docx"; IsEntry.FormulaID = "Table 1.5-2"; //reference to formula from code IsEntry.VariableValue = Is.ToString(); #endregion this.AddToLog(IsEntry);
public data.SeismicDesignCategory GetSeismicDesignCategory(BuildingRiskCategory RiskCategory, double SDS, double SD1, double S1) { data.SeismicDesignCategory SDC, CategoryS1, CategorySDS, CategorySD1; CategorySDS = Get02secSeismicDesignCategory(SDS, RiskCategory); CategorySD1 = Get1secSeismicDesignCategory(SD1, RiskCategory); if (S1 >= 0.75) { if (RiskCategory == BuildingRiskCategory.IV) { CategoryS1 = data.SeismicDesignCategory.F; } else { CategoryS1 = data.SeismicDesignCategory.E; } //High-seismic design category SDC = CategoryS1; } else { if ((int)CategorySDS >= (int)CategorySD1) { SDC = CategorySDS; } else { SDC = CategorySD1; } } return(SDC); }
public partial class IceStructure : AnalyticalElement { public double GetImportanceFactor(BuildingRiskCategory RiskCategory) { double Ii = 1.0; switch (RiskCategory) { case BuildingRiskCategory.I: Ii = 0.8; break; case BuildingRiskCategory.II: Ii = 1.0; break; case BuildingRiskCategory.III: Ii = 1.25; break; case BuildingRiskCategory.IV: Ii = 1.25; break; } #region Ii ICalcLogEntry IiEntry = new CalcLogEntry(); IiEntry.ValueName = "Ii"; IiEntry.AddDependencyValue("RiskCategory", RiskCategory.ToString()); IiEntry.Reference = ""; IiEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Ice/IceImportanceFactor.docx"; IiEntry.FormulaID = null; //reference to formula from code IiEntry.VariableValue = Math.Round(Ii, 3).ToString(); #endregion this.AddToLog(IiEntry);
public partial class General { public double GetImportanceFactor(BuildingRiskCategory RiskCategory) { double Ie = 1.0; switch (RiskCategory) { case BuildingRiskCategory.I: Ie = 1.0; break; case BuildingRiskCategory.II: Ie = 1.0; break; case BuildingRiskCategory.III: Ie = 1.25; break; case BuildingRiskCategory.IV: Ie = 1.5; break; } #region Ie ICalcLogEntry IeEntry = new CalcLogEntry(); IeEntry.ValueName = "Ie"; IeEntry.AddDependencyValue("RiskCategory", RiskCategory.ToString()); IeEntry.Reference = ""; IeEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Seismic/SeismicImportanceFactorIe.docx"; IeEntry.FormulaID = "Table 1.5-2"; //reference to formula from code IeEntry.VariableValue = Ie.ToString(); #endregion this.AddToLog(IeEntry); return Ie;
public BuildingRiskCategory GetRiskCategory(string structureCategoryByOccupancyId) { #region Read Category Data (ASCE Table 1.5-1) var SampleValue = new { OccupancyId = "", OccupancyDescription = "", RiskCategory = "" }; // sample var RiskCategoryList = ListFactory.MakeList(SampleValue); using (StringReader reader = new StringReader(Resources.ASCE7_10T1_5_1RiskCategories)) { string line; while ((line = reader.ReadLine()) != null) { string[] Vals = line.Split(','); if (Vals.Count() == 3) { string OccupId = (string)Vals[0]; string OccupancyDescription = (string)Vals[1]; string RiskCat = (string)Vals[2]; RiskCategoryList.Add(new { OccupancyId = OccupId, OccupancyDescription = OccupancyDescription, RiskCategory = RiskCat }); } } } #endregion var dataValues = from riskCat in RiskCategoryList where (riskCat.OccupancyId == structureCategoryByOccupancyId) select riskCat; var resultCategory = dataValues.ToList().First(); string parsedCategoryValue = resultCategory.RiskCategory; string parsedOccupancyDescription = resultCategory.OccupancyDescription; BuildingRiskCategory riskCategory = BuildingRiskCategory.None; BuildingRiskCategory tmpParsedVal; if (Enum.TryParse <BuildingRiskCategory>(parsedCategoryValue, false, out tmpParsedVal) == true) { riskCategory = tmpParsedVal; } #region RiskCategory ICalcLogEntry riskCategoryEntry = new CalcLogEntry(); riskCategoryEntry.ValueName = "RiskCategory"; riskCategoryEntry.AddDependencyValue("OccupancyDescription", parsedOccupancyDescription); riskCategoryEntry.Reference = "Risk Category"; riskCategoryEntry.DescriptionReference = "/Templates/General/RiskCategory.docx"; riskCategoryEntry.FormulaID = "Table 1.5-1"; //reference to formula from code riskCategoryEntry.VariableValue = riskCategory.ToString(); #endregion this.AddToLog(riskCategoryEntry); return(riskCategory); }
public data.SeismicDesignCategory Get1secSeismicDesignCategory(double SD1, BuildingRiskCategory RiskCategory) { data.SeismicDesignCategory CategorySD1 = data.SeismicDesignCategory.A; //TODO: see special case when SDC is permitted to be determined from Table 11.6-1 alone # region Table 11.6-2 Seismic Design Category Based on 1-S Period Response Acceleration Parameter if (SD1 < 0.067)
{ public data.SeismicDesignCategory Get02secSeismicDesignCategory(double SDS, BuildingRiskCategory RiskCategory) { data.SeismicDesignCategory CategorySDS = data.SeismicDesignCategory.A; //TODO: see special case when SDC is permitted to be determined from Table 11.6-1 alone # region Table 11.6-1 Seismic Design Category Based on Short Period Response Acceleration Parameter if (SDS < 0.167) { CategorySDS = data.SeismicDesignCategory.A; } if (SDS >= 0.167 && SDS < 0.33) { if (RiskCategory == BuildingRiskCategory.IV) { CategorySDS = data.SeismicDesignCategory.C; } else { CategorySDS = data.SeismicDesignCategory.B; } } if (SDS >= 0.33 && SDS < 0.5) { if (RiskCategory == BuildingRiskCategory.IV) { CategorySDS = data.SeismicDesignCategory.D; } else { CategorySDS = data.SeismicDesignCategory.C; } } if (SDS >= 0.5) { CategorySDS = data.SeismicDesignCategory.D; } #endregion #region Sds ICalcLogEntry SdsEntry = new CalcLogEntry(); SdsEntry.ValueName = "CategorySDS"; SdsEntry.AddDependencyValue("SDS", Math.Round(SDS, 4)); SdsEntry.AddDependencyValue("RiskCategory", RiskCategory.ToString()); SdsEntry.Reference = "Seismic design rategory"; SdsEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Seismic/SeismicSDC_02S.docx"; SdsEntry.FormulaID = "Table 11.6-1"; //reference to formula from code SdsEntry.VariableValue = CategorySDS.ToString(); #endregion this.AddToLog(SdsEntry); return CategorySDS;
public data.SeismicDesignCategory GetSeismicDesignCategory(BuildingRiskCategory RiskCategory,double SDS, double SD1, double S1 ) { data.SeismicDesignCategory SDC, CategoryS1, CategorySDS, CategorySD1; CategorySDS = Get02secSeismicDesignCategory(SDS, RiskCategory); CategorySD1 = Get1secSeismicDesignCategory(SD1, RiskCategory); if (S1 >= 0.75) { if (RiskCategory == BuildingRiskCategory.IV) { CategoryS1 = data.SeismicDesignCategory.F; } else { CategoryS1 = data.SeismicDesignCategory.E; } //High-seismic design category SDC = CategoryS1; } else { if ((int)CategorySDS >= (int)CategorySD1) { SDC = CategorySDS; } else { SDC = CategorySD1; } } return SDC; }
public double GetImportanceFactor(BuildingRiskCategory RiskCategory) { double Ii = 1.0; switch (RiskCategory) { case BuildingRiskCategory.I: Ii = 0.8; break; case BuildingRiskCategory.II: Ii = 1.0; break; case BuildingRiskCategory.III: Ii = 1.25; break; case BuildingRiskCategory.IV: Ii = 1.25; break; } #region Ii ICalcLogEntry IiEntry = new CalcLogEntry(); IiEntry.ValueName = "Ii"; IiEntry.AddDependencyValue("RiskCategory", RiskCategory.ToString()); IiEntry.Reference = ""; IiEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Ice/IceImportanceFactor.docx"; IiEntry.FormulaID = null; //reference to formula from code IiEntry.VariableValue = Math.Round(Ii, 3).ToString(); #endregion this.AddToLog(IiEntry); return(Ii); }
public double GetImportanceFactor(BuildingRiskCategory RiskCategory) { double Ie = 1.0; switch (RiskCategory) { case BuildingRiskCategory.I: Ie = 1.0; break; case BuildingRiskCategory.II: Ie = 1.0; break; case BuildingRiskCategory.III: Ie = 1.25; break; case BuildingRiskCategory.IV: Ie = 1.5; break; } #region Ie ICalcLogEntry IeEntry = new CalcLogEntry(); IeEntry.ValueName = "Ie"; IeEntry.AddDependencyValue("RiskCategory", RiskCategory.ToString()); IeEntry.Reference = ""; IeEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Seismic/SeismicImportanceFactorIe.docx"; IeEntry.FormulaID = "Table 1.5-2"; //reference to formula from code IeEntry.VariableValue = Ie.ToString(); #endregion this.AddToLog(IeEntry); return(Ie); }
public double GetWindSpeed(string ZoneId, BuildingRiskCategory RiskCategory, bool IsSpecialWindRegion) { double v = 0; string filename = null; string Figure = null; if (ZoneId == "0") { return -1; //error zone not found } else { #region Read Zone Data var SampleValue = new { ZoneId = "", LoadData = "" }; // sample var WindZoneList = ListFactory.MakeList(SampleValue); using (StringReader reader = new StringReader(Resources.ASCE7_10F26_5_1WindZones)) { string line; while ((line = reader.ReadLine()) != null) { string[] Vals = line.Split(','); if (Vals.Count() == 2) { string zone = (string)Vals[0]; string load = (string)Vals[1]; WindZoneList.Add(new { ZoneId = zone, LoadData = load }); } } } #endregion switch (RiskCategory) { case BuildingRiskCategory.I: filename = "ASCE7_10WindEastCategoryI.txt"; Figure = "26.5-1C"; break; case BuildingRiskCategory.II: filename = "ASCE7_10WindEastCategoryII.txt"; Figure = "26.5-1A"; break; case BuildingRiskCategory.III: filename = "ASCE7_10WindEastCategoryIIIandIV.txt"; Figure = "26.5-1B"; break; case BuildingRiskCategory.IV: filename = "ASCE7_10WindEastCategoryIIIandIV.txt"; Figure = "26.5-1B"; break; } string loadStr = WindZoneList.First(z => z.ZoneId == ZoneId).LoadData.ToString(); if (loadStr != "VAR") { v = double.Parse(loadStr, CultureInfo.InvariantCulture); } else { if (filename != null) { WindDataPoint wdp = FindClosestDataPoint(filename, Latitude, Longitude); v = Math.Ceiling(wdp.WindSpeed); } else { v = -1; } } } //Add CalcLogEntry #region v ICalcLogEntry vEntry = new CalcLogEntry(); vEntry.ValueName = "v"; vEntry.AddDependencyValue("Latitude", Math.Round(Latitude, 3)); vEntry.AddDependencyValue("Longitude", Math.Round(Longitude, 3)); //vEntry.AddDependencyValue("County", County); vEntry.AddDependencyValue("Figure", Figure); vEntry.AddDependencyValue("RiskCategory", RiskCategory.ToString()); vEntry.Reference = ""; if (County != null) { vEntry.AddDependencyValue("County", County); if (IsSpecialWindRegion==true) { vEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Wind/WindSpeedSWR.docx"; } else { vEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Wind/WindSpeed.docx"; } } else { if (IsSpecialWindRegion == true) { vEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Wind/WindSpeedNoCountySWR.docx"; } else { vEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Wind/WindSpeedNoCounty.docx"; } } vEntry.FormulaID = null; //reference to formula from code vEntry.VariableValue = Math.Round(v, 1).ToString(); #endregion this.AddToLog(vEntry); return v; }
public double GetWindSpeed(string ZoneId, BuildingRiskCategory RiskCategory, bool IsSpecialWindRegion) { double v = 0; string filename = null; string Figure = null; if (ZoneId == "0") { return(-1); //error zone not found } else { #region Read Zone Data var SampleValue = new { ZoneId = "", LoadData = "" }; // sample var WindZoneList = ListFactory.MakeList(SampleValue); using (StringReader reader = new StringReader(Resources.ASCE7_10F26_5_1WindZones)) { string line; while ((line = reader.ReadLine()) != null) { string[] Vals = line.Split(','); if (Vals.Count() == 2) { string zone = (string)Vals[0]; string load = (string)Vals[1]; WindZoneList.Add(new { ZoneId = zone, LoadData = load }); } } } #endregion switch (RiskCategory) { case BuildingRiskCategory.I: filename = "ASCE7_10WindEastCategoryI.txt"; Figure = "26.5-1C"; break; case BuildingRiskCategory.II: filename = "ASCE7_10WindEastCategoryII.txt"; Figure = "26.5-1A"; break; case BuildingRiskCategory.III: filename = "ASCE7_10WindEastCategoryIIIandIV.txt"; Figure = "26.5-1B"; break; case BuildingRiskCategory.IV: filename = "ASCE7_10WindEastCategoryIIIandIV.txt"; Figure = "26.5-1B"; break; } string loadStr = WindZoneList.First(z => z.ZoneId == ZoneId).LoadData.ToString(); if (loadStr != "VAR") { v = double.Parse(loadStr, CultureInfo.InvariantCulture); } else { if (filename != null) { WindDataPoint wdp = FindClosestDataPoint(filename, Latitude, Longitude); v = Math.Ceiling(wdp.WindSpeed); } else { v = -1; } } } //Add CalcLogEntry #region v ICalcLogEntry vEntry = new CalcLogEntry(); vEntry.ValueName = "v"; vEntry.AddDependencyValue("Latitude", Math.Round(Latitude, 3)); vEntry.AddDependencyValue("Longitude", Math.Round(Longitude, 3)); //vEntry.AddDependencyValue("County", County); vEntry.AddDependencyValue("Figure", Figure); vEntry.AddDependencyValue("RiskCategory", RiskCategory.ToString()); vEntry.Reference = ""; if (County != null) { vEntry.AddDependencyValue("County", County); if (IsSpecialWindRegion == true) { vEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Wind/WindSpeedSWR.docx"; } else { vEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Wind/WindSpeed.docx"; } } else { if (IsSpecialWindRegion == true) { vEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Wind/WindSpeedNoCountySWR.docx"; } else { vEntry.DescriptionReference = "/Templates/Loads/ASCE7_10/Wind/WindSpeedNoCounty.docx"; } } vEntry.FormulaID = null; //reference to formula from code vEntry.VariableValue = Math.Round(v, 1).ToString(); #endregion this.AddToLog(vEntry); return(v); }