aoligei Posted April 8 Share Posted April 8 I am using ethercat and the servo drives are in CSV mode, my current motion program (motion.pmc) is as follows. &1 #1->100x open prog1 f 50 x 100 x 0 close This motion program has a speed of 50, now I want to have an offset for the motor speed, say with a veloffset, but I don't want to modify the motion program, so how do I change the motor configuration file or add a plc program? I found a parameter in ethercat called velorityoffset (60B1) but it doesn't work well and I can't change the speed by adding the variable veloffset directly to the address corresponding to Motor[x].pDac (target speed). Quote Link to comment Share on other sites More sharing options...
leandro.martins Posted April 8 Share Posted April 8 (edited) The simplest way of doing that should be using the "%{constant}" online command, which overrides the motion program time-base. In that way you can increase up to two times the velocity described in motion program, sending via terminal the command %200 To return to default time-base %100 If your application really needs as an offset, and the relation between Motor[x].ServoOut and the velocity is well-known, probably you can use the the variable veloffset in Motor[x].DacBias. Edited April 8 by leandro.martins Quote Link to comment Share on other sites More sharing options...
aoligei Posted April 9 Author Share Posted April 9 It is not easy to use the Motor[1].DacBais parameter as you said. I can only try to operate the existing Motor[1].pDac address, but it still cannot modify the set speed. For example, the original The speed of the motion program is 50, but I want to add 10 to the speed offset. How to do this? Below is my code, where is the problem? xx.pmh Sys.WpKey = $AAAAAAAA Motor[1].pAmpEnable = ECAT[0].IO[3].Data.a Motor[1].AmpEnableBit = 0 Motor[1].pLimits = 0 Motor[1].pDac = Sys.Idata[1].a EncTable[1].pEnc = ECAT[0].IO[4099].Data.a EncTable[1].pEnc1 = Sys.pushm EncTable[1].ScaleFactor = 1 EncTable[1].Type = 1 Motor[1].pEnc = EncTable[1].a Motor[1].pEnc2 = EncTable[1].a Motor[1].pAmpFault = ECAT[0].IO[4102].Data.a Motor[1].ctrl =Sys.servoctrl Motor[1].ServoCtrl = 1 plc0.plc open plc0 ECAT[0].IO[1].Data = Sys.Idata[1] + 1000 //target vel close prog1.pmc open prog1 f50 x300 x0 close Quote Link to comment Share on other sites More sharing options...
leandro.martins Posted April 9 Share Posted April 9 In my opinion your plc is doing exactly the same thing if you set Motor[1].pDac =ECAT[0].IO[1].Data Motor[1].DacBias = 100 but your plc is being executed in a different task, with a different interruption. I assume that can make the motor to use the ECAT[0].IO[1].Data before the offset being applied. My best suggestion would be changing the motion program to open prog1 f(50+Q1) x300 x0 close being possible to use the Coord[x].Q[1] as your veloffset. As that isn't an option, I don't think that I have more suggestions. I hope someone else can help you. Quote Link to comment Share on other sites More sharing options...
David Jan Posted April 11 Share Posted April 11 Actually, I don't particularly understand why changing the speed setting value directly in the Ethercat address doesn't work, I'll keep an eye on your question. Quote Link to comment Share on other sites More sharing options...
aoligei Posted April 11 Author Share Posted April 11 I set it up like you said, but the movement of the motor is something I can't understand, the speed of the motor after the enable on the motor is the reciprocating movement, it is reciprocating around the point where the position is 0. My understanding in this is that the motor can't move properly according to the value I gave for Motor[1].DacBais due to the presence of the position loop that restricts the movement of the motor. When running the motion programme, there is no significant change in its speed, is my understanding of Motor[1].DacBais incorrect? This is how I am using it as you said. Motor[1].pDac =ECAT[0].IO[1].Data Motor[1].DacBias = 100 Quote Link to comment Share on other sites More sharing options...
MoMo Posted April 26 Share Posted April 26 First you must clarify the following: ①No matter what mode your motor uses in PMAC, CSP, CSV or CST, PMAC will eventually change it to position control mode. ②When you use a motion program, the controller plans a position-time curve, so its speed-time curve is also determined. ③If you want to simply offset the motion speed through DacBias, this is only possible when the motor is in open loop mode, which for your current situation means that you cannot control the position. ④The easiest way for your current situation is to use the TimeBase or Coord[].SegOverride mentioned above to change the speed. The premise of using Coord[].SegOverride is that Coord[].SegMoveTime is not 0 Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 10 Share Posted May 10 Can you help me with my problem? If I want the speed of axis 1 to be 50, then the speed of axis 2 is equal to the speed of axis 1 minus 10. the speed of axis 3 is equal to the speed of axis 1 plus 10. how can I achieve this? I don't want to set the speeds of motor 2 and motor 3 in the motion programme, i just want to find motor 2 and motor 3 by the speed of motor 1. it can be understood that the speeds of motor 2 and motor 3 are coupled with the speed of motor 1. Quote Link to comment Share on other sites More sharing options...
MoMo Posted May 10 Share Posted May 10 Can you answer a few questions for me? ① Do you want motor #2 and motor #3 to have a fixed speed deviation from motor #1? And this deviation will change at any time? ② If the motor changes speed while it is moving, positional alignment cannot be guaranteed, or there is a speed change process when changing speed online.Is this acceptable? ③When motor #1 is moving forward, its speed minus the deviation is less than zero, is motor #2 or motor #3 moving in reverse? Quote Link to comment Share on other sites More sharing options...
MoMo Posted May 10 Share Posted May 10 7 hours ago, David Jan said: Can you help me with my problem? If I want the speed of axis 1 to be 50, then the speed of axis 2 is equal to the speed of axis 1 minus 10. the speed of axis 3 is equal to the speed of axis 1 plus 10. how can I achieve this? I don't want to set the speeds of motor 2 and motor 3 in the motion programme, i just want to find motor 2 and motor 3 by the speed of motor 1. it can be understood that the speeds of motor 2 and motor 3 are coupled with the speed of motor 1. The following is a simple demonstration using CPLC and virtual motor. There are many ways to achieve similar effects, including not using CPLC. The difficulty in using it on a real motor is the control of acceleration and deceleration. Since you did not specify an explicit application, this method does not guarantee that your device can be used. VelocityOffset.mp4 VelocityOffset.zip Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 10 Share Posted May 10 4 hours ago, MoMo said: Can you answer a few questions for me? ① Do you want motor #2 and motor #3 to have a fixed speed deviation from motor #1? And this deviation will change at any time? ② If the motor changes speed while it is moving, positional alignment cannot be guaranteed, or there is a speed change process when changing speed online.Is this acceptable? ③When motor #1 is moving forward, its speed minus the deviation is less than zero, is motor #2 or motor #3 moving in reverse? I would like to set the velocity bias as a parameter and then modify the velocity deviation by modifying the parameter. I understand that there will be a velocity change as the motors move to modify the speed, even if it is necessary to re-fit the velocity transition curve When motor #1 is moving in the forward direction, its speed minus the bias is less than zero, motor #2 and motor #3 are moving in the reverse direction. Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 10 Share Posted May 10 18 minutes ago, MoMo said: The following is a simple demonstration using CPLC and virtual motor. There are many ways to achieve similar effects, including not using CPLC. The difficulty in using it on a real motor is the control of acceleration and deceleration. Since you did not specify an explicit application, this method does not guarantee that your device can be used. VelocityOffset.mp4 VelocityOffset.zip 643.27 kB · 0 downloads Allow me to understand your CPLC program first。 Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 14 Share Posted May 14 On 5/10/2024 at 9:44 PM, MoMo said: The following is a simple demonstration using CPLC and virtual motor. There are many ways to achieve similar effects, including not using CPLC. The difficulty in using it on a real motor is the control of acceleration and deceleration. Since you did not specify an explicit application, this method does not guarantee that your device can be used. VelocityOffset.mp4 VelocityOffset.zip 643.27 kB · 3 downloads hi,MoMo I got the following initial conclusions and questions by understanding your programme: Your program is a real-time cplc program written in rticplc by defining some functions in the header file of pp_proj.h. The meaning of the cplc program is to add or subtract Mtr2VelOffset*4 when Motor[1].IqCmd is greater than 0 or less than 0, where 4 is because type=11 is a single-precision Floating point number, occupies 4 bytes, and Mtr2VelOffset you define in pp_proj.h. #define Mtr2VelOffset pshm->P[8192] So how did you get the number 8192? Also EncTable[2].type=11 EncTable[2].pEnc=Motor[2].IqCmd.a. For simulating servo loops, it is good to set pEnc to the address of the motor servo command output IqCmd register, and I am using the CK3E+Ethercat communication protocol to control the motor, and I have the following EncTable in my motor configuration file: EncTable[1].Type = 1 EncTable[1].pEnc = ECAT[0].IO[92].Data.a This is how the manual describes it: For data received from the EtherCAT network, this specifies the register in the EtherCAT holding register that maps to the EtherCAT drive's actual position register: So I don't need to multiply by 4, right? mptr2_tmp=pshm->ECAT[0].IO[92].Data-Mtr2VelOffset; Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 15 Share Posted May 15 (edited) Another problem is that I am using CSV (Cyclic Synchronous velocity) mode and my motor configuration file is as follows: Motor[1].pDac = ECAT[0].IO[2].Data.a EncTable[1].pEnc = ECAT[0].IO[92].Data.a Where ECAT[0].IO[2].Data is the desired speed value of the motor and ECAT[0].IO[92].Data is the actual position value of the motor, can this still use pDAc = pEnc + Mtr2VelOffset from your rticplc? In your programme pDAc(pushm, motor desired speed) = pEnc(motor command current) + Mtr2VelOffset In my programme pDAc(motor desired speed) = pEnc(motor actual position) + Mtr2VelOffset Does this make sense? Why your desired speed can be obtained from the motor command current + Mtr2VelOffset, can you tell me the principle? Then I want to modify the speed in CSV mode, what should I do? Edited May 15 by David Jan Quote Link to comment Share on other sites More sharing options...
MoMo Posted May 15 Share Posted May 15 (edited) 12 hours ago, David Jan said: Another problem is that I am using CSV (Cyclic Synchronous velocity) mode and my motor configuration file is as follows: Motor[1].pDac = ECAT[0].IO[2].Data.a EncTable[1].pEnc = ECAT[0].IO[92].Data.a Where ECAT[0].IO[2].Data is the desired speed value of the motor and ECAT[0].IO[92].Data is the actual position value of the motor, can this still use pDAc = pEnc + Mtr2VelOffset from your rticplc? In your programme pDAc(pushm, motor desired speed) = pEnc(motor command current) + Mtr2VelOffset In my programme pDAc(motor desired speed) = pEnc(motor actual position) + Mtr2VelOffset Does this make sense? Why your desired speed can be obtained from the motor command current + Mtr2VelOffset, can you tell me the principle? Then I want to modify the speed in CSV mode, what should I do? can this still use pDAc = pEnc + Mtr2VelOffset from your rticplc? No PMAC always controls the motor in position mode, so if you want to control a certain motor for speed offset, you must convert the speed offset into position. This has nothing to do with whether you use CSV mode or not. It can still be achieved using CSP mode. And using CSV mode in the EtherCAT system does not bring good servo performance. The only way to achieve this is to let the real motor follow the virtual motor. You can see in my example, I'm not tampering with any motor output values, I'm letting the other motors follow. Motor2 and Motor3 follow the modified Motor1 position. Position and velocity are the same at a given time. Just like your monthly income of $5,000 represents speed, then you have earned $25,000 this year, which represents position. If you go to a bank for a loan, the bank needs to confirm your monthly income, but PMAC is a special bank. It only confirms how much you earned this year. The most important thing is how to convert the offset speed into position information. In my example, this is achieved through the encoder conversion table. Edited May 15 by MoMo 1 Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 16 Share Posted May 16 (edited) I seem to understand what you mean, according to what you mean, I can set up a virtual motor 1, and then let the actual motor 2 and the actual motor 3 follow the position of the virtual motor 1. The way you implement the conversion of the offset velocity to position information is by using the encoder conversion table, and I don't particularly understand how you implement it, you implement it by assigning the pshm->Motor[1].IqCmd- Mtr2VelOffset*4 to pushm[100], where pshm->Motor[1].IqCmd is EncTable[1].pEnc , the 4 in Mtr2VelOffset*4 is because EncTable[1].type=11, which is 32 bytes, so it's a multiplication by 4, and the pushm is Motor[1].pDac, so what does pushm[100] stand for? Why assign the address offset of EncTable[1].pEnc to pushm[100]? Also is there another way to implement the conversion of offset velocity to position information? Edited May 16 by David Jan Quote Link to comment Share on other sites More sharing options...
MoMo Posted May 16 Share Posted May 16 The simplest way is to create a virtual motor #1, and then let real motor #2 and real motor #3 follow the virtual motor. Then set Motor[2].JogSpeed and Motor[3].JogSpeed And use the Jog+ or Jog- command for real motor #2 and #3. The motion speed of the real motor is the speed of virtual motor #1 + the speed of real motor JogSpeed. Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 17 Share Posted May 17 On 5/15/2024 at 9:18 PM, MoMo said: can this still use pDAc = pEnc + Mtr2VelOffset from your rticplc? No PMAC always controls the motor in position mode, so if you want to control a certain motor for speed offset, you must convert the speed offset into position. This has nothing to do with whether you use CSV mode or not. It can still be achieved using CSP mode. And using CSV mode in the EtherCAT system does not bring good servo performance. The only way to achieve this is to let the real motor follow the virtual motor. You can see in my example, I'm not tampering with any motor output values, I'm letting the other motors follow. Motor2 and Motor3 follow the modified Motor1 position. Position and velocity are the same at a given time. Just like your monthly income of $5,000 represents speed, then you have earned $25,000 this year, which represents position. If you go to a bank for a loan, the bank needs to confirm your monthly income, but PMAC is a special bank. It only confirms how much you earned this year. The most important thing is how to convert the offset speed into position information. In my example, this is achieved through the encoder conversion table. Hi,MoMo. Could you help me to answer my question above? I really can't understand your method of converting offset velocity to position information by means of an encoder conversion table, I feel too stupid, I hope you can help me to explain it, thank you very much! Quote Link to comment Share on other sites More sharing options...
leandro.martins Posted May 17 Share Posted May 17 3 hours ago, David Jan said: I really can't understand your method of converting offset velocity to position information by means of an encoder conversion table I think the trick is done because the velocity offset is being applied on the IqCmd, which is used as the EncTable[n].pEnc. With the EncTable[n].Type=11 and EncTable[n].index<32, the EncTable[n].index4 controls how many times the IqCmd (which represents the velocity) will be integrated. In this case, as index4=1 the velocity will be integrated once, resulting in a position value. Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 18 Share Posted May 18 (edited) If I follow your line of reasoning, then if I have EncTable[n].Type=1. Motor[1].pDac = ECAT[0].IO[2].Data.a. EncTable[n].pEnc= ECAT[0].IO[92].Data.a, ECAT[0].IO[2].Data is the desired speed value of the motor, ECAT[0].IO[92].Data is the actual position value of the motor, then EncTable[n].index4 = 0, at this time, I directly modify ECAT[ 0].IO[92].Data to change the position? The code is as follows: ECAT[0].IO[2].Data=ECAT[0].IO[92].Data.a + Mtr2VelOffset Does this allow for velocity bias? Edited May 18 by David Jan Quote Link to comment Share on other sites More sharing options...
MoMo Posted May 19 Share Posted May 19 (edited) Your method cannot meet the requirements. Motor command velocity= motor act position + constant? I feel that it is difficult for me to explain the principles to you without understanding the classical control theory. The description of leandro.martins is correct. this is your method. Your velocity offset will be eliminated by the PD controller. The only way to achieve what you ask for in PMAC is to modify the Cmd Position. This is the correct way. Edited May 19 by MoMo 1 Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 20 Share Posted May 20 Sorry, maybe my thinking is not good enough, but I want to learn to use PMAC well with. According to the control diagram you gave, my understanding is that the motor position value is differentiated, then a speed bias is added, and finally the position value is integrated to get the corresponding position value. I can understand this process because there is only position control in PMAC, adding speed offset actually modifies the position, we can't modify the speed directly, so we need to convert the speed to position to give the set position, but what I don't understand at the moment is the way you use encoder conversion table to convert the offset speed to the position information, I understand that you use the address to convert the position information to the position. What I understand is that you modify the value of IqCmd by transforming the address, then make the velocity integral to position by index4=1, and finally ensure the velocity offset by position following, so my pEnc is the actual position of the motor, do I need to modify the pEnc to the actual velocity of the motor? I don't have a velocity value to allow me to get the new velocity via address transformation (+bit*Mtr2VelOffset). Quote Link to comment Share on other sites More sharing options...
DaveBarnett Posted May 20 Share Posted May 20 The statement that Pmac “only works in position mode” might be a little misleading. The motion program below shows a method by which you can command velocities and velocity offsets to any number of motors. It has the advantage of using standard motor configuration…no special ECT pointers, following, or C code required. Might this meet your needs? open prog VelDemo LINEAR INC //incremental move mode (not abs) TM 200 //200 msec "move time" while(1) { X(VelCmd_1) Y(VelCmd_2 + Vel_Offset) } close Every 200mS the argument to the X and Y commands are added to the desired position, creating a cmd velocity. You need to have Coord[*].NoBlend =0 for this to work properly. Motion programs can dynamically switch between INC mode and ABS mode for more complex operations. Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 21 Share Posted May 21 Sorry, this method may not be able to accomplish what I want, my idea is very simple, that is, through the configuration file or PLC to make the speed of motor 2 and motor 3 coupled with motor 1, and the PMAC itself is only coupled to the position, there is no speed coupling, I try to understand MoMo's method of speed bias converted into position information, but perhaps I understand it poorly, resulting in the inability to achieve, can you give me a detailed Can you explain to me in detail how to convert velocity bias to position information? What I understand is the process of converting position information to velocity through integrator, adding velocity bias, and then converting it to position through differentiator. Quote Link to comment Share on other sites More sharing options...
David Jan Posted May 21 Share Posted May 21 I followed MoMo's method of programming, using axis 3 as the virtual axis and axis 1 as the actual axis, so that the speed of axis 1 is coupled to axis 3, but it doesn't run correctly, what is the problem? Below is my plc program with the motor configuration file. global definitions.pmh rticplc.c Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.