Amir Posted February 16, 2011 Posted February 16, 2011 I have master / slave working with ACC-28E. The question I have is how to control the speed of reaction to a new master command position. Below I describe the setup and algorithm. Motor[2] is stopped in closed loop during following. This is working fine, but when a new M1 is calculated, the slave motor 2 seems to want to jump to the new commanded master position as opposed to travel there in a given speed. Is there a way to control the speed? //---------------// Setup the analog following in pp_Startup.txt//--------------- //Enc Table 9 is used for Z axis following the probeEncTable[9].Type = 1 //Parallel 32 bitm1->s.user:$20.0.32 //to set the master positionEncTable[9].pEnc = Sys.pushm + $20 //s.user:$20.0.32EncTable[9].Index1 = 0EncTable[9].Index2 = 0EncTable[9].Index3 = 0EncTable[9].Index4 = 0 //integrate offEncTable[9].ScaleFactor = 1; //Set the Motor2 to follow EncTable 9M1 = 0 //to set the initial position followingMotor[2].pMasterEnc = EncTable[9].aMotor[2].MasterPosSf = 1;Motor[2].MasterCtrl = 1; //enable master following //-------------------------// Following Algorithm in rticplc.c//-------------------------//read the analog inputAD1 = (*(pACC28E + 0xa00000/4 + 0)) /65536; //Calculate the error and multiply by a gain (P100)FollowAmount = p100 * ((34000 - AD1) / 34000); //Set the master encoder for motor 2SetPtrVar(M1, FollowAmount);
bradp Posted February 16, 2011 Posted February 16, 2011 Look in the saved data structures manual for these 3 structures. Motor[x].SlewMasterPosSf, Motor[x].MasterMaxAccel, Motor[x].MasterMaxSpeed. They will give you the ability to do what you want. But remember when you set accel and velocity limits then you are not going to exactly follow the master input, which I think in your case is OK but others who read this might need to know. Another way this has been accomplished is to use the ACC28 input as a reference and have the PLC turn it into a JOG command. In this way the analog input can be either a speed or postion reference (whatever the application calls for) and you have the speed and acceleration control of a jog move. Motor[x].SlewMasterPosSfDescription: Position following ratio slew rateRange: Non-negative floating-pointUnits: (Motor units per master unit) per servo cycleDefault: 0.0 (slew rate control disabled)Legacy I-variable alias: noneMotor[x].SlewMasterPosSf specifies the rate of change of the position-following ratio on enabling and disabling of the position-following function, and on changes in the desired ratio in Motor[x].MasterPosSf. If Motor[x].SlewMasterPosSf is set to the default value of 0.0, slew rate control is disabled, and changes in the following ratio take place immediately as step changes.If Motor[x].SlewMasterPosSf is set to a value greater than 0.0, slew rate control is enabled, and each servo cycle, the actual position-following ratio used in that servo cycle, found in status element Motor[x].ActiveMasterPosSf, will change by the magnitude of Motor[x].SlewMasterPosSf until the desired value in Motor[x].MasterPosSf is reached, or in the case of disabling following, until 0.0 is reached.If it is desired to enable or disable following, or to change the following ratio, while the master signal is changing (“on-the-fly” changes), it is important to set Motor[x].MasterPosSf to an appropriate positive value so the resulting motor acceleration or deceleration is properly controlled. Motor[x].MasterMaxAccelDescription: Position following maximum acceleration magnitudeRange: Non-negative floating-pointUnits: Motor units per servo cycle per servo cycleDefault: 0.0 (acceleration limiting disabled)Motor[x].MasterMaxAccel specifies the magnitude of the maximum change in motor velocity that can result from position following in any servo cycle, and therefore sets the maximum acceleration that can result from position following. It also controls whether any “excess” following resulting from following speed limiting is discarded or retained.If Motor[x].MasterMaxAccel is set to the default value of 0.0, this acceleration limiting is disabled, and the full contribution of position following to the motor commanded acceleration is always used. In addition, if following speed limiting is enabled by Motor[x].MasterMaxSpeed, any difference in following distance between the unlimited command and the limited speed actually used is discarded, so that position synchronization with the master is lost.If Motor[x].MasterMaxAccel is set to a value greater than 0.0, acceleration limiting is enabled, and each servo cycle, the change in the magnitude of the following from the previous servo cycle, as computed from the change in the master and the active following ratio, is compared to Motor[x].MasterMaxAccel. If the magnitude of the change in following is larger than this limit, the value of the limit (in the direction of the following) is used instead, thus providing a clamp on the acceleration resulting from following.With following acceleration limiting active, any difference in following distance between the unlimited command and the limited speed and/or acceleration actually used is retained, and accumulated, so that it can be “released” when the following is no longer limited. The process of releasing the accumulated excess proceeds at the maximum rate that does not result in either the maximum following speed or acceleration being violated. When the excess is fully released, position synchronization between the motor and its master is restored.As the excess from limiting is being accumulated, Power PMAC is not just considering the speed and acceleration at the moment, but the speed and acceleration profile required to bring the following profile to a stop within the specified limits, assuming each servo cycle that no further master position change occurs. This can cause the speed and/or acceleration of the following to be limited to lower values than those of the specified limits. Motor[x].MasterMaxSpeedDescription: Position following maximum velocity magnitudeRange: Non-negative floating-pointUnits: Motor units per servo cycleDefault: 0.0 (speed limiting disabled)Motor[x].MasterMaxSpeed specifies the magnitude of the maximum change in motor position that can result from position following in any servo cycle, and therefore sets the maximum speed that can result from position following. If Motor[x].MasterMaxSpeed is set to the default value of 0.0, this speed limiting is disabled, and the full contribution of position following to the motor commanded velocity is always used.If Motor[x].MasterMaxSpeed is set to a value greater than 0.0, speed limiting is enabled, and each servo cycle, the magnitude of the following, as computed from the change in the master and the active following ratio, is compared to Motor[x].MasterMaxSpeed. If the magnitude of the following is larger than this limit, the value of the limit (in the direction of the following) is used instead, thus providing a clamp on the speed resulting from following.Depending on the setting of Motor[x].MasterMaxAccel, the “excess” in the following value can be discarded, so that any position synchronization to the master is lost when the following speed is limited, but there will be no residual motion after the master has stopped, or the “excess” in the following value can be retained and “released” when the limit is no longer exceeded, so as to recover full position synchronization with the master.If trajectory-commanded motion for the motor (from jogging moves or programs) is superimposed on top of the position-following, only the component of motor motion resulting from the following is limited by this function.
Amir Posted February 23, 2011 Author Posted February 23, 2011 m1->s.user:$20.0.32 //to set the master position EncTable[9].pEnc = Sys.pushm + $20 //s.user:$20.0.32 EncTable[9].ScaleFactor = 1; Just found out that the M1 assignment is an Integer and not a floating point. You may use EncTable[9].ScaleFactor = 1/1000 eg. to add 3 more decimal places.
Recommended Posts