'discrete-time and continuous-time transfer functions with Gekko sysid

In a project, I have to use python language to tune the PID coefficients of the boiler de-super-heater control loop. So, I use the Gekko package to identify the plant transfer function. After identifying the ARX model, I need to convert it to the discrete and continue time transfer functions to be able to tune this loop with PID tuning methods. According to the results, I do not know whether I use this package correctly or not. Are the following 3 lines of code written correctly?

y, p, k = m.sysid(np.linspace(1, u[0], num = u.shape[0]), u, y, 2, 2, pred='meas')
gp_d = control.tf([p['b'][0][0][0], p['b'][0][1][0]], \
                   [1,-p['a'][0][0],-p['a'][1][0]], dt=1)
gp_c = d2c(gp_d, method='zoh')

What role does the coefficient k play? Is it true to write [1,-p['a'][0][0],-p['a'][1][0]] as the denominator of a discrete-time transfer function?

Thanks a lot



Solution 1:[1]

K is the gain matrix, and you should use the variables to make the code clear

extracting them like so:

linspace = np.linspace(1, u[0], num = u.shape[0])
y, p, k = m.sysid(linspace, u, y, 2, 2, pred='meas')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 anthony lutjen