private void store(OleDbConnection cn, LineElement obj) { Joint i = obj.I; Joint j = obj.J; string sql = "INSERT INTO [Connectivity - Frame] (Frame, JointI, JointJ, IsCurved, Length, CentroidX, CentroidY, CentroidZ) " + "VALUES (" + obj.Id + ", " + i.Id + ", " + j.Id + ",\"No\", " + obj.Length + ", " + (i.X + j.X) / 2.0F + ", " + (i.Y + j.Y) / 2.0F + ", " + (i.Z + j.Z) / 2.0F + ");"; new OleDbCommand(sql, cn).ExecuteNonQuery(); LineProps props = obj.Properties; List <Section> exported = new List <Section>(); if (props is StraightFrameProps) { FrameSection sec = ((StraightFrameProps)props).Section; sql = "INSERT INTO [Frame Section Assignments] (Frame, SectionType, AutoSelect, AnalSect, DesignSect, MatProp) " + "VALUES (" + obj.Id + ", \"" + secShape(sec.Shape) + "\", \"N.A.\", \"" + sec.Name + "\", \"" + sec.Name + "\", \"Default\");"; new OleDbCommand(sql, cn).ExecuteNonQuery(); store(cn, sec.ConcreteProperties, sec, exported); } AssignedLoads loads = obj.Loads; if (loads != null) { store(cn, obj.Id, loads); } }
/// <summary> /// Create tables for joint elements /// </summary> /// <param name="cn"></param> /// <param name="obj"></param> private void store(OleDbConnection cn, Joint obj) { Microsoft.DirectX.Vector3 pos = obj.Position; string sql = "INSERT INTO [Joint Coordinates](Joint, CoordSys, CoordType, XorR, Y, Z, SpecialJt, GlobalX, GlobalY, GlobalZ) " + "VALUES (" + obj.Id + ", \"GLOBAL\", \"Cartesian\", " + pos.X + ", " + pos.Y + ", " + pos.Z + ", \"Yes\", " + pos.X + ", " + pos.Y + ", " + pos.Z + ");"; new OleDbCommand(sql, cn).ExecuteNonQuery(); float[] masses = obj.Masses; if (masses != null && masses.Length >= 6) { if (masses[0] + masses[1] + masses[2] + masses[3] + masses[4] + masses[5] > float.Epsilon) { sql = "INSERT INTO [Joint Added Mass Assignments](Joint, CoordSys, Mass1, Mass2, Mass3, MMI1, MMI2, MMI3) " + "VALUES (" + obj.Id + ", \"GLOBAL\", " + masses[0] + ", " + masses[1] + ", " + masses[2] + ", " + masses[3] + ", " + masses[4] + ", " + masses[5] + ");"; new OleDbCommand(sql, cn).ExecuteNonQuery(); } } JointDOF dof = obj.DoF; if (dof != null) { store(cn, obj.Id, obj.DoF); } AssignedLoads loads = obj.Loads; if (loads != null) { store(cn, obj.Id, loads); } }
/// <summary> /// Relocates a ConcentratedSpanLoad between the line element where it is and a new adjacent line element. /// </summary> /// <param name="newLineLoads">The AssignedLoads object of the new Line Element</param> /// <param name="lc">The Load Case to which the load belongs.</param> /// <param name="x">The dividing point of the two line elements [0, 1]</param> /// <param name="load">The Load to distribute in two elements</param> /// <returns>true if the load was moved to the new Line Element (so the caller removes it). false otherwise.</returns> private static bool RelocateConcentratedLoads(AssignedLoads newLineLoads, LoadCase lc, float x, ConcentratedSpanLoad load) { if (x > load.D) { load.D = load.D / x; return(false); } else { load = (ConcentratedSpanLoad)load.Clone(); load.Id = 0; load.D = (load.D - x) / (1f - x); newLineLoads.Add(load, lc); return(true); } }
private void store(OleDbConnection cn, uint itemId, AssignedLoads obj) { Dictionary <string, LoadCase> cases = Canguro.Model.Model.Instance.LoadCases; foreach (LoadCase lCase in cases.Values) { ItemList <Canguro.Model.Load.Load> list = obj[lCase]; if (list != null) { foreach (Canguro.Model.Load.Load load in list) { if (load != null) { store(cn, itemId, lCase.Name, load); } } } } }
/// <summary> /// Distributes a DistributedSpanLoad between the line element where it is and a new adjacent line element. /// </summary> /// <param name="newLineLoads">The AssignedLoads object of the new Line Element</param> /// <param name="lc">The Load Case to which the load belongs.</param> /// <param name="x">The dividing point of the two line elements [0, 1]</param> /// <param name="load">The Load to distribute in two elements</param> /// <returns>true if the load was moved to the new Line Element (so the caller removes it). false otherwise.</returns> private static bool RelocateDistributedLoads(AssignedLoads newLineLoads, LoadCase lc, float x, DistributedSpanLoad load) { if (load.Da < x && load.Db < x) { load.Da = load.Da / x; load.Db = load.Db / x; return(false); } if (load.Da >= x && load.Db >= x) { load = (DistributedSpanLoad)load.Clone(); load.Id = 0; load.Da = (load.Da - x) / (1 - x); load.Db = (load.Db - x) / (1 - x); newLineLoads.Add(load, lc); return(true); } if (load.Da > load.Db) { float tmp = load.Db; load.Db = load.Da; load.Da = tmp; tmp = load.Lb; load.Lb = load.La; load.La = tmp; } DistributedSpanLoad nLoad = (DistributedSpanLoad)load.Clone(); nLoad.Id = 0; load.Da = load.Da / x; load.Db = 1f; load.Lb = (load.La) + (x - load.Da) * (load.Lb - load.La) / (load.Db - load.Da); nLoad.Da = 0; nLoad.Db = (nLoad.Db - x) / (1 - x); nLoad.La = load.Lb; newLineLoads.Add(nLoad, lc); return(false); }
private void store(OleDbConnection cn, uint itemId, AssignedLoads obj) { Dictionary<string, LoadCase> cases = Canguro.Model.Model.Instance.LoadCases; foreach (LoadCase lCase in cases.Values) { ItemList<Canguro.Model.Load.Load> list = obj[lCase]; if (list != null) { foreach (Canguro.Model.Load.Load load in list) { if (load != null) store(cn, itemId, lCase.Name, load); } } } }
/// <summary> /// Distributes a DistributedSpanLoad between the line element where it is and a new adjacent line element. /// </summary> /// <param name="newLineLoads">The AssignedLoads object of the new Line Element</param> /// <param name="lc">The Load Case to which the load belongs.</param> /// <param name="x">The dividing point of the two line elements [0, 1]</param> /// <param name="load">The Load to distribute in two elements</param> /// <returns>true if the load was moved to the new Line Element (so the caller removes it). false otherwise.</returns> private static bool RelocateDistributedLoads(AssignedLoads newLineLoads, LoadCase lc, float x, DistributedSpanLoad load) { if (load.Da < x && load.Db < x) { load.Da = load.Da / x; load.Db = load.Db / x; return false; } if (load.Da >= x && load.Db >= x) { load = (DistributedSpanLoad)load.Clone(); load.Id = 0; load.Da = (load.Da - x) / (1 - x); load.Db = (load.Db - x) / (1 - x); newLineLoads.Add(load, lc); return true; } if (load.Da > load.Db) { float tmp = load.Db; load.Db = load.Da; load.Da = tmp; tmp = load.Lb; load.Lb = load.La; load.La = tmp; } DistributedSpanLoad nLoad = (DistributedSpanLoad)load.Clone(); nLoad.Id = 0; load.Da = load.Da / x; load.Db = 1f; load.Lb = (load.La) + (x - load.Da) * (load.Lb - load.La) / (load.Db - load.Da); nLoad.Da = 0; nLoad.Db = (nLoad.Db - x) / (1 - x); nLoad.La = load.Lb; newLineLoads.Add(nLoad, lc); return false; }
/// <summary> /// Relocates a ConcentratedSpanLoad between the line element where it is and a new adjacent line element. /// </summary> /// <param name="newLineLoads">The AssignedLoads object of the new Line Element</param> /// <param name="lc">The Load Case to which the load belongs.</param> /// <param name="x">The dividing point of the two line elements [0, 1]</param> /// <param name="load">The Load to distribute in two elements</param> /// <returns>true if the load was moved to the new Line Element (so the caller removes it). false otherwise.</returns> private static bool RelocateConcentratedLoads(AssignedLoads newLineLoads, LoadCase lc, float x, ConcentratedSpanLoad load) { if (x > load.D) { load.D = load.D / x; return false; } else { load = (ConcentratedSpanLoad)load.Clone(); load.Id = 0; load.D = (load.D - x) / (1f - x); newLineLoads.Add(load, lc); return true; } }