Outdoor lighting control

Once I was faced with the task of modernizing the outdoor lighting control system: artistic illumination of facades, advertising signs, street poles, illumination of address plates, etc. The need for modernization was caused by the fact that the work of lighting installations required frequent human participation. In order for the control to work as expected, it was necessary to manually adjust the on and off times .





IT . , . , , . . , , , .





: , , , .





, , . . , - . , . () .





. (). RS485 -, . SCADA OPC-, Ethernet, . .





, . , : , . . , . . .





, , . . , / , . , . : , () 0. . , "-6" , 6°. , , . .





, . , . -, - . , . , Ethernet, , Linux-.





-, . - , Modbus TCP.





Modbus modpoll. Linux :





$ wget https://www.modbusdriver.com/downloads/modpoll.tgz
$ tar xzf modpoll.tgz
$ sudo cp modpoll/linux_x86-64/modpoll /usr/local/bin/
      
      



:





# 
$ modpoll -m tcp -r 2 -t 0 -a 1 -p 502 192.168.0.227 1 1 1 1 1 1 1 1 

# 
$ modpoll -m tcp -r 2 -t 0 -a 1 -p 502 192.168.0.227 0 0 0 0 0 0 0 0 
      
      



- . , . , , "".





, «». , . : , . , 0°50′ 6°, — 6° 12°, — 12° 18°.





. , , . , ( -6° ) ( -6° ). , , , -6° .





.

, , . . , . , , . , , . - .





, , .





Youtube - / How the sun moves across the sky (by daybit).





, . - , - . Linux Perl, . :





$ sudo cpan install Astro::Coord::ECI
      
      



get_sun_elevation.pl, .





#!/usr/bin/perl
#          
# get_sun_elevation.pl 55.7558 37.6173 127
# 55.7558 -   
# 37.6173 -   
# 127 -      

use Astro::Coord::ECI::Sun;
use Astro::Coord::ECI::Utils qw{:all};

my ($lat, $lon, $elev) = (deg2rad($ARGV[0]), deg2rad($ARGV[1]), $ARGV[2]/1000);

my $time = time ();

my $loc = Astro::Coord::ECI->geodetic ($lat, $lon, $elev);

my $sun = Astro::Coord::ECI::Sun->universal ($time);

my ($azimuth, $elevation, $range) = $loc->azel ($sun);

print rad2deg ($elevation), "\n";
      
      



moscow_lights_ctrl.sh . , , - :





#!/bin/sh

[ -z "$1" ] && angle=-6 || angle=$1

sun_angle=`./sun_pos.pl 55.751244 37.618423 124`

if [ $(echo "$sun_angle >= $angle" |bc -l) -eq "0" ]; then
  modpoll -m tcp -r 2 -t 0 -a 1 -p 502 192.168.0.227 1 1 1 1 1 1 1 1
  exit 0
fi

modpoll -m tcp -r 2 -t 0 -a 1 -p 502 192.168.0.227 0 0 0 0 0 0 0 0
      
      



, , -1.5°. , , .





cron moscow_lights_ctrl.sh :





#    1.5  -  ,  - 
* * * * * root /path/to/moscow_lights_ctrl.sh -1.5
      
      



. , . -, Modbus TCP.





. .





ZABBIX

, . . , . , .. , . , - ZABBIX.





. ZABBIX.





ZABBIX

astro_outdoor_lighting Zabbix :





  • {$CIVIL_DEGREES} - . ,





  • {$ELEV} - ,





  • {$LAT} - ,





  • {$LON} - .





- elevation. .





, get_sun_elevation.pl.





/usr/lib/zabbix/externalscripts/get_sun_elevation.pl
#!/usr/bin/perl
#          
# get_sun_elevation.pl 55.7558 37.6173 127
# 55.7558 -   
# 37.6173 -   
# 127 -      

use Astro::Coord::ECI::Sun;
use Astro::Coord::ECI::Utils qw{:all};

my ($lat, $lon, $elev) = (deg2rad($ARGV[0]), deg2rad($ARGV[1]), $ARGV[2]/1000);

my $time = time ();

my $loc = Astro::Coord::ECI->geodetic ($lat, $lon, $elev);

my $sun = Astro::Coord::ECI::Sun->universal ($time);

my ($azimuth, $elevation, $range) = $loc->azel ($sun);

print rad2deg ($elevation), "\n";
      
      



ZABBIX .





civil_twilight_dawn , . . , .





github.





, , . .





ZABBIX

[]->[] facade light off facade light on.





civil_twilight_dawn "", , .. facade light on. , facade light off. []->[] facade light, .





.





ZABBIX .





. - .





, ( cron) . . , . ., . , - , .





The variant with the use of a monitoring system can solve even more interesting problems. In addition to control, it makes it possible to monitor the operation of the equipment and notify personnel when a malfunction is detected. An example is the synchronous inclusion of advertising signs on the facade of a shopping center. And in the event of a malfunction of any sign, the operating personnel will receive a message.





Of course, all of the above is relevant in the presence of any kind of IT infrastructure. But, as a rule, it is available.





That's all. Thanks for attention!








All Articles