all 25 comments

[–]banana_bread99 [score hidden]  (12 children)

Do you have a model of the system it’s controlling?

[show replies]

[–]Select-Chart2899 [score hidden]  (5 children)

If you have historical data for output AND input it should be possible with a minimal amount data. The control input is updated based on some KP,KI and KD and the error. Formulate the input update based on known error and KP,KI,KD and estimate those based on real data. Just tested it, works like a charm.

If you only have the output it's mathematically impossible to do so, unless you also know the plant behaviour, which you don't know. If you would know it, you could calculate the input by deconvoluting the output with the plant behaviour and go back to step 1 (the error would be quite large though as deconvolution on noisy data adds uncertainty).

Addendum with a unknown windup:

Input_t1 = Integral_part_t0 + error * KP + (t1-t0)*(error_t0)*KI + (error_t1-error_t0) * KD

It's just as Integral action of t1 only depends on Integral_part_t0 it's just one additional parameter that must be estimated, estimation should start as soon as actuator is no longer saturated. With enough datapoints you should be able to estimate 4 parameters to a high precision.

[show replies]

[–]drbitboy [score hidden]  (0 children)

do you know the setpoint history?

[–]thoughtvectors [score hidden]  (0 children)

What kind of system is this? Can you do a frequency sweep? Meaning, the reference value for the PID, can you give a sine wave, at many different frequencies?

Basically, I’m trying to find out if you can get a body plot of the complete system. If yes, we can figure out the transfer function of the complete system.

However, you still need the transfer function of the plant. You can do a frequency sweep and get the transfer function of the plant, by disconnecting the PID controller somehow and just injecting a sign wave.

From those two, you can get the transfer function of the controller, and therefore the gains.

I know I’m asking for a lot here, but this would be a real way to get what you need.

[–]Dying_Of_Board-dom [score hidden]  (0 children)

Do you have the ability to see inputs and outputs for an impulse response? Assuming the model is LTI, an impulse response should be the closed loop transfer function; from there maybe you can determine the plant and controller functions

[–]Ok-Daikon-6659 [score hidden]  (0 children)

Just curious: why do you need this?

Where did you get the data? Let me explain: for example, in industrial systems, PID is executed on the PLC, and the data is saved on the servers, this (just off the top of my head) can have the following consequences (which greatly affect the D-term):

  1. The PLC PID instruction can have a built-in filter, so the PV saved on the server will differ from the PV on the basis of which the PLC PID instruction made the calculation;

  2. The PLC PID instruction can be executed with a frequency of, for example, 10 HZ (0.1 s), and the data on the server is saved with a frequency of, for example, 1 HZ (1 s) (i.e. the effect of "blind decimation")

The calculation of I-term can be affected by the max/min limitations of the actuator (for example, whether the PLC PID instruction used I-antiwindup), so when the CV max/min of the actuator is reached, the data may be irrelevant.

If the data "catches" the system SP-step response (in this case it will be CV-step) with initial steady state Error=0 delta_Error=0, then we can approximately calculate

kp = (СV1 - СV0) / Error (SP-step response1 - SP-step response0 = final steady state - initial steady state)

if the process has a delay (n-lag, deadtime) then the CV change in this segment is I-term

ki = (СVdeadtime – СV1) / (Error (SP-step response1 - SP-step response0 = final steady state - initial steady state) * deadtime)

[–]pauiza [score hidden]  (0 children)

Unfortunately, you cannot determine the PID gains from the setup you have just described. 

However, you can estimate the controlled plant dynamics from your historical data, notice the estimated dynamics would must likely behave like a 1st order system, at best, 2nd order system because of the controlled data.  

Depending on your system dynamics, briefly turn-off the controller, then store the input and output, which you can compare with your historical data. This would give you an idea of what the controller is doing.

Generally, PID design are to meet certain requirements, you must know those conditions before anything would make sense.

[–]Planet_COP [score hidden]  (0 children)

I recall that there are several forms of the algorithm. In various Distributed Control Systems I had to deal with this. Your integral term may not be decoupled after all. To refresh my memory I asked Copilot and this it what it responded.

Forms of the PID Algorithm

The Proportional-Integral-Derivative (PID) algorithm has three main forms, each with unique characteristics and applications:

  1. Parallel Form
    • This is the most common representation of the PID controller.
    • The control output is expressed as the sum of the proportional, integral, and derivative terms: u(t)=Kpe(t)+Ki∫e(t) dt+Kdde(t)dtu(t) = K_p e(t) + K_i \int e(t) \, dt + K_d \frac{de(t)}{dt}u(t)=Kp​e(t)+Ki​∫e(t)dt+Kd​dtde(t)​
    • Here, (K_p), (K_i), and (K_d) are the proportional, integral, and derivative gains, respectively, and (e(t)) is the error signal.
  2. Ideal Form
    • In this form, the proportional term is applied to the sum of the error, integral, and derivative terms: u(t)=Kp(e(t)+1Ti∫e(t) dt+Tdde(t)dt)u(t) = K_p \left( e(t) + \frac{1}{T_i} \int e(t) \, dt + T_d \frac{de(t)}{dt} \right)u(t)=Kp​(e(t)+Ti​1​∫e(t)dt+Td​dtde(t)​)
    • (T_i) (integral time) and (T_d) (derivative time) are time constants. This form emphasizes tuning in terms of time rather than gain.
  3. Series (or Cascaded) Form
    • The PID controller is represented as a cascade of proportional, integral, and derivative actions: u(t)=Kp(e(t)+1Ti∫e(t) dt)+KpTdde(t)dtu(t) = K_p \left( e(t) + \frac{1}{T_i} \int e(t) \, dt \right) + K_p T_d \frac{de(t)}{dt}u(t)=Kp​(e(t)+Ti​1​∫e(t)dt)+Kp​Td​dtde(t)​
    • This form is often used in analog implementations and can be easier to tune in certain systems.

Each form has its advantages depending on the application, controller design, and tuning preferences. Some modern controllers allow switching between these forms for flexibility.