A rotation unit for air conditioners is designed to ensure the switching mode of work in two air conditioners with a specified period of time and maintain a normal temperature mode in a room in different climatic conditions.
Using a control unit for air conditioners allows to use the lifetime of main and backup air conditioners equally by switching their roles from time to time. It also automatically switches a backup conditioner on when a main one failed or it is not powerful enough.
As a rule, rotation and backing up are used in the rooms where there is a need to maintain a maximum allowed temperature, for example, in server rooms with a big number of expensive equipment. To implement a backup scheme, there is a need to make sure that a power of either one of both conditioners is enough to maintain operating climatic conditions. I.e. one conditioner operates while another one is on backup.
The use of a rotation unit allows you to ensure the operation stability of an air conditioning system at your infrastructure!
In this article, we will examine an example of creating a rotation unit for conditioners in a server room on the basis of NetPing monitoring units.
A server room is equipped by two air conditioners. There is a need to implement the next operation algorithm:
- A regular mode of air conditioners operation. In this mode, conditioners work according to a switching scheme (two conditioners are automatically switched on one by one: the first conditioner works during the first twenty four hours, the second conditioner works during the next twenty four hours, the first conditioner works during the third twenty four hours, etc.);
- An emergency mode of air conditioners operation. If one of conditioners fails, and a temperature rises above 35°C, there is a need to use a backup conditioner that must operate until the first one is fixed.
To implement a rotation unit, there is a need to have the next equipment:
- UniPing server solution v3 – 2 pcs.;
- IR Module IRC-TR v2 – 2 pcs.;
- 1-wire temperature sensor – 2 pcs.;
- Airlow sensor – 2 pc.;
- PC/server with OS Ubuntu – 1 pc.;
- Local network
Let's consider UniPing server solution v3 monitoring unit are configured for the operation in your local network, and IR modules IRC-TR v2, airflow sensors, and 1-wire temperature sensors are plugged in. More detailed information about parameters of a monitoring unit can be found here. In addition, let's consider the UniPing server solution v3 monitoring unit configured for controlling an air conditioner. Rules of the configuration can be read here and here.
In our article, we will use the next parameters of monitoring unit:
Parameter | UniPing server solution v3 device №1 | UniPing server solution v3 device №2 |
---|---|---|
IP address | 192.168.1.200 | 192.168.1.208 |
Login | visor | visor |
Password | ping | ping |
Connected temperature sensor | 1 | 1 |
IO line with a connected airflow sensor | IO 1 | IO 1 |
Command number for switching a conditioner on | 2 | 2 |
Command for switching a conditioner off | 3 | 3 |
To implement a software compound of our rotation unit for conditioners, we will write a script on a scripting programming language BASH. The script will be executed on a console at a PC/Server with the OS Ubuntu. PC/server may be either virtual or physical, connected to the same local network with the UniPing server solution v3 monitoring unit. A controlling script can also be launched on a computer outside a local network, in this case UniPing server solution v3 monitoring unit must be available on the Internet. It is possible to read about how to do this here.
For a script to work, there is a need to install the utility Curl using a command «sudo apt install curl»)
Then, we create a script file split_rotation.sh using a command «nano split_rotation.sh»
Then, we write a script text, as shown in the example below (there is a link for downloading a ready script file in the end):
#!/bin/bash
error_t=$"thermo_result('error');"
error_io=$"io_result('error');"
error_ir=$"ir_result('error')"
split1_status=0 #A variable that records the status of the air conditioner # 1 operation. 0 - ok, 1 - failure
split2_status=0 #A variable that records the status of the air conditioner # 2 operation. 0 - ok, 1 - failurewhile [ $split1_status -eq 0 ] || [ $split2_status -eq 0 ]
do
count1=0 # Operating hours counter 1
count2=0 # Operating hours counter 1# Turn on the air conditioner1:
ir1=$(curl --silent --user visor:ping http://192.168.1.200/ir.cgi?play=2) #Substitute your values login:password, the IP address of the device 1 and the command number of the air conditioning unit 1
ir2=$(curl --silent --user visor:ping http://192.168.1.208/ir.cgi?play=3) #Substitute your values login:password, the IP address of device 2 and the number of the command to turn off the air conditioner 2
# Verify the syntax of the URL-encoded commands from the server to the UniPing Server Solution v3/SMS device
if [ "$ir1" = "$error_ir" ] || [ "$ir2" = "$error_ir" ]
then
echo "Error in the URL-encoded command to turn on the air conditioner #1"
exit
else
echo "The conditioner #1 is switched on"
sleep 5m #Рause 5m to receive a temperature sensor
while [ $count1 -lt 23 ]
do
# Url-encoded requests to the UniPing Server Solution v3/SMS 1 for information on temperature and availability of airflow:
thermo1=$(curl --silent --user visor:ping http://192.168.1.200/thermo.cgi?t9) # Substitute your login values: password, the IP address of device 1 and the number of the temperature sensor
io1=$(curl --silent --user visor:ping http://192.168.1.200/io.cgi?io1) #Substitute your login: password, the IP address of device 2, and the IO number of the line to which the flow sensor is connected air.
# Validate the syntax of the URL-encoded request from the server to the UniPing Server Solution v3/SMS device
if [ "$thermo1" = "$error_t" ]||[ "$io1" = "$error_io" ]
then
echo "Error in URL-encoded condition request for air conditioner #1"
exit
else # Check the condition of the regular work of the air conditioner 1
thermo1_value=${thermo1:20:2} #Getting temperature information near the air conditioner 1
io1_value=${io1:20:1} #Get information about the presence of airflow from the air conditioner 1
if [ $thermo1_value -le 35 ] && [ $io1_value -eq 1 ]
then # Normal mode
sleep 1h #Pause between checks 1 hour
((count1 ++ ))
split1_status=0
else # Emergency mode
echo "Air conditioning #1 Emergency mode!"
echo "Temperature above normal or no airflow"
count1=25
split1_status=1
fi
fi
done
fi#Turn on the air conditioner2:
ir1=$(curl --silent --user visor:ping http://192.168.1.200/ir.cgi?play=3) #Substitute your values login:password, device IP address and command number
ir2=$(curl --silent --user visor:ping http://192.168.1.208/ir.cgi?play=2) #Substitute your values login:password, device IP address and command number
#Verify the syntax of the URL-encoded commands from the server to the UniPing Server Solution v3/SMS device
if [ "$ir1" = "$error_ir" ] || [ "$ir2" = "$error_ir" ]
then
echo "Error in the URL-encoded command to turn on the air conditioner #2"
exit
else
echo "The conditioner #2 is switched on"
sleep 5m #Рause 5m to receive a temperature sensor
while [ $count2 -lt 23 ]
do
# Url-encoded requests to the UniPing Server Solution v3/SMS 2 for information on temperature and availability of airflow:
thermo2=$(curl --silent --user visor:ping http://192.168.1.208/thermo.cgi?t1) #Substitute your values login:password, device IP address and temperature sensor number
io2=$(curl --silent --user visor:ping http://192.168.1.208/io.cgi?io1) #Substitute your values login:password, the IP address of the device and the IO number of the line to which the airflow sensor is connected .
# Validate the syntax of the URL-encoded request from the server to the UniPing Server Solution v3/SMS device
if [ "$thermo2" = "$error_t" ]||[ "$io2" = "$error_io" ]
then
echo "Error in URL-encoded condition request for air conditioner #2"
exit
else #Checking the condition of the regular work of the air conditioner 2
thermo2_value=${thermo2:20:2} #Getting temperature information near the air conditioner 2
io2_value=${io2:20:1} #Obtain information about the presence of airflow from the air conditioner 2
if [ $thermo2_value -le 35 ] && [ $io2_value -eq 1 ]
then #Normal mode
sleep 1h #Pause between checks 1 hour
((count2 ++ ))
split2_status=0
else #Emergency mode
echo "Air conditioning #2 Emergency mode!"
echo "Temperature above normal or no airflow"
count2=25
split2_status=1
fi
fi
done
fi
done
echo "All air conditioners in the server room do not work!"
Save and make a file executable using a command «sudo chmod +x split_rotation.sh»:
Then, we launch our script using a command «./split_rotation.sh»:
And, if there is no syntax errors in the script source code, then a notification about switching on the conditioner #1 will appear in a console:
24 hours after launching the script, the conditioner #1 will be switched off and the conditioner #2 will be switched on:
After the next 24 hours, the conditioner #2 will be switched off, and the conditioner #1 will be switched on again. In a normal operatin mode, the script will be executed endlessly (only if a server works). The execution can be interrupted by clicking a key combination «CTRL+C»:
Temperature near air conditioners is controlled once every hour. If temperature exceeds 35°C and/or an airflow sensor does not register the airflow during the next polling of sensors of the conditioner that is currently working, then the script will activate «Emergency mode» and switch on another conditioner. At the same time, the next notification appears in a console:
Or
At the same time, the script will try to switch on the conditioner that failed and request temerature data and a status of an airflow sensor 24 hours after switching to another conditioner. If these values are tested successfully, then the script switches to a normal operation mode.
If both air conditioners fail, the script will send a notification about this to a console and will end its work:
After failures of air conditioners are fixed, the script should be launched manually.
Testing URL-encoded requests to UniPing server solution v3 monitoring unit for correctness is embedded in the script.
If requests are incorrect, a notification about an error in a URL-encoded command is displayed, and the execution of the scrip is interrupted. After fixing commands in the script source code the script should be launched manually:
To make the script launch automatically at the start of a PC/a server, there is a need to add it to the autoload. To do this, open a file using a rc.local command: «sudo nano /etc/rc.local»:
Add the script before the line «exit 0» and save the file:
The script will be executed after a system reboot.
A ready script file can be downloaded from here: split_rotation.sh.
As a result of all actions listed above, we will get a rotation unit for air conditioners implemented on the basis of devices and sensors of the NetPing company.