Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about basic pid and user servo algorithm
Hello there,

I build simulink user servo algorithm as figure(a.jpg), following diagram from Power pmac user manual(b.jpg).

and Tuning control gain(kp, ki, kvff, kvfb) to work motor well.

then, The Same motor apply Basic PID(Motor[x].Ctrl=Sys.PidCtrl) with same gain.

I assume both of control gain are same but the motor servo off due to exceed following error limit.

The Basic PID in Power pmac is something different with the diagram in manual(b.jpg)?

The Servo frequency is 6kHz both of them. (at Simulink config, setting fixed step 1/6000)

Applying about 1/100 smaller kvff, kvfb gain than user servo, basic PID algorithm applied motor seems to control well.

Attached Files Image(s)
You might be forgetting a few scale factors present in the actual servo loop. See the diagram below:


Motor[x]. structures use “Motor Units” or M.U.s for length units

A Motor Unit is the resultant of the following multiplications:
  • The Encoder Conversion Table (ECT) processes raw feedback and its “raw” units are multiplied by EncTable[n].ScaleFactor, resulting in a floating-point number, before being multiplied by Motor[x].PosSf or Motor[x].Pos2Sf and used in the servo loop.
  • Delta Tau recommends setting EncTable[n].ScaleFactor such that the ECT entry’s output is in units of the feedback sensor (e.g. quadrature counts, ADC LSBs, etc.) to make troubleshooting easier.
  • For the position loop, Motor[x].PosSf multiplies the output of the Encoder Conversion Table entry to which Motor[x].pEnc points (i.e. an EncTable[n].a address).
  • For the velocity loop, Motor[x].Pos2Sf multiplies the output of the Encoder Conversion Table entry to which Motor[x].pEnc2 points (i.e. an EncTable[n].a address).
  • All of the above scale factors are effectively gain terms in the servo loop
  • It is up to the user’s preference whether the Motor Units are in “raw” feedback units (e.g. counts) at the same scale as the output of the ECT (usually when Motor[x].PosSf = Motor[x].Pos2Sf = 1.0)
  • Many of the default motor parameters are set for reasonable values in units of counts and would have to be changed dramatically if the motor units were engineering units (e.g. mm or degree), but when using kinematics, having Motor Units in engineering units can make the programming more convenient
Thank you for your prompt reply.

I check my Power pmac system variables follow your mentions, but Motor[x].PosSf, Motor[x].Pos2Sf are set as 1.

and I use just one positional encoder.(it means motor[x].PosSf=motor[1].Pos2Sf, motor[x].Actpos=motor[x].Actpos2, too.)

As you attached diagram, if i use Motor[1].ActPos variable, this variable is already multiplied scale factors(Enctable[i].scalefactor, motor[x].Possf).
and CompTable[i] are applied also.(In my case, CompTable are empty)

Don't know why different Basic PID with user algorithm by Simulink. it just simple and same structure PI-D controller
Ki, Kvff and Kvfb in the Sys.PidCtrl algorithm are equivalent to Ts*Ki, Kvff/Ts and Kvfb/Ts in the Simulink model respectively. Here Ts=1/6000.
This is because -as you see in the pictures- the content of the discrete time integrator blocks for example in the Sys.PidCtrl diagram reads Ki/(1-z^(-1)) but in the Simulink diagram the block content reads K*Ts/(1-z^(-1))*Ki. So you would need to multiply (divide) all your Simulink derivative (integrator) gains by 6000. Kp must remain untouched.

Also, verify that in the generated code, the servo rate of 6000 has appeared and not the default servo rate
I want to know how to set the upper limit value and lower limit value of saturation block in the above diagram,we all know that the Motor[x].MaxDac=32768 means that the Power Pmac controller output ±10v analog voltage,but if I build my servo algorithm in simulink,because the saturation block have two value need to set( upper limit and lower limit) how to set the saturation?
You can set the upper limit to +32,768, and the lower limit to -32,768.

Forum Jump:

Users browsing this thread: 1 Guest(s)