Cut To Length (Punching) Application/zh-hans

From SoftMC-Wiki
Jump to: navigation, search
语言: English  • 中文(简体)‎

简介

偏心冲床(曲柄压力机)在由凸轮到轮的角位置的伺服驱动的进给装置进给。 轮位置是由被连接到驱动器作为外部位置信号(PEXT)的外部反馈装置(旋转变压器,编码器等)进行测定。

应用图

cut2len1.png

轮的角位置是在其运行期间连续增加的主源信号。 在轮的每一圈,在一个起始和终止角度值之间进给轴应该停止。

运动曲线

进给轴的运行曲线看起来像:

cut2len2.png

构建此应用程序的主要任务是根据以下参数设计凸轮: • 轮转角,轮转一整圈所需的pext值。 • 起始角度,冲孔开始时的轮的角度。 • 终止角度,材料移动时轮转过角度或冲孔结束时的轮的角度。 • 切割长度,在终止角度到下一个起始角度从轴位置的距离。 • 从轴的最大加速度和速度,在凸轮运动过程中不能超过这些值。 另外一个限制是决定采用速度梯形曲线来进行从动。 可以采用另一个运动曲线,但方程式将不同。 假设轮速度是恒定的,对于计算而言是已知的。 现在,要从给定的A,L,T值计算运动曲线,请参见示例末尾的附录。

程序

common shared c1 as cam

dim shared toolong as error "The given cut length is too long for the given slave accel."
dim shared toofast as error "Slave axis can not move that fast"

' Shared profile parameters:..............................................
dim shared lprof        as double  ' total length 
dim shared aprof        as double  ' acceleration used
dim shared vprof        as double  ' cruise velocity
dim shared t_acc_prof   as double  ' acceleration duration
dim shared t_dec_prof   as double  ' end of cruise phase
dim shared t_tot_prof   as double  ' total velocity trapeze duration
'.........................................................................

program
    ' Process data
    dim sangle      as double = 10  ' start to cut at this angle
    dim eangle      as double = 60  ' finish the cut at this angle
    dim rev         as double = 360 ' full turn of the wheel
    dim Vwheel      as double = 60  ' RPM - velocity of the wheel
    
    dim CutLength   as double = 20  ' mm of the slave motion
    dim CutAngle    as double
    dim CutTime     as double 
    dim i           as long
    
    ' Variables used in cam computation
    dim t           as double
    dim t_from_end  as double

    ' Creating 1000 points in the cam
     createcamdata 1000 c1  
                  
    ' Computing the next motion
    CutAngle = rev - (eangle-sangle)    ' The wheel passes this angel while it moves
    CutTime  = CutAngle/(Vwheel*360/60) ' Time needed to move to another cut (sec)
    with A1
    
        call ProfileLTA(CutLength,CutTime,Acc)
        
        ' Start computing the cam table
        ' t is relative time of velocity trapeze profile
        for i = 1 to c1.size
           c1.MasterData[i] = (i-1)*rev/c1.size ' Defining a uniform master axis
           
           select case (c1.MasterData[i])
              case is < sangle     ' it is a rotary axis in cases when master < start
                  ' we need to compute the relative time from the end    
                  t_from_end = (sangle - c1.MasterData[i])/(Vwheel*360/60)
                  t = CutTime - t_from_end
                  c1.SlaveData[i] = VTProfile(t)  - CutLength 
                  
              case is <= eangle    ' master is between start and end - no motion of slave:
                  c1.SlaveData[i] = 0.0
                  
              case is > eangle     ' Time passed after exit [start,end] master segment
                  t = (c1.MasterData[i]-eangle)/(Vwheel*360/60)
                  c1.SlaveData[i] = VTProfile(t)
                  
           end select 
        next
    end with
    
    with A2
        ' Setup the cam table
        c1.Cycle            = -1 ' endless camming
        Attach
           FirstCam         = c1
           MasterSource     = A1.Pcmd   'For example with 2 axes
'           MasterSource    = pext
           GearRatio        = 1
           Slave            = CAM
           SlaveDisconnect  = 0
           En               = ON
        Detach
         
    end with
    
    Print "Cut to length Ready"
    
end program


' Velocity Trapeze pre-calculation routine
' Input: Length, Total time, max Accleration
' Global used: Vmax

sub ProfileLTA(byval L as double ,byval T as double, byval A as double)
    dim sqr as double
    
    with A1
      aprof = A
      sqr = T^2 - 4*L/A
      select case (sqr)
      
        case is < -0.004 ' less then 4ms
            throw toolong
            
        case is < 0
            ' In cases of numeric computation errors (high accel. values) this could be a small
            ' negative number. In order to avoid math error the value is cut to zero.
            sqr = 0          
            
        case else
            sqr = sqrt(sqr)
      end select
      
      vprof = 0.5*A*(T - sqr)
      if vprof > vmax then
            throw toofast
      end if
      
      ' Compute fixed points in time (end of acceleration, begin of deceleration)
      t_acc_prof = vprof/A
      t_dec_prof = T - t_acc_prof
      t_tot_prof = T
      
    end with
end sub


'.................................................................................
' Velocity Trapeze gernal purpose profile function
' uses shared variables:
' t_acc - time where acceleration ends (cruise starts)
' t_dec - time where deceleration starts (cruise ends)
' t_tot - end of movement
' aprof - accleration/deceleration value
' vprof - cruise (max) velocity
' lprof - total movement length
function VTProfile(byval t as double) as double
  select case(t)          
     case is <=0
      VTProfile = 0 
     case is <= t_acc_prof
      VTProfile = 0.5*aprof*t^2
     case is <= t_dec_prof
      VTProfile = 0.5*vprof^2/aprof + (t-t_acc_prof)*vprof
     case is < t_tot_prof
      VTProfile = lprof - 0.5*aprof*(t_tot_prof-t)^2
     case else
      VTProfile = lprof
   end select
end function

记录曲线

主轮旋转两圈(切割长度20 mm):

cut2len4.PNG

长度35mm,接近三角形曲线:

cut2len5.png

用已知的A,L,T计算速度曲线

cut2len3.PNG