Example #1
0
    def _update_global_forces(self):        

# Fluid Weight in Pipe
#--------------------------------------------
        if self.model in ["TUBE","TUYAU"]:
            if tub.current_rho_fluid:
                density_fluid=tub.current_rho_fluid
                outer_radius=self.section[0]
                wall_thickness=self.section[1]
                force_grav_fluid= math.pi*(outer_radius-wall_thickness)**2*density_fluid*tub.G
                print("Fluid_Weight N/mm", force_grav_fluid)
                self.linear_force.append(eu.Vector3(0,0,-force_grav_fluid))
                print("Fluid_Weight N/mm", eu.Vector3(0,0,-force_grav_fluid))

# Insulation of the Pipe
#--------------------------------------------
        if self.model in ["TUBE","TUYAU"]:
            if tub.current_insulation:            
                [insulation_thickness, insulation_density]=tub.current_insulation
                outer_radius=self.section[0]
    
    
                force_grav_insulation= math.pi*((outer_radius+insulation_thickness)**2-outer_radius**2)*insulation_density*9.81
                print("Insulation_Weight N/mm", force_grav_insulation)
                self.linear_force.append(eu.Vector3(0,0,-force_grav_insulation))
Example #2
0
def Moment(rx=0,ry=0,rz=0,reference="local"):
    """appends a moment to the current tubapoint
            
       Multiple moments can be summed up. 
    """
    moment = eu.Vector3(rx,ry,rz)
    tub.current_TubaPoint.moment.append(moment)
Example #3
0
def V(x,y,z,name_point=""):
    """Creates a vector and an end point starting from the specified tubapoint. If no tubapoint-name is specified, the vector will be created starting from the last created point. The direction is defined by the
    user input x,y,z.
    """

    logging.debug("Processing V: "+name_point)
    print(name_point)
    if not name_point:
        name_point="P"+str(tub.tubapoint_counter)
    print("name", name_point)
    
    #Get start point of vector
    vector=eu.Vector3(x,y,z)    
    start_tubapoint=tub.current_tubapoint
    end_pos=start_tubapoint.pos+vector
    
    #Create the new tubapoint-Object "end_tubapoint" for the Vector
#------------------------------------------------------------------------------
    name_point=TubaPoint(end_pos.x,end_pos.y,end_pos.z,name_point)
#------------------------------------------------------------------------------ 
    end_tubapoint=tub.current_tubapoint
                  
    name_vector="V"+str(tub.tubavector_counter)
    #Create the TubaVector object containing all the informations of the line element (Material, Temperature, Pressure etc)
#------------------------------------------------------------------------------
    name_vector=TubaVector(start_tubapoint, end_tubapoint, vector, name_vector)
#------------------------------------------------------------------------------ 
    logging.debug("start_point connected?: "+str(start_tubapoint.vd2x))
Example #4
0
def Force(x=0,y=0,z=0,reference="global"):
    """appends a force-vector to the current tubapoint
            
       Multiple force vectors can be summed up. 
    """
  
    force=eu.Vector3(x,y,z)
    tub.current_tubapoint.force.append(force)    
Example #5
0
def LinearForce(x=0,y=0,z=0,reference="global"):
    """appends a linear force-vector to the last created vector.
       [N/mm]
            
       Multiple force vectors can be summed up. 
    """    
    force=eu.Vector3(x,y,z)
    tub.dict_tubavectors[-1].linear_force.append(force)    
Example #6
0
current_model = "TUBE"
current_section = []
current_material = "SS316"

current_rho_fluid = 0
current_insulation = []

tubapoint_counter = 0
dict_tubapoints = []
current_tubapoint = []

tubavector_counter = 0
dict_tubavectors = []
current_tubavector = []

vd1x0 = eu.Vector3(0, 1, 0)  # default dihedral vector 1
vd2x0 = eu.Vector3(1, 0, 0)

V_gravitation = eu.Vector3(0, 0, -9.8)  # gravitational vector (m/s²)

MeshNbElement = 8

colors = {
    "BLOCK": "1,1,0",
    "POUTRE_RECTANGLE": "0.8,0.8,0.8",  #grey
    "RECTANGULAR": "0.8,0.8,0.8",  #grey
    "POUTRE": "0.8,0.8,0.8",  #grey
    "TUBE": "0.6,0.6,0.6",  #grey
    "BAR": "0.4,0.4,0.4",  #grey
    "CABLE": "0.8,0.8,0.8",  #grey
    "TUYAU": "0.9,0.9,0.9",  #grey
Example #7
0
def Bent(bending_radius,arg1="",arg2="",arg3="intersect",name=""):
    """There are 3 general ways to create a pipe bent:
    

#.  Bent(bending_radius,arg1=Vector3): \n
    arg1 as a vector defines the new direction after the bent
    With this function, it's not possible to create 180°-bents as the bending plane
    would not be defined. A workaround would be to define 2 consecutive 90°-bents \n
    
#.  Bent(bending_radius,arg1=ang_Bent,arg2=ang_Orient): \n
    With the input arg1=bent angle and arg2=orientation angle (defined as a dihedral angle),
    the new direction after the bent can be calculated. \n

#.  Give 2 absolut vectors and make bent in between -- still not implemented


arg3 defines around which point the bent will be created.
For "add" the start_tubapoint of the Bent will be the end_tubapoint of the last vector.\n
For "intersect" the last vector will be changed. Its end_tubapoint will be defined as
intersection point of the current and new vector of the piping

    """

   #TO DO: when intersection problem arises (no vector before bent to move old end_tubapoint)--> switch automatically to add and bring a warning

    if arg3=="intersect":
        tub.current_tubapoint.pos=tub.current_tubapoint.pos - \
                                     tub.current_tubapoint.vd2x*bending_radius
        start_tubapoint=tub.current_tubapoint
    elif arg3=="add":
# The end_tubapoint of the last vector is as well the start_tubapoint of the bent.
# The intersection point in x=bentradius is created

        start_tubapoint=tub.current_tubapoint
    else:
        logging.ERROR("Only \"intersect\" or \"add\" are allowed as input")

    print(start_tubapoint.__dict__)
    logging.debug("bending_radius ="+str(bending_radius)+ "  Mode: "+str(arg3))
    logging.debug("currentPoint: "+str(tub.current_tubapoint.pos))
    logging.debug("start_tubapoint.Pos: "+str(start_tubapoint.pos))
#    logging.debug("Intersectpoint: "+str(intersectpoint))


    if arg1=="" and arg2=="":  #1. version of the bentfunction Bent(bending_radius)
        pass

    elif  arg1!="" and arg2=="": #2. version of bentfunction Bent(bending_radius,arg1=Vector3)
        new_direction=eu.Vector3(0, 0, 0) + arg1
        bent_dot=start_tubapoint.vd2x.dot(new_direction.normalized())
        logging.debug("bent_dot: "+str(bent_dot))
        angle_bent=math.acos(bent_dot)


    elif arg1!="" and arg2!="":  #3. version of the bentfunction  Bent(bending_radius,arg1=ang_Bent,arg2=ang_Orient)
        angle_bent=arg1*math.pi/180
        angle_orient=arg2*math.pi/180
        new_direction=dihedral_vector(start_tubapoint.vd1x,
                                  start_tubapoint.vd2x,angle_bent,angle_orient)


    logging.debug("Bent-Vector"+str(new_direction))
    
    #In Case of angle_bent=180degree the function would have problems to construct the arc. Therefore, its split in 2x90degree
    if angle_bent==math.pi :
        print("Spezial case angle=180")
        Bent(bending_radius,angle_bent/2*180/math.pi,angle_orient*180/math.pi,arg3,name)
        Bent(bending_radius,angle_bent/2*180/math.pi,angle_orient*180/math.pi,arg3,name)
    else:
           #The second version is the standard version. Version1 and Version3 are porcessed to be  handeled in Version2
        rotation_axis=start_tubapoint.vd2x.cross(new_direction)    #normal vector of bent plane


        logging.debug("new_direction "+str(new_direction))

        vector_start_center=rotation_axis.cross(start_tubapoint.vd2x).normalized()    #from start_tubapoint go to direction centerpoint
        logging.debug("vector_start_center"+str(vector_start_center))
        center_pos=start_tubapoint.pos+vector_start_center*bending_radius
     
        name_center_tubapoint="P"+str(tub.tubapoint_counter-1)+"_"+str(tub.tubapoint_counter)+"_center"

        #------------------------------------------------------------------------------
        name_center_tubapoint=TubaPoint(center_pos.x,center_pos.y,center_pos.z,name=name_center_tubapoint,nocount=True)
        #------------------------------------------------------------------------------

        vector_center_end=-vector_start_center.rotate_around(rotation_axis,angle_bent).normalized()

        end_pos=center_pos+vector_center_end*bending_radius


        
        if name=="":
            name_end_tubapoint="P"+str(tub.tubapoint_counter)

        else:
            name_end_tubapoint = name
     
        print(bending_radius)
        #------------------------------------------------------------------------------
        name_end_tubapoint = TubaPoint(end_pos.x,end_pos.y,end_pos.z,
                                     name=name_end_tubapoint)
        #------------------------------------------------------------------------------

        #Create the BendObject and add it to the tub.dic_Vectors list  with (Tubastart_tubapoint,Tubaend_tubapoint,TubaCenterPoint)
        #TubaBent(TubaVector): __init__(self,start_tubapoint,end_tubapoint,CenterPoint,bending_radius,VdN,name_vect):
        name_vect = "V_Bent"+str(tub.tubavector_counter)
     
        #------------------------------------------------------------------------------
        name_vect = TubaBent(start_tubapoint,name_end_tubapoint,name_center_tubapoint
                           ,bending_radius,rotation_axis,angle_bent, name_vect)
                
        #------------------------------------------------------------------------------

        logging.debug("===================================")
        logging.debug("                                   ")
        logging.debug("           tubabent                ")
        logging.debug("Start_Tubapoint "+str(name_vect.start_tubapoint.name))
        logging.debug("End_Tubapoint "+str(name_vect.end_tubapoint.name))
        logging.debug("bending_radius "+str(name_vect.bending_radius))
        logging.debug("rotation_axis "+str(name_vect.rotation_axis))
        logging.debug("angle_bent "+str(name_vect.angle_bent*180/math.pi))
        logging.debug("                                   ")
        logging.debug("start_tubapoint.Vd2x "+str(name_vect.start_tubapoint.vd2x))
        logging.debug("end_tubapoint.Vd2x "+str(name_vect.end_tubapoint.vd2x))
        logging.debug("                                   ")
        logging.debug("Tubabent:  "+str(name_vect.__dict__))
        logging.debug("===================================")