Class ZTF

Import ZTF as:

from ZTF import ZTF

for transfer function in Z-domain

class ZTF.ZTF(num, den, *args, **kwargs)

Z Transform implementation as difference equation.

Z transform is defined as

\[H(z) = \cfrac{Y(z)}{X(z)} = \cfrac{\sum_{i= 0}^n b_i z^i }{ \sum_{j = 0}^m a_jz^j }\]

which is implemented as difference equation.

Parameters:
num : list

Coefficients of the numerator in ascending order of the power of z.

den : list

Coefficients of the denominator in ascending order of the power of z.

print_coefficients()

Print coefficients of the numerator and the denominator

processing(x)
Parameters:
x : double

Input value for which next value y in the chain is to be predicted.

Returns:

The next predicted value for the given input x as per the transfer function.

Return type:

double

Class PID

Import PID as:

from ZTF import PID

for Z-domain PID controller

class ZTF.PID(P, I, D, N, Ts)

Implements a realizable discrete PID Control in the form of parallel structure consisting of three Z-transform blocks.

\[H(Z) = P + I\cdot T_s\cdot \cfrac{1}{z-1} + D\cdot \cfrac{N}{1 + N\cdot T_s \cfrac{1}{z-1} }\]
Parameters:
P : double

Proportional term of a PID controller

I : double

Integrator term of a PID contoller

D : double

Derivative term of a PID controller

N : double

Filter coefficient for the derivative term

Ts : double

Sample time in seconds for digital PID controller

processing(error)

Returns the value controlled value from the PID controller

Parameters:
error : double

Error term as an input the PID controller

Returns:

Returns the next control command

Return type:

double