<!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='type800 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='SID800'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr800'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port800'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd800'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State800'> </span></td></tr>
    </table>

    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>运行参数</h1></td></tr>
        <tr>
			<td >输入电压:<span class='VinA800'> </span>&nbsp;<span class='VinB800'> </span>&nbsp;<span class='VinC800'> </span></td>
			<td> 输出电压:<span class='VoutA800'> </span>&nbsp;<span class='VoutB800'> </span>&nbsp;<span class='VoutC800'> </span></td>
			<td> 旁路电压:<span class='VBA800'> </span>&nbsp;<span class='VBB800'> </span>&nbsp;<span class='VBC800'> </span></td>
		</tr>
		<tr>
			<td>输入频率:<span class='FinA800'> </span>&nbsp;<span class='FinB800'> </span>&nbsp;<span class='FinC800'> </span></td>
			<td>输出频率:<span class='FoutA800'> </span>&nbsp;<span class='FoutB800'> </span>&nbsp;<span class='FoutC800'> </span></td>
			<td>旁路频率:<span class='FBA800'> </span>&nbsp;<span class='FBB800'> </span>&nbsp;<span class='FBC800'> </span></td>
		</tr>
		<tr>
			<td>输入电流:<span class='IinA800'> </span>&nbsp;<span class='IinB800'> </span>&nbsp;<span class='IinC800'> </span></td>
			<td>输出电流:<span class='IoutA800'> </span>&nbsp;<span class='IoutB800'> </span>&nbsp;<span class='IoutC800'> </span></td>
			<td><span class='IBA800'> </span>&nbsp;<span class='IBB800'> </span>&nbsp;<span class='IBC800'> </span></td>
		</tr>
        <tr>
			<td>电池电压:<span class='Vbatt800'> </span></td>
			<td>电池温度:<span class='Tem800'> </span></td>
			<td>电池剩于时间:<span class='Mbatt800'> </span></td>
		</tr>
		<tr>
			<td>电池容量:<span class='Pbatt800'> </span></td>
			<td><span class='v1800'> </span></td>
			<td><span class='xx800'> </span></td>
		</tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>工作状态</h1></td></tr>
        <tr>
			<td>整流器故障:<span class='b15800'> </span></td>
			<td>逆变器故障:<span class='b14800'> </span></td>
			<td>辅助电源故障:<span class='b13800'> </span></td>
			<td>风扇故障:<span class='b12800'> </span></td>
		</tr>   
		<tr>    
			<td>输入晶闸管故障:<span class='b11800'> </span></td>
			<td>逆变晶闸管故障:<span class='b10800'> </span></td>
			<td>旁路晶闸管故障:<span class='b9800'> </span></td>
			<td>熔丝断:<span class='b8800'> </span></td>
		</tr>   
        <tr>    
			<td>母线电压异常:<span class='b7800'> </span></td>
			<td>初始化故障:<span class='b6800'> </span></td>
			<td>电池晶闸管故障:<span class='b5800'> </span></td>
			<td>充电器故障:<span class='b4800'> </span></td>
		</tr>
        <tr>
			<td>整流器状态:<span class='b3800'> </span></td>
			<td>整流器限流:<span class='b2800'> </span></td>
			<td>输入供电状态:<span class='b1800'> </span></td>
			<td>输入供电模式:<span class='b0800'> </span></td>
		</tr>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
    </div>
<script>
var itype=800;
var tescape= 5000,time;

<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
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){
        $(".SID800").html(n.SID);
        $(".Addr800").html(n.Addr);
        $(".Port800").html(n.Port%256);
        $(".DateUpd800").html(n.DateUpd);
        $(".State800").html(parseState(n.State));

        $(".VinA800").html(n.Vin1/10+"V");
		$(".VinB800").html(n.Vin2/10+"V");
		$(".VinC800").html(n.Vin3/10+"V");
		
        $(".VoutA800").html(n.Vout1/10+"V");
		$(".VoutB800").html(n.Vout2/10+"V");
		$(".VoutC800").html(n.Vout3/10+"V");
		
        $(".VBA800").html(n.VB1/10+"V");
		$(".VBB800").html(n.VB2/10+"V");
		$(".VBC800").html(n.VB3/10+"V");
		
		$(".IinA800").html(n.Iin1/10+"A");
		$(".IinB800").html(n.Iin2/10+"A");
		$(".IinC800").html(n.Iin3/10+"A");
		
		$(".IoutA800").html(n.Iout1/10+"A");
		$(".IoutB800").html(n.Iout2/10+"A");
		$(".IoutC800").html(n.Iout3/10+"A");
		
		//$(".IBA800").html(n.IB1/10+"A");
		//$(".IBB800").html(n.IB2/10+"A");
		//$(".IBC800").html(n.IB3/10+"A");
		
		$(".FinA800").html(n.Fin1/10+"Hz");
		$(".FinB800").html(n.Fin2/10+"Hz");
		$(".FinC800").html(n.Fin3/10+"Hz");
		
		$(".FoutA800").html(n.Fout1/10+"Hz");
		$(".FoutB800").html(n.Fout2/10+"Hz");
		$(".FoutC800").html(n.Fout3/10+"Hz");
		
		$(".FBA800").html(n.FB1/10+"Hz");
		$(".FBB800").html(n.FB2/10+"Hz");
		$(".FBC800").html(n.FB3/10+"Hz");
		
        $(".Tem800").html(n.Tem/10+"℃");  
        $(".Vbatt800").html(n.Vbatt/10+"V");            
		$(".Pbatt800").html(n.Pbatt+"%");
        $(".Mbatt800").html(n.Mbatt+"min");  
		
        $(".b15800").html(n.b15 ? "是" : "否");
        $(".b14800").html(n.b14 ? "是" : "否");
        $(".b13800").html(n.b13 ? "是" : "否");
        $(".b12800").html(n.b12 ? "是" : "否");
        $(".b11800").html(n.b11 ? "是" : "否");
        $(".b10800").html(n.b10 ? "是" : "否");
        $(".b9800").html(n.b9 ? "是" : "否");
        $(".b8800").html(n.b8 ? "是" : "否");
        $(".b7800").html(n.b7 ? "是" : "否");
        $(".b6800").html(n.b6 ? "是" : "否");
        $(".b5800").html(n.b5 ? "是" : "否");
        $(".b4800").html(n.b4 ? "是" : "否");
        $(".b3800").html(n.b3 ? "工作" : "停止");
        $(".b2800").html(n.b2 ? "工作" : "停止");
        $(".b1800").html(n.b1 ? "工作" : "停止");
        $(".b0800").html(n.b0 ? "输入供电" : "电池供电");

    })
    $("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 "故障";
}
</script>
</body>
</html>