Inheritance: AbstractCase
Exemplo n.º 1
0
 private string GetComboType(LoadCombination.CombinationType comboType)
 {
     switch (comboType)
     {
         case LoadCombination.CombinationType.AbsoluteAdd: return "Abs Add";
         case LoadCombination.CombinationType.Envelope: return "Envelope";
         case LoadCombination.CombinationType.SRSS: return "SRSS";
         default: return "Linear Add";
     }
 }
Exemplo n.º 2
0
        private void readLoadCombinationCase(XmlNode node)
        {
            string name = readAttribute(node, "ComboName", "");
            name = (name.Length > 0) ? name : Culture.Get("Case");
            string type = readAttribute(node, "ComboType", "");
            string caseType = readAttribute(node, "CaseType", "Response Spectrum");
            string caseName = readAttribute(node, "CaseName", "");
            string factor = readAttribute(node, "ScaleFactor", "0");
            bool steel = readAttribute(node, "SteelDesign", "No").Equals("Yes");
            bool conc = readAttribute(node, "ConcDesign", "No").Equals("Yes");
            bool alum = readAttribute(node, "AlumDesign", "No").Equals("Yes");
            bool cold = readAttribute(node, "ColdDesign", "No").Equals("Yes");

            LoadCombination combo = null;
            AbstractCase aCase = null;
            foreach (AbstractCase ac in model.AbstractCases)
            {
                if (ac.Name.Equals(name) && ac is LoadCombination)
                    combo = (LoadCombination)ac;
                else if (ac.Name.Equals(caseName))
                    aCase = ac;
            }
            if (combo == null)
            {
                combo = new LoadCombination(name);
                model.AbstractCases.Add(combo);
            }
            if (aCase != null)
                combo.Cases.Add(new AbstractCaseFactor(aCase, float.Parse(factor)));

            if (steel && !model.SteelDesignOptions.DesignCombinations.Contains(combo))
                model.SteelDesignOptions.DesignCombinations.Add(combo);
            if (conc && !model.ConcreteDesignOptions.DesignCombinations.Contains(combo))
                model.ConcreteDesignOptions.DesignCombinations.Add(combo);
            if (alum && !model.AluminumDesignOptions.DesignCombinations.Contains(combo))
                model.AluminumDesignOptions.DesignCombinations.Add(combo);
            if (cold && !model.ColdFormedDesignOptions.DesignCombinations.Contains(combo))
                model.ColdFormedDesignOptions.DesignCombinations.Add(combo);
        }
Exemplo n.º 3
0
        private void writeLoadCombinationCase(XmlTextWriter xml, LoadCombination obj, Canguro.Model.Model m)
        {
            IList<AbstractCaseFactor> list = obj.Cases;

            string steel = CodeYN(m.SteelDesignOptions.DesignCombinations.Contains(obj));
            string concrete = CodeYN(m.ConcreteDesignOptions.DesignCombinations.Contains(obj));
            string alum = CodeYN(m.AluminumDesignOptions.DesignCombinations.Contains(obj));
            string cold = CodeYN(m.ColdFormedDesignOptions.DesignCombinations.Contains(obj));
            string comboType = GetComboType(obj.Type);
            foreach (AbstractCaseFactor f in list) {
                AbstractCase aCase = f.Case as AbstractCase;
                if (aCase != null) { // && aCase.IsActive)
                    if (aCase is LoadCombination) {
                        xml.WriteStartElement("Combo");
                        xml.WriteAttributeString("ComboName", obj.Name);
                        xml.WriteAttributeString("ComboType", " ");
                        xml.WriteAttributeString("CaseType", "Combo");
                        xml.WriteAttributeString("CaseName", aCase.Name);
                        xml.WriteAttributeString("ScaleFactor", f.Factor.ToString());
                        xml.WriteAttributeString("SteelDesign", steel.ToString());
                        xml.WriteAttributeString("ConcDesign", concrete.ToString());
                        xml.WriteAttributeString("AlumDesign", alum.ToString());
                        xml.WriteAttributeString("ColdDesign", cold.ToString());
                        xml.WriteEndElement();
                    } else if (aCase is AnalysisCase) {
                        AnalysisCaseProps props = ((AnalysisCase)aCase).Properties;
                        if (props is StaticCaseProps) {
                            //StaticCaseProps sprops = (StaticCaseProps)props;
                            xml.WriteStartElement("Combo");
                            xml.WriteAttributeString("ComboName", obj.Name);
                            xml.WriteAttributeString("ComboType", comboType.ToString());
                            xml.WriteAttributeString("CaseType", "Linear Static");
                            xml.WriteAttributeString("CaseName", aCase.Name);
                            xml.WriteAttributeString("ScaleFactor", f.Factor.ToString());
                            xml.WriteAttributeString("SteelDesign", steel.ToString());
                            xml.WriteAttributeString("ConcDesign", concrete.ToString());
                            xml.WriteAttributeString("AlumDesign", alum.ToString());
                            xml.WriteAttributeString("ColdDesign", cold.ToString());
                            xml.WriteEndElement();
                        } else if (props is ResponseSpectrumCaseProps) {
                            xml.WriteStartElement("Combo");
                            xml.WriteAttributeString("ComboName", obj.Name);
                            xml.WriteAttributeString("ComboType", comboType.ToString());
                            xml.WriteAttributeString("CaseType", "Response Spectrum");
                            xml.WriteAttributeString("CaseName", aCase.Name);
                            xml.WriteAttributeString("ScaleFactor", f.Factor.ToString());
                            xml.WriteAttributeString("SteelDesign", steel.ToString());
                            xml.WriteAttributeString("ConcDesign", concrete.ToString());
                            xml.WriteAttributeString("AlumDesign", alum.ToString());
                            xml.WriteAttributeString("ColdDesign", cold.ToString());
                            xml.WriteEndElement();
                        }
                        //steel = concrete = alum = cold = "\"\"";
                    }
                }
            }
        }
Exemplo n.º 4
0
 private void writeNamedSets2(XmlTextWriter xml, LoadCombination aCase)
 {
     xml.WriteStartElement("DBNamedSet");
     xml.WriteAttributeString("DBNamedSet", "RESULTS");
     xml.WriteAttributeString("SelectType", "Combo");
     xml.WriteAttributeString("Selection", aCase.Name);
     xml.WriteEndElement();
 }
Exemplo n.º 5
0
        private void store(OleDbConnection cn, LoadCombination obj, Canguro.Model.Model model)
        {
            List<AbstractCaseFactor> list = obj.Cases;

            string sql = "";
            string steel = CodeYN(model.SteelDesignOptions.DesignCombinations.Contains(obj));
            string concrete = CodeYN(model.ConcreteDesignOptions.DesignCombinations.Contains(obj));
            string alum = CodeYN(model.AluminumDesignOptions.DesignCombinations.Contains(obj));
            string cold = CodeYN(model.ColdFormedDesignOptions.DesignCombinations.Contains(obj));
            string comboType = GetComboType(obj.Type);
            foreach (AbstractCaseFactor f in list)
            {
                AbstractCase aCase = f.Case as AbstractCase;
                sql = "";
                if (aCase != null) // && aCase.IsActive)
                {
                    if (aCase is LoadCombination)
                        sql = "INSERT INTO [Combination Definitions] " +
                            "(ComboName,ComboType,CaseType,CaseName,ScaleFactor,SteelDesign,ConcDesign,AlumDesign,ColdDesign) VALUES " +
                            "(\"" + obj.Name + "\",\"\",\"Combo\",\"" + aCase.Name + "\"," + f.Factor + "," + steel + "," + concrete + "," + alum + "," + cold + ");";
                    else if (aCase is AnalysisCase)
                    {
                        AnalysisCaseProps props = ((AnalysisCase)aCase).Properties;
                        if (props is StaticCaseProps)
                        {
                            // StaticCaseProps sprops = (StaticCaseProps)props;
                            sql = "INSERT INTO [Combination Definitions] " +
                                "(ComboName,ComboType,CaseType,CaseName,ScaleFactor,SteelDesign,ConcDesign,AlumDesign,ColdDesign) VALUES " +
                                "(\"" + obj.Name + "\",\"" + comboType + "\",\"Linear Static\",\"" + aCase.Name + "\"," + f.Factor + "," + steel + "," + concrete + "," + alum + "," + cold + ");";
                        }
                        else if (props is ResponseSpectrumCaseProps)
                        {
                            sql = "INSERT INTO [Combination Definitions] " +
                                "(ComboName,ComboType,CaseType,CaseName,ScaleFactor,SteelDesign,ConcDesign,AlumDesign,ColdDesign) VALUES " +
                                "(\"" + obj.Name + "\",\"" + comboType + "\",\"Response Spectrum\",\"" + aCase.Name + "\"," + f.Factor + "," + steel + "," + concrete + "," + alum + "," + cold + ");";
                        }
                        //steel = concrete = alum = cold = "\"\"";
                    }
                    if (sql.Length > 0)
                        new OleDbCommand(sql, cn).ExecuteNonQuery();
                }
            }

            // Insert record in RESULTS Named Set
            sql = " INSERT INTO [Named Sets - Database Tables 2 - Selections] " +
                "(DBNamedSet, SelectType, [Selection]) VALUES (\"RESULTS\", \"Combo\", \"" + obj.Name + "\");";
            new OleDbCommand(sql, cn).ExecuteNonQuery();
        }
Exemplo n.º 6
0
        protected void AddCombination(string name, LoadCase.LoadCaseType[] types, float[] factors)
        {
            foreach (AbstractCase ac in Model.Instance.AbstractCases)
                if (ac.Name.Equals(name))
                {
                    if (ac is LoadCombination)
                        designCombinations.Add((LoadCombination)ac);
                    return;
                }

            LoadCombination combo = new LoadCombination(name);
            for (int i = 0; i < types.Length; i++)
            {
                float factor = 1;
                if (factors.Length > i)
                    factor = factors[i];
                List<AbstractCaseFactor> loads = GetLoads(types[i], factors[i]);
                if (loads.Count > 0)
                    combo.Cases.AddRange(loads);
                else
                    return;
            }
            if (combo.Cases.Count > 0) designCombinations.Add(combo);
        }