• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help converting decimal result into dBm

#1
Hi guys

i am having some troubles in trying to setup the following in PHP


i have a xml file that reads out the direct results of my card.

i want to parse it to php in code igniter but i am having some troubles 

i need to convert a decimal result into dBm, which i found the code below

and want to print it on the php page with a menu bar signal kind of thing similar to wifi

basically it reads a DVB signal from the xml file and outputs it in php page but the current result is output in decimal which is weird cause i need to convert it to dBM

i have the following code to convert it to dBm

PHP Code:
function calcDb() {
    var 
frm document.calc;
    if (
frm.perc.value == null || frm.perc.value.length == 0) {
        return;
    }
    var 
perc frm.perc.value;
    var 
db Math.round(1000000000*20*(Math.log(perc*0.01)/Math.log(10)))/1000000000;
    
document.getElementById("answerDb").innerHTML db " %";

which currently i need to input result manually


atm i am reading those with this.

PHP Code:
<td align="center">Signal:</td>
 
   <?php 
    
foreach ($signal as $item): 
    
     
   echo '<td align="center">'.$item->firstChild->nodeValue.'</td>';
    endforeach;
    
?>
    
    <tr>
    <td align="center">SNR:</td>
    <?php
    
foreach ($snr as $item): 
     
   echo '<td align="center">'.$item->firstChild->nodeValue.'</td>';
    endforeach;
    
?>
which fetches the result from
Quote:<frontend_system><![CDATA[DVB-S2]]></frontend_system>

<frontend_status><![CDATA[SCVYL]]></frontend_status>

<frontend_ber>0</frontend_ber>

<frontend_signal>28208</frontend_signal>

<frontend_snr>40016</frontend_snr>

<frontend_ub>0</frontend_ub>

<ts_discontinuities>0</ts_discontinuities>

and the actual result is descbribed on the picture below
pic1
i would like to display the results in dbm   example  SNR  50%  OR 70%   dB  and display it in a graphic similar to this one on pic2
fe has lock. status:SCVYL signal:60% snr:80% ber:0 unc:0



pic2


Attached Files Thumbnail(s)
               
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.