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

From SoftMC-Wiki
Jump to: navigation, search
m (Graph)
 
Line 1: Line 1:
 +
{{Languages|Program_Examples:Cyclic_recording_of_single_Axis}}
 
= Introduction =
 
= Introduction =
 
The following example demonstrate how to record an external interference in single axis. <br>
 
The following example demonstrate how to record an external interference in single axis. <br>

Latest revision as of 06:47, 17 July 2017

Language: English  • 中文(简体)‎

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



Graph

In the graph below you see the velocity command stay the same, while external interference reduce the velocity dramatically.

graph.JPG