PID Algorithm Question



I have a question regarding the PID algorithms in Opto 22. Is it possible to convert gain, I, and D coefficients from the Ideal (ISA) algorithm to the Velocity algorithm? If so, how? If I switch algorithms, I do not want to lose my tuning. Thanks!


I wish I knew for sure, but I recently changes some of my control loops from ISA to velocity and the stability didn’t seem to change, so you may be okay.

The feed forward works VERY differently however.


Hello optonovice,
Welcome to the OptoForums!
Generally, if you’re going to change algorithms, you’ll need to re-tune the loop.
What prompted the urge to switch algorithms? Have you contacted support about your options? (it’s free! email is best:
They’d be happy to help…


I needed to switch algorithms because the control system I have needs to frequently switch between Auto and Manual mode. The problem I had with the ISA algorithm when switching back and forth is that the integral term is reset to zero every time the system is switched back to auto mode ruining the tuning of the PID. I discovered that the Velocity Algorithm does not have this problem because it is only based on the instantaneous integral. When I switched algorithms, the Gain, I, and D coefficients as Philip mentioned were in the ballpark, but did require a bit of tweaking. I was hoping there was a relationship between the algorithms so that I can save some tuning time in the future. Thanks!


I ran the math on the ISA and Velocity algorithm, and the tuning parameters are the same. Feed forward is the only thing that works completely different, and I can’t think of a use for it on the velocity algorithm, as implemented.

I haven’t seen this behavior. What I have found is that the integral is recalculated so the PID output matches the output from the [B]previous scan[/B] of the PID. This means if you are in manual and change the output of the PID, you [B]must wait [/B]for a scan to complete before setting the PID to Auto, which is super annoying and I think Opto22 should change this behavior if possible.
Fortunately the velocity algorithm doesn’t suffer from this behavior.

My PID bug list:

  1. Changing the output on a non-velocity PID should trigger an integral recalculation immediately, or the algorithm should look at the current value of the output at scan time, and not the output from the last scan (wherever that is stored).

  2. Feed forward for the velocity algorithm doesn’t work as it should. There needs to be a TempOutput for OutputChange calculation and then this should be used with the feed forward for a final output:

TempOutput = (LastTempOutput + OutputChange)
Output = OutputChecks(TempOutput + FeedFwd * TuneFF)

This would allow the feed forward to work consistently across all the algorithms.

  1. This equation in PAC Control Help is incorrect/misleading:
    DOutput = Span * Gain * ( DTermP + DTermI + DTermD )

There is no DTermP, DTermI or DTermD - just TermP, TermI and TermD. The delta on the “Terms” is not used. The same mistake is in 1465 OptoMMP Protocol Guide on page 58.

Configuration PID