/// <summary> /// Executes the command. /// Gets the Load Case properties from the User, adds it to the Model and sets it as Active. /// </summary> /// <param name="services">CommandServices object to interact with the system</param> public override void Run(Canguro.Controller.CommandServices services) { string name = Culture.Get("defaultLoadCase"); LoadCase lCase = new LoadCase(name, LoadCase.LoadCaseType.Dead); lCase.Name = name; // services.GetProperties(lCase.Name, lCase, false); EditLoadCaseDialog dlg = new EditLoadCaseDialog(lCase); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (!services.Model.LoadCases.ContainsKey(lCase.Name)) { services.Model.LoadCases.Add(lCase.Name, lCase); } services.Model.ActiveLoadCase = lCase; AnalysisCase aCase = new AnalysisCase(lCase.Name); StaticCaseProps props = aCase.Properties as StaticCaseProps; if (props != null) { List <StaticCaseFactor> list = props.Loads; list.Add(new StaticCaseFactor(lCase)); props.Loads = list; services.Model.AbstractCases.Add(aCase); } } else { services.Model.Undo.Rollback(); } }
/// <summary> /// Executes the command. /// Gets the parameters and creates the analysis case. /// </summary> /// <param name="services">CommandServices object to interact with the system</param> public override void Run(Canguro.Controller.CommandServices services) { string name = Culture.Get("defaultAnalysisCaseName"); Canguro.Model.Model model = services.Model; StaticCaseProps props = new StaticCaseProps(); AnalysisCase aCase = new AnalysisCase(name, props); services.GetProperties(aCase.Name, aCase, false); model.AbstractCases.Add(aCase); }
private void store(OleDbConnection cn, AnalysisCase obj) { AnalysisCaseProps props = obj.Properties; string sql; if (props is ResponseSpectrumCaseProps) { ResponseSpectrumCaseProps rProps = props as ResponseSpectrumCaseProps; sql = "INSERT INTO [Analysis Case Definitions] " + "([Case], Type, ModalCase, RunCase) VALUES " + "(\"" + obj.Name + "\", \"LinRespSpec\", \"" + rProps.ModalAnalysisCase + "\", \"Yes\");"; } else { string type = (props is ModalCaseProps) ? "LinModal" : "LinStatic"; sql = "INSERT INTO [Analysis Case Definitions] " + "([Case], Type, InitialCond, RunCase) VALUES " + "(\"" + obj.Name + "\",\"" + type + "\",\"Zero\",\"Yes\");"; } 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\", \"AnalysisCase\", \"" + obj.Name + "\");"; new OleDbCommand(sql, cn).ExecuteNonQuery(); if (props is StaticCaseProps) { store(cn, obj.Name, (StaticCaseProps)props); } else if (props is ModalCaseProps) { store(cn, obj.Name, (ModalCaseProps)props); } else if (props is ResponseSpectrumCaseProps) { store(cn, obj.Name, (ResponseSpectrumCaseProps)props); } //else if (props is MultistepStaticCaseProps) // store(cn, obj.Name, (MultistepStaticCaseProps)props); //else if (props is TimeHistoryCaseProps) // store(cn, obj.Name, (TimeHistoryCaseProps)props); //else if (props is MovingLoadCaseProps) // store(cn, obj.Name, (MovingLoadCaseProps)props); //else if (props is BucklingCaseProps) // store(cn, obj.Name, (BucklingCaseProps)props); //else if (props is SteadyStateCaseProps) // store(cn, obj.Name, (SteadyStateCaseProps)props); //else if (props is PowerSpectalDensityCaseProps) // store(cn, obj.Name, (PowerSpectalDensityCaseProps)props); }
/// <summary> /// Builds an adjacencyList of dependant abstract cases, so that each entry has its dependant cases in its list /// </summary> /// <returns>The adjacency list</returns> public Dictionary <AbstractCase, LinkedList <AbstractCase> > BuildAnalysisCaseAdjacency() { Dictionary <AbstractCase, LinkedList <AbstractCase> > adjancencyList = new Dictionary <AbstractCase, LinkedList <AbstractCase> >(); AnalysisCase aCase = null; LoadCombination combo = null; foreach (AbstractCase ac in abstractCases) { if ((aCase = ac as AnalysisCase) != null) { if (aCase.Properties.DependsOn == null) { if (!adjancencyList.ContainsKey(aCase)) { adjancencyList.Add(aCase, new LinkedList <AbstractCase>()); } } else if (adjancencyList.ContainsKey(aCase.Properties.DependsOn)) { adjancencyList[aCase.Properties.DependsOn].AddLast(aCase); } else { adjancencyList.Add(aCase.Properties.DependsOn, new LinkedList <AbstractCase>()); adjancencyList[aCase.Properties.DependsOn].AddLast(aCase); } } else if ((combo = ac as LoadCombination) != null) { foreach (AbstractCaseFactor acf in combo.Cases) { if (adjancencyList.ContainsKey(acf.Case)) { adjancencyList[acf.Case].AddLast(combo); } else { adjancencyList.Add(acf.Case, new LinkedList <AbstractCase>()); adjancencyList[acf.Case].AddLast(combo); } } } } return(adjancencyList); }
private void responseSpectrumCheckBox_CheckedChanged(object sender, EventArgs e) { AnalysisCase modalCase = null; List <AnalysisCase> responseCases = new List <AnalysisCase>(); foreach (AbstractCase ac in model.AbstractCases) { if (ac is AnalysisCase && ((AnalysisCase)ac).Properties is ResponseSpectrumCaseProps) { responseCases.Add((AnalysisCase)ac); } else if (ac is AnalysisCase && ((AnalysisCase)ac).Properties is ModalCaseProps) { modalCase = (AnalysisCase)ac; } } if (modalCase == null) { modalCase = new AnalysisCase(Culture.Get("defaultModalCase"), new ModalCaseProps()); model.AbstractCases.Add(modalCase); } if (modalCase != null) { if (responseCases.Count == 0 && responseSpectrumCheckBox.Checked && model.ResponseSpectra.Count > 0) { ResponseSpectrumCaseProps props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UX); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " X", props)); model.AbstractCases.Add(responseCases[0]); props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UY); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " Y", props)); model.AbstractCases.Add(responseCases[1]); props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UZ); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " Z", props)); model.AbstractCases.Add(responseCases[2]); } foreach (AbstractCase responseCase in responseCases) { responseCase.IsActive = responseSpectrumCheckBox.Checked; } } }
private void modalAnalysisCheckBox_CheckedChanged(object sender, EventArgs e) { if (!updatingDialog) { if (modalCase == null && modalAnalysisCheckBox.Checked) { modalCase = new AnalysisCase(Culture.Get("defaultModalCase"), new ModalCaseProps()); services.Model.AbstractCases.Add(modalCase); } if (modalCase != null) { modalCase.IsActive = modalAnalysisCheckBox.Checked; Canguro.Model.Model.Instance.RepairAbstractCases(modalCase); } UpdateDialog(); } }
private void pDeltaCheckBox_CheckedChanged(object sender, EventArgs e) { if (!updatingDialog) { if (pDeltaCase == null && pDeltaCheckBox.Checked) { PDeltaCaseProps props = new PDeltaCaseProps(); pDeltaCase = new AnalysisCase(Culture.Get("defaultPDeltaCase"), props); services.Model.AbstractCases.Add(pDeltaCase); } if (pDeltaCase != null) { pDeltaCase.IsActive = pDeltaCheckBox.Checked; Canguro.Model.Model.Instance.RepairAbstractCases(pDeltaCase); } UpdateDialog(); } }
private void responseSpectrumCheckBox_CheckedChanged(object sender, EventArgs e) { if (!updatingDialog) { if (responseCases.Count == 0 && responseSpectrumCheckBox.Checked && services.Model.ResponseSpectra.Count > 0) { if (modalCase == null) { modalCase = new AnalysisCase(Culture.Get("defaultModalCase"), new ModalCaseProps()); services.Model.AbstractCases.Add(modalCase); } ResponseSpectrumCaseProps props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UX); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " X", props)); responseCases[0].IsActive = false; services.Model.AbstractCases.Add(responseCases[0]); props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UY); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " Y", props)); services.Model.AbstractCases.Add(responseCases[1]); props = new ResponseSpectrumCaseProps(AccelLoad.AccelLoadValues.UZ); props.ModalAnalysisCase = modalCase; responseCases.Add(new AnalysisCase(Culture.Get("defaultResponseCase") + " Z", props)); services.Model.AbstractCases.Add(responseCases[2]); } foreach (AbstractCase responseCase in responseCases) { responseCase.IsActive = responseSpectrumCheckBox.Checked; Canguro.Model.Model.Instance.RepairAbstractCases(responseCase); } UpdateDialog(); } }
public void UpdateModel() { ResetModel(); // Dimensions float wi = mParent.SectionProperties.InnerWidth; float hi = mParent.SectionProperties.InnerHeight; float tw = mParent.SectionProperties.OuterWallThickness; float tf = mParent.SectionProperties.FoundationThickness; float ts = mParent.SectionProperties.SlabThickness; int iw = mParent.SectionProperties.InnerWalls; float twi = mParent.SectionProperties.InnerWallThickness; bool gusset = mParent.SectionProperties.HasSlabGussets; float gw = mParent.SectionProperties.SlabGussetWidth; float gh = mParent.SectionProperties.SlabGussetHeight; float wo = mParent.SectionProperties.OuterWidth - tw; float ho = hi + tf / 2 + ts / 2; // Concrete material Material mat = AddMaterial("Concrete", 3000000, 0.2, 25); // Sections FrameSection outerWallSection = AddFrameSection("Outer Wall", mat, 1.0 * tw, 1.0 * tw * tw * tw / 12.0); FrameSection innerWallSection = AddFrameSection("Inner Wall", mat, 1.0 * twi, 1.0 * twi * twi * twi / 12.0); FrameSection slabSection = AddFrameSection("Slab", mat, 1.0 * ts, 1.0 * ts * ts * ts / 12.0); FrameSection foundationSection = AddFrameSection("Foundation", mat, 1.0 * tf, 1.0 * tf * tf * tf / 12.0); // Build model Node n1; Node n2; Frame f; double dx; // Foundation slab n1 = AddNode(-wo / 2, 0); n2 = AddNode(-wo / 2 + tw / 2, 0); Node lowerLeft = n1; f = AddFrame(foundationSection, n1, n2); dx = -wo / 2 + tw / 2 + wi; for (int i = 0; i < iw + 1; i++) { n1 = n2; n2 = AddNode(dx, 0); f = AddFrame(foundationSection, n1, n2); if (i < iw) { n1 = n2; n2 = AddNode(dx + twi / 2, 0); f = AddFrame(foundationSection, n1, n2); n1 = n2; n2 = AddNode(dx + twi, 0); f = AddFrame(foundationSection, n1, n2); } dx += wi + twi; } n1 = n2; n2 = AddNode(wo / 2, 0); f = AddFrame(foundationSection, n1, n2); Node lowerRight = n2; // Create a mid point (for support) if it does not exist if (Nodes.Count % 2 == 0) { DivideFrame(Frames[(Frames.Count - 1) / 2], 2); } SortNodes(); Node lowerMid = Nodes[(Nodes.Count - 1) / 2]; // Top slab n1 = AddNode(-wo / 2, ho); n2 = AddNode(-wo / 2 + tw / 2, ho); f = AddFrame(slabSection, n1, n2); dx = -wo / 2 + tw / 2 + wi; for (int i = 0; i < iw + 1; i++) { n1 = n2; n2 = AddNode(dx, ho); f = AddFrame(slabSection, n1, n2); if (i < iw) { n1 = n2; n2 = AddNode(dx + twi / 2, ho); f = AddFrame(slabSection, n1, n2); n1 = n2; n2 = AddNode(dx + twi, ho); f = AddFrame(slabSection, n1, n2); } dx += wi + twi; } n1 = n2; n2 = AddNode(wo / 2, ho); f = AddFrame(slabSection, n1, n2); Node rackingPoint = n2; // Left wall n1 = AddNode(-wo / 2, 0); n2 = AddNode(-wo / 2, tf / 2); f = AddFrame(outerWallSection, n1, n2); n1 = n2; n2 = AddNode(-wo / 2, tf / 2 + hi); f = AddFrame(outerWallSection, n1, n2); n1 = n2; n2 = AddNode(-wo / 2, ho); f = AddFrame(outerWallSection, n1, n2); // Right wall n1 = AddNode(wo / 2, 0); n2 = AddNode(wo / 2, tf / 2); f = AddFrame(outerWallSection, n1, n2); n1 = n2; n2 = AddNode(wo / 2, tf / 2 + hi); f = AddFrame(outerWallSection, n1, n2); n1 = n2; n2 = AddNode(wo / 2, ho); f = AddFrame(outerWallSection, n1, n2); // Inner walls dx = -wo / 2 + tw / 2 + wi + twi / 2; for (int i = 0; i < iw; i++) { n1 = AddNode(dx, 0); n2 = AddNode(dx, tf / 2); f = AddFrame(innerWallSection, n1, n2); n1 = n2; n2 = AddNode(dx, tf / 2 + hi); f = AddFrame(innerWallSection, n1, n2); n1 = n2; n2 = AddNode(dx, ho); f = AddFrame(innerWallSection, n1, n2); dx += wi + twi; } // Divide frames DivideFrames(0.5); // Springs double springSize = 0.1; Dictionary <Node, double> slabNodeDict = new Dictionary <Node, double>(); foreach (Frame frame in Frames.FindAll((e) => e.Section == foundationSection)) { double springCoefficient = frame.Length / 2.0 * mParent.SoilParameters.BeddingCoefficient; if (slabNodeDict.ContainsKey(frame.NodeI)) { slabNodeDict[frame.NodeI] += springCoefficient; } else { slabNodeDict.Add(frame.NodeI, springCoefficient); } if (slabNodeDict.ContainsKey(frame.NodeJ)) { slabNodeDict[frame.NodeJ] += springCoefficient; } else { slabNodeDict.Add(frame.NodeJ, springCoefficient); } } foreach (KeyValuePair <Node, double> pair in slabNodeDict) { double springCoefficient = pair.Value; Node upperNode = pair.Key; Node lowerNode = AddNode(upperNode.X, upperNode.Z - springSize); lowerNode.Restraints = DOF.Fixed; AddSpring(springCoefficient, springCoefficient, 0, lowerNode, upperNode); } // Clean up close nodes MergeNodes(0.01); // Sort according to coordinates SortNodes(); SortFrames(); SortSprings(); // Analysis cases AnalysisCase deadLoad = AddAnalysisCase("Self Weight"); AnalysisCase fillLoad = AddAnalysisCase("Earth Fill"); AnalysisCase pressureLoad = AddAnalysisCase("Soil Pressure"); AnalysisCase surchargeLoad = AddAnalysisCase("Surcharge"); AnalysisCase racking1 = AddAnalysisCase("Racking (+)"); AnalysisCase racking2 = AddAnalysisCase("Racking (-)"); // Loads // Self weight foreach (Frame frame in Frames) { AddFrameSelfWeight(deadLoad, frame); } // Fill load foreach (Frame frame in Frames.FindAll((e) => e.Section == slabSection)) { AddFrameUniformLoad(fillLoad, frame, 0, -mParent.SoilParameters.FillLoad); } // Soil pressure foreach (Frame frame in Frames.FindAll((e) => e.Section == outerWallSection)) { double zi = frame.NodeI.Z; double zj = frame.NodeJ.Z; double pmin = mParent.SoilParameters.SoilPressureTop; double pmax = mParent.SoilParameters.SoilPressureBottom; double pi = (ho - zi) / ho * (pmax - pmin) + pmin; double pj = (ho - zj) / ho * (pmax - pmin) + pmin; if (frame.NodeI.X < 0) { AddFrameTrapezoidalLoad(pressureLoad, frame, pi, 0, pj, 0); } else { AddFrameTrapezoidalLoad(pressureLoad, frame, -pi, 0, -pj, 0); } } // Surcharge foreach (Frame frame in Frames.FindAll((e) => e.Section == outerWallSection)) { if (frame.NodeI.X < 0) { AddFrameUniformLoad(surchargeLoad, frame, mParent.SoilParameters.SurchargeLoad, 0); } else { AddFrameUniformLoad(surchargeLoad, frame, -mParent.SoilParameters.SurchargeLoad, 0); } } // Solve racking // Temporary supports lowerLeft.Restraints = DOF.Pinned; lowerRight.Restraints = DOF.Pinned; // Solve under unit load AddNodePointLoad(racking1, rackingPoint, 1, 0, 0); BuildStiffnessMatrix(); Run(racking1); // Calculate actual load to create racking deformation double deformationForUnitLoad = racking1.NodeDeformations[rackingPoint.Index].UX; double rackingPointLoad = mParent.SoilParameters.FreeFieldDeformation / deformationForUnitLoad; rackingPoint.Loads.Clear(); AddNodePointLoad(racking1, rackingPoint, rackingPointLoad, 0, 0); AddNodePointLoad(racking2, rackingPoint, -rackingPointLoad, 0, 0); // Run racking Run(racking1); Run(racking2); // Remove temporary supports lowerLeft.Restraints = DOF.Free; lowerRight.Restraints = DOF.Free; // Solve service loads BuildStiffnessMatrix(); Run(deadLoad); Run(fillLoad); Run(pressureLoad); Run(surchargeLoad); // Combinations // Service Combination service = AddLinearCombination("Service"); service.SetCoefficient(1, deadLoad); service.SetCoefficient(1, fillLoad); service.SetCoefficient(1, pressureLoad); service.SetCoefficient(1, surchargeLoad); service.Update(); // Factored 1 Combination factored1 = AddLinearCombination("Factored 1"); factored1.SetCoefficient(1.3, deadLoad); factored1.SetCoefficient(1.3, fillLoad); factored1.SetCoefficient(1.3, pressureLoad); factored1.SetCoefficient(1.3, surchargeLoad); factored1.Update(); // Factored 2 Combination factored2 = AddLinearCombination("Factored 2"); factored2.SetCoefficient(1.3, deadLoad); factored2.SetCoefficient(1.3, fillLoad); factored2.SetCoefficient(0.65, pressureLoad); factored2.SetCoefficient(0.65, surchargeLoad); factored2.Update(); // Racking Combination racking = AddEnvelopeCombination("Racking"); racking.SetCoefficient(1, racking1); racking.SetCoefficient(1, racking2); racking.Update(); // Seismic Combination seismic = AddLinearCombination("Seismic"); seismic.SetCoefficient(1, deadLoad); seismic.SetCoefficient(1, fillLoad); seismic.SetCoefficient(1, pressureLoad); seismic.SetCoefficient(1, racking); seismic.Update(); // Envelope Combination envelope = AddEnvelopeCombination("Envelope"); envelope.SetCoefficient(1, service); envelope.SetCoefficient(1, factored1); envelope.SetCoefficient(1, factored2); envelope.SetCoefficient(1, seismic); envelope.Update(); }
public void Init() { try { updatingDialog = true; Canguro.Model.Model model = services.Model; int responseSpectrumCases = 0; foreach (AbstractCase aCase in model.AbstractCases) { if (aCase is AnalysisCase && ((AnalysisCase)aCase).Properties is ModalCaseProps) { modalCase = (AnalysisCase)aCase; modalAnalysisCheckBox.Checked = aCase.IsActive; } else if (aCase is AnalysisCase && ((AnalysisCase)aCase).Properties is PDeltaCaseProps) { pDeltaCase = (AnalysisCase)aCase; pDeltaCheckBox.Checked = aCase.IsActive; } else if (aCase is AnalysisCase && ((AnalysisCase)aCase).Properties is ResponseSpectrumCaseProps) { responseCases.Add((AnalysisCase)aCase); if (aCase.IsActive) { responseSpectrumCases++; } switch (responseSpectrumCases) { case 1: case 2: responseSpectrumCheckBox.CheckState = CheckState.Indeterminate; break; case 3: responseSpectrumCheckBox.CheckState = CheckState.Checked; break; default: responseSpectrumCheckBox.CheckState = CheckState.Unchecked; break; } } } responseSpectrumFunctionsComboBox.Items.Clear(); foreach (ResponseSpectrum rs in model.ResponseSpectra) { responseSpectrumFunctionsComboBox.Items.Add(rs); } steelDesignComboBox.Items.Add(NoDesign.Instance); concreteDesignComboBox.Items.Add(NoDesign.Instance); foreach (DesignOptions option in model.DesignOptions) { if (option is SteelDesignOptions) { steelDesignComboBox.Items.Add(option); } else if (option is ConcreteDesignOptions) { concreteDesignComboBox.Items.Add(option); } } steelDesignComboBox.SelectedItem = model.SteelDesignOptions; concreteDesignComboBox.SelectedItem = model.ConcreteDesignOptions; bool steelActive = false; bool concreteActive = false; foreach (Canguro.Model.LineElement e in model.LineList) { if (e != null && e.Properties is Canguro.Model.StraightFrameProps && ((Canguro.Model.StraightFrameProps)e.Properties).Section.Material.DesignProperties is Canguro.Model.Material.SteelDesignProps) { steelActive = true; } else if (e != null && e.Properties is Canguro.Model.StraightFrameProps && ((Canguro.Model.StraightFrameProps)e.Properties).Section.Material.DesignProperties is Canguro.Model.Material.ConcreteDesignProps) { concreteActive = true; } } steelDesignComboBox.Enabled = steelActive; concreteDesignComboBox.Enabled = concreteActive; } finally { updatingDialog = false; } this.Width = NormalWidth; }