Shop OBEX P1 Docs P2 Docs Learn Events
P.I.D questions? — Parallax Forums

P.I.D questions?

grasshoppergrasshopper Posts: 438
edited 2008-06-24 23:06 in Propeller 1
When using the PID object I want to know when do I set Δt to zero.

An exaggerated example [noparse][[/noparse]If running a PID program that is controlling a system; after a full day of keeping track Δt the number would become so huge.]

Comments

  • LeonLeon Posts: 7,620
    edited 2008-06-24 16:39
    I can't see deltat anywhere in the code, just IT which is a constant. Are you using the PID code in the Obex?

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • grasshoppergrasshopper Posts: 438
    edited 2008-06-24 17:19
    Leon said...
    I can't see deltat anywhere in the code, just IT which is a constant. Are you using the PID code in the Obex?

    Leon

    No that object seems lacking. I am using Andys PID object listed below

    [code]

    {{
    ┌──────────────────┬────────────────────────┬────────┬────────────────┬────────┐
    │ PID.spin │ (C)2007 Parallax, Inc. │ V0.92 │ by Andy Lindsay│ Aug 24 │
    │ │ │ │ │ │
    ├──────────────────┴────────────────────────┴────────┴────────────────┴────────┤
    │ │
    │ Relies on Cam Thompson's Float32 object, which is available for download │
    │ from the Propeller Object Exchange. │
    │ │
    │ Includes HyperTerminal diplay code for viewing calculation iterations. │ │
    │ In HyperTerminal, use 57600, 8, N, 1, no flow control. │
    │ │
    │ │
    │ Performs PID calculations: │
    │ │
    │ P + I + D │




    │ E + Ep ΔE │
    │ out = kp
  • LeonLeon Posts: 7,620
    edited 2008-06-24 20:16
    That code is completely different from that I mentioned. I don't think that Deltat should be increasing continuously, should it not stay at roughly the same value?

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle

    Post Edited (Leon) : 6/24/2008 8:23:42 PM GMT
  • John AbshierJohn Abshier Posts: 1,116
    edited 2008-06-24 20:48
    Delta is calculated each call and will not grow. If you set it to zero, that will cause an error when you calculate dedt in the Derivative section. I have read of people resetting the integral term I to zero. Note what integral windup is capped by Amax and Amin

    John Abshier
  • LeonLeon Posts: 7,620
    edited 2008-06-24 21:28
    Deltat is current time - previous time. The OP must be using the time when the program starts instead of the current time, for Deltat to keep increasing.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • grasshoppergrasshopper Posts: 438
    edited 2008-06-24 23:06
    Thanks for pointing this out for some reason I figured that the delta t would keep adding up.
Sign In or Register to comment.