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

From SoftMC-Wiki
Jump to: navigation, search
(Plots)
(Program)
Line 7: Line 7:
 
= Program =
 
= Program =
  
 +
= Introduction =
 +
The following example demonstrate how to record an external interference in one axis.
  
 +
= Program flow =
 +
 +
The program refer to the axis that it should check, and set motion command for it. <br>
 +
 +
 +
= Program =
 +
<pre>
 +
'------------------------------------------------------------------------------
 +
' 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
 +
</pre>
 +
 +
 +
 +
<!--
 
'''SETUP.PRG'''
 
'''SETUP.PRG'''
 
<pre>
 
<pre>
Line 28: Line 79:
  
 
</pre>
 
</pre>
 +
-->
 +
 +
<!--
 +
= Plots =
 +
[[Image:GearMotor.png|GearMotor.png|250px]]
 +
-->
  
 
= Plots =
 
= Plots =
 
[[Image:GearMotor.png|GearMotor.png|250px]]
 
[[Image:GearMotor.png|GearMotor.png|250px]]

Revision as of 10:07, 12 June 2017

Introduction

Inon

Program flow

Inon

Program

Introduction

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

Program flow

The program refer to the axis that it should check, and set motion command for it.


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



Plots

GearMotor.png