Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NodalLoad" /> class. satisfies the constrictor for <see cref="ISerializable" /> interface.
 /// </summary>
 /// <param name="info">The information.</param>
 /// <param name="context">The context.</param>
 private NodalLoad(SerializationInfo info, StreamingContext context)
 {
     force = (Force)info.GetValue("force", typeof(Force));
     _case = (LoadCase)info.GetValue("case", typeof(LoadCase));
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NodalLoad"/> struct with <see cref="LoadCase.DefaultLoadCase"/> as <see cref="NodalLoad.Case"/>.
 /// </summary>
 /// <param name="force">The force.</param>
 public NodalLoad(Force force)
 {
     this.force = force;
     this._case = LoadCase.DefaultLoadCase;
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NodalLoad"/> struct.
 /// </summary>
 /// <param name="force">The force.</param>
 /// <param name="case">The Load case.</param>
 public NodalLoad(Force force, LoadCase @case)
 {
     this.force = force;
     _case      = @case;
 }
        internal Force GetSupportReaction2(LoadCombination cmb)
        {
            //TODO: this methods not works correctly!

            var f1 = new Force();
            var f  = new Force();

            foreach (var cse in cmb.Keys)
            {
                parent.LastResult.AddAnalysisResultIfNotExists(cse);
            }



            #region From Connected Elements

            foreach (var elm in ConnectedElements)
            {
                var ind = elm.Nodes.IndexOfReference(this);

                foreach (var cse in cmb.Keys)
                {
                    foreach (var lde in elm.Loads)
                    {
                        if (lde.Case != cse)
                        {
                            continue;
                        }

                        //elm.GetGlobalEquivalentNodalLoads
                        var loads = elm.GetGlobalEquivalentNodalLoads(lde);

                        f1 += cmb[cse] * loads[ind];
                    }
                }
            }

            #endregion

            #region From Loads on this node

            foreach (var load in this.loads)
            {
                if (!cmb.ContainsKey(load.Case))
                {
                    continue;
                }

                f1 += cmb[load.Case] * load.Force;
            }

            #endregion


            foreach (var cse in cmb.Keys)//
            {
                f += cmb[cse] * Force.FromVector(parent.LastResult.Forces[cse], 6 * this.Index);
            }

            var buf = f + -f1;


            if (constraints.DX == DofConstraint.Released)
            {
                buf.Fx = 0;
            }
            if (constraints.DY == DofConstraint.Released)
            {
                buf.Fy = 0;
            }
            if (constraints.DZ == DofConstraint.Released)
            {
                buf.Fz = 0;
            }

            if (constraints.RX == DofConstraint.Released)
            {
                buf.Mx = 0;
            }
            if (constraints.RY == DofConstraint.Released)
            {
                buf.My = 0;
            }
            if (constraints.RZ == DofConstraint.Released)
            {
                buf.Mz = 0;
            }


            return(buf);

            throw new NotImplementedException();
        }
        private double[] GetTotalForceVector(LoadCase cse, DofMappingManager map)
        {
            //force vector for both free and fixed dof

            var n = parent.Nodes.Count;

            var loads = new Force[n]; //loads from connected element to node is stored in this array instead of Node.ElementLoads.


            for (int i = 0; i < n; i++)//re indexing
            {
                parent.Nodes[i].Index = i;
            }

            #region adding element loads

            foreach (var elm in parent.Elements)
            {
                var nc = elm.Nodes.Length;

                foreach (var ld in elm.Loads)
                {
                    if (ld.Case != cse)
                    {
                        continue;
                    }

                    var frcs = elm.GetGlobalEquivalentNodalLoads(ld);

                    for (var i = 0; i < nc; i++)
                    {
                        var nde = elm.Nodes[i];
                        loads[nde.Index] += frcs[i];
                    }
                }
            }

            #endregion



            #region adding concentrated nodal loads

            for (int i = 0; i < n; i++)
            {
                foreach (var load in parent.Nodes[i].Loads)
                {
                    if (load.Case != cse)
                    {
                        continue;
                    }

                    loads[parent.Nodes[i].Index] += load.Force;
                }
            }

            #endregion


            var buf = new double[6 * n];
            for (int i = 0; i < n; i++)
            {
                var force = loads[i];

                buf[6 * i + 0] = force.Fx;
                buf[6 * i + 1] = force.Fy;
                buf[6 * i + 2] = force.Fz;

                buf[6 * i + 3] = force.Mx;
                buf[6 * i + 4] = force.My;
                buf[6 * i + 5] = force.Mz;
            }

            return(buf);
        }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConcentratedLoad1D"/> class.
 /// </summary>
 /// <param name="force">The force.</param>
 /// <param name="distanseFromStartNode">The distance from start node.</param>
 /// <param name="coordinationSystem">The coordination system.</param>
 public ConcentratedLoad1D(Force force, double distanseFromStartNode, CoordinationSystem coordinationSystem)
 {
     this.force = force;
     this.distanseFromStartNode = distanseFromStartNode;
     this.coordinationSystem    = coordinationSystem;
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UniformLoad1D"/> class.
 /// </summary>
 /// <param name="info">The information.</param>
 /// <param name="context">The context.</param>
 protected ConcentratedLoad1D(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     this.distanseFromStartNode = info.GetDouble("distanseFromStartNode");
     this.force = (Force)info.GetValue("force", typeof(Force));
 }
Example #8
0
        public override Force[] GetGlobalEquivalentNodalLoads(Element element)
        {
            if (element is FrameElement2Node)
            {
                var e = element as FrameElement2Node;

                var localForce = this.force;

                if (this.coordinationSystem == CoordinationSystem.Global)
                {
                    var tmp = e.TransformGlobalToLocal(localForce.Forces, localForce.Moments);

                    localForce.Forces  = tmp[0];
                    localForce.Moments = tmp[1];
                }

                var buf = new Force[2];

                buf[0] = new Force();

                var l = (e.EndNode.Location - e.StartNode.Location).Length;

                var a = distanseFromStartNode;
                var b = l - a;

                var mymy1 = localForce.My * b / (l * l) * (b - 2 * a);
                var mymy2 = localForce.My * a / (l * l) * (a - 2 * b);

                var myfz1 = 6 * localForce.My * a * b / (l * l * l);
                var myfz2 = -myfz1;


                var mzmz1 = localForce.Mz * b / (l * l) * (b - 2 * a);
                var mzmz2 = localForce.Mz * a / (l * l) * (a - 2 * b);

                var mzfy1 = -6 * localForce.Mz * a * b / (l * l * l);
                var mzfy2 = -mzfy1;


                var fzmy1 = -localForce.Fz * a * b * b / (l * l);
                var fzmy2 = localForce.Fz * a * a * b / (l * l);

                var fzfz1 = localForce.Fz * b * b / (l * l * l) * (3 * a + b);
                var fzfz2 = localForce.Fz * a * a / (l * l * l) * (3 * b + a);


                var fymz1 = localForce.Fy * a * b * b / (l * l);
                var fymz2 = -localForce.Fy * a * a * b / (l * l);

                var fyfy1 = localForce.Fy * b * b / (l * l * l) * (3 * a + b);
                var fyfy2 = localForce.Fy * a * a / (l * l * l) * (3 * b + a);


                var fxfx1 = localForce.Fx * b / l;
                var fxfx2 = localForce.Fx * a / l;

                var mxmx1 = localForce.Mx * b / l;
                var mxmx2 = localForce.Mx * a / l;

                var f1 = new Force(
                    fxfx1,
                    mzfy1 + fyfy1,
                    fzfz1 + myfz1,
                    mxmx1,
                    mymy1 + fzmy1,
                    mzmz1 + fymz1
                    );

                var f2 = new Force(
                    fxfx2,
                    mzfy2 + fyfy2,
                    fzfz2 + myfz2,
                    mxmx2,
                    mymy2 + fzmy2,
                    mzmz2 + fymz2
                    );

                var localEndForces = new Force[2];
                localEndForces[0] = f1;
                localEndForces[1] = f2;

                localEndForces = CalcUtil.ApplyReleaseMatrixToEndForces(e, localEndForces);//applying release matrix to end forces

                var vecs  = new Vector[] { localEndForces[0].Forces, localEndForces[0].Moments, localEndForces[1].Forces, localEndForces[1].Moments };
                var tvecs = e.TransformLocalToGlobal(vecs);

                buf[0] = new Force(tvecs[0], tvecs[1]);
                buf[1] = new Force(tvecs[2], tvecs[3]);

                return(buf);
            }

            throw new NotImplementedException();
        }
Example #9
0
 public bool Equals(Force other)
 {
     return(fx.Equals(other.fx) && fy.Equals(other.fy) && fz.Equals(other.fz) && mx.Equals(other.mx) && my.Equals(other.my) && mz.Equals(other.mz));
 }
Example #10
0
 public static double[] ToVector(Force force)
 {
     return(new double[] { force.fx, force.fy, force.fz, force.mx, force.my, force.mz });
 }