Exemplo n.º 1
0
 def getContour(self):
     ''' Return the base plate contour. '''
     retval= geom.Polygon2d()
     deltaX= self.B/2.0
     deltaY= self.N/2.0
     origin2d= geom.Pos2d(self.origin.x, self.origin.y)
     retval.appendVertex(origin2d+geom.Vector2d(deltaX+self.offsetB,deltaY+self.offsetN))
     retval.appendVertex(origin2d+geom.Vector2d(-deltaX+self.offsetB,deltaY+self.offsetN))
     retval.appendVertex(origin2d+geom.Vector2d(-deltaX+self.offsetB,-deltaY+self.offsetN))
     retval.appendVertex(origin2d+geom.Vector2d(deltaX+self.offsetB,-deltaY+self.offsetN))
     return retval
Exemplo n.º 2
0
 def movePointsRangeToYcylinder(self,ijkRange,xCent,zCent,R):
     '''Moves the points in the range to make them belong to 
     a cylinder with radius R and axis parallel to global Y passing 
     through the point (xCent,0,zCent)
     '''
     vCent=geom.Vector2d(xCent,zCent)
     setPnt=self.getSetPntRange(ijkRange,'setPnt')
     for p in setPnt.getPoints:
         v=geom.Vector2d(p.getPos.x,p.getPos.z)-vCent
         vdir=v.normalizado()
         p.getPos.x=xCent+R*vdir.x
         p.getPos.z=zCent+R*vdir.y
     setPnt.clear()
Exemplo n.º 3
0
def getSVDfromVDesliz(DOFs, coo, v):
    # Returns a SVD which represents vector.
    if (DOFs == "UV"):
        return geom.SVD2d(geom.Pos2d(coo[0], coo[1]),
                          geom.Vector2d(v[0], v[1]))
    elif (DOFs == "UVR"):
        return geom.SVD2d(geom.Pos2d(coo[0], coo[1]),
                          geom.Vector2d(v[0], v[1]), v[2])
    elif (DOFs == "UVW"):
        return geom.SVD3d(geom.Pos3d(coo[0], coo[1], coo[2]),
                          geom.Vector3d(v[0], v[1], v[2]))
    elif (DOFs == "UVWRxRyRz"):
        return geom.SVD3d(geom.Pos3d(coo[0], coo[1], coo[2]),
                          geom.Vector3d(v[0], v[1], v[2]),
                          geom.Vector3d(v[3], v[4], v[5]))
Exemplo n.º 4
0
 def __init__(self,preprocessor,supportNodes):
   self.forces= dict()
   self.moments= dict()
   self.positions= dict()
   self.svdReac= geom.SVD3d()
   meshNodes= preprocessor.getNodeLoader
   meshNodes.calculateNodalReactions(True)
   f3d= geom.Vector3d(0.0,0.0,0.0)
   m3d= geom.Vector3d(0.0,0.0,0.0)
   for n in supportNodes:
     tag= n.tag
     tmp= n.getReaction
     if(meshNodes.numDOFs==3):
       force= geom.Vector2d(tmp[0],tmp[1])
       f3d= geom.Vector3d(tmp[0],tmp[1],0.0)
       moment= geom.Vector3d(0.0,0.0,tmp[2])
       m3d= moment
     else:
       force= geom.Vector3d(tmp[0],tmp[1],tmp[2])
       f3d= force
       moment= geom.Vector3d(tmp[3],tmp[4],tmp[5])
       m3d= moment
     self.forces[tag]= force
     self.moments[tag]= moment
     pos= n.getInitialPos3d
     self.positions[tag]= pos
     self.svdReac+= geom.SVD3d(pos,f3d,m3d)
Exemplo n.º 5
0
    def __init__(self,
                 boltArray,
                 width=None,
                 length=None,
                 thickness=10e-3,
                 steelType=None,
                 eccentricity=geom.Vector2d(0.0, 0.0),
                 doublePlate=False):
        ''' Constructor.

        :param boltArray: bolt array.
        :param width: plate width (if None it will be computed from the bolt arrangement.)
        :param length: plate length (if None it will be computed from the bolt arrangement.)
        :param thickness: plate thickness.
        :param steelType: steel type.
        :param eccentricity: eccentricity of the plate with respect the center
                             of the bolt array.
        :param doublePlate: if true there is one plate on each side
                            of the main member.
        '''
        self.width = width
        self.length = length
        self.setBoltArray(boltArray)
        self.thickness = thickness
        self.steelType = steelType
        self.eccentricity = eccentricity
        self.doublePlate = doublePlate
Exemplo n.º 6
0
    def __init__(self, preprocessor, supportNodes, inclInertia=False):
        ''' Constructor.

      :param preprocessor: XC preprocessor of the problem.
      :param supportNodes: nodes to compute reactions.
      :param inclInertia: include inertia effects (defaults to false).
      '''
        self.forces = dict()
        self.moments = dict()
        self.positions = dict()
        self.svdReac = geom.SlidingVectorsSystem3d()
        nodeHandler = preprocessor.getNodeHandler
        nodeHandler.calculateNodalReactions(inclInertia, 1e-7)
        f3d = geom.Vector3d(0.0, 0.0, 0.0)
        m3d = geom.Vector3d(0.0, 0.0, 0.0)
        for n in supportNodes:
            tag = n.tag
            tmp = n.getReaction
            f3d = n.getReactionForce3d
            m3d = n.getReactionMoment3d
            if (nodeHandler.numDOFs == 3):
                force = geom.Vector2d(f3d.x, f3d.y)
            else:
                force = f3d
            self.forces[tag] = force
            self.moments[tag] = m3d
            pos = n.getInitialPos3d
            self.positions[tag] = pos
            self.svdReac += geom.SlidingVectorsSystem3d(pos, f3d, m3d)
Exemplo n.º 7
0
def getSlidingVectorsSystemfromSlidingVector(DOFs,coo,v):
  '''Returns a sliding vector system equivalent to the sliding vector.

  Parameters:
  :param DOFs: degrees of freedom.
  :param coo: coordinates of a point in the vector line of action.
  :param v: vector.
  '''
  if(DOFs=="UV"):
    return geom.SlidingVectorsSystem2d(geom.Pos2d(coo[0],coo[1]),geom.Vector2d(v[0],v[1]))
  elif(DOFs=="UVR"):
    return geom.SlidingVectorsSystem2d(geom.Pos2d(coo[0],coo[1]),geom.Vector2d(v[0],v[1]),v[2])
  elif(DOFs=="UVW"):
    return geom.SlidingVectorsSystem3d(geom.Pos3d(coo[0],coo[1],coo[2]),geom.Vector3d(v[0],v[1],v[2]))
  elif(DOFs=="UVWRxRyRz"):
    return geom.SlidingVectorsSystem3d(geom.Pos3d(coo[0],coo[1],coo[2]),geom.Vector3d(v[0],v[1],v[2]),geom.Vector3d(v[3],v[4],v[5]))
Exemplo n.º 8
0
def getSVDfromVDesliz(DOFs,coo,v):
  '''Returns a sliding vector system that represents the vector.

  Parameters:
  :param DOFs: degrees of freedom.
  :param coo: coordinates of a point in the vector line of action.
  :param v: vector.
  '''
  if(DOFs=="UV"):
    return geom.SVD2d(geom.Pos2d(coo[0],coo[1]),geom.Vector2d(v[0],v[1]))
  elif(DOFs=="UVR"):
    return geom.SVD2d(geom.Pos2d(coo[0],coo[1]),geom.Vector2d(v[0],v[1]),v[2])
  elif(DOFs=="UVW"):
    return geom.SVD3d(geom.Pos3d(coo[0],coo[1],coo[2]),geom.Vector3d(v[0],v[1],v[2]))
  elif(DOFs=="UVWRxRyRz"):
    return geom.SVD3d(geom.Pos3d(coo[0],coo[1],coo[2]),geom.Vector3d(v[0],v[1],v[2]),geom.Vector3d(v[3],v[4],v[5]))
Exemplo n.º 9
0
 def getFoundationCenterPosition(self):
     ''' Returns the position of the foundation center (for excentricity
         computation).'''
     toeEndPos= self.getWFToeEndPosition()
     heelEndPos= self.getWFHeelEndPosition()
     v= (heelEndPos-toeEndPos)*0.5+geom.Vector2d(0.0,-self.footingThickness/2.0)
     return toeEndPos+v
Exemplo n.º 10
0
 def getBoltedPlateTemplate(self):
     ''' Return the blocks corresponding to the plate
         bolted to the gusset plate.
     '''
     # Create bolted plate.
     boltedPlate = ASTM_materials.BoltedPlate()
     boltedPlate.setFromDict(self.boltedPlateTemplate.getDict())
     boltedPlate.eccentricity = geom.Vector2d(.025, 0.0)
     boltedPlate.length += .05
     return boltedPlate
Exemplo n.º 11
0
    def writeDXFAnchorBolts(self, modelSpace, layerName):
        ''' Draw anchor bolts

        :param modelSpace: model space to write into.
        :param layerName: layer name.
        '''
        boltDiameter = self.anchorGroup.anchors[0].diameter
        self.holeDiameter = self.getHoleDiameter()
        origin2d = geom.Pos2d(self.origin.x, self.origin.y)
        for anchor in self.anchorGroup.anchors:
            center = origin2d + geom.Vector2d(anchor.pos3d.x, anchor.pos3d.y)
            modelSpace.add_circle((center.x, center.y),
                                  self.holeDiameter / 2.0,
                                  dxfattribs={'layer': layerName})
Exemplo n.º 12
0
    def Cp(self, x, y):
        '''External wind pressure coefficient in a point of the cylinder 
        with coordinates (x,y) 

        - Cp (+) -> pressure acts toward external surface
        - Cp (-) -> pressure acts away from external surface

        '''
        vectPoint = geom.Vector2d(x - self.xCent, y - self.yCent)
        theta = self.vectRef.getAngle(vectPoint)
        Cp1 = self.Cp1_theta(theta)
        kc = self.kc(Cp1)
        Cp = kc * Cp1
        return Cp
Exemplo n.º 13
0
 def __init__(self,
              diam,
              height,
              windParams,
              windComp=[1, 0],
              zGround=0,
              xCent=0,
              yCent=0):
     self.diam = diam
     self.height = height
     self.windParams = windParams
     self.windComp = windComp
     self.zGround = zGround
     self.xCent = xCent
     self.yCent = yCent
     self.vectRef = geom.Vector2d(-windComp[0], -windComp[1])
Exemplo n.º 14
0
    def writeDXFShapeContour(self, modelSpace, layerName):
        ''' Writes the shape contour in the model
            space argument.

        :param modelSpace: model space to write into.
        :param layerName: layer name.
        '''
        plg = self.steelShape.getContour()
        posVec3d = self.origin.getPositionVector()
        posVec2d = geom.Vector2d(posVec3d.x, posVec3d.y)
        plg.move(posVec2d)
        vtx = plg.getVertices()
        vtx.append(vtx[0])
        v0 = vtx[0]
        for v in vtx[1:]:
            modelSpace.add_line((v0.x, v0.y), (v.x, v.y),
                                dxfattribs={'layer': layerName})
            v0 = v
Exemplo n.º 15
0
  def getSlidingSafetyFactor(self,R,gammaR,foundationSoilModel):
    '''Return the factor of safety against sliding.

     :param R: (SlidingVectorsSystem3d) resultant of the loads acting on the retaining wall.
     :param gammaR: partial resistance reduction factor.
     :param foundationSoilModel: (FrictionalCohesionalSoil) soil model.
     :param gammaMPhi: (float) partial reduction factor for internal friction angle of the soil.
     :param gammaMc: (float) partial reduction factor for soil cohesion.
    '''
    foundationPlane= self.getFoundationPlane()
    alphaAngle= math.atan(foundationPlane.getSlope())
    F= R.getResultant()
    F2D= geom.Vector2d(F.x,F.y)
    Ftang= foundationPlane.getVector2dProj(F2D)
    Fnormal= F2D-Ftang
    #Sliding strength
    e= self.getEccentricity(R) #eccentricity
    b= self.getFootingWidth()
    bReduced= 2*(b/2.0+e)
    Rd= Fnormal.getModulus()*math.tan(foundationSoilModel.getDesignPhi())+foundationSoilModel.getDesignC()*bReduced/math.cos(alphaAngle)
    return Rd/Ftang.getModulus()/gammaR   
Exemplo n.º 16
0
 def getContourPoints(self):
     ''' Return a list with the points that form the wall contour.'''
     retval= list()
     retval.append(self.stemTopPosition)
     stemInsideBottom= self.stemTopPosition-geom.Vector2d(0.0,self.stemHeight)
     retval.append(stemInsideBottom)
     toePosTop= stemInsideBottom+geom.Vector2d(-self.bToe, 0.0) # toe
     retval.append(toePosTop)
     
     toePosBottom= toePosTop-geom.Vector2d(0.0,self.footingThickness)
     retval.append(toePosBottom)
     heelEndPosBottom= toePosBottom+geom.Vector2d(self.getFootingWidth(), 0.0) # heel end
     retval.append(heelEndPosBottom)
     heelEndPosTop= heelEndPosBottom+geom.Vector2d(0.0, self.footingThickness)
     retval.append(heelEndPosTop)        
     stemOutsideTop= self.stemTopPosition+geom.Vector2d(self.stemTopWidth,0.0) # stem top
     stemOutsideBottom= stemOutsideTop+geom.Vector2d(self.stemHeight*self.stemBackSlope,-self.stemHeight) #stem bottom
     retval.append(stemOutsideBottom)
     retval.append(stemOutsideTop) # stem top
     return retval
Exemplo n.º 17
0
 def __init__(self, preprocessor, supportNodes):
     self.forces = dict()
     self.moments = dict()
     self.positions = dict()
     self.svdReac = geom.SlidingVectorsSystem3d()
     nodeHandler = preprocessor.getNodeHandler
     nodeHandler.calculateNodalReactions(True, 1e-7)
     f3d = geom.Vector3d(0.0, 0.0, 0.0)
     m3d = geom.Vector3d(0.0, 0.0, 0.0)
     for n in supportNodes:
         tag = n.tag
         tmp = n.getReaction
         f3d = n.getReactionForce3d
         m3d = n.getReactionMoment3d
         if (nodeHandler.numDOFs == 3):
             force = geom.Vector2d(f3d.x, f3d.y)
         else:
             force = f3d
         self.forces[tag] = force
         self.moments[tag] = m3d
         pos = n.getInitialPos3d
         self.positions[tag] = pos
         self.svdReac += geom.SlidingVectorsSystem3d(pos, f3d, m3d)
Exemplo n.º 18
0
 def getWFStemTopPosition(self):
     ''' Returns the position of the stem top in the wireframe model.'''
     return self.stemTopPosition-geom.Vector2d(self.stemTopWidth/2.0,0.0)
Exemplo n.º 19
0
kip2N = 4448.2216

import xc_base
import geom
from materials.astm_aisc import ASTM_materials

bolt = ASTM_materials.BoltFastener(0.75 * in2m,
                                   steelType=ASTM_materials.A325)  # group A
boltArray = ASTM_materials.BoltArray(bolt, nRows=4, nCols=1, dist=3 * in2m)
eccentr = (4.5 / 2.0 - 1.25) * in2m
finPlate = ASTM_materials.FinPlate(boltArray,
                                   width=11.5 * in2m,
                                   length=4.5 * in2m,
                                   thickness=0.25 * in2m,
                                   steelType=ASTM_materials.A36,
                                   eccentricity=geom.Vector2d(eccentr, 0.0))

Rd = 49.6 * kip2N

## Check bolt strength
CFShear = boltArray.getDesignShearEfficiency(Rd, doubleShear=False)
loadDir = geom.Vector2d(0.0, -1.0)
CF = finPlate.getDesignEfficiency(geom.Vector2d(0.0, -Rd), Ubs=1.0)
CFRef = 49.6 / 52.2
ratio1 = abs(CF - CFRef) / CFRef
'''
print('Rd= ', Rd/1e3, 'kN')
print('CF(Shear)= ', CFShear)
print('CF= ', CF)
print('ratio1= ', ratio1)
'''
Exemplo n.º 20
0
  fv= sigma_h*math.tan(delta)*stepHeight
  Fv+= fv
  x.append(z)r
  results5_16.append(sigma_h)

totalEarthPressure= scipy.integrate.simps(results5_16,x)

earthPressurePolygon=geom.Polygon2d()

for cx,cy in zip(x,results5_16):
  earthPressurePolygon.appendVertex(geom.Pos2d(cx,cy))

earthPressurePolygon.appendVertex(geom.Pos2d(x[-1],0.0))
earthPressurePolygon.appendVertex(geom.Pos2d(0,0))
earthPressurePolygonCentroid= earthPressurePolygon.getCenterOfMass()
earthPressureVector= geom.Vector2d(-totalEarthPressure,-Fv)
earthPressureTail= geom.Pos2d(foundationWidth,H-earthPressurePolygonCentroid.x)
earthPressureSVS= geom.SlidingVectorsSystem2d(geom.SlidingVector2d(earthPressureTail,earthPressureVector))
print 'earthPressureSVS: ', earthPressureSVS

'''
print 'B/H= 0.1', results5_16
'''

# Spandrel wall.
foundationCenter= geom.Pos2d(foundationWidth/2.0,0.0)
spandrelWallPolygon= geom.Polygon2d()
spandrelWallPolygon.appendVertex(geom.Pos2d(0.0,0.0))
spandrelWallPolygon.appendVertex(geom.Pos2d(foundationWidth,0.0))
spandrelWallPolygon.appendVertex(geom.Pos2d(1.05,H))
spandrelWallPolygon.appendVertex(geom.Pos2d(0.00,H))
Exemplo n.º 21
0
# -*- coding: utf-8 -*-
import xc_base
import geom
pol1 = geom.Polygon2d()
pol1.appendVertex(geom.Pos2d(-1., -1.))
pol1.appendVertex(geom.Pos2d(1., -1.))
pol1.appendVertex(geom.Pos2d(1., 1.))
pol1.appendVertex(geom.Pos2d(-1., 1.))

pol2 = geom.Polygon2d(pol1)
pol2.mueve(geom.Vector2d(1, 1))

pol3 = geom.Polygon2d(pol1)
pol3.clipUsingPolygon(pol2)

areaPol = pol3.getArea()
polygonPerimeter = pol3.getPerimeter()
polygonCenterOfMass = pol3.getCenterOfMass()
polygonCenterOfMassX = polygonCenterOfMass.x
polygonCenterOfMassY = polygonCenterOfMass.y
IxPol = pol3.getIx()
IyPol = pol3.getIy()
PxyPol = pol3.getPxy()

ratio1 = (areaPol - 1)
ratio2 = (polygonPerimeter - 4) / 4.
ratio3 = (polygonCenterOfMassX - 0.5) / 0.5
ratio4 = (polygonCenterOfMassY - 0.5) / 0.5
ratio5 = (IxPol - (1 / 12.0)) / (1 / 12.0)
ratio6 = (IyPol - (1 / 12.0)) / (1 / 12.0)
ratio7 = PxyPol
Exemplo n.º 22
0
# -*- coding: utf-8 -*-

import xc_base
import geom
import math

u=geom.Vector2d(1,0)
ptoOrigen=geom.Pos2d(0,0)
ptoDestino=geom.Pos2d(1,1)
s=geom.Segment2d(ptoOrigen,ptoDestino)
alpha=s.angleVector(u)
ratio1= math.degrees(alpha)-45

ptoDestino=geom.Pos2d(0,1)
s=geom.Segment2d(ptoOrigen,ptoDestino)
alpha=s.angleVector(u)
ratio2= math.degrees(alpha)-90

ptoDestino=geom.Pos2d(-1,1)
s=geom.Segment2d(ptoOrigen,ptoDestino)
alpha=s.angleVector(u)
ratio3= math.degrees(alpha)-135

ptoDestino=geom.Pos2d(-1,0)
s=geom.Segment2d(ptoOrigen,ptoDestino)
alpha=s.angleVector(u)
ratio4= math.degrees(alpha)-180

ptoDestino=geom.Pos2d(-1,-1)
s=geom.Segment2d(ptoOrigen,ptoDestino)
alpha=s.angleVector(u)
Exemplo n.º 23
0
# -*- coding: utf-8 -*-

import xc_base
import geom
import math

circ1 = geom.Circle2d(geom.Pos2d(0.0, 0.0), 1.0)
alpha = math.radians(0)
v = geom.Vector2d(math.cos(alpha), math.sin(alpha))
pol1 = circ1.getInscribedPolygon(3, 0)

ptsTang = pol1.getApproxTangentPositions(v)
pt0 = ptsTang[0]
pt0Teor = geom.Pos2d(-0.125, -0.649519)

alpha = math.radians(45)
v = geom.Vector2d(math.cos(alpha), math.sin(alpha))
ptsTang = pol1.getApproxTangentPositions(v)
pt1Teor = geom.Pos2d(0.4375, -0.32476)
pt1 = ptsTang[0]

alpha = math.radians(90)
v = geom.Vector2d(math.cos(alpha), math.sin(alpha))
ptsTang = pol1.getApproxTangentPositions(v)
pt2Teor = geom.Pos2d(1, 0)
pt2 = ptsTang[0]

alpha = math.radians(135)
v = geom.Vector2d(math.cos(alpha), math.sin(alpha))
ptsTang = pol1.getApproxTangentPositions(v)
pt3Teor = geom.Pos2d(0.4375, 0.32476)
Exemplo n.º 24
0
 def getFoundationPlane(self):
     ''' Returns the foundation plane.'''
     v = geom.Vector2d(0.0, -self.footingThickness / 2.0)
     toeEndPos = self.getWFToeEndPosition() + v
     heelEndPos = self.getWFHeelEndPosition() + v
     return geom.Line2d(toeEndPos, heelEndPos)
Exemplo n.º 25
0
 def getToePosition(self):
     ''' Returns the position of the toe (for overturning moment computation).'''
     return self.getWFToeEndPosition() + geom.Vector2d(
         0.0, -self.footingThickness / 2.0)
Exemplo n.º 26
0
ratio3 = 10
feProblem = xc.FEProblem()
preprocessor = feProblem.getPreprocessor
# Define materials
scc = typical_materials.defElasticSection3d(preprocessor, "scc", 1, 1, 1, Iz,
                                            Iy, 4)
scc.sectionProperties.rotate(math.radians(45))

I1 = scc.sectionProperties.getI1()
I2 = scc.sectionProperties.getI2()
I1axis = scc.sectionProperties.getAxis1VDir()
I2axis = scc.sectionProperties.getAxis2VDir()
strongAxis = scc.sectionProperties.getVDirStrongAxis()
weakAxis = scc.sectionProperties.getVDirWeakAxis()

strongAxisTeor = geom.Vector2d(math.sqrt(2) / 2, math.sqrt(2) / 2)
ratio0 = (strongAxis - strongAxisTeor).getModulus()
ratio1 = (I1axis - strongAxisTeor).getModulus()
weakAxisTeor = geom.Vector2d(-math.sqrt(2) / 2, math.sqrt(2) / 2)
ratio2 = (weakAxis - weakAxisTeor).getModulus()
ratio3 = (I2axis - weakAxisTeor).getModulus()
''' 
print "Iz: ",Iz
print "I1: ",I1
print "Axis 1: ",I1axis
print "Strong axis: ",strongAxis
print "Iy: ",Iy
print "I2: ",I2
print "Axis 2: ",I2axis
print "Weak axis: ",weakAxis
print "ratio0= ",ratio0
Exemplo n.º 27
0
ratio2= 10
ratio3= 10
prueba= xc.ProblemaEF()
preprocessor=  prueba.getPreprocessor   
# Define materials
scc= typical_materials.defElasticSection3d(preprocessor, "scc",1,1,1,Iz,Iy,4)
scc.sectionProperties.rotate(math.radians(45))

I1= scc.sectionProperties.getI1()
I2= scc.sectionProperties.getI2()
ejeI1= scc.sectionProperties.getVDirEje1()
ejeI2= scc.sectionProperties.getVDirEje2()
ejeFuerte= scc.sectionProperties.getVDirStrongAxis()
ejeDebil= scc.sectionProperties.getVDirWeakAxis()

ejeFuerteTeor= geom.Vector2d(math.sqrt(2)/2,math.sqrt(2)/2)
ratio0= (ejeFuerte-ejeFuerteTeor).getModulo()
ratio1= (ejeI1-ejeFuerteTeor).getModulo()
ejeDebilTeor= geom.Vector2d(-math.sqrt(2)/2,math.sqrt(2)/2)
ratio2= (ejeDebil-ejeDebilTeor).getModulo()
ratio3= (ejeI2-ejeDebilTeor).getModulo()

''' 
print "Iz: ",Iz
print "I1: ",I1
print "Eje 1: ",ejeI1
print "Eje fuerte: ",ejeFuerte
print "Iy: ",Iy
print "I2: ",I2
print "Eje 2: ",ejeI2
print "Eje debil: ",ejeDebil
Exemplo n.º 28
0
# -*- coding: utf-8 -*-

from __future__ import print_function
import xc_base
import geom
import math


def getAbs(vt1):
    return vt1.getModulus()


def getAngle(vt1, vt2):
    return vt1.getAngle(vt2)


u = geom.Vector2d(1, 0)
v = geom.Vector2d(1, 1)
modulus = getAbs(u)
alpha = getAngle(v, u)

ratio1 = modulus - 1
ratio2 = math.degrees(alpha) - 45

import os
fname = os.path.basename(__file__)
if math.fabs(ratio1) < 1e-10 and math.fabs(ratio2) < 1e-10:
    print("test ", fname, ": ok.")
else:
    print("test ", fname, ": ERROR.")
Exemplo n.º 29
0
# -*- coding: utf-8 -*-
from __future__ import print_function
import xc_base
import geom
svd1 = geom.SlidingVectorsSystem2d()
ptoAplic = geom.Pos2d(1, 1)
vectorDir = geom.Vector2d(1, 0)
vec = geom.SlidingVector2d(ptoAplic, vectorDir)
svd1 += vec
ptoAplic = geom.Pos2d(1, -1)
vec = geom.SlidingVector2d(ptoAplic, vectorDir)
svd1 += vec

zml1 = svd1.zeroMomentLine()
vDir1 = zml1.getVDir()

svd2 = geom.SlidingVectorsSystem2d()
ptoAplic = geom.Pos2d(0, 0)
vectorDir = geom.Vector2d(0, 1)
vec = geom.SlidingVector2d(ptoAplic, vectorDir)
svd2 += vec
ptoAplic = geom.Pos2d(-1, 0)
vec = geom.SlidingVector2d(ptoAplic, vectorDir)
svd2 += vec

zml2 = svd2.zeroMomentLine()
vDir2 = zml2.getVDir()
ratio = (vDir1.x - 1.0)**2 + vDir1.y**2 + vDir2.x**2 + (vDir2.y - 1.0)**2

# print('zml1= ', zml1)
# print('vDir1= ', vDir1)
Exemplo n.º 30
0
uTeor= 8*P*f/L**2

p0= geom.Pos2d(0,e1)
p1= geom.Pos2d(L/2.0,(e1+e2)/2.0-f)
p2= geom.Pos2d(L,e2)

traceCable= pb.Parabola(p0,p1,p2)
 
x= 0.0
err= 0
nPts= 5
for i in range(1,nPts+2):
  x= float(i-1)*L/float(nPts)
  alpha= traceCable.alpha(x)
  r= traceCable.curvature(x)
  Px= P/math.cos(alpha)*geom.Vector2d(math.cos(alpha),math.sin(alpha))
  u= (P/math.cos(alpha))*r
  err+= (u-uTeor)**2

err= math.sqrt(err)

#print "err= ", err
  
import os
from misc_utils import log_messages as lmsg
fname= os.path.basename(__file__)
if (err<0.01):
  print "test ",fname,": ok."
else:
  lmsg.error(fname+' ERROR.')