Program Examples:Cyclic recording of single Axis/zh-hans

From SoftMC-Wiki
< Program Examples:Cyclic recording of single Axis
Revision as of 07:03, 17 July 2017 by Chi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
语言: English  • 中文(简体)‎

简介

以下示例演示如何在单轴中记录外部干扰。
该实例是在实验室条件下电机无负载编写的。以低速旋转电机,几秒钟后,使用外部设备将电机停止。

程序流程

程序是指在运动过程中失败的轴。
该程序设置一个轴的运动条件并开始记录运动数据。
在用户设置的条件下,程序停止记录并停止轴运动。

程序

'------------------------------------------------------------------------------
' File:        <Cyclic_rec>.prg
' Purpose:     To record an external interference to axis
' Version:     1.00
' Author:      <Inon Shoshani>
' Description: External interference recording - look for the Introduction
' History:     2017-06-12   V1.00
'              Created
'------------------------------------------------------------------------------


common shared ii as long = 1   '' define a var as a flag
program

    attach a1
        
            Record CycRec.rec 500 Gap = 4 RingBuffer=On RecData =  a1.VFb ,a1.VCmd 
            RecordOn
            
                a1.En= 1
                jog a1 360                  ''set motion command 360 degree per second.
                sleep 1000                  '' wait the velocity to become constant
                while (ii=1)                ''run while the falg is up
                    sleep 10                ''10 millisecond for the proccesor
                    if  a1.VFb <50  then    ''if the motion  fail
                          RecordClose       '''stop the recording
                          sleep 10
                          print "---------"  '' monitoring the fault
                          print "fail time:",  sys.Time '' monitoring the fault
                          print "a1.VFb = " , a1.VFb '' monitoring the fault                      
                          ii=0              ''flag down                                                
                          a1.En =0                                                                             
                          detach a1                                                                             
                    end if
                end while
        
end program ' <Cyclic_rec>.prg



图形

在下图中,您可以看到速度指令保持不变,而外部干扰明显降低了速度。

graph.JPG