Difference between revisions of "AXY:Rec2Pext feature"
(category added) |
|||
Line 95: | Line 95: | ||
− | [[Category:Axystems:Motion]] | + | [[Category:Axystems:Motion Control]] |
--[[User:Miborich|Mirko]] 11:16, 5 October 2010 (CEST) | --[[User:Miborich|Mirko]] 11:16, 5 October 2010 (CEST) |
Revision as of 13:26, 23 May 2011
Replaying a previously recorded pext signal.
In cases we want to simulate an external input we can record it in a "*.rec" file and replay it later in a simulated mode. This feature was implemented in AMCS FW version 4.5.26 and it is an internal feature (means the code is in form of user functions).
First you need to add this segment into your proto.pro file:
import_c MOT_GET_RECORD(byval as long, as string) as long import_c MOT_GET_RECDATA(byval as long, byval as long,byval as long) as double import_c MOT_GET_RECRUN(byval as long,byval as long) as double import_c MOT_GET_RUNINDEX(byval as long) as long import_c MOT_REC_START(byval as long,byval as long) as long import_c MOT_SET_REC_OFFSET(byval as long,byval as double) as double import_c MOT_REC_MASTER(byval as long,byval as long) as long import_c MOT_REC_VER()as long
then the feature is started using the following example:
dim shared fname as string = "CYCREC.DAT" ' Orignal file was CYCREC.REC and I renamed it to *.dat so that do not have to send it each time. dim shared master_axis as generic axis dim shared column as long = 2 program ?VesExecute("sys.Motion = 1") call SetAxis(a1) call SetAxis(a2) attach a2 attach a1 a1.En = 0 a2.En = 0 master_axis = a1 Print "Recorder version :",MOT_REC_VER() Print "Opening file ", fname, "on axis", master_axis.elementname, ":";MOT_GET_RECORD(master_axis.elementid, fname) Print "See telnet output for details." Print "Offset = ", MOT_SET_REC_OFFSET(master_axis.elementid,17*(2^32)) Print "Hook PEXT of the axis:"; master_axis.elementname;" :"; MOT_REC_MASTER(master_axis.elementid,column); " on column:";column; " of the file" a2.MasterSource = a1.Pext attach a2 attach a1 record test.rec 500000 gap = 1 recdata = a1.Pext, a2.PCmd, a2.slave recordon Print "Go:", MOT_REC_START(master_axis.elementid,on) a2.En = 1 a1.En = 1 sleep 100 a2.Slave = 1 while MOT_GET_RUNINDEX(master_axis.elementid) < 17990 ' sleep 1 end while a2.Slave =0 sleep 1000 detach a1 detach a2 a1.En = 0 a2.En = 0 Print "Done" recordclose end program
The above program will generate the exactly the same signal as it was recorded in the CYCREC.REC file , knowing that PEXT is in column 2.
The program printout will be:
1 set. A2 set. Recorder version : 2 Opening file CYCREC.DAT on axis A1 :0 See telnet output for details. Offset = 7.30144e+10 Hook PEXT of the axis:A1 :0 on column:2 of the file Go: 1 Done
And on telnet, the content of the REC file:
AMCS-> File name = CYCREC.DAT n = 6 m = 18002 gap = 1 Recdata = PCDRYIN.PCMD,PCDRYIN.PEXT,PCDRYIN.DSTATSHR13,PCDRYIN.DCONSHR13,PCDRYIN.SLAVE,PCDRYIN.ISMOVING 108012 bytes read. size = 108012
--Mirko 11:16, 5 October 2010 (CEST)