IMAC 在运行中改变反馈.doc_第1页
IMAC 在运行中改变反馈.doc_第2页
IMAC 在运行中改变反馈.doc_第3页
IMAC 在运行中改变反馈.doc_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Turbo PMAC Program ExamplesApr-2005Changing Feedback on the FlySometimes multiple sensors are required to cover the full range of motion for an axis. In one common case, multiple linear scales, each one with its own read head, are needed to handle the full linear range of motion. Switching between the feedback sensors must be done “on the fly”, with no disturbance to the motion.It is easy in Turbo PMAC controllers to switch on the fly between sensors of equivalent resolution, by changing the source address of the feedback I-variable. The only special requirement is that the “last source position” register be updated to reflect the position of the new sensor in the same servo cycle as the address is changed. This requirement necessitates that the actual change be done in a foreground program such as PLCC 0 or an Open Servo algorithm for a spare “motor” on Turbo PMAC. If PLCC 0 is used, it must be confirmed that these operations can complete reliably before the next servo interrupt occurs.In this example, there are three position sensors for Motor 1. In its proper range, a sensor is used simultaneously for position-loop feedback, velocity-loop feedback, and commutation-angle feedback. Each of these functions has its own address I-variable to be changed, and its own “last position” register whose contents must be changed when the sensor is switched. Note that the position and velocity loops used processed position values from the encoder conversion table (ECT), but commutation uses “raw” position values from encoder counters in the Servo ASIC.; Substitutions and definitions; Address I-variables#define Mtr1PosFdbkAdrI103; Reg for position-loop feedback#define Mtr1VelFdbkAdrI104; Reg for velocity-loop feedback#define Mtr1CommFdbkAdrI183; Reg for commutation feedback; Sensor source addresses (processed values in conversion table)#define Sensor1PosAdr$003501; ECT result 0 (from I8000)#define Sensor2PosAdr$003502; ECT result 1 (from I8001)#define Sensor3PosAdr$003503; ECT result 2 (from I8002); M-variables for processed sensor positions#define Sensor1PosM8000Sensor1Pos-X:$003501,0,24,S; 1st result line of ECT#define Sensor2PosM8001Sensor2Pos-X:$003502,0,24,S; 2nd result line of ECT#define Sensor3PosM8002Sensor3Pos-X:$003503,0,24,S; 3rd result line of ECT; Sensor raw counter addresses (in Servo ASIC)#define Sensor1CtrAdr$079201; IC4 Ch1 encoder counter#define Sensor2CtrAdr$079209; IC4 Ch2 encoder counter#define Sensor3CtrAdr$079211; IC4 Ch3 encoder counter; M-variables for raw sensor counter positions#define Sensor1CtrM7997Sensor1Ctr-X:$079201,0,24,S; IC4 Ch1 encoder counter#define Sensor1CtrM7998Sensor2Ctr-X:$079209,0,24,S; IC4 Ch2 encoder counter#define Sensor1CtrM7999Sensor3Ctr-X:$079211,0,24,S; IC4 Ch3 encoder counter; M-variables for last position registers#define Mtr1LastActPosM150Mtr1LastActPos-Y:$00008A,0,24,S; #1 previous pos-loop source#define Mtr1LastVelPosM151Mtr1LastVelPos-Y:$00009D,0,24,S; #1 previous vel-loop source#define Mtr1LastCommPosM152Mtr1LastCommPos-Y:$0000B2,0,24,S; #1 previous commutation source; M-variable for servo cycle counter#define ServoCycCtrM100ServoCycCtr-X:$000000,0,24,S; Increments every servo interrupt; General-purpose user variables for specifying sensor#define SensorNumP8000; Active sensor#define LastSensorNumP8001; Sensor of previous scan#define StartServoCycP8002; Servo counter at start of switch; This foreground PLC performs the actual feedback switching; Some other task must determine when the switching must occur; and change the SensorNum variable. Some other task must also; initialize the motor to the proper sensor at power-on/reset.; This PLC includes a check to make sure the entire swap takes; place in a single servo cycle (mainly for debugging purposes).OPEN PLCC 0 CLEARIF (SensorNum!=LastSensorNum); Change in sensor? StartServoCyc=ServoCycCtr; Log starting cycle IF (SensorNum=1); Select first sensor Mtr1PosFdbkAdr=Sensor1PosAdr Mtr1LastActPos=Sensor1Pos Mtr1VelFdbkAdr=Sensor1PosAdr Mtr1LastVelPos=Sensor1Pos Mtr1CommFdbkAdr=Sensor1CtrAdr Mtr1LastCommPos=Sensor1Ctr LastSensorNum=1; For next scan ELSE IF (SensorNum=2); Select second sensor Mtr1PosFdbkAdr=Sensor2PosAdr Mtr1LastActPos=Sensor2Pos Mtr1VelFdbkAdr=Sensor2PosAdr Mtr1LastVelPos=Sensor2Pos Mtr1CommFdbkAdr=Sensor2CtrAdr Mtr1LastCommPos=Sensor2Ctr LastSensorNum=2; For next scan ELSE; Select third sensor Mtr1PosFdbkAdr=Sensor3PosAdr Mtr1LastActPos=Sensor3Pos Mtr1VelFdbkAdr=Sensor3PosAdr Mtr1LastVelPos=Sensor3Pos Mtr1CommFdbkAdr=Sensor3CtrAdr Mtr1LastCommPos=Sensor3Ctr LastSensorNum=3; For next scan ENDIF ENDIF IF (ServoCycCtr!=StartServoCyc); New servo cycle? CMDK; Too late, kill all motors ENDIFENDIFCLOSENote that most of the M-variables in this compiled PLC could be replaced with L-variables for higher efficiency, but since actual action does not happen often, this is not very important, unless it is required for the PLC to finish its scan reliably before the start of the next servo interrupt.Following is a sample background PLC program that could be used to initialize the system and to decide when to switch the sensors. It assumes that Sensor 1 is at the most negative end of travel and Sensor 3 is at the most positive end. It also assumes that each sensor has a high-true “sensor OK” signal wired into the channels T-flag input.; Additional substitutions and definitions#define Sensor1OKM7994Sensor1OK-X:$078200,23,1; IC2 Chan 1 T flag input#define Sensor1OKM7995Sensor2OK-X:$078208,23,1; IC2 Chan 2 T flag input#define Sensor1OKM7996Sensor3OK-X:$078210,23,1; IC2 Chan 3 T flag input#define Mtr1CmdVelM160Mtr1CmdVel-D:$000086; Instant command vel register#define CS1Timer1I5111; Servo countdown timer#define ValidSensorP8003; Status flag#define EnableWaitTime2259; In servo cycles (1 sec default)OPEN PLC 22 CLEAR; Initialize to first active sensorLastSensorNum=0IF (Sensor1OK=1); Valid signal from 1st encoder SensorNum=1 ValidSensor=1ELSE IF (Sensor2OK=1); Valid signal from 2nd encoder SensorNum=2 ValidSensor=1 ELSE IF (Sensor3OK=1); Valid sig

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论