source: www/web/calculate_wlan.php@ 1

Last change on this file since 1 was 1, checked in by george, 18 years ago

Prvotní import všeho

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1<?
2include_once('db.php');
3//include_once('../html/is/error.php');
4DB_Init('localhost','root','','is');
5
6ini_set('error_reporting', E_ALL);
7ini_set('display_errors', true);
8ini_set('display_startup_errors', true);
9
10
11function DbById($Id)
12{
13 DB_Select('wlan_db', '*', 'id='.$Id);
14 $Row = DB_Row();
15 return($Row);
16}
17
18$Polozky = array('device', 'connector1', 'cable', 'connector2', 'antena');
19
20echo('<table width="100%"><tr><td valign="top">');
21echo('<table cellspacing="0" cellpadding="3" border="1"><tr><th>Oznaèení</th><th>Výkon [dB]</th><th>Výkon [mW]</tr>');
22DB_Select('wlan_list', 'id,cable_length,name,'.implode(',', $Polozky));
23while($Row = DB_Row())
24{
25 DB_Save();
26 foreach($Polozky as $Item)
27 {
28 $Row2 = DbById($Row[$Item]);
29 $Row[$Item.'_db'] = $Row2['value'];
30 $Row[$Item] = $Row2['name'];
31 }
32 $Row['cable_db'] = $Row['cable_db'] * $Row['cable_length'];
33 $Row['cable'] = $Row['cable'].' '.$Row['cable_length'].' m';
34
35 $Total = 0;
36 foreach($Polozky as $Item)
37 {
38 $Total = $Total + $Row[$Item.'_db'];
39 }
40 echo('<tr><td>'.$Row['name'].'</td><td>'.round($Total).'</td><td>'.round(pow(10, $Total/10)).'</td></tr>');
41 echo('<tr><td colspan="3"><table style="font-size: smaller;" width="100%" cellspacing="0" cellpadding="3" border="1">');
42 foreach($Polozky as $Item)
43 {
44 echo('<tr><td>'.$Row[$Item].'</td><td>'.$Row[$Item.'_db'].'</td></tr>');
45 }
46 echo('</table></td></tr>');
47
48 DB_Update('wlan_list', 'id='.$Row['id'], array('total' => $Total, 'total_passive' => ($Total-$Row['device_db'])));
49
50 DB_Load();
51}
52echo('</table>');
53
54echo('</td><td valign="top">');
55
56echo('<table cellspacing="0" cellpadding="3" border="1">
57<tr><th>Bod 1</th><th>Bod 2</th><th>Signál [dB]</tr>');
58DB_Select('wlan_links', '*');
59while($Row = DB_Row())
60{
61 DB_Save();
62
63 DB_Select('wlan_list', '*', 'id='.$Row['point1']);
64 $Point1 = DB_Row();
65 DB_Select('wlan_list', '*', 'id='.$Row['point2']);
66 $Point2 = DB_Row();
67
68 $UtlumTrasy = -round(40 + 20*log10($Row['distance']));
69 $Signal = $Point1['total'] + $UtlumTrasy + $Point2['total_passive'];
70 echo('<tr><td>'.$Point1['name'].'</td><td>'.$Point2['name'].'</td><td>'.$Signal.'</td></tr>');
71 echo('<tr><td colspan="3"><table style="font-size: smaller;" width="100%" cellspacing="0" cellpadding="3" border="1">');
72
73 echo('<tr><td>Vyzáøený výkon</td><td>'.$Point1['total'].'</td></tr>');
74 echo('<tr><td>Útlum trasy</td><td>'.$UtlumTrasy.'</td></tr>');
75 echo('<tr><td>Zisk pøíjímaèe</td><td>'.$Point2['total_passive'].'</td></tr>');
76
77 echo('</table></td></tr>');
78
79 DB_Load();
80}
81
82echo('</td></tr></table>');
83
84?>
Note: See TracBrowser for help on using the repository browser.