C'est juste hyper compliqué, et ... hyper difficile à expliquer.
Tout ce que j'emploie est en logiciel libre, et il existe des modes d'emploi sur internet. Pour le reste, c'est "juste" un empilement de logiciel, inexplicable à des non-experts.
Ce dernier graphique est généré avec les données accumulées dans mysql avec la librairie JpGraph (
Exemple : le script qui effectue les mesures, génère les graphiques et les transferts sur internet ... je ne suis pas sur que cela parle à tout le monde
Code : Tout sélectionner
<?php
function trunk_end_sql(&$value)
{
$value=str_replace(');',',',$value);
}
function trunk_begin_sql(&$value)
{
$value=substr_replace($value,'',0,54);
}
function LoadPNG($imgname) {
$im = @imagecreatefrompng($imgname); /* Tentative d'ouverture */
if (!$im) { /* Vérification */
$im = imagecreatetruecolor(150, 30); /* Création d'une image blanche */
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Affichage d'un message d'erreur */
imagestring($im, 1, 5, 5, "Erreur de chargement de l'image $imgname", $tc);
}
return $im;
}
// -----------------------------------
// acquisition 1 minutes + rrd graphes
// -----------------------------------
$blnet_data = '';
$blnet_data = shell_exec('dl-aktuelle-datenx -i xxx.xxx.xxx.xxx:xxx -t0 --rrd');
$data_time = exec('date +%s');
$date_time = date('d.m.y H:i:s');
$date_date = date('d.m.y');
$date_jour = date('d');
$time_minute = date('i');
$time_00min = $time_minute;
$time_minute = $time_minute[strlen($time_minute)-1];
$new_day = date('H:i');
$data_array=explode(";",$blnet_data);
$data_rrd = $data_array[2].':'.$data_array[3].':'.$data_array[4].':'.$data_array[5].':'.$data_array[13].':'.$data_array[6].':'.$data_array[7].':'.$data_array[8].':'.$data_array[9].':'.$data_array[10].':'.$data_array[17].':'.$data_array[11].':'.$data_array[12].':'.$data_array[16].':'.$data_array[14].':'.$data_array[41].':'.$data_array[42].':'.$data_array[43].':'.$data_array[35].':'.($data_array[36]*10).':'.($data_array[38]*10).':'.$data_array[36].':'.$data_array[38].':'.$data_array[18].':'.$data_array[20].':'.$data_array[25].':'.$data_array[27].':'.$data_array[24].':'.$data_array[22].':'.$data_array[23];
$data_rrd=str_replace(CHR(32),"",$data_rrd);
exec ("rrdtool update /srv/www/htdocs/solar/data/solar_data.rrd N:$data_rrd");
$data_array[44]=number_format($data_array[44]*0.0112,1);
exec ("rrdtool update /srv/www/htdocs/solar/data/solar_wind_data.rrd $data_time:$data_array[44]");
// ----------------------------------
// acquisition 5 minutes + update web
// ----------------------------------
if (($time_minute==0) || ($time_minute==5)) {
// toutes les 5 minutes
$img = LoadPNG('/srv/www/htdocs/solar/data/hydro.png');
$textcolor_black=imagecolorallocate($img,0,0,0);
$textcolor_blue=imagecolorallocate($img,0,0,255);
$textcolor_red=imagecolorallocate($img,255,0,0);
imagestring($img,3,10,10,$date_time,$textcolor_black);
imagestring($img,3,10,30,'Mise a jour auto toutes les 5 minutes',$textcolor_black);
imagestring($img,3,535,398,$data_array[2].'°C',$textcolor_black);//Haut stock OK
imagestring($img,3,524,463,$data_array[3].'°C',$textcolor_black);//milieu stock OK
imagestring($img,3,506,665,$data_array[4].'°C',$textcolor_black);//bas stock OK
$data_graph='/srv/www/htdocs/solar/data/stock.png --start end-24h --end N --title "Système solaire thermique - Stock chauffage - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE CDEF:sol=solar,10,/ AREA:sol#660000:"Ensoleillement [W/m2]" LINE1:sol#cc0000 DEF:vanne_stock=/srv/www/htdocs/solar/data/solar_data.rrd:vanne_stock:AVERAGE CDEF:v_stock=vanne_stock,3,* AREA:v_stock#ff6600:"Vanne stock [ON]" DEF:t_haut_stock=/srv/www/htdocs/solar/data/solar_data.rrd:t_haut_stock:AVERAGE LINE1:t_haut_stock#ffff00:"Temp. haut stock [°C]" DEF:t_milieu_stock=/srv/www/htdocs/solar/data/solar_data.rrd:t_milieu_stock:AVERAGE LINE1:t_milieu_stock#00FF00:"Temp. milieu stock [°C]" DEF:t_bas_stock=/srv/www/htdocs/solar/data/solar_data.rrd:t_bas_stock:AVERAGE LINE1:t_bas_stock#A8EDFF:"Temp. bas stock [°C]"';
exec ("rrdtool graph ".$data_graph);
$data_graph='/srv/www/htdocs/solar/data/delta_stock.png --start end-24h --end N --title "Système solaire thermique - Delta T éch. Stock chauffage - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE CDEF:sol=solar,50,/ AREA:sol#660000:"Profil ensoleillement [W/m2 (divisé par 50)]" DEF:t_arrive_stock=/srv/www/htdocs/solar/data/solar_data.rrd:t_arrive_stock:AVERAGE DEF:t_retour_capt=/srv/www/htdocs/solar/data/solar_data.rrd:t_retour_capt:AVERAGE CDEF:delta_stock=t_arrive_stock,t_retour_capt,- LINE1:delta_stock#ffff00:"Delta T échangeur stock [°C]"';
exec ("rrdtool graph ".$data_graph);
imagestring($img,3,1205,553,$data_array[5].'°C',$textcolor_black);//T ECS haut OK
imagestring($img,3,1205,605,$data_array[13].'°C',$textcolor_black);//T ECS milieu OK
imagestring($img,3,1205,700,$data_array[6].'°C',$textcolor_black);//T ECS bas OK
$data_graph='/srv/www/htdocs/solar/data/ecs.png --start end-24h --end N --title "Système solaire thermique - Stock ECS - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE CDEF:sol=solar,10,/ AREA:sol#660000:"Ensoleillement [W/m2]" LINE1:sol#cc0000 DEF:vanne_ecs=/srv/www/htdocs/solar/data/solar_data.rrd:vanne_ecs:AVERAGE CDEF:v_ecs=vanne_ecs,3,* AREA:v_ecs#ff6600:"Vanne ECS [ON]" DEF:circ_ecs=/srv/www/htdocs/solar/data/solar_data.rrd:circ_ecs:AVERAGE CDEF:c_ecs=circ_ecs,-3,* AREA:c_ecs#ff0000:"Charge chauffage->ECS [ON]" DEF:t_haut_ecs=/srv/www/htdocs/solar/data/solar_data.rrd:t_haut_ecs:AVERAGE LINE1:t_haut_ecs#ffff00:"Temp. haut ECS [°C]" DEF:t_milieu_ecs=/srv/www/htdocs/solar/data/solar_data.rrd:t_milieu_ecs:AVERAGE LINE1:t_milieu_ecs#00FF00:"Temp. milieu ECS [°C]" DEF:t_bas_ecs=/srv/www/htdocs/solar/data/solar_data.rrd:t_bas_ecs:AVERAGE LINE1:t_bas_ecs#A8EDFF:"Temp. bas ECS [°C]"';
exec ("rrdtool graph ".$data_graph);
$data_graph='/srv/www/htdocs/solar/data/delta_ecs.png --start end-24h --end N --title "Système solaire thermique - Delta T éch. ECS - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE CDEF:sol=solar,50,/ AREA:sol#660000:"Profil ensoleillement [W/m2 (divisé par 50)]" DEF:t_arrive_ecs=/srv/www/htdocs/solar/data/solar_data.rrd:t_arrive_ecs:AVERAGE DEF:t_arrive_stock=/srv/www/htdocs/solar/data/solar_data.rrd:t_arrive_stock:AVERAGE CDEF:delta_ecs=t_arrive_ecs,t_arrive_stock,- LINE1:delta_ecs#ffff00:"Delta T échangeur ECS [°C]"';
exec ("rrdtool graph ".$data_graph);
imagestring($img,3,969,529,$data_array[7].'°C',$textcolor_black);//T arrivée capt. ok
imagestring($img,3,921,700,$data_array[8].'°C',$textcolor_black);//T arrivée ecs. ok
imagestring($img,3,832,634,$data_array[9].'°C',$textcolor_black);//T arrivée stock. ok
imagestring($img,3,791,557,$data_array[10].'°C',$textcolor_black);//T retour aux capt. ok
imagestring($img,3,209,203,$data_array[11].'°C',$textcolor_black);//départ rad ok
imagestring($img,3,436,203,$data_array[12].'°C',$textcolor_black);//départ sol ok
$data_graph='/srv/www/htdocs/solar/data/chauffage.png --start end-24h --end N --title "Système solaire thermique - Chauffage - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE CDEF:sol=solar,20,/ AREA:sol#660000:"Ensoleillement [W/m2]" LINE1:sol#cc0000 DEF:circ_radiateur=/srv/www/htdocs/solar/data/solar_data.rrd:circ_radiateur:AVERAGE CDEF:c_rad=circ_radiateur,1,* AREA:c_rad#ffcc66:"Circ. radiateur [ON]" DEF:circ_chauffage_sol=/srv/www/htdocs/solar/data/solar_data.rrd:circ_chauffage_sol:AVERAGE CDEF:c_sol=circ_chauffage_sol,-1,* AREA:c_sol#00FF66:"Circ. chauffage sol [ON]" DEF:t_radiateur=/srv/www/htdocs/solar/data/solar_data.rrd:t_radiateur:AVERAGE LINE1:t_radiateur#ffff00:"Temp. radiateurs [°C]" DEF:t_chauffage_sol=/srv/www/htdocs/solar/data/solar_data.rrd:t_chauffage_sol:AVERAGE LINE1:t_chauffage_sol#00FF00:"Temp. chauffage sol [°C]" DEF:t_ext=/srv/www/htdocs/solar/data/solar_data.rrd:t_ext:AVERAGE LINE1:t_ext#A8EDFF:"Temp. extérieur [°C]" DEF:t_int=/srv/www/htdocs/solar/data/solar_data.rrd:t_int:AVERAGE LINE1:t_int#FF6600:"Temp. intérieur [°C]"';
exec ("rrdtool graph ".$data_graph);
if($data_array[14]>50) {
imagestring($img,3,406,43,' NC',$textcolor_black);//T int OK
}
else {
imagestring($img,3,406,43,$data_array[14].'°C',$textcolor_black);//T int OK
}
imagestring($img,3,773,43,$data_array[16].'°C',$textcolor_black);//T ext OK
$data_graph='/srv/www/htdocs/solar/data/t_ext.png --start end-24h --end N --title "Système solaire thermique - Température extérieur - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE CDEF:sol=solar,10,/ AREA:sol#660000:"Ensoleillement [W/m2]\l" LINE1:sol#cc0000 DEF:t_ext=/srv/www/htdocs/solar/data/solar_data.rrd:t_ext:AVERAGE VDEF:t_ext_act=t_ext,LAST VDEF:t_ext_max=t_ext,MAXIMUM VDEF:t_ext_min=t_ext,MINIMUM VDEF:t_ext_avg=t_ext,AVERAGE COMMENT:" \l" LINE1:t_ext#ffff00:"Temp. extérieur [°C]" GPRINT:t_ext_act:"\tACTUELLE\: %3.1lf°C" GPRINT:t_ext_max:"\tMAX\: %3.1lf°C" GPRINT:t_ext_min:"\tMIN\: %3.1lf°C" GPRINT:t_ext_avg:"\tMOY\: %3.1lf°C\j"';
exec ("rrdtool graph ".$data_graph);
imagestring($img,3,738,511,number_format($data_array[17],0).' l/h',$textcolor_black);//débit solaire ok
$data_graph='/srv/www/htdocs/solar/data/debit.png --start end-24h --end N --title "Système solaire thermique - Débit circuit solaire - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE CDEF:sol=solar AREA:sol#660000:"Ensoleillement [W/m2]" LINE1:sol#cc0000 DEF:vanne_stock=/srv/www/htdocs/solar/data/solar_data.rrd:vanne_stock:AVERAGE CDEF:v_stock=vanne_stock,30,* AREA:v_stock#ff6600:"Vanne stock [ON]" DEF:vanne_ecs=/srv/www/htdocs/solar/data/solar_data.rrd:vanne_ecs:AVERAGE CDEF:v_ecs=vanne_ecs,-30,* AREA:v_ecs#ff0000:"Vanne ECS [ON]" DEF:debit=/srv/www/htdocs/solar/data/solar_data.rrd:debit:AVERAGE LINE1:debit#ffff00:"Débit circuit solaire [l/h]"';
exec ("rrdtool graph ".$data_graph);
imagestring($img,3,945,102,$data_array[41].'°C',$textcolor_black);//T absorbeur 1 ok
$data_graph='/srv/www/htdocs/solar/data/t_absorbeurs.png --start end-24h --end N --title "Système solaire thermique - Température absorbeurs - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE CDEF:sol=solar,10,/ AREA:sol#660000:"Ensoleillement [W/m2]" LINE1:sol#cc0000 DEF:circ_solaire=/srv/www/htdocs/solar/data/solar_data.rrd:circ_solaire:AVERAGE CDEF:c_sol=circ_solaire,3,* AREA:c_sol#ff6600:"Circulateur solaire [ON]\l" DEF:t_absorbeur_1=/srv/www/htdocs/solar/data/solar_data.rrd:t_absorbeur_1:AVERAGE LINE1:sol#cc0000 DEF:t_absorbeur_2=/srv/www/htdocs/solar/data/solar_data.rrd:t_absorbeur_2:AVERAGE VDEF:t_abs1_act=t_absorbeur_1,LAST VDEF:t_abs1_max=t_absorbeur_1,MAXIMUM VDEF:t_abs1_min=t_absorbeur_1,MINIMUM VDEF:t_abs1_avg=t_absorbeur_1,AVERAGE VDEF:t_abs2_act=t_absorbeur_2,LAST VDEF:t_abs2_max=t_absorbeur_2,MAXIMUM VDEF:t_abs2_min=t_absorbeur_2,MINIMUM VDEF:t_abs2_avg=t_absorbeur_2,AVERAGE COMMENT:" \l" LINE1:t_absorbeur_1#ffff00:"Temp. absorbeur 1 [°C]" GPRINT:t_abs1_act:"\tACTUELLE\: %3.1lf°C" GPRINT:t_abs1_max:"\tMAX\: %3.1lf°C" GPRINT:t_abs1_min:"\tMIN\: %3.1lf°C" GPRINT:t_abs1_avg:"\tMOY\: %03.1lf°C\j" LINE1:t_absorbeur_2#A8EDFF:"Temp. absorbeur 2 [°C]" GPRINT:t_abs2_act:"\tACTUELLE\: %3.1lf°C" GPRINT:t_abs2_max:"\tMAX\: %3.1lf°C" GPRINT:t_abs2_min:"\tMIN\: %3.1lf°C" GPRINT:t_abs2_avg:"\tMOY\: %3.1lf°C\j"';
exec ("rrdtool graph ".$data_graph);
$data_graph='/srv/www/htdocs/solar/data/delta_capteurs.png --start end-24h --end N --title "Système solaire thermique - Delta T capteurs - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE CDEF:sol=solar,50,/ AREA:sol#660000:"Profil ensoleillement [W/m2 (divisé par 50)]" DEF:t_arrive_capt=/srv/www/htdocs/solar/data/solar_data.rrd:t_arrive_capt:AVERAGE DEF:t_retour_capt=/srv/www/htdocs/solar/data/solar_data.rrd:t_retour_capt:AVERAGE CDEF:delta_capteurs=t_arrive_capt,t_retour_capt,- LINE1:delta_capteurs#ffff00:"Delta T capteurs [°C]"';
exec ("rrdtool graph ".$data_graph);
$data_graph='/srv/www/htdocs/solar/data/delta_t_abs_t_ext.png --start end-24h --end N --title "Système solaire thermique - Delta absorbeurs / temp. extérieur - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE CDEF:sol=solar,10,/ AREA:sol#660000:"Ensoleillement [W/m2]\l" LINE1:sol#cc0000 DEF:t_absorbeur_1=/srv/www/htdocs/solar/data/solar_data.rrd:t_absorbeur_1:AVERAGE DEF:t_absorbeur_2=/srv/www/htdocs/solar/data/solar_data.rrd:t_absorbeur_2:AVERAGE DEF:t_ext=/srv/www/htdocs/solar/data/solar_data.rrd:t_ext:AVERAGE CDEF:delta_abs1=t_absorbeur_1,t_ext,- CDEF:delta_abs2=t_absorbeur_2,t_ext,- VDEF:delta_abs1_act=delta_abs1,LAST VDEF:delta_abs1_max=delta_abs1,MAXIMUM VDEF:delta_abs1_min=delta_abs1,MINIMUM VDEF:delta_abs1_avg=delta_abs1,AVERAGE VDEF:delta_abs2_act=delta_abs2,LAST VDEF:delta_abs2_max=delta_abs2,MAXIMUM VDEF:delta_abs2_min=delta_abs2,MINIMUM VDEF:delta_abs2_avg=delta_abs2,AVERAGE COMMENT:" \l" LINE1:delta_abs1#ffff00:"Delta T absorbeur 1 / Temp. extérieur [°C]" GPRINT:delta_abs1_act:"\tACTUELLE\: %3.1lf°C" GPRINT:delta_abs1_max:"\tMAX\: %3.1lf°C" GPRINT:delta_abs1_min:"\tMIN\: %3.1lf°C" GPRINT:delta_abs1_avg:"\tMOY\: %3.1lf°C\j" LINE1:delta_abs2#A8EDFF:"Delta T absorbeur 2 / Temp. extérieur [°C]" GPRINT:delta_abs2_act:"\tACTUELLE\: %3.1lf°C" GPRINT:delta_abs2_max:"\tMAX\: %3.1lf°C" GPRINT:delta_abs2_min:"\tMIN\: %3.1lf°C" GPRINT:delta_abs2_avg:"\tMOY\: %3.1lf°C\j"';
exec ("rrdtool graph ".$data_graph);
imagestring($img,3,945,124,$data_array[42].'°C',$textcolor_black);//T absorbeur 2 ok
imagestring($img,3,950,43,number_format($data_array[43],0).' W/m2',$textcolor_black);//solarimètre ok
imagestring($img,3,1069,43,$data_array[44].' Km/h',$textcolor_black);//Vent ok
imagestring($img,3,1069,73,number_format($data_array[44]/3.6,2).' m/s',$textcolor_black);//Vent ok
$data_graph='/srv/www/htdocs/solar/data/wind.png --start end-24h --end N --title "Système solaire thermique - Vitesse du vent - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:wind=/srv/www/htdocs/solar/data/solar_wind_data.rrd:wind:AVERAGE CDEF:windms=wind,3.6,/ VDEF:wind_act=wind,LAST VDEF:wind_max=wind,MAXIMUM VDEF:wind_min=wind,MINIMUM VDEF:wind_avg=wind,AVERAGE VDEF:windms_act=windms,LAST VDEF:windms_max=windms,MAXIMUM VDEF:windms_min=windms,MINIMUM VDEF:windms_avg=windms,AVERAGE LINE1:wind#ffff00:"Vitesse du vent [Km/h]" GPRINT:wind_act:"\tACTUELLE\: %3.1lfKm/h" GPRINT:wind_max:"\tMAX\: %3.1lfKm/h" GPRINT:wind_min:"\tMIN\: %3.1lfKm/h" GPRINT:wind_avg:"\tMOY\: %3.1lfKm/h\j" COMMENT:" Vitesse du vent [m/s] " GPRINT:windms_act:"\tACTUELLE\: %2.2lfm/s" GPRINT:windms_max:"\tMAX\: %2.2lfm/s" GPRINT:windms_min:"\tMIN\: %2.2lfm/s" GPRINT:windms_avg:"\tMOY\: %2.2lfm/s\j"';
exec ("rrdtool graph ".$data_graph);
$data_graph='/srv/www/htdocs/solar/data/solar.png --start end-24h --end N --title "Système solaire thermique - Energie solaire incidente - www.open-dream.org - '.$date_date.'" -w 800 -h 240 --imgformat PNG --color CANVAS#000000 --color BACK#101010 --color FONT#ffffdf --color MGRID#337fbf --color GRID#615900 --color FRAME#808080 --color ARROW#FF0099 --color SHADEA#000000 --color SHADEB#000000 DEF:solar=/srv/www/htdocs/solar/data/solar_data.rrd:solar:AVERAGE AREA:solar#660000:"Ensoleillement [W/m2]" LINE1:solar#cc0000';
exec ("rrdtool graph ".$data_graph);
//Puissance instantanée
imagestring($img,3,1030,200,'Puissance instantanée : '.$data_array[35].' KW',$textcolor_black);//Puissance instantanée
imagestring($img,3,1030,220,'Energie journaliere : '.number_format($data_array[38],1).' kWh',$textcolor_black);
imagestring($img,3,1030,240,'Energie totale : '.number_format($data_array[36],1).' kWh',$textcolor_black);
imagestring($img,3,1030,260,'(depuis le 1er mai 2009)',$textcolor_black);
imagestring($img,3,1030,280,'Rendement jour (3 derniers mois)',$textcolor_black);
if ($data_array[18]==1) {
imagestring($img,5,1019,450,'ON',$textcolor_red);//circ. ecs ok
}
else {
imagestring($img,5,1019,450,'OFF',$textcolor_blue);//circ. ecs ok
}
if ($data_array[20]==1) {
imagestring($img,5,765,450,'ON',$textcolor_red);//circ. solaire ok
}
else {
imagestring($img,5,765,450,'OFF',$textcolor_blue);//circ. solaire ok
}
if ($data_array[22]==1) {
imagestring($img,5,818,704,'ON',$textcolor_red);//vanne ecs ok
}
else {
imagestring($img,5,818,704,'OFF',$textcolor_blue);//vanne ecs ok
}
if ($data_array[23]==1) {
imagestring($img,5,769,616,'ON',$textcolor_red);//vanne stock
}
else {
imagestring($img,5,769,616,'OFF',$textcolor_blue);//vanne stock
}
if ($data_array[24]==1) {
imagestring($img,5,918,622,'ON',$textcolor_red);//vanne surchauffe ok
}
else {
imagestring($img,5,918,622,'OFF',$textcolor_blue);//vanne surchauffe ok
}
if ($data_array[25]==1) {
imagestring($img,5,185,260,'ON',$textcolor_red);//circ. rad ok
}
else {
imagestring($img,5,185,260,'OFF',$textcolor_blue);//circ. rad ok
}
if ($data_array[27]==1) {
imagestring($img,5,410,260,'ON',$textcolor_red);//circ. sol ok
}
else {
imagestring($img,5,410,260,'OFF',$textcolor_blue);//circ. sol ok
}
$circulateurs = array('ecs' => $data_array[18]."\n", 'solaire' => $data_array[20]."\n", 'radiateur' => $data_array[25]."\n", 'chauffage_sol' => $data_array[27]."\n");
file_put_contents('/srv/www/htdocs/solar/data/statut_pompes.dat', $circulateurs);
imagepng($img, '/srv/www/htdocs/solar/data/solaire.png');
imagedestroy($img);
$img = LoadPNG('/srv/www/htdocs/solar/data/tableau_prod.png');
$bg = imagecolorallocate($img,255,255,255);
if ($date_jour < 11) {
imagefilledrectangle($img,6,74+(34*($date_jour-1)),138,103+(34*($date_jour-1)),$bg);
imagestring($img,5,38,82+(34*($date_jour-1)),$date_date,$textcolor_black);
imagefilledrectangle($img,145,74+(34*($date_jour-1)),280,103+(34*($date_jour-1)),$bg);
imagestring($img,5,185,82+(34*($date_jour-1)),' '.number_format($data_array[38],1).' ',$textcolor_black);
}
else
{
if ($date_jour < 21) {
imagefilledrectangle($img,284,74+(34*($date_jour-11)),420,103+(34*($date_jour-11)),$bg);
imagestring($img,5,315,82+(34*($date_jour-11)),$date_date,$textcolor_black);
imagefilledrectangle($img,424,74+(34*($date_jour-11)),560,103+(34*($date_jour-11)),$bg);
imagestring($img,5,465,82+(34*($date_jour-11)),' '.number_format($data_array[38],1).' ',$textcolor_black);
}
else {
imagefilledrectangle($img,565,74+(34*($date_jour-21)),700,103+(34*($date_jour-21)),$bg);
imagestring($img,5,595,82+(34*($date_jour-21)),$date_date,$textcolor_black);
imagefilledrectangle($img,704,74+(34*($date_jour-21)),840,103+(34*($date_jour-21)),$bg);
imagestring($img,5,745,82+(34*($date_jour-21)),' '.number_format($data_array[38],1).' ',$textcolor_black);
}
}
imagepng($img, '/srv/www/htdocs/solar/data/tableau_prod.png');
imagedestroy($img);
if ($new_day=='00:00') {
$cur_dir = getcwd();
chdir('/srv/www/htdocs/solar/data_winsol');
exec ("/usr/bin/dl-lesenx -i xxx.xxx.xxx.xxx:xxx");
chdir($cur_dir);
}
$conn_id = ftp_connect("xxx.xxx.xxx.xxx");
$login_result = ftp_login($conn_id, "ftpuser", "password");
ftp_pasv($conn_id, true);
ftp_chdir($conn_id, "/web/solaire/data/");
ftp_put($conn_id, "statut_pompes.dat", "/srv/www/htdocs/solar/data/statut_pompes.dat", FTP_BINARY);
ftp_put($conn_id, "solaire.png", "/srv/www/htdocs/solar/data/solaire.png", FTP_BINARY);
ftp_put($conn_id, "stock.png", "/srv/www/htdocs/solar/data/stock.png", FTP_BINARY);
ftp_put($conn_id, "delta_stock.png", "/srv/www/htdocs/solar/data/delta_stock.png", FTP_BINARY);
ftp_put($conn_id, "ecs.png", "/srv/www/htdocs/solar/data/ecs.png", FTP_BINARY);
ftp_put($conn_id, "delta_ecs.png", "/srv/www/htdocs/solar/data/delta_ecs.png", FTP_BINARY);
ftp_put($conn_id, "chauffage.png", "/srv/www/htdocs/solar/data/chauffage.png", FTP_BINARY);
ftp_put($conn_id, "t_ext.png", "/srv/www/htdocs/solar/data/t_ext.png", FTP_BINARY);
ftp_put($conn_id, "debit.png", "/srv/www/htdocs/solar/data/debit.png", FTP_BINARY);
ftp_put($conn_id, "t_absorbeurs.png", "/srv/www/htdocs/solar/data/t_absorbeurs.png", FTP_BINARY);
ftp_put($conn_id, "delta_capteurs.png", "/srv/www/htdocs/solar/data/delta_capteurs.png", FTP_BINARY);
ftp_put($conn_id, "delta_t_abs_t_ext.png", "/srv/www/htdocs/solar/data/delta_t_abs_t_ext.png", FTP_BINARY);
ftp_put($conn_id, "solar.png", "/srv/www/htdocs/solar/data/solar.png", FTP_BINARY);
ftp_put($conn_id, "wind.png", "/srv/www/htdocs/solar/data/wind.png", FTP_BINARY);
ftp_put($conn_id, "tableau_prod.png", "/srv/www/htdocs/solar/data/tableau_prod.png", FTP_BINARY);
ftp_close($conn_id);
// -----------------------------------------------------
// acquisition winsol + stockage mysql toutes les heures
// -----------------------------------------------------
if ($time_00min == '00') {
$log_file = 'log.log';
file_put_contents($log_file,date('d.m.y H:i:s') . ' : acquisition winsol' . "\n", FILE_APPEND);
$db = mysql_pconnect("localhost","msqluser","password");
if (!$db) {
file_put_contents($log_file,date('d.m.y H:i:s') . ' : erreur de connexion database' . "\n", FILE_APPEND);
}
else
{
mysql_select_db("databasename");
$query="SELECT * FROM `CONFIG` LIMIT 0 , 1";
$result=mysql_query($query) or die ("Query failed: " . mysql_error() . "> Actual query: " . $query . "\n");
$row = mysql_fetch_object($result);
$last_data_date = $row->last_data_date;
$last_data_time = $row->last_data_time;
$last_date_log = $row->last_date_log;
$date_log = date('Ym');
$cur_dir = getcwd();
chdir('/srv/www/htdocs/solar/data_winsol');
exec ("/usr/bin/dl-lesenx -i xxx.xxx.xxx.xxx:xxx --res");
if ($last_date_log <> $date_log) {
$iteration = 2;
$date_log = $last_date_log;
}
else {
$iteration = 1;
}
for($j = 0; $j < $iteration; ++$j){
if ($j == 1) {
$date_log = date('Ym');
}
exec ("/usr/bin/winsol2csv Y".$date_log.".log ".$date_log.".sql -sql UVR_1611");
exec ("/usr/bin/winsol2csv Y".$date_log."_2.log ".$date_log."_2.sql -sql UVR_1611_2");
$num_rec = 0;
$data_1 = '';
$data_1 = file($date_log.'.sql');
array_walk($data_1,'trunk_end_sql');
$data_2 = '';
$data_2 = file($date_log.'_2.sql');
array_walk($data_2,'trunk_begin_sql');
for($i = 0; $i < sizeof($data_1); ++$i) {
$data_date = strtok($data_1[$i],"'");
$data_date = strtok("'");
$data_time = strtok("'");
$data_time = strtok("'");
if (strtotime($data_date . ' ' . $data_time) - strtotime($last_data_date . ' ' . $last_data_time) > 0){
$data_1[$i]=trim($data_1[$i]) . trim($data_2[$i]) . "\n";
$query=$data_1[$i];
file_put_contents("/srv/www/htdocs/solar/sql/".$data_date.".sql", $query, FILE_APPEND);
$result=mysql_query($query) or die ("Query failed: " . mysql_error() . "> Actual query: " . $query . "\n");
if ($result) {
$query="UPDATE `CONFIG` SET `last_data_date` = '" . $data_date . "', `last_data_time` = '" . $data_time . "', `last_date_log` = '" . $date_log . "' WHERE `key` = '0'";
$result=mysql_query($query) or die ("Query failed: " . mysql_error() . "> Actual query: " . $query . "\n");
if ($result) {
$last_data_date = $data_date;
$last_data_time = $data_time;
++$num_rec;
}
}
}
}
file_put_contents($log_file,date('d.m.y H:i:s') . ' : traitement ' . $date_log . '.sql -> ' . $num_rec . ' nouvelles données écrites' . "\n", FILE_APPEND);
copy('/srv/www/htdocs/solar/data_winsol/Y'.$date_log.'.log','/srv/www/htdocs/solar/data_winsol/log1/Y'.$date_log.'.log');
copy('/srv/www/htdocs/solar/data_winsol/Y'.$date_log.'_2.log','/srv/www/htdocs/solar/data_winsol/log2/Y'.$date_log.'.log');
copy('/srv/www/htdocs/solar/data_winsol/log1/Y'.$date_log.'.log','/home/admin/winsol/Log1/Y'.$date_log.'.log');
copy('/srv/www/htdocs/solar/data_winsol/log2/Y'.$date_log.'.log','/home/admin/winsol/Log2/Y'.$date_log.'.log');
$conn_id = ftp_connect("xxx.xxx.xxx.xxx");
$login_result = ftp_login($conn_id, "ftpuser", "password");
ftp_pasv($conn_id, true);
ftp_chdir($conn_id, "/web/solaire/sql/");
ftp_put($conn_id, $data_date.".sql", "/srv/www/htdocs/solar/sql/".$data_date.".sql", FTP_BINARY);
ftp_close($conn_id);
}
mysql_close($db);
}
chdir($cur_dir);
//nettoyage process dl-aktuelle-datenx zombie
shell_exec ('/srv/www/htdocs/solar/script/kill_dl-a.sh');
}
}
?>