Exemple #1
0
        private double GetDotProduct(Vector2d Vector)
        {
            Vector2d A = this;
            Vector2d B = Vector;
            return A.X*B.X+A.Y*B.Y;

        }
Exemple #2
0
        /// <summary>
        /// Gets an angle between 0 and 90 degrees when second vector is specified
        /// </summary>
        /// <param name="Vector">Second Vector</param>
        /// <returns></returns>
        public double GetAngle0to90(Vector2d Vector)
        {
            double A = GetMagnitude(this);
            double B = GetMagnitude(Vector);
            double ABdotProduct = GetDotProduct(Vector);

            double angleRad = Math.Acos(Math.Abs(ABdotProduct/(A*B))) ;
            double angleDeg = angleRad*180.0/Math.PI;
            return angleDeg;
        }
Exemple #3
0
        public double FindDistance(Vector2d A)
        {
            //Find Cross Product of PositionVector X Force Unit Vector
            //which is the moment vector for a unit force
            Vector2d B = GetUnit();
            
            double Ax = A.X;
            double Ay = A.Y;
            double Az = 0;
            
            double Bx = B.X;
            double By = B.Y;
            double Bz = 0;



            double i =Ay*Bz -Az*By;
            double j = -(Ax*Bz -Az*Bx);
            double k = Ax*By -Ay*Bx;

            double Mag = Math.Sqrt(i * i + j * j + k * k);

            return Mag;
        }
Exemple #4
0
 public Vector2d GetUnit()
 {
     double M = GetMagnitude();
     Vector2d Unit = new Vector2d(X/M, Y/M);
     return Unit;
 }
Exemple #5
0
 private double GetMagnitude(Vector2d v)
 {
     double m = Math.Sqrt(Math.Pow(v.X,2)+Math.Pow(v.Y,2));
     return m;
 }
        /// <summary>
        /// Finds bolt or weld group ultimate strength (force)
        /// using instantaneous center of rotation method
        /// </summary>
        /// <param name="e_x">Horizontal component of eccentricity</param>
        /// <param name="AngleOfLoad">Angle of load from vertical</param>
        /// <returns></returns>
        protected double FindUltimateEccentricForce(double e_x , double AngleOfLoad)
        {
            bool iterationYieldedResult = false;
            int MaxNumberOfIterations = 1999;
            //iteration variables
            double P=0.0;
            M=0.0;
            J_ic = 0.0;
            Ry=0.0;
            Rx=0.0;
            double Pprev = 0;
            double Mapfunc =0.0;
            ILocationArrayElement controllingElement=null ;

            double Rot = AngleOfLoad.ToRadians();
            double Ec = e_x;
            int N = Elements.Count();
            
            //Initial assumption of bolt center
            Center = new Point2D(0, 0);
            int iterationCount = 0;
            while (iterationYieldedResult == false)
            {
               controllingElement = FindUltimateDeformationElement(Center); 

                //Iterate through all bolts/welds and using force-displacement 
                //relationship find the force in each element
                //then find the contribution of this element to overall
                //Force and Moment of the group.


                //Calculate M and J for all elements
                IterateThroughElements(controllingElement, AngleOfLoad);

                      
                            //Define a force vector due to unit force
                            Vector2d UnitForce = new Vector2d(Math.Sin(Rot), Math.Cos(Rot));
                            //note: it is assumed that the force goes through the coordinate origin
                            //therefore for standard weld geometries the coordinates are by adding Ec to the 
                            //IC location
                            Vector2d PositionVector;

                            PositionVector = new Vector2d(Ec - Center.X, -Center.Y); 

                            //Distance between IC and and Force vector
                            double e = UnitForce.FindDistance(PositionVector); //Internal moment arm
                            P = M / e;   //resolving the internal forces into a resultant at the given moment arm
                
                        double Py = P * Math.Cos(Rot);
                        double Px = P * Math.Sin(Rot);

                        double Fyy;
                        double Fxx = Px - Rx;       //Horizontal Unbalanced Force
                        if (Ec>=0)
                        {
                            Fyy = Py - Ry;          //Vertical Unbalanced Force 
                        }
                        else
                        {
                            Fyy = Py + Ry;  
                        }

                        double Pp = Math.Sqrt(Fyy*Fyy+ Fxx*Fxx); //Unbalanced force resultant

                bool CovergedCriteria1 = Math.Abs(Fyy) <= 0.0001 && Math.Abs(Fxx) <= 0.0001 ? true : false; //reached convergence tolerance
                bool CovergedCriteria2 = (iterationCount > MaxNumberOfIterations)? true :false;   
                bool CovergedCriteria3 = iterationCount > 200 && Pp > Pprev ? true : false;  
                
                if (CovergedCriteria1 == true)
	                {
		            break;
	                }
                    else
	                {
                        if (CovergedCriteria2==true)
	                    {
		                     throw new Exception("Failed to find solution for bolt group coefficient. Maximum number of iterations in bolt group has been exceeded.");
	                    }
                        else
	                    {
                            if (CovergedCriteria3 == true)
                            {
                                break; 
                            }
                            
                            //throw new Exception(String.Format("Failed to find solution for bolt group coefficient.The resultant force increment increased after iteration {0}.", iterationCount ));
	                    }
	                }

                //if the solution hasn't converged update values for next iteration
       
                Pprev = Pp  ;
                Mapfunc = J_ic / (N * M);                        //Mapping function

                //I.C. location on x-axis from bolt group C.G.
                if (e_x >= 0)
                {
                    Center.X = Center.X - Fyy * Mapfunc;
                    Center.Y = Center.Y + Fxx * Mapfunc;   
                }
                else
                {
                    Center.X = Center.X + Fyy * Mapfunc;
                    Center.Y = Center.Y - Fxx * Mapfunc;   
                }


           iterationCount++;
            }
            #region Final run through elelents (for debug only)
           IterateThroughElements(controllingElement, AngleOfLoad);
            #endregion
            return P;
        }
        /// <summary>
        /// Returns a unit vector of the resultant force in the element. Which is perpendicular to
        /// the ray from center of rotation to the element.
        /// </summary>
        /// <param name="e">Element</param>
        /// <param name="c">Center of rotation</param>
        /// <returns></returns>
        protected Vector2d GetElementForceUnitVector(ILocationArrayElement e, Point2D c)
        {
            double BX = e.Location.X - c.X;
            double BY = e.Location.Y - c.Y;

            //Normal vector:
            // cross product definition
            //AXB=(AyBz -AzBy)i -(AxBz -AzBx)j +(AxBy -AyBx)k
            //assuming AZ = 1, AX =AY =0;
            if (BX==0 && BY == 0)
            {
                return new Vector2d(0, 0);
            }
            else
            {

                Vector2d perpVector = new Vector2d(-BY, BX);
                return perpVector.GetUnit();
            }
        }
        public double GetAngleTheta(Point2D Center)
        {
            double Dx = Center.X - this.Location.X;
            double Dy = Center.Y - this.Location.Y;

            //Define vector from the IC to weld element centroid
            Vector2d PositionVector = new Vector2d(Dx, Dy);
            Vector2d ForceVector = new Vector2d(Dy, -Dx);

            Vector2d ElementLineVector = new Vector2d(this.NodeJ.X - this.NodeI.X, this.NodeJ.Y - this.NodeI.Y);
            double theta = ForceVector.GetAngle0to90(ElementLineVector);
            return theta;
        }