[Nut-upsdev] Powercom BNT-1200AP driver

Alexey Sidorov alex at reutman.ru
Fri Dec 22 10:30:05 CET 2006


Hello.
What about driver for my UPS?
I have changed the powercom driver for myself, but I have made it not absolutely correctly. However, somehow this driver works.
Now i have protocol spec for powercom BNT series and attach it to this email.
It can be interesting to authors?
-- 
С уважением,	Алексей Сидоров
 	mailto:alex at reutman.ru
	JID: alex at reutman.ru
	ICQ: 5052225
-------------- next part --------------
******************************************************************************
*  COMM ---Protocol                                                           
*-----------------------------------------------------------------------------
* BPS = 1200, 1 START BIT, 1 END BIT, 16 DATA BIT                              
*-----------------------------------------------------------------------------
*  UPS receive 1 byte data is 1: UPS will echo 16 bytes status                 
*      byte  0  is load level                                                  
*      byte  1  is battery level                                               
*      byte  2  is input voltage                                               
*      byte  3  is output voltage                                              
*      byte  4  is input frequency                                             
*      byte  5  is Version  
                IMP is FFH                                                                                                     
*      byte  6  is output frequency                                                                            
*      byte  7  is XX                                                                                                    
*      byte  8  is XX                                                                                                    
*      byte  9 bit 0 is line fail (1 = INV, 0 = LINE)                        
*               bit 1 is low battery (1 = BAT LOW, 0 = NORMAL)                 
*               bit 2 X                                                        
*               bit 3 AVR (1 = AVR, 0 = NO AVR)                                
*               bit 4 AVR MODE (1 = BOOST, 0 = BUCK)                           
*               bit 5 LOAD STATUS(1 = OVER LOAD, 0 = NORMAL)                   
*               bit 6 X                                                        
*               bit 7 SD MODE DISPLAY                                          
*      byte  10 bit 0 UPS FAILT(1 = FAILT)                                    
*               bit 1 BAT STATUS(1 = BAD, 0 = NORAML)                          
*               bit 2 TEST MODE (1 = TEST, 0, NORMAL)                          
*               bit 3 X                                                        
*               bit 4 PRE-SD COUNT MODE  (1 = ACTIVE)                          
*               bit 5 SCHEDULE COUNT MODE (1 = ACTIVE)                         
*               bit 6 DISBLE NO LOAD SHUTDOWN (1 = ACTIVE)                                                        
*               bit 7 1                                                                                               
*      byte  11 is UPS model Name
                KIN = 4BH           BNT = 42H                                                                    
*      byte  12 is UPS model number                                                                           
*               100V = X0H  110V = X1H  115V = X2H  120V = X3H                                
*               200V = X7H  220V = X8H  230V = X9H  240V = XAH                                
*      byte  13 is XX                                                                                                        
*      byte  14 is XX                                                                                                        
*      byte  15 is XX                                                                                                        
*                                                                                                                                       
*  From Byte 0 to Byte 15 use binary data                                     
*                                                                             
*  Receive data 3: UPS self test                                              
*  Receive data 4: WAKE UP TIME SETUP                                                                        
*                  BYTE 1 IS HIGH BYTE MIN (0-255)                                                 
*                  BYTE 2 IS LOW BYTE MIN (0-255)                                                   
*                  EX: SET WAKE UP TIME 1 HR                                                            
*                      4 0 60                                                                                      
*                                                                                                                                       
*  Receive data 185: ENABLE AC NORMAL RESTART                                 
*  Receive data 186: DISABLE AC NORMAL RESTART                                
*  Receive data 188: PRE-SD COUNT                                             
*                   byte 1 is MIN                                             
*                   byte 2 is SEC                                             
*  Example: pre-shutdown counter count 1 minute and enable ac normal wake up  
*           185 188 1 0                                                       


*BNT Series

*InData is UPS echo 16 bytes status ; from 0 to 15

*****************************Data define Start********************************************************
T=InData[6] div 2;
aVA6:array[1..9] of Word=(400,500,600,800,801,1000,1200,1500,2000);
iVA=aVA6[InData[12] div 16];
*****************************Data define End**********************************************************
*****************************Input Voltage Start******************************************************
Involtage=InData[2]*2.2-24;
*****************************Input Voltage End********************************************************
*****************************Output Voltage Start*****************************************************
if (INV=0)and(AVR=0) then
begin
 Ovoltage=InData[3]*2.2-24;
end;
if (INV=0)and(AVR=1)and(AVRMode=1) then 
begin
 Ovoltage=(InData[3]*2.2-24)*31/27;
end;
if (INV=0)and(AVR=1)and(AVRMode=0) then 
begin
 Ovoltage=(InData[3]*2.22-24)*27/31;
end;
if (INV=1) then
begin
 sqrtest=(InData[15]*1.965)*(InData[15]*1.965)*(T-InData[3])/T;
 Ovoltage=sqrt(sqrtest);
end;
*****************************Output Voltage End*******************************************************
*****************************Load Level Start*********************************************************
if INV=0 then
begin
 if (iVA=801)or(iVA=400) then       
 begin
  case Voltage of
   220:Load=InData[0]*110/88;
   230:Load=InData[0]*110/83;
   240:Load=InData[0]*110/78;
  end;
 end;
 if (iVA=1000)or(iVA=1500)or(iVA=2000)or(iVA=500)or(iVA=800) then       
 begin
  case Voltage of
   220:Load=InData[0]*110/108;
   230:Load=InData[0]*110/103;
   240:Load=InData[0]*110/98;
  end;
 end;
 if (iVA=1200)or(iVA=600) then
 begin
  case Voltage of
   220:Load=InData[0]*110/128;
   230:Load=InData[0]*110/123;
   240:Load=InData[0]*110/118;
  end;
 end;
end;
if INV=1 then
begin
 if (iVA=801) then       
 begin
  case Voltage of
   220:Load=InData[0]*110/44;
   230:Load=InData[0]*110/42;
   240:Load=InData[0]*110/40;
  end;
 end;
 if (iVA=1000)or(iVA=1500)or(iVA=2000) then       
 begin
  case Voltage of
   220:Load=InData[0]*110/56;
   230:Load=InData[0]*110/54;
   240:Load=InData[0]*110/52;
  end;
 end;
 if (iVA=1200) then       
 begin
  case Voltage of
   220:Load=InData[0]*110/76;
   230:Load=InData[0]*110/74;
   240:Load=InData[0]*110/72;
  end;
 end;
 if iVA=400 then       
 begin
  case Voltage of
   220:Load=InData[0]*110/54;
   230:Load=InData[0]*110/52;
   240:Load=InData[0]*110/49;
  end;
 end;
 if (iVA=500)or(iVA=800) then      
 begin
  case Voltage of
   220:Load=InData[0]*110/66;
   230:Load=InData[0]*110/64;
   240:Load=InData[0]*110/61;
  end;
 end;
 if iVA=600 then    
 begin
  case Voltage of
   220:Load=InData[0]*110/86;
   230:Load=InData[0]*110/84;
   240:Load=InData[0]*110/81;
  end;
 end;
end;
*****************************Load Level End***********************************************************
******************************Input Frequency Start***************************************************
Ifreq=1/InData[4]*4807
******************************Input Frequency End*****************************************************
******************************Output Frequency Start**************************************************
Ofreq=1/InData[6]*4807;
******************************Output Frequency End****************************************************
******************************Battery Level Start*****************************************************
BattVal=InData[1]+InData[0]/4;
Bat0=157;
Bat29=165;
Bat100=193;
if BattVal<=Bat0 then
 BattLevel=0;
if (BattVal>Bat0)and(BattVal<=Bat29) then
 BattLevle=(BattVal-Bat0)*30/(Bat29-Bat0);
if (BattVal>Bat29)and(BattVal<=Bat100) then
 BattLevel=30+(BattVal-Bat29)*70/(Bat100-Bat29);
if BattVal>Bat100 then
 Batt=100;
******************************Battery Level End*******************************************************


More information about the Nut-upsdev mailing list