Program Examples:Cyclic recording of one Axis

From SoftMC-Wiki
Revision as of 10:18, 12 June 2017 by Itay (talk | contribs) (Program flow)
Jump to: navigation, search

Introduction

The following example demonstrate how to record an external interference in one axis.

Program flow

The program refer to the axis that doesn't work well.
The program set motion conditions for the axis and start to record velocity data.
Under the conditions the user set, the program stop recording and axis motion, and raise an information message about the fault - time and velocity.

Program

'------------------------------------------------------------------------------
' 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