OMRON Forums

# replacing PID with ESA

## Recommended Posts

Hi All

I am trying to implement a ESA instead of a standard PID, in order to have more flexibility regarding filtering.

At first, I would like to implement the ESA exactly as my PID, just to see if I am doing everything correct.

Unfortunately, it seems that my conversion algorithm is not working.

This is the procedure I am following:

1) Compute the exact coefficient of Proportional, Integral and Derivative parts in terms of counts (input) and servo bit (output). I get the formulas from page 170 of "TURBO PMAC User Manual"

```UMAC.i130 = 10000;
UMAC.i131 = 8000;
UMAC.i133 = 60000;

Kp      = UMAC.i130 / (1    / (2^-19 * 96));   % = 1.8311
Kd      = UMAC.i131 / (128  / (2^-19 * 96 * UMAC.i130 * UMAC.servotime));   % = 0.0509
Ki      = UMAC.i133 / (2^23 / (2^-19 * 96 * UMAC.i130 * (1/UMAC.servotime))); % = 29.4676
```

2) Use the above coefficients to get a transfer function in z^(-n) domain.

The transfer function is

Kp * (1 + Integral_TransferFunction - Derivative_TranferFunction)

This is what I get:

```30.42 - 0.8983 z^-1 - 0.05086 z^-2
----------------------------------      * 1.8311
1 - z^-1
```

I'm using the Kp as a global gain, as the UMAC does in its servo loop.

3) Insert the transfer function above in the ESA algorithm. It seems that I can use the only TS block to implement a simple PID. So, I compute the gains, paying attention to dimension correctly s0, TS, t0, t1, t2 and r1. The transfer function that I get is the same as above, except for the Kp (1.8311) that I'm going to use to dimension the Ixx69

4) Translate the Kp (1.8311) into the Ixx69, that I plan to use as the new global proportional gain.

In principle, I would say that

`Ixx69 = Kp * 2^15 / 96 / 32;   % 19`

(96 and 32 are used because the ESA works in that unit, while the PID gains are computed as entire counts.

Now the problems start. It seems that these coefficients are not representative of the stardard PID: in particular, the Ixx69 value is extremely low. With the Ixx69 computed, the ouput is quite low (no motion at all at level of actuator). I should multiply the Ixx69 value of a factor ~100 to get some output at level of the driver.

Where am I doing wrong here? Am I forgetting some conversion?

thanks

gigi

• Replies 4
• Created

#### Popular Days

One way to see what is happening is to first use the standard PID loop and use Pmac Tuning's Auto Tuner. Just pick a basic bandwidth and get the PID gains and check the response with a step move. Then close the tuning, set the Pmac to use the ESA and re-open tuning. Now you can have the tuning use the ESA and auto tune for the same bandwidth. You will see what values are used and will most likely be able to see what went wrong in your conversion.
##### Share on other sites

First of all If you use the TS polynomial in ESA,

what you can have a P+I+D, note that this is different

than what you have with PI plus velocity feedback.

And the transfer function you have should have been

i.e.

Kp * (1 + Integral_TransferFunction+ Derivative_TranferFunction)

otherwise you will have an unstable system.

##### Share on other sites

• 1 month later...

Hi

thanks to all for the suggestions. I finally made an ESA working as a standard PID loop.

Here in attach a matlab script file that implements the conversion (you can open it with a standard text editor).

I tested the conversion on a real hardware, where I measured transfer functions and step responses: the PID and the ESA performances are almost equal.

The major problem on this was a missing coefficient on the Ixx69 used on the ESA: I had to multiply by 3 (or 96/32) to make the loop working.

EDIT: regarding the Ixx69: is there a way to have a limit on the output current? The Ixx69 in the ESA is used as a global Proportional Gain; I'd like to have a global limit on top of the loop (like Ixx69 on the classic PID), in order to be extra-safe on the maximum output current.

Hope this can be useful to someone.

gigi

PID2ESA.m.txt

##### Share on other sites

First of all If you use the TS polynomial in ESA,

what you can have a P+I+D, note that this is different

than what you have with PI plus velocity feedback.

And the transfer function you have should have been

i.e.

Kp * (1 + Integral_TransferFunction+ Derivative_TranferFunction)

otherwise you will have an unstable system.

Yes, I understand that.

In my previous post, I made the TS + GS polys working as a standard PMAC "PI + D loop".

Now I need a to build an ESA working as a normal PID (D working with the Error, not with the Actual Velocity), but it seems that I can't implement it because of some missing gain.

I tested my actuator with a normal PID loop (to have D working with the error, I put i132 == i131), and I know it works fine.

But if I try to put this PID in the only TS polynomial, my transfer function is completely different (way much slower).

The TurboPMAC UserManual is quite cumbersome on this topic, can somebody help me regarding the theory of the control laws?

Here's the list of things that are not quite clear in the manual:

1) GS poly: the diagram at page 178 shows GS(g0 + g1(1-z^-1)). I suppose the correct poly is GS(g0 + g1*z^-1 + g2*z^-2), as reported in the TUNING PRO sw. Am I correct?

2) D poly: the diagram shows 1/(1+d1*z^-1 * d2*z^-2), while the TUNING PRO sw shows 1/(1+2(d1*z^-1 + d2*z^-2)). I suppose the TUNING PRO sw is correct, but I'd like to have a confirm on that.

3) the Pmac PID Actual Algorithm (page 170): I start my conversion "PID to ESA" from the law on section "Actual PID/Feedforward Algorithm". Is that law correct? Shouldn't be there a *32 gain on top of everything (I suppose it is 2^-19*Ixx30*32*(..) ).

Thanks a lot

gigi

##### Share on other sites

This topic is now closed to further replies.

### Announcements

×
• Forums

• Events
• #### Browse

×
• Create New...