Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Is there something wrong in PID object ?

Is there something wrong in PID object ? 13 years 3 months ago #1429

  • brunad
  • brunad's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 247
  • Thank you received: 48
  • Karma: 11
Hi there,

I start to learn to use proview. The possibilities of the soft plc part of proview seems to be very wide. But it seems there is a trouble with the PID object: I think there is a bug in the derivative calculation because it acts on a negative way on a positive setpoint step. I have take a look at the source file \"rt_plc_pid.c\" and it seems there is an error in the derivative filter calculation, this line is:

object->FiltDer += (ddiff - derold) *
object->DerGain * *object->ScanTime; /* Filter */

Unfortunately, I have no time now to try to correct this and (learn to) rebuild proview.

Take a look at the joined pdf, it is the part concerning derivative I wrote for my students in process control for explain how to create a PID corrector in C++

Attachment PID_Numerique_16012011_partD.gz not found

from z transform.

(sorry it's in french)

Proview is amazing !
Thank you for your work.
:)

Post edited by: brunad, at: 2011/01/17 18:06
Attachments:
The administrator has disabled public write access.

Re:Is there something wrong in PID object ? 13 years 3 months ago #1433

  • werner
  • werner's Avatar
Thanks for the feedback on the PID controller.
I can't find that the controller behaves in a negative way. However I've found an error in the derivative part, after more than 15 years in use!
I suppose this means that we most often uses only the PI-part of the controller!

The algorithm behaves as it should if you remove the derivative filtering (DerGain = 0), but with normal filtering it doesn't respond correctly to changes in DerTime. (Always DerTime = 1.0)
This correction will be included in the next version of Proview 4.8.1

If the controller in itself goes in the wrong direction, it is probably caused by the flag Inverse, which eguals factor -1 on the gain.
Sorry my french is not good enough to understand your paper.

Best regards
Hans Werner

Post edited by: werner, at: 2011/01/18 11:02
The administrator has disabled public write access.

Re:Is there something wrong in PID object ? 13 years 3 months ago #1435

  • brunad
  • brunad's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 247
  • Thank you received: 48
  • Karma: 11
Hi Werner,

Using pure derivative is not desirable because it introduces a theoretical infinite gain on error steps which produces very noisy output command signal of the PID. In real world, a derivative gain of 3 is sufficient to acquire 90% of the phase margin.

Maybe you can try to replace this:

object->FiltDer += (ddiff - derold) *
object->DerGain * *object->ScanTime; /* Filter */


By something like that:

float kd;

...

kd= 1/(1+(object->DerGain * *object->ScanTime/object->DerTime)) ;
object->FiltDer = (1-kd)*ddiff - kd*derold; /* Filter */


Regards

Bruno Permanne

;)

P.S. Is it possible to increase the maximal size of files that one can send on the forum, because I can't sent my entire document (with pictures in it) ?
For example to 250 kbytes ?

Post edited by: brunad, at: 2011/01/18 18:27

Post edited by: brunad, at: 2011/01/18 18:28

Post edited by: brunad, at: 2011/01/18 18:42
The administrator has disabled public write access.

Re:Is there something wrong in PID object ? 13 years 3 months ago #1448

  • werner
  • werner's Avatar
Hi Bruno,
Of course you are quite correct.
The original code (until version 3.4) was more or less like this, but with a somewhat simplified algorithm for filtering.
I have no idea why the code was changed in version 4.0.
Anyway it will be restored (with improved filtering algorithm) in version 4.8.1
Many thanks for your help!
Best regards
Hans Werner
The administrator has disabled public write access.

Re:Is there something wrong in PID object ? 13 years 3 months ago #1449

  • admin
  • admin's Avatar
  • OFFLINE
  • Administrator
  • Posts: 7
  • Karma: 0
Hi Bruno,

The maximum size for uploaded files is now increased to 250k.

/Claes
The administrator has disabled public write access.

Re:Is there something wrong in PID object ? 13 years 3 months ago #1452

  • brunad
  • brunad's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 247
  • Thank you received: 48
  • Karma: 11
Hi Claes and Hans,

thank you.

\"They don't know it was impossible, so they did it !\"
Marc Twain


Regards

Bruno
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 8.968 seconds