With the completed logic trees from last week, Zhen Xuan began coding out the complete logic trees for Codesys. The temperature logic tree and fan control logic tree were successfully set up without any errors during compilation and building. The temperature sensor attached also provided evidence that the temperature logic tree was working.
Moving forwards, he consulted Tony and the lab seniors on the subsequent steps and began working on the temperature control program module involving PID, which required reading up on how the PID worked. He set up the basic PID code without the variables first such that when we tested we could easily input the required information.
For the fan control, he learnt more about how we could set the fan speed dial to our desired range, limiting the maximum speed at which our fans were allowed to spin. This was an important safety feature as our fans could go up to quite a high (and dangerous) speed! Taking Tony’s suggestion into account, he based the fan speed dial on the pulse-width modulation minimum and maximum values of 0 and 1 respectively, which gave us a spectrum of power supplied to the fans. This is similar to the continuous nature of the temperature control.
One problem that Zhen Xuan ran into this week was the complexity of the PID, as it is difficult to understand the way in which the module works. He was relieved to learn that there were other groups that were using the PID modules as well and as such, this created opportunities for him to learn from his peers. He also found it tough to understand how the block of code in Codesys functions and the input values required, as it is vastly different from Python, which he has prior experience in. As such, he resolved to research and read up more on Codesys and PID modules to gain a better understanding.