* include/functions_forecast.php: Fixed division by zero.

* operation/visual_console/public_console.php: Fixed link
	to public visual console.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9992 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2014-05-23 06:44:15 +00:00
parent 0c420e819e
commit 565ac40d16
3 changed files with 35 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2014-05-23 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_forecast.php: Fixed division by zero.
* operation/visual_console/public_console.php: Fixed link
to public visual console.
2014-05-22 Sergio Martin <sergio.martin@artica.es>
* include/functions_graph.php: Fix end of unknown

View File

@ -116,18 +116,31 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
// 3.2 Standard deviation for Y: sqrt((Sum(Yi²)/Obs) - (avg Y)²)
// Linear correlation coefficient:
$avg_x = $cont/$sum_xi;
if ($sum_xi != 0) {
$avg_x = $cont/$sum_xi;
} else {
$avg_x = 0;
}
if ($sum_yi != 0)
$avg_y = $cont/$sum_yi;
else
$avg_y = 0;
$covariance = $sum_xi_yi/$cont;
$dev_x = sqrt(($sum_xi2/$cont) - ($avg_x*$avg_x));
$dev_y = sqrt(($sum_yi2/$cont) - ($avg_y*$avg_y));
/*
if ($cont != 0) {
$covariance = $sum_xi_yi/$cont;
$dev_x = sqrt(($sum_xi2/$cont) - ($avg_x*$avg_x));
$dev_y = sqrt(($sum_yi2/$cont) - ($avg_y*$avg_y));
} else {
$covariance = 0;
$dev_x = 0;
$dev_y = 0;
}
// Prevents division by zero
if ($dev_x != 0 and $dev_y != 0) {
$linear_coef = $covariance / ($dev_x * $dev_y);
}
*/
// Agent interval could be zero, 300 is the predefined
if ($sum_obs == 0) {
$agent_interval = SECONDS_5MINUTES;
@ -159,7 +172,12 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
$b = $b_num / $b_den;
$a_num = ($sum_yi) - ($b * $sum_xi);
$a = $a_num / $cont;
if ($cont != 0) {
$a = $a_num / $cont;
} else {
$a = 0;
}
// Data inicialization
$output_data = array();

View File

@ -134,7 +134,10 @@ $(document).ready (function () {
description: '<?php echo __('Until refresh'); ?>',
onExpiry: function () {
href = "<?php echo ui_get_full_url();?>";
href = href + "&refr=<?php echo $refr;?>";
$exists_refr = href.indexOf("refr");
if ($exists_refr == -1) {
href = href + "&refr=<?php echo $refr;?>";
}
$(document).attr ("location", href);
}
}
@ -146,4 +149,4 @@ $(document).ready (function () {
draw_lines (lines, 'layout_map');
});
/* ]]> */
</script>
</script>