=1) { $timestamp = date("Y-m-d H:i:s", $cols[1]); $line[$l][1] = $cols[2]; // timestamp $line[$l][2] = date("H:i",$cols[2]); // time $line[$l][3] = round($cols[3],1); // temp if ($line[$l][3]==85) $line[$l][3] = $line[$l-1][3]; $temp = round($cols[3],2); // temp if ($cols[0] == 'nit') $entry_type = 'nit'; if ($cols[0] == 'nithb') $entry_type = 'hb'; if ($entry_type == 'nit') { //$count = $cols[5]; $pulse_length = $cols[4]; } else { //$count = $cols[4]; $pulse_length = ''; } if (($entry_type == 'nit' && $pulse_length>1100) || $entry_type=='hb') { if ($entry_type == 'nit') $count++; echo "insert into nitownica (timestamp, entry_type, temperature, pulse_length, nit_count) values ('{$timestamp}','{$entry_type}','{$temp}','{$pulse_length}','{$count}');"; if ($cols[1]-$prev_timestamp <2) echo " *****"; echo "\n"; } // print_r ($line[$l]); $wydajnosc = 0; if ($line[$l][0] == 'nit') { for ($p=$l-1; $p>=0; $p--) { if ($line[$p][1] < $line[$l][1] - 180) { $prev_wydajnosc = 0; break; } if ($line[$p][0] == 'nit') { $ts = $line[$l][1]; $wydajnosc = round(3600/($line[$l][1] - $line[$p][1])/4); break; } } } else { $wydajnosc = $prev_wydajnosc; } if ($wydajnosc > 60) $wydajnosc = 40; $line[$l][4] = $wydajnosc; $prev_wydajnosc = $wydajnosc; if ($l !=0) $line[$l][5] = round($licznik/($line[$l][1] - $line[0][1])*3600*0.2,1); else $line[$l][5] = 0; if ($line[$l][0] == 'nit') $line[$l][6] = 10; else $line[$l][6] = 0; if ($line[$l][0]=='nit' || $line[$l][0]=='nithb') { $data .= "['".$line[$l][2]."', ".$line[$l][6].", ".$line[$l][4].", ".$line[$l][5].", ".$line[$l][3]."],"; } $l++; } } ?>