design-category-factory
Factory for computing seismic design category values based on a ground motion and risk category.
This will work in much the same way as the SiteAmplificationFactory except it will use "risk category" instead of "site class".
Abstract a "lookup-data" factory from which both site-amplification-factory and design-category-factory can extend. Update site-amplification-factory to extend this new abstract class.
Here is some helpful code (Java)
protected static class Default implements Impl {
protected static final double[] sdsThresholds = {0, 0.167, 0.33, 0.50};
protected static final char[][] sdsMap = {
{'A', 'B', 'C', 'D'},
{'A', 'B', 'C', 'D'},
{'A', 'B', 'C', 'D'},
{'A', 'C', 'D', 'D'},
};
protected static final double[] sd1Thresholds = {0, 0.067, 0.133, 0.20};
protected static final char[][] sd1Map = {
{'A', 'B', 'C', 'D'},
{'A', 'B', 'C', 'D'},
{'A', 'B', 'C', 'D'},
{'A', 'C', 'D', 'D'},
};
public char calculateDesignCategory(String riskCategory, double s1, double sds, double sd1) {
if (riskCategory.equals("N")) return 'N';
if ((riskCategory.equals(RISK_CATEGORY_I) ||
riskCategory.equals(RISK_CATEGORY_II) ||
riskCategory.equals(RISK_CATEGORY_III)) &&
s1 >= 0.75) {
return 'E';
} else if (riskCategory.equals(RISK_CATEGORY_IV) &&
s1 >= 0.75) {
return 'F';
} else {
char sdsCategory = calcCategoryFromMap(riskCategory, sdsMap, sdsThresholds, sds);
char sd1Category = calcCategoryFromMap(riskCategory, sd1Map, sd1Thresholds, sd1);
return sdsCategory > sd1Category ? sdsCategory : sd1Category;
}
}
}