Operator problem


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103


    Did you find this post helpful? Yes | No

    Default Re: Operator problem

    Thanks for your splendid explanations Henrik .. I've just seen once again that I misunderstood the integral term of the PID control system ... But I'm trying to match the theoritical knowledge in my head and the code you've written .. especially the lines pointing out the Integral term calcs .

    We keep accumulating the error over and over and again during a period of cycles that we choose in the programme (Ti) And then we divide the sum of the errors to Ti ... Thus we get the arithmetic mean of the error sum , Am I Right ? On the other hand "the integral" in math gives us the field under the curve .... That's where I find the code a bit awkward .. Because after summing the errors we just do not use it in the process but using the arithmetic mean of the errors we summed ...

    Please set my mind free of these mind killing questions digging and eating my head ...

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Operator problem

    Hi,
    Correct.
    1) We accumulate (in the pid_Ei variable) the error over Ti number of samples
    2) We multiply the accumulated error by the integral gain
    3) We divide the result by Ti to get the average error over Ti number of samples.
    4) We add the result to the PID_I variable and make sure it doesn't violate or min/max settings.
    5) We clear the accumulator (the pid_Ei variable).

    So, PID_I is the actual integral term, it holds the history of all past errors and is what's used to "build" the final output together with the P and D terms (and the feedforward terms). The accumulation/averaging kind of low pass filters the integral term. If you you don't want to use it then simply use a Ti of 1 - it'll then update the I-term every cycle with the error at exactly that sample.

    There are different ways of implementing a PID filter and this is only one of them. Another change I'm thinking of implementing is the option to have the differential term work from the feedback instead of the setpoint.

    /Henrik.

Similar Threads

  1. Can someone please explain the operator */
    By triton99 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 29th November 2011, 15:16
  2. // Division Operator
    By Dick Ivers in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th September 2011, 15:27
  3. Exponential Operator
    By andrewroz in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 31st October 2007, 09:00
  4. '*/' operator
    By jblackann in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th January 2007, 21:00
  5. math operator LOG
    By Eyal in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd July 2004, 00:45

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts