PADE_DELAY

Time delays (dead time) are common in process control, representing the transport delay before an output responds to an input. In the Laplace domain, a strict time delay T is represented by the exponential term e^{-sT}.

However, e^{-sT} is not a rational polynomial, making it difficult to use with standard linear analysis tools (like Root Locus or state-space matrices). The Padé approximation is a technique to approximate this delay using a standard continuous-time transfer function (a ratio of polynomials).

The function computes the numerator and denominator coefficients for an n-th order Padé approximation: e^{-sT} \approx \frac{num(s)}{den(s)}

Excel Usage

=PADE_DELAY(T, n, numdeg)
  • T (float, required): The time delay to approximate (in seconds).
  • n (int, required): The order (degree) of the denominator polynomial approximation.
  • numdeg (int, optional, default: null): Optional order of the numerator. If left blank, it equals the denominator degree.

Returns (list[list]): A 2D array where the first row contains the numerator coefficients and the second row contains the denominator coefficients.

Example 1: First order approximation of 1s delay

Inputs:

T n numdeg
1 1

Excel formula:

=PADE_DELAY(1, 1, )

Expected output:

Result
-1 2
1 2
Example 2: Third order approximation of 0.5s delay

Inputs:

T n numdeg
0.5 3

Excel formula:

=PADE_DELAY(0.5, 3, )

Expected output:

Result
-1 24 -240 960
1 24 240 960
Example 3: Denominator order 3, Numerator order 2

Inputs:

T n numdeg
1 3 2

Excel formula:

=PADE_DELAY(1, 3, 2)

Expected output:

Result
3 -24 60
1 9 36 60
Example 4: Zero delay (returns 1/1)

Inputs:

T n numdeg
0 2

Excel formula:

=PADE_DELAY(0, 2, )

Expected output:

Result
1
1

Python Code

Show Code
import control as ct
import numpy as np

def pade_delay(T, n, numdeg=None):
    """
    Calculate the Pade approximation of a continuous time delay.

    See: https://python-control.readthedocs.io/en/latest/generated/control.pade.html

    This example function is provided as-is without any representation of accuracy.

    Args:
        T (float): The time delay to approximate (in seconds).
        n (int): The order (degree) of the denominator polynomial approximation.
        numdeg (int, optional): Optional order of the numerator. If left blank, it equals the denominator degree. Default is None.

    Returns:
        list[list]: A 2D array where the first row contains the numerator coefficients and the second row contains the denominator coefficients.
    """
    try:
        delay = float(T)
        if delay < 0:
            return "Error: Time delay T must be non-negative"

        order = int(n)
        if order < 1:
            return "Error: Order n must be a positive integer"

        if numdeg is not None and str(numdeg) != "":
            num_degree = int(numdeg)
            num, den = ct.pade(delay, order, num_degree)
        else:
            num, den = ct.pade(delay, order)

        # Ensure rectangular output by padding the shorter array with empty strings
        num_list = list(num)
        den_list = list(den)

        max_len = max(len(num_list), len(den_list))

        padded_num = num_list + [""] * (max_len - len(num_list))
        padded_den = den_list + [""] * (max_len - len(den_list))

        return [padded_num, padded_den]

    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

The time delay to approximate (in seconds).
The order (degree) of the denominator polynomial approximation.
Optional order of the numerator. If left blank, it equals the denominator degree.