I have a little difficulty on my project. Can I calculate Reset Time (Ti) if I just had the value of P gain, I gain, D gain, Process Variable, and Manipulated Variable? Is there any reference about this task?

# How to calculate the reset time

controllerpid controller

#### Related Solutions

The key to good engineering is to keep it simple. In your case, you can use something very simple to turn on/off a relay to control a heater. A psuedo code:

```
int temperature;
int setpoint;
int status = 0;
int pulses = 0;
int integral = 4;
int derivative = 5;
int upperTemp = 1000; //100.0C
int upperLimit = 100; //pulses per time frame
int counter = 0;
//NO PULSING
runtime //make a timer that runs and updates temperature value
{
read temperature;
temperature *= 10; //still keeping in int for faster processing
status = ((setpoint - temperature)*integral)/derivative; //EX: (800-400)*4/5 = 320
//EX: (800-780)*4/5 = 16
status = abs(status); //get absolute value, this for for within range
//(800-850)*4/5 = -40 -> ABS(-40) = 40
if(status < 16) //from example, 16 means that value is within 2*C, you can always
Relay Off; //change this value to something else (e.g: (800-795)*4/5 = 4
else //4 gives 0.5*C tolerance range...which is a bit tight for temp.
Relay On; //anyway, play around with this value;
//you can also change integral and derivative if you wish.
}
//WITH PULSING
runtime //make a timer that runs and updates temperature value...lets say every second
{
read temperature; //every second
temperature *= 10; //multiply by 10 for decimal place, but still keeping in integer
pulses = map(temperature, upperTemp, 0, 0, upperLimit); //when temperature increases,
//pulses decreases...vice versa
//take this value of pulses to update the timer interval
//timer's interval = pulses per second or minute
}
timer
{
if(Relay On)
Relay Off;
else
Relay On;
}
//borrowed from arduino
long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
```

//PWM method: still need the runtime with pulsing from above. Let's say you get 75 pulses, this means that the relay will be on for 75% of the duration of each pulse and off for the other 25%. Let's say that you want to have a frequency of 1s (1000mS). Relay will be on for 750mS and off for 250mS. If the temperature is very far away from setpoint, then it might even be on for 100% of the time.

//choose entire duration by tick_interval*percentage: 100mS*100 = 10000mS or 10seconds. Back to example. If you have 75 pulses, then relay will be on for 7.5 seconds and off for 2.5 seconds.

```
timer //example 100mS per tick
{
if(counter > 100) //has reached the end of time period
counter = 0;
if(counter > pulses) //pulses from above is now the duty cycle
{
if(Relay is On)
Relay off;
}
else
{
if(Relay is Off)
Relay on;
}
counter++; //increment by 1
}
```

//this method is more flexible than using a fixed number (30 minutes) because different heater controllers respond differently

Various forms of the PID equation are possible, but from your description it appears you have: \$(K_p + 1/T_i s + K_ds)\$. Generally, \$K_i = 1/T_i\$.

Other common forms are: \$(K_p + K_i/s + K_ds)\$ ; \$K_p(1 + 1/T_i s + T_d s)\$

Arguably, the most useful form is: \$ \frac{K_p (1 + T_i s + T_i T_d s^2)} {T_i s} \$ as this is the easiest to build into a transfer function, and also the proportional gain operates on all three terms and is identifiable as a 'loop gain'. This form is also very useful in root locus analysis as it clearly identifies the PID's open loop pole, at \$s=0\$, and two open loop zeros, with the integral and derivative times, \$T_i\$ and \$T_d\$, allowing the zeros to be placed at appropriate positions in the s-plane.

## Best Answer

The best way, if possible, is to tune the parameters rather than 'calculating' them.

The reset time, or integrating time constant, \$T_i\$, is

roughlythe time your controller takes to overcome steady-state errors.To tune it, you can just start from a high value and slowly reduce it checking out the performance of a step-response (quick change in reference to your controller). As soon as you are satisfied with the promptness of the response and the (eventual) amount of overshoot you introduced, you are finished.

If you really want to 'calculate' the value, you just have to choose one of the hundreds avaliable PID tuning rules of thumb. Note though that not all of them define \$T_i\$ directly just as a function of the other values, but rather define all parameters together.