Difference between revisions of "Program Examples:Cyclic recording of one Axis"

From SoftMC-Wiki
Jump to: navigation, search
(Program flow)
m (Introduction)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= Introduction =
 
= Introduction =
The following example demonstrate how to record an external interference in one axis.
+
The following example demonstrate how to record an external interference in single axis. <br>
 +
the example was written for a motor without load, in lab conditions. Spinning the motor in low velocity and after couple of seconds hold the motor by using external device to stop it.
  
 
= Program flow =
 
= Program flow =
  
The program refer to the axis that doesn't work well. <br>  
+
The program refer to axis that fail during motion. <br>  
The program set motion conditions for the axis and start to record velocity data. <br>
+
The program set motion conditions for an axis and start recording motion data. <br>
Under the conditions the user set, the program stop recording and axis motion, and raise an information message about the fault - time and velocity.
+
Under the conditions the user set, the program stop recording and stop axis motion.
  
 
= Program =
 
= Program =

Latest revision as of 12:45, 19 June 2017

Introduction

The following example demonstrate how to record an external interference in single axis.
the example was written for a motor without load, in lab conditions. Spinning the motor in low velocity and after couple of seconds hold the motor by using external device to stop it.

Program flow

The program refer to axis that fail during motion.
The program set motion conditions for an axis and start recording motion data.
Under the conditions the user set, the program stop recording and stop axis motion.

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