Today I’m going to explain a thing I had to do some time ago, it was slightly different but the overall functionality was kind of the same.
Imagine that we have a pump fed through a VFD controlled by a PID with its sensor and reference. For today’s example, we’re going to read that PID reference and if it’s higher than a set point for a period of time that we can configure, then we will turn on a pump fed through a soft starter.
Let’s see our overall system. We’re going to focus on the area highlited in green:
First of all, I’ve created a data type (STRUCT) named as PUMP, whose variables are the following:
STATUS : INT; // 1 RUN, 2 STOP, 3 LOCAL
MODE : INT; // 1 AUTOMATIC MODE (An algorithm will take charge of it), 2 MANUAL
FAILED_TO_START : BOOL; // As receiving a start command the pump will have to start within a period of time. If not, this alarm will be raised.
FAILED_TO_STOP : BOOL; // As receiving a stop command the pump will have to stop within a period of time. If not, this alarm will be raised.
CURRENT_RT : REAL; // Accumulated running time of the pump.
HEALTHY : BOOL; // 0 Unhealthy ; 1 Healthy
For the modelling of the pump there are several modes to control the pump. Locally, we have the LOCAL_SELECTOR which will be true if the pump is controlled from the electrical panel, the algorithm will copy that state so that if it turns to REMOTE it will keep the very same status. The running feedback will be on if locally the pump is turned on or remotely we turn it on.
The pump has two protections, a thermal relay and a bearing relay, it should have far more, I just put two for the sake of simplicity. If the pump fails to start or to stop, it will be unhealthy and will remain like that until someone restart the pump. This has been made because by doing so we make sure someone has seen the alarm and somehow has acknowledge it. It could be added a log to register such alarms, but that is something out of the aim of today’s project.
As the algorithm will pay attention to the running hours of the pump, in case of replacing one of the pumps you’ll have to modify the running time of the pump (To set it to 0 or another pump if you are using that one from another facility with an amount of running hours accumulated).
For the commands I’ve decided to set all of them to 0 once we’ve gone once through this block, because of experience I do really recommend doing this, because if some command by any reason is latched from local to remote operation may result in undesired consequences.
I’ve created the following function block to control the pumps with the following I/O variables:
About the algorithm, it will determine, within the healthy pumps which to start (the one in auto mode with the least current time accumulated) if the PID Reference is higher than the set point to start a pump. Likewise the algorithm wil decide the pumps to stop if the PID Reference is lower than the set point to stop a pump (the one with the most current time accumulated) The I/O variables of the function block are the following:
Here is a demo of the program simulated on TwinCAT: