* 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:
parent
8661765df1
commit
091db5c2ef
|
@ -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>
|
2014-05-22 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* include/functions_graph.php: Fix end of unknown
|
* include/functions_graph.php: Fix end of unknown
|
||||||
|
|
|
@ -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)²)
|
// 3.2 Standard deviation for Y: sqrt((Sum(Yi²)/Obs) - (avg Y)²)
|
||||||
// Linear correlation coefficient:
|
// Linear correlation coefficient:
|
||||||
|
|
||||||
|
if ($sum_xi != 0) {
|
||||||
$avg_x = $cont/$sum_xi;
|
$avg_x = $cont/$sum_xi;
|
||||||
|
} else {
|
||||||
|
$avg_x = 0;
|
||||||
|
}
|
||||||
if ($sum_yi != 0)
|
if ($sum_yi != 0)
|
||||||
$avg_y = $cont/$sum_yi;
|
$avg_y = $cont/$sum_yi;
|
||||||
else
|
else
|
||||||
$avg_y = 0;
|
$avg_y = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ($cont != 0) {
|
||||||
$covariance = $sum_xi_yi/$cont;
|
$covariance = $sum_xi_yi/$cont;
|
||||||
$dev_x = sqrt(($sum_xi2/$cont) - ($avg_x*$avg_x));
|
$dev_x = sqrt(($sum_xi2/$cont) - ($avg_x*$avg_x));
|
||||||
$dev_y = sqrt(($sum_yi2/$cont) - ($avg_y*$avg_y));
|
$dev_y = sqrt(($sum_yi2/$cont) - ($avg_y*$avg_y));
|
||||||
|
} else {
|
||||||
|
$covariance = 0;
|
||||||
|
$dev_x = 0;
|
||||||
|
$dev_y = 0;
|
||||||
|
}
|
||||||
// Prevents division by zero
|
// Prevents division by zero
|
||||||
if ($dev_x != 0 and $dev_y != 0) {
|
if ($dev_x != 0 and $dev_y != 0) {
|
||||||
$linear_coef = $covariance / ($dev_x * $dev_y);
|
$linear_coef = $covariance / ($dev_x * $dev_y);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// Agent interval could be zero, 300 is the predefined
|
// Agent interval could be zero, 300 is the predefined
|
||||||
if ($sum_obs == 0) {
|
if ($sum_obs == 0) {
|
||||||
$agent_interval = SECONDS_5MINUTES;
|
$agent_interval = SECONDS_5MINUTES;
|
||||||
|
@ -159,7 +172,12 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
$b = $b_num / $b_den;
|
$b = $b_num / $b_den;
|
||||||
|
|
||||||
$a_num = ($sum_yi) - ($b * $sum_xi);
|
$a_num = ($sum_yi) - ($b * $sum_xi);
|
||||||
|
|
||||||
|
if ($cont != 0) {
|
||||||
$a = $a_num / $cont;
|
$a = $a_num / $cont;
|
||||||
|
} else {
|
||||||
|
$a = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Data inicialization
|
// Data inicialization
|
||||||
$output_data = array();
|
$output_data = array();
|
||||||
|
|
|
@ -134,7 +134,10 @@ $(document).ready (function () {
|
||||||
description: '<?php echo __('Until refresh'); ?>',
|
description: '<?php echo __('Until refresh'); ?>',
|
||||||
onExpiry: function () {
|
onExpiry: function () {
|
||||||
href = "<?php echo ui_get_full_url();?>";
|
href = "<?php echo ui_get_full_url();?>";
|
||||||
|
$exists_refr = href.indexOf("refr");
|
||||||
|
if ($exists_refr == -1) {
|
||||||
href = href + "&refr=<?php echo $refr;?>";
|
href = href + "&refr=<?php echo $refr;?>";
|
||||||
|
}
|
||||||
$(document).attr ("location", href);
|
$(document).attr ("location", href);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue