## Time Delay (Dead-Time)

## Apps.TimeDelay History

Hide minor edits - Show changes to output

Changed lines 1-5 from:

to:

(:title Time Delay (Dead-Time):)

(:keywords dead-time, time delay, input, output, model predictive control, dynamic optimization, engineering optimization, Python, Gekko, APMonitor, FOPDT:)

(:description Time delay is also known as dead-time and is implemented with the delay function in Python Gekko. This is a discrete state-space model that is added to the model when there is input or output delay.:)

Model predictive controllers rely on dynamic models of the process, most often linear empirical models obtained by system identification. APMonitor and [[https://gekko.readthedocs.io/en/latest/|GEKKO]] support continuous or discrete state space and autoregressive exogenous (ARX) input models. The delay function implements dead-time and is a simplified ARX model that includes a single input and output with a delay structure specified by the number of integer time steps.

(:keywords dead-time, time delay, input, output, model predictive control, dynamic optimization, engineering optimization, Python, Gekko, APMonitor, FOPDT:)

(:description Time delay is also known as dead-time and is implemented with the delay function in Python Gekko. This is a discrete state-space model that is added to the model when there is input or output delay.:)

Model predictive controllers rely on dynamic models of the process, most often linear empirical models obtained by system identification. APMonitor and [[https://gekko.readthedocs.io/en/latest/|GEKKO]] support continuous or discrete state space and autoregressive exogenous (ARX) input models. The delay function implements dead-time and is a simplified ARX model that includes a single input and output with a delay structure specified by the number of integer time steps.

Added lines 1-51:

Model predictive controllers rely on dynamic models of the process, most often linear empirical models obtained by system identification. APMonitor and [[https://gekko.readthedocs.io/en/latest/|GEKKO]] support continuous or discrete state space and autoregressive exogenous (ARX) input models. The delay function is a simplified ARX model that includes a single input and output with a delay structure specified by the number of integer time steps.

Usage: delay(u,y,steps=1)

u = delay input

y = delay output

steps = integer number of steps (default=1)

Description: Build a delay with number of time steps between

input (u) and output (y) with a time series model.

The following is an example of implementing a discrete time series model for an input delay of 60 seconds. The sample time for this model is 15 seconds with 4 steps of delay. The model is implemented in Gekko with the delay function.

%width=550px%Attach:input_delay_dss.png

(:source lang=python:)

import numpy as np

from gekko import GEKKO

import matplotlib.pyplot as plt

# Create GEKKO model

m = GEKKO()

cv = m.Var()

mv = m.Param()

m.delay(mv,cv,4)

m.time = np.linspace(0,120,9)

mv.value = np.zeros(9)

mv.value[3:9] = 1

m.options.imode = 4

m.options.nodes = 2

m.solve() # (GUI=True)

# also create a Python plot

import matplotlib.pyplot as plt

plt.subplot(2,1,1)

plt.plot(m.time,mv.value,'r-',label=r'MV')

plt.legend()

plt.subplot(2,1,2)

plt.plot(m.time,cv.value,'b--',label=r'$CV$')

plt.legend()

plt.show()

(:sourceend:)

Also see

* [[Apps/DiscreteStateSpace | Discrete State Space]]

* [[Apps/ARXTimeSeries | ARX Time Series]]

* [[Apps/LinearStateSpace|Continuous State Space]]

Usage: delay(u,y,steps=1)

u = delay input

y = delay output

steps = integer number of steps (default=1)

Description: Build a delay with number of time steps between

input (u) and output (y) with a time series model.

The following is an example of implementing a discrete time series model for an input delay of 60 seconds. The sample time for this model is 15 seconds with 4 steps of delay. The model is implemented in Gekko with the delay function.

%width=550px%Attach:input_delay_dss.png

(:source lang=python:)

import numpy as np

from gekko import GEKKO

import matplotlib.pyplot as plt

# Create GEKKO model

m = GEKKO()

cv = m.Var()

mv = m.Param()

m.delay(mv,cv,4)

m.time = np.linspace(0,120,9)

mv.value = np.zeros(9)

mv.value[3:9] = 1

m.options.imode = 4

m.options.nodes = 2

m.solve() # (GUI=True)

# also create a Python plot

import matplotlib.pyplot as plt

plt.subplot(2,1,1)

plt.plot(m.time,mv.value,'r-',label=r'MV')

plt.legend()

plt.subplot(2,1,2)

plt.plot(m.time,cv.value,'b--',label=r'$CV$')

plt.legend()

plt.show()

(:sourceend:)

Also see

* [[Apps/DiscreteStateSpace | Discrete State Space]]

* [[Apps/ARXTimeSeries | ARX Time Series]]

* [[Apps/LinearStateSpace|Continuous State Space]]