private void store(OleDbConnection cn, uint itemId, string loadCase, DirectionalLineLoad obj) { string sql = ""; string dir = obj.Direction.ToString(); string dirFrame = "GLOBAL"; if (obj.Direction != LineLoad.LoadDirection.Gravity) { dirFrame = dir.Substring(0, dir.Length - 1).ToUpper(); dir = dir.Substring(dir.Length - 1); } if (obj is ConcentratedSpanLoad) { ConcentratedSpanLoad point = (ConcentratedSpanLoad)obj; sql = "INSERT INTO [Frame Loads - Point] " + "(Frame,LoadCase,CoordSys,Type,Dir,DistType,RelDist,AbsDist,Force) VALUES " + "(" + itemId + ",\"" + loadCase + "\",\"" + dirFrame + "\",\"" + point.Type + "\"," + "\"" + dir + "\",\"RelDist\"," + point.D + ",0," + point.LoadInt + ");"; } else if (obj is DistributedSpanLoad) { DistributedSpanLoad dist = (DistributedSpanLoad)obj; sql = "INSERT INTO [Frame Loads - Distributed] " + "(Frame,LoadCase,CoordSys,Type,Dir,DistType,RelDistA,RelDistB,AbsDistA,AbsDistB,FOverLA,FOverLB) VALUES " + "(" + itemId + ",\"" + loadCase + "\",\"" + dirFrame + "\",\"" + dist.Type + "\"," + "\"" + dir + "\",\"RelDist\"," + dist.Da + "," + dist.Db + ",0,0," + dist.LoadAInt + "," + dist.LoadBInt + ");"; } if (sql.Length > 0) { new OleDbCommand(sql, cn).ExecuteNonQuery(); } }
public LineStressCalculator() { selfWeight = new DistributedSpanLoad(); selfWeight.Direction = LineLoad.LoadDirection.Gravity; selfWeight.Da = 0f; selfWeight.Db = 1f; }
/// <summary> /// Executes the command. /// Creates, gets parameters and add a Distributed line load to the selected line elements. /// </summary> /// <param name="services">CommandServices object to interact with the system</param> public override void Run(Canguro.Controller.CommandServices services) { services.GetProperties(this); DistributedSpanLoad newLoad = new DistributedSpanLoad(); newLoad.Da = 0; newLoad.Db = 1; newLoad.Direction = direction; newLoad.La = load; newLoad.Lb = load; newLoad.Type = type; //services.GetProperties(Title, load, false); if (Canguro.Controller.Grid.LoadEditFrm.EditLoad(newLoad) == System.Windows.Forms.DialogResult.OK) { List <Item> selection = GetSelection(services); foreach (Item item in selection) { if (item is LineElement) { ((LineElement)item).Loads.Add((DistributedSpanLoad)newLoad.Clone()); } } } }
/// <summary> /// Executes the command. /// Creates, gets parameters and add a Distributed line load to the selected line elements. /// </summary> /// <param name="services">CommandServices object to interact with the system</param> public override void Run(Canguro.Controller.CommandServices services) { if (Canguro.Controller.Grid.LoadEditFrm.EditLoad(this) == System.Windows.Forms.DialogResult.OK) { DistributedSpanLoad newLoad = new DistributedSpanLoad(); newLoad.Da = 0; newLoad.Db = 0.5f; newLoad.Direction = direction; newLoad.La = 0; newLoad.Lb = load; newLoad.Type = type; DistributedSpanLoad newLoad2 = new DistributedSpanLoad(); newLoad2.Da = 0.5f; newLoad2.Db = 1; newLoad2.Direction = direction; newLoad2.La = load; newLoad2.Lb = 0; newLoad2.Type = type; List <Item> selection = services.GetSelection(); foreach (Item item in selection) { if (item is LineElement) { ((LineElement)item).Loads.Add((DistributedSpanLoad)newLoad.Clone()); ((LineElement)item).Loads.Add((DistributedSpanLoad)newLoad2.Clone()); } } } }
private void addUniformForceDeflection(LineElement line, float lineLength, DistributedSpanLoad load, float a, float b, float c, float[,] controlPoints, float dirComponent, float scale, float EI) { float W, w; float RA; float c1, c3, c5, c6; float x = 0.0f, deflection = 0.0f, angle = 0.0f; w = -1f * Math.Sign(load.La) * Math.Min(Math.Abs(load.La), Math.Abs(load.Lb)); W = w * b; RA = W * (1.0f - (2.0f * a + b) / (2.0f * lineLength)); // Calculo de las constantes c6 = w * (float)Math.Pow(b, 3) * (b + 2.0f * a) / 48.0f; c5 = (w * b * (float)Math.Pow(lineLength - a - b / 2.0f, 3) / (6.0f * lineLength)) - RA * (float)Math.Pow(lineLength, 2) / 6.0f - c6 / lineLength; c1 = c3 = w * (float)Math.Pow(b, 3) / 24.0f + c5; // Flechas, angulos for (int i = 0; i < controlPoints.GetLength(0); i++) { x = controlPoints[i, 0] * lineLength; deflection = addUniformForceDeflection(load, x, lineLength, ref angle, a, b, c, W, w, RA, c1, c3, c5, c6) * scale / EI; controlPoints[i, 1] += (deflection * dirComponent); controlPoints[i, 2] += angle * dirComponent / EI; } }
private float addToMomentDiagram(LineLoad load, float dirComponent, float position, float lineLength) { if (load is ConcentratedSpanLoad) { float P = ((ConcentratedSpanLoad)load).L; float pDist = ((ConcentratedSpanLoad)load).D; if (position < (pDist * lineLength)) { return(P * dirComponent * (1f - pDist) * position); } else { return(P * dirComponent * pDist * (lineLength - position)); } } else if (load is DistributedSpanLoad) { DistributedSpanLoad dLoad = load as DistributedSpanLoad; //if (position >= 0) // return -(dLoad.La * dirComponent * position / 2f) * (lineLength - position); float a, b, c, Ra, W, xt; a = dLoad.Da * lineLength; b = dLoad.Db * lineLength - a; c = lineLength - a - b; W = (dLoad.La + dLoad.Lb) * b / 2f; xt = Math.Abs(dLoad.La + dLoad.Lb) > float.Epsilon ? b * (dLoad.La + 2f * dLoad.Lb) / (3 * (dLoad.La + dLoad.Lb)) : 0.0f; Ra = W / lineLength * (lineLength - (a + xt)); if (b == 0f) { return(0f); } else if (position < a) { return(Ra * position * dirComponent); } else if (position <= (a + b)) { float Wx, y, xt2, y1; y1 = (dLoad.Lb - dLoad.La) * (position - a) / b; y = dLoad.La + y1; xt2 = Math.Abs(dLoad.La + y) > float.Epsilon ? (position - a) / 3f * (dLoad.La + 2 * y) / (dLoad.La + y) : 0.0f; Wx = (dLoad.La + y) * (position - a) / 2f; return((Ra * position - Wx * (position - a - xt2)) * dirComponent); } else { return((Ra * position - W * (position - a - xt)) * dirComponent); } } return(0f); }
private void addLoadDeflection(LineElement line, float lineLength, DirectionalLineLoad load, float[,] controlPoints, DeformationAxis component, float scale, float EI) { if (load == null) { return; } Vector3 dir = getLocalDir(line, load.Direction); float dirComponent = 0.0f; switch (component) { case DeformationAxis.Local2: dirComponent = dir.Y; break; case DeformationAxis.Local3: dirComponent = dir.Z; break; } if (load is ConcentratedSpanLoad) { if (load.Type == LineLoad.LoadType.Force) { addConcentratedForceDeflection(line, lineLength, (ConcentratedSpanLoad)load, controlPoints, dirComponent, scale, EI); } else { addConcentratedMomentDeflection(line, lineLength, (ConcentratedSpanLoad)load, controlPoints, dirComponent, scale, EI); } } else if (load is DistributedSpanLoad) { DistributedSpanLoad dsl = (DistributedSpanLoad)load; float a, b, c; a = dsl.Da * lineLength; b = (dsl.Db - dsl.Da) * lineLength; c = (1.0f - dsl.Db) * lineLength; if (load.Type == LineLoad.LoadType.Force) { addUniformForceDeflection(line, lineLength, dsl, a, b, c, controlPoints, dirComponent, scale, EI); addTriangularForceDeflection(line, lineLength, dsl, a, b, c, controlPoints, dirComponent, scale, EI); } else { // TODO: Partial Uniform and Triangular Moments Deflection calculator } } }
/// <summary> /// Executes the command. /// Creates, gets parameters and add a Distributed line load to the selected line elements. /// </summary> /// <param name="services">CommandServices object to interact with the system</param> public override void Run(Canguro.Controller.CommandServices services) { DistributedSpanLoad load = new DistributedSpanLoad(); //services.GetProperties(Title, load, false); if (Canguro.Controller.Grid.LoadEditFrm.EditLoad(load) == System.Windows.Forms.DialogResult.OK) { List <Item> selection = services.GetSelection(); foreach (Item item in selection) { if (item is LineElement) { ((LineElement)item).Loads.Add((DistributedSpanLoad)load.Clone()); } } } }
/// <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 float addToShearDiagram(LineLoad load, float dirComponent, float position, float lineLength) { if (load is ConcentratedSpanLoad) { float P = ((ConcentratedSpanLoad)load).L; float pDist = ((ConcentratedSpanLoad)load).D; if (position < (pDist * lineLength)) { return((P * dirComponent) / lineLength * position); } else { return(-(P * dirComponent) / lineLength * (lineLength - position)); } } else if (load is DistributedSpanLoad) { DistributedSpanLoad dLoad = load as DistributedSpanLoad; //return 0f; float a, b, c, Ra, W, xt; a = dLoad.Da * lineLength; b = dLoad.Db * lineLength - a; c = lineLength - a - b; if (b == 0) { return(0f); } else if (position >= a && position <= (a + b)) { W = (dLoad.La + dLoad.Lb) * b / 2f; xt = Math.Abs(dLoad.La + dLoad.Lb) > float.Epsilon ? b * (dLoad.La + 2f * dLoad.Lb) / (3 * (dLoad.La + dLoad.Lb)) : 0.0f; Ra = W / lineLength * (lineLength - (a + xt)); ///////////////////////////////////////// // Shear in a float shear_a = Ra; ///////////////////////////////////////// ///////////////////////////////////////// // Shear in a + b float Wx_b, shear_b; Wx_b = (dLoad.La + dLoad.La + dLoad.Lb - dLoad.La) * b / 2f; shear_b = Ra - Wx_b; ///////////////////////////////////////// ///////////////////////////////////////// // Line between a --- b float originalLine = (position - a) / b * ((shear_b - shear_a)) + shear_a; ///////////////////////////////////////// float Wx, y, xt2, y1; y1 = (dLoad.Lb - dLoad.La) * (position - a) / b; y = dLoad.La + y1; xt2 = Math.Abs(dLoad.La + y) > float.Epsilon ? (position - a) / 3f * (dLoad.La + 2 * y) / (dLoad.La + y) : 0.0f; Wx = (dLoad.La + y) * (position - a) / 2f; return((Ra - Wx - originalLine) * dirComponent); //return dirComponent * dLoad.La * (position - a) + dLoad.La * (dLoad.Db - dLoad.Da) * position; } } return(0f); }
private void addTriangularForceDeflection(LineElement line, float lineLength, DistributedSpanLoad load, float a, float b, float c, float[,] controlPoints, float dirComponent, float scale, float EI) { float q; float RA; float c1, c2, d1, d2, e1, e2; float x = 0.0f, deflection = 0.0f, angle = 0.0f; if ((load.La - load.Lb) == 0) { return; } // Define load orientation +/-, left/right bool isLeft = false; if (Math.Abs(load.La) > Math.Abs(load.Lb)) { isLeft = true; } if (isLeft) { q = load.Lb - load.La; // Swap a and c float swapAC = a; a = c; c = swapAC; } else { q = load.La - load.Lb; } RA = (q * b / 2f) * (1f - (a + 2f * b / 3f) / lineLength); // Calculo de las constantes c2 = d2 = 0f; e1 = (q * b * (float)Math.Pow(lineLength - a - 2f * b / 3f, 3) / 12f - RA * (float)Math.Pow(lineLength, 3) / 6f - 7f * q * (float)Math.Pow(b, 4) / 810f - q * a * (float)Math.Pow(b, 3) / 72f) / lineLength; e2 = q * a * (float)Math.Pow(b, 3) / 72 + 7f * q * (float)Math.Pow(b, 4) / 810f; c1 = d1 = e1 + q * (float)Math.Pow(b, 3) / 72; // Flechas, angulos for (int i = 0; i < controlPoints.GetLength(0); i++) { if (isLeft) { x = (1f - controlPoints[i, 0]) * lineLength; } else { x = controlPoints[i, 0] * lineLength; } deflection = addTriangularForceDeflection(load, lineLength, x, ref angle, RA, a, b, q, c1, c2, d1, d2, e1, e2) * scale / EI; controlPoints[i, 1] += (deflection * dirComponent); controlPoints[i, 2] += angle * dirComponent / EI; } }