<!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='type796 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='SID796'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr796'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port796'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd796'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State796'> </span></td></tr>
    </table>

    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>运行参数</h1></td></tr>
        <tr><td >输入电压:<span class='VinA796'> </span>&nbsp;<span class='VinB796'> </span>&nbsp;<span class='VinC796'> </span></td><td> 输出电压:<span class='VoutA796'> </span>&nbsp;<span class='VoutB796'> </span>&nbsp;<span class='VoutC796'> </span></td><td> 旁路电压:<span class='VBA796'> </span>&nbsp;<span class='VBB796'> </span>&nbsp;<span class='VBC796'> </span></td></tr>
		<tr><td>输入频率:<span class='FinA796'> </span>&nbsp;<span class='FinB796'> </span>&nbsp;<span class='FinC796'> </span></td><td>输出频率:<span class='FoutA796'> </span>&nbsp;<span class='FoutB796'> </span>&nbsp;<span class='FoutC796'> </span></td><td> 旁路频率:<span class='FBA796'> </span>&nbsp;<span class='FBB796'> </span>&nbsp;<span class='FBC796'> </span></td></tr>
		<tr><td>输出电流:<span class='IoutA796'> </span>&nbsp;<span class='IoutB796'> </span>&nbsp;<span class='IoutC796'> </span></td><td ><span class='IinA796'> </span>&nbsp;<span class='IinB796'> </span>&nbsp;<span class='IinC796'> </span></td><td> <span class='IBA796'> </span>&nbsp;<span class='IBB796'> </span>&nbsp;<span class='IBC796'> </span></td></tr>
        <tr><td>电池电压:<span class='Vbatt796'> </span></td><td>电池温度:<span class='Tem796'> </span></td><td>电池剩于时间:<span class='Mbatt796'> </span></td></tr>
		<!--<tr><td>电池容量:<span class='Pbatt796'> </span></td><td> <span class='v1796'> </span></td><td> <span class='xx796'> </span></td></tr>-->

    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>工作状态</h1></td></tr>
        <tr><td >电池状态:<span class='b15796'> </span></td><td> 系统运行状态:<span class='b14796'> </span></td><td>旁路接触器异常:<span class='b13796'> </span></td><td >逆变接触器异常:<span class='b12796'> </span></td></tr>
        <tr><td >旁路相序错误:<span class='b11796'> </span></td><td> 交流输入故障:<span class='b10796'> </span></td><td>直流正负母线不平衡:<span class='b9796'> </span></td><td >E2PROM  故障:<span class='b8796'> </span></td></tr>
        <tr><td >直流正母线欠压:<span class='b7796'> </span></td><td> 直流负母线欠压:<span class='b6796'> </span></td><td>市电输入相序错误:<span class='b5796'> </span></td><td >U 相交流输入电压异常:<span class='b4796'> </span></td></tr>
        <tr><td >V 相交流输入电压异常:<span class='b3796'> </span></td><td> W 相交流输入电压异常:<span class='b2796'> </span></td><td>交流输入频率异常:<span class='b1796'> </span></td><td >EPO异常:<span class='b0796'> </span></td></tr>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
    </div>
<script>
var itype=796;
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){
        $(".SID796").html(n.SID);
        $(".Addr796").html(n.Addr);
        $(".Port796").html(n.Port%256);
        $(".DateUpd796").html(n.DateUpd);
        $(".State796").html(window.parent.parseState(n.State));

        $(".VinA796").html(n.Vin1/10+"V");
		$(".VinB796").html(n.Vin2/10+"V");
		$(".VinC796").html(n.Vin3/10+"V");
		
        $(".VoutA796").html(n.Vout1/10+"V");
		$(".VoutB796").html(n.Vout2/10+"V");
		$(".VoutC796").html(n.Vout3/10+"V");
		
        $(".VBA796").html(n.VB1/10+"V");
		$(".VBB796").html(n.VB2/10+"V");
		$(".VBC796").html(n.VB3/10+"V");
		
		$(".IinA796").html(n.Iin1/10+"A");
		$(".IinB796").html(n.Iin2/10+"A");
		$(".IinC796").html(n.Iin3/10+"A");
		$(".IBA796").html(n.IB1/10+"A");
		$(".IBB796").html(n.IB2/10+"A");
		$(".IBC796").html(n.IB3/10+"A");
		
		$(".IoutA796").html(n.Iout1/10+"A");
		$(".IoutB796").html(n.Iout2/10+"A");
		$(".IoutC796").html(n.Iout3/10+"A");
		
		$(".FinA796").html(n.Fin1/10+"Hz");
		$(".FinB796").html(n.Fin2/10+"Hz");
		$(".FinC796").html(n.Fin3/10+"Hz");
		
		$(".FoutA796").html(n.Fout1/10+"Hz");
		$(".FoutB796").html(n.Fout2/10+"Hz");
		$(".FoutC796").html(n.Fout3/10+"Hz");
		
		$(".FBA796").html(n.FB1/10+"Hz");
		$(".FBB796").html(n.FB2/10+"Hz");
		$(".FBC796").html(n.FB3/10+"Hz");
		
        $(".Tem796").html(n.Tem/10+"℃");  
        $(".Vbatt796").html(n.Vbatt/10+"V");            
		//$(".Pbatt796").html(n.Pbatt/10+"%");
        $(".Mbatt796").html(n.Mbatt/10+"min");  
		
        //$(".v1796").html(GetWorkState(n.v1)); 
		//1 	 供电方式					01H：UPS供电 02H：旁路供电 E9H：均不供电
		if (n.b15 == 0)
			n.b15 = "放电";
		else if (n.b15 == 1)
			n.b15 = "均充";
		else if (n.b15 == 2)
			n.b15 = "浮充";
		else
			n.b15 = "未知状态";
        $(".b15796").html(n.b15);
		if (n.b14 == 0)
			n.b14 = "关机";
		else if (n.b14 == 1)
			n.b14 = "开机进行中";
		else if (n.b14 == 2)
			n.b14 = "旁路输出";
		else if (n.b14 == 3)
			n.b14 = "故障保护";
		else if (n.b14 == 4)
			n.b14 = "市电逆变输出";
		else if (n.b14 == 5)
			n.b14 = "电池逆变输出";
		else if (n.b14 == 6)
			n.b14 = "维修旁路输出";
		else
			n.b14 = "未知状态";
        $(".b14796").html(n.b14);
        $(".b13796").html(n.b13 ? "异常" : "正常");
        $(".b12796").html(n.b12 ? "异常" : "正常");
        $(".b11796").html(n.b11 ? "异常" : "正常");
        $(".b10796").html(n.b10 ? "异常" : "正常");
        $(".b9796").html(n.b9 ? "异常" : "正常");
        $(".b8796").html(n.b8 ? "异常" : "正常");
        $(".b7796").html(n.b7 ? "异常" : "正常");
        $(".b6796").html(n.b6 ? "异常" : "正常");
        $(".b5796").html(n.b5 ? "异常" : "正常");
        $(".b4796").html(n.b4 ? "异常" : "正常");
        $(".b3796").html(n.b3 ? "异常" : "正常");
        $(".b2796").html(n.b2 ? "异常" : "正常");
        $(".b1796").html(n.b1 ? "异常" : "正常");
        $(".b0796").html(n.b0 ? "异常" : "正常");

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

//1：待机模式 2：旁路模式 3：市电模式 4：电池模式 5：电池自检 6：故障模式 7：变频模式 8：紧急关机模式 9：关机模式
function GetWorkState(st)
{
    switch(st){
    case 1: return "待机模式";
    case 2: return "旁路模式";
    case 3: return "市电模式";
    case 4: return "电池模式";
    case 5: return "电池自检";
    case 6: return "故障模式";
    case 7: return "变频模式";
    case 8: return "紧急关机模式";
    case 9: return "关机模式";
    }
    return "未知模式";
}
</script>
</body>
</html>