Summary
Having established the serial link between the Doubling oven at the Y-end and the Raspberry pi, I wanted to use this interface to collect time-series from the oven after applying a step function in an effort to measure the transfer function of the oven. The idea was that knowing the transfer function of the oven, I could use some simple PID tuning rules like the Ziegler-Nichols rule or put everything in SIMULINK and find the optimal PID gains. However, I am unable to extract the oven transfer function from the time series data collected.
Methodology:
Last night, between 920pm and 940pm I applied a step function to the doubling oven by changing the setpoint of the controller from 35.7 Celsius to 39 Celsius (having checked elog 3203 to get an idea of a 'safe' step to apply). I then used the Pi to collect time series data for 6 minutes, then returned the set-point back to 35.7 Celsius, and took another time-series to make sure things were back to normal. Having gotten the time series data, I attempted to fit it using some exponentials which I derived as follows:

I couldn't think of a way to get the laplace transform of the time-series data collected, so I approximated the oven transfer function as a system with a one simple pole i.e. G(s)=K/(1+Ts), where K and T are parameters that characterise the oven transfer function. I then plugged in the above expression for Y(s) into Mathematica (knowing X(s)=constant/s, and H(s) = 250 + 60/s +25s from the PID gains) and did an inverse laplace transform to find a y(t) with two unknown parameters K and T to which I could fit the time-series data.
Results:
The time-series data collected via the Pi after applying the step was this:

The inverse laplace transform from mathematica yielded the following (formidable!) function (time, the independent variable, is x, and the fitting parameters are a=K and b=T where K and T are as described earlier):
(39*(exp(x*(1/(2*(25*a - b)) - (125*a)/(25*a - b) - sqrt(1 - 500*a+ 56500*a^2 + 240*a*b)/(2*(25*a - b)))) - exp(x*(1/(2*(25*a - b)) - (125*a)/(25*a - b) + sqrt(1 - 500*a + 56500*a^2 + 240*a*b)/(2*(25*a - b)))))*a)/sqrt(1 - 500*a + 56500*a^2 + 240*a*b)
My best attempts to fit this using MATLAB's cftool have given me useless fits:

I tried changing the start-points for the fitting parameters but I didn't get any better fits.
To Do:
- Explore other fitting options.
- Try and find a way to Laplace transform the time-series data so I can do the fitting in the s-domain.
- I have some tweaking to do as far as the python scripts on the pi are concerned.
- I have to get the current temperature readings onto one of the unused Y-arm EPICS channels, and log that data ~ once every 10 seconds.
Misc Remarks:
- The time-series data has a 'stepped' appearance because of the resolution of the temperature sensor: it is 0.1 Celsius.
- The sampling rate of the data-acquisition is limited; right now, I wait for 0.15 seconds after sending the command word to the controller before reading the data. When I set the wait-period any lower than this, I get errors. This has to be investigated more as I feel I should be able to get better sampling with the advertised baudrate of 115200, but in any case, it looks like it is sufficient for our purposes.
|