Jump to content
OMRON Forums

How to change the motor speed


aoligei

Recommended Posts

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).

Link to comment
Share on other sites

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 by leandro.martins
Link to comment
Share on other sites

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


 

Link to comment
Share on other sites



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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.zip

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.zip 643.27 kB · 0 downloads

Allow me to understand your CPLC program first。

 

 

Link to comment
Share on other sites

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.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;
 

Link to comment
Share on other sites

Posted (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 by David Jan
Link to comment
Share on other sites

Posted (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 by MoMo
  • Thanks 1
Link to comment
Share on other sites

Posted (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 by David Jan
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Posted (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 by David Jan
Link to comment
Share on other sites

Posted (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.

 

image.thumb.png.7532ec9b5bfb2b5062da88b6e3094316.png

this is your method.

image.thumb.png.7f7de04d7328fb9f811ac51d9c33e467.png

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.

image.thumb.png.563a2dd84a756dd7362141a3e7c18f09.png

This is the correct way.

Edited by MoMo
  • Thanks 1
Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.
 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...