<!DOCTYPE html>
<% language=javascript %>
<html>
<head lang="en">
    <meta charset="GB2312">
    <title></title>
    <link href="css/style.css" title="style" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.6.3.min.js"></script>

</head>
<body style="background: #F3F3F3">
<div class='type811 empty' style=' margin: 10px;'>
  <table width="100%">
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-ups.png" style="width: 50%;text-align: center;"></td>
    <td>
    <table width='100%'>
        <tr><td style='border: none'> <h1>基本信息</h1></td></tr>
        <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SID811'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr811'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port811'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd811'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State811'> </span></td></tr>
    </table>

    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>运行参数</h1></td></tr>
        <tr>
			<td id='Vin' >输入电压:<span class='VinA811'> </span>&nbsp;<span class='VinB811'> </span>&nbsp;<span class='VinC811'> </span></td>
			<td id='Vout'>输出电压:<span class='VoutA811'> </span>&nbsp;<span class='VoutB811'> </span>&nbsp;<span class='VoutC811'> </span></td>
			<td id='Vba' >旁路电压:<span class='VBA811'> </span>&nbsp;<span class='VBB811'> </span>&nbsp;<span class='VBC811'> </span></td>
		</tr>
		<tr>
			<td id='Fin' >输入频率:<span class='FinA811'> </span></td>
			<td id='Fout'>输出频率:<span class='FoutA811'> </span></td>
			<td id=' ' > <span class='811'> </span></td>
		</tr>
		<tr>
			<td id='Iin' >输入电流:<span class='IinA811'> </span>&nbsp;<span class='IinB811'> </span>&nbsp;<span class='IinC811'> </span></td>
			<td id='Iout'>输出电流:<span class='IoutA811'> </span>&nbsp;<span class='IoutB811'> </span>&nbsp;<span class='IoutC811'> </span></td>
			<td id='Tem' >系统温度:<span class='Tem811'> </span></td>
		
		</tr>
        <tr>
			<td id='Vbat'>电池电压:<span class='Vbatt811'> </span></td>
			<td id='Tem' >电池容量:<span class='Pbatt811'> </span></td>
			<td id='Mbat'>电池剩余时间:<span class='Mbatt811'> </span></td>
		</tr>

    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>工作状态</h1></td></tr>
        <tr>
			<td id='b15'>输出过载: </span><span class='b15811'> </span></td>
			<td id='b14'>输入电压过低: </span><span class='b14811'> </span></td>
			<td id='b13'>电池电压过低: </span><span class='b13811'> </span></td>
			<td id='b12'>输入电压异常: </span><span class='b12811'> </span></td>
		</tr>
        <tr>
			<td id='b11'>整流器过温: </span><span class='b11811'> </span></td>
			<td id='b10'>Line3输入电压过低: </span><span class='b10811'> </span></td>
			<td id='b9' >Line2输入电压过低: </span> <span class='b9811'> </span> </td>
			<td id='b8' >Line1输入电压过低: </span> <span class='b8811'> </span> </td>
		</tr>
        <tr>
			<td id='b7' >Line3输入电压过高: </span> <span class='b7811'> </span> </td>
			<td id='b6' >Line2输入电压过高: </span> <span class='b6811'> </span> </td>
			<td id='b5' >Line1输入电压过高: </span> <span class='b5811'> </span> </td>
			<td id='b4' >Line3输出过载: </span> <span class='b4811'> </span> </td>
		</tr>
        <tr>
			<td id='b3' >Line2输出过载: </span> <span class='b3811'> </span> </td>
			<td id='b2' >Line1输出过载:</span> <span class='b2811'> </span> </td>
			<td id='b1' >电池电压: </span> <span class='b1811'> </span> </td>
			<td id='b0' >统温度过高: </span> <span class='b0811'> </span> </td>
		</tr>
  
         
		<tr>             
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
    </div>
<script>
var itype=811;
var tescape= 5000,time;

<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var tag1=<% write(db_QryInt("select Tag1 from tbSM where SID="+sid,1));%>;
var json=<% db_QryAdv("select * from tbUpsEx where SID="+sid,0); %>;
<% db_Close(); %>

$(function(){
    time=setInterval(ajax,tescape);

});
function ajax(){
    $.ajax({
        type: "POST",
        url: "omdev/smdat0.asp",
        data: "itype="+itype+"&sid="+sid,
        dataType:"json",
        success: function(msg){
            list3(msg)
        }
    });
}
		
list3(json);
function list3(data){
	
    $.each(data.recs,function(i,n){
        $(".SID811").html(n.SID);
        $(".Addr811").html(n.Addr);
        $(".Port811").html(n.Port%256);
        $(".DateUpd811").html(n.DateUpd);
        $(".State811").html(parseState(n.State));

		{
			if ((n.Vin1==0) && (n.Vin2==0) && (n.Vin3==0))
			{
					$(".VinA811").html("N/A");
					$(".VinB811").html("N/A");
					$(".VinC811").html("N/A");
			}
			else
			{
				$(".VinA811").html(n.Vin1/10+"V");
				$(".VinB811").html(n.Vin2/10+"V");
				$(".VinC811").html(n.Vin3/10+"V");
			}
			
			if ((n.Vout1==0) && (n.Vout2==0) && (n.Vout3==0))
			{
				$(".VoutA811").html("N/A");
				$(".VoutB811").html("N/A");
				$(".VoutC811").html("N/A");
			}
			else
			{
				$(".VoutA811").html(n.Vout1/10+"V");
				$(".VoutB811").html(n.Vout2/10+"V");
				$(".VoutC811").html(n.Vout3/10+"V");
			}
			
			if ((n.VB1==0) && (n.VB2==0) && (n.VB3==0))
			{
				$(".VBA811").html("N/A");
				$(".VBB811").html("N/A");
				$(".VBC811").html("N/A");
			}
			else
			{
				$(".VBA811").html(n.VB1/10+"V");
				$(".VBB811").html(n.VB2/10+"V");
				$(".VBC811").html(n.VB3/10+"V");
			}
			
			if ((n.Iin1==0) && (n.Iin2==0) && (n.Iin3==0))
			{
				$(".IinA811").html("N/A");
				$(".IinB811").html("N/A");
				$(".IinC811").html("N/A");
			}
			else
			{
				$(".IinA811").html(n.Iin1/10+"A");
			    $(".IinB811").html(n.Iin2/10+"A");
			    $(".IinC811").html(n.Iin3/10+"A");
			}
			
			if ((n.Iout1==0) && (n.Iout2==0) && (n.Iout3==0))
			{
				$(".IoutA811").html("N/A");
				$(".IoutB811").html("N/A");
				$(".IoutC811").html("N/A");
			}
			else
			{
				$(".IoutA811").html(n.Iout1/10+"A");
				$(".IoutB811").html(n.Iout2/10+"A");
				$(".IoutC811").html(n.Iout3/10+"A");
			}
			
			
			$(".FinA811").html(n.Fin1/10+" Hz");
			$(".FoutA811").html(n.Fout1/10+" Hz");
			
			$(".Vbatt811").html(n.Vbatt/10+"V"); 
			//$(".Pbatt811").html(n.Pbatt+"%");
			$(".Pbatt811").html("NA");
			$(".Mbatt811").html(n.Mbatt+" Min");  
			$(".Tem811").html(n.Tem/10+"℃"); 

			ShowiTrustAdaptState(n);
			
		}

    })
    $("span:contains('故障'),span:contains('告警'),span:contains('闭合'),span:contains('关闭'),span:contains('异常'),span:contains('是')").addClass("red").removeClass("ger");
    $("span:contains('正常'),span:contains('否')").addClass("ger").removeClass("red");
}

function parseState(istate)
{
    if(istate==0) return "正常";
    else   if(istate==1) return "告警";
    else return "故障";
}

function ShowiTrustAdaptState(n)
{
	var sst = "";
	if (n.b15 == 0) 	sst = "正常";//'输出过载'
	else			sst = "异常";
	$(".b15811").html(sst);
	
	if (n.b14 == 0)			sst = "正常"; //'输入电压过低'
	else					sst = "异常";
	$(".b14811").html(sst);
	
	if (n.b13 == 0)			sst = "正常";//'电池电压过低'
	else					sst = "异常";
	$(".b13811").html(sst);
	
	if (n.b12 == 0) 		sst = "正常";//输入电压异常'
	else					sst = "异常";
	$(".b12811").html(sst);
	
	if (n.b11 == 0) 		sst = "正常";//'整流器过温'
	else					sst = "异常";
	$(".b11811").html(sst);
	
	if (n.b10 == 0) 		sst = "正常";//Line3输入电压过低
	else					sst = "异常";
	$(".b10811").html(sst);
	
	if (n.b9  == 0) 		sst = "正常";//Line2输入电压过低
	else					sst = "异常";
	$(".b9811").html(sst);
	
	if (n.b8  == 0) 		sst = "正常";//Line1输入电压过低
	else					sst = "异常";
	$(".b8811").html(sst);
	
	if (n.b7  == 0) 		sst = "正常";//Line3输入电压过高
	else					sst = "异常";
	$(".b7811").html(sst);
	
	if (n.b6  == 0) 		sst = "正常";//Line2输入电压过高
	else					sst = "异常";
	$(".b6811").html(sst);
	
	if (n.b5  == 0) 		sst = "正常";//Line1输入电压过高
	else					sst = "异常";
	$(".b5811").html(sst);
	
	if (n.b4  == 0) 		sst = "正常";//Line3输出过载
	else					sst = "异常";
	$(".b4811").html(sst);
	
	if (n.b3  == 0) 		sst = "正常";//Line2输出过载
	else					sst = "异常";
	$(".b3811").html(sst);
	
	if (n.b2  == 0) 		sst = "正常";//Line1输出过载
	else					sst = "异常";
	$(".b2811").html(sst);
	
	if (n.b1  == 0) 		sst = "正常";//'电池电压或整流器低电压'
	else					sst = "异常";
	$(".b1811").html(sst);
	
	if (n.b0  == 0) 		sst = "正常";//'系统温度过高'
	else					sst = "异常";
	$(".b0811").html(sst);
	
}

function ShowUL33StateDes()
{
	$(".desb15811").html("输出过载:");
	$(".desb14811").html("输入电压过低:");
	$(".desb13811").html("电池电压过低:");
	$(".desb12811").html("输入电压异常:");
	$(".desb11811").html("整流器过温:");
	$(".desb10811").html("Line3输入电压过低:");
	$(".desb9811").html("Line2输入电压过低:");
	$(".desb8811").html("Line1输入电压过低:");
	$(".desb7811").html("Line3输入电压过高:");
	$(".desb6811").html("Line2输入电压过高:");
	$(".desb5811").html("Line1输入电压过高:");
	$(".desb4811").html("Line3输出过载:");
	$(".desb3811").html("Line2输出过载:");
	$(".desb2811").html("Line1输出过载:");
	$(".desb1811").html("电池电压或整流器低电压:");
	$(".desb0811").html("系统温度过高:");
}


</script>
</body>
</html>