📄 dlmeter.~pas
字号:
ID1_PmTime:
begin //最大需量发生时间
aBKSet:=[];
aJH:=GetJH(ID);
aYUE:=GetYUE(ID);
aBK:=GetBK(ID);
aFL:=GetFL(ID);
//////////////有功最大需量发生时间集合//////////////////////////////////
if aJH=JH_P2 then begin // 有功最大需量发生时间集合,
S:=data;
tmp:=StrToken(S);
if length(tmp) = (4+20) then begin
try
aV3[ZP]:= PaserPmTime_Block(aFL,tmp,5); //正向有功最大需量发生时间,
aBKSet:=aBKSet+[ZP];
except
DoLogEvent('正向有功最大需量发生时间数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (20) then begin
try
aV3[FP]:= PaserPmTime_Block(aFL,tmp,1); //反向有功,
aBKSet:=aBKSet+[FP];
except
DoLogEvent('反向有功最大需量发生时间数据格式错!');
end;
end;
if assigned(FOnPaserPmTime) then
FOnPaserPmTime(self,aJH, aYUE,aBKSet,aFL,aTime,aV3);
DoStopEvent;
exit;
end; //有功最大需量发生时间集合,
//////////////无功最大需量发生时间集合//////////////////////////////////
if aJH=JH_Q6 then begin // 无功最大需量发生时间集合,
S:=data;
tmp:=StrToken(S);
if length(tmp) = (4+20) then begin
try
aV3[ZQ]:= PaserPmTime_Block(aFL,tmp,5); //正向无功最大需量发生时间,
aBKSet:=aBKSet+[ZQ];
except
DoLogEvent('正向无功最大需量发生时间数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (20) then begin
try
aV3[FQ]:= PaserPmTime_Block(aFL,tmp,1); //反向最大需量发生时间无功,
aBKSet:=aBKSet+[FQ];
except
DoLogEvent('反向无功最大需量发生时间数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (20) then begin
try
aV3[ZQL1]:= PaserPmTime_Block(aFL,tmp,1); //一象限无功最大需量发生时间(+RL),
aBKSet:=aBKSet+[ZQL1];
except
DoLogEvent('一象限无功最大需量发生时间(+RL)数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (20) then begin
try
aV3[FQC4]:= PaserPmTime_Block(aFL,tmp,1); //四象限无功最大需量发生时间(-RC)
aBKSet:=aBKSet+[FQC4];
except
DoLogEvent('四象限无功最大需量发生时间(-RC)数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (20) then begin
try
aV3[ZQC2]:= PaserPmTime_Block(aFL,tmp,1); //二象限无功最大需量发生时间(+RC),
aBKSet:=aBKSet+[ZQC2];
except
DoLogEvent('二象限无功最大需量发生时间(+RC)数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (20) then begin
try
aV3[FQL3]:= PaserPmTime_Block(aFL,tmp,1); //三象限无功最大需量发生时间(-RL)
aBKSet:=aBKSet+[FQL3];
except
DoLogEvent('三象限无功最大需量发生时间(-RL)数据格式错!');
end;
end;
if assigned(FOnPaserPmTime) then
FOnPaserPmTime(self,aJH, aYUE,aBKSet,aFL,aTime,aV3);
DoStopEvent;
exit;
end; //无功集合
//////////////最大需量发生时间块 或 项//////////////////////////////////
aJH:=JH_NO;
aYUE:=GetYUE(ID);
aBK:=GetBK(ID);
aFL:=GetFL(ID);
try
aV3[aBK]:=PaserPmTime_Block(aFL,Data,5);
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
aBKSet:=[aBK];
if assigned(FOnPaserPmTime) then
FOnPaserPmTime(self,aJH, aYUE,aBKSet,aFL,aTime,aV3);
end; //最大需量发生时间
//////////////////////////////
//最大需量发生时间结束
//////////////////////////////////////
// /////////变量处理开始////
///////////////////////////////////////
ID1_BL : //变量
begin
aBLSet:=[];
aJH:=GetJH(ID);
////////////////瞬时量集合//////////////////////////////////////
if aJH = JH_X then begin //瞬时量集合
aX:=X_Block;
S:=data;
tmp:=StrToken(S);
if length(tmp) = (4+2*3 ) then begin
try
aV4.aXV_BK:= PaserXV_Block(aX,tmp,5); //相电压,
aBLSet:=aBLSet+[X_V];
except
DoLogEvent('相电压数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (2*3 ) then begin
try
aV4.aXI_BK:= PaserXI_Block(aX,tmp,1); //相电流,
aBLSet:=aBLSet+[X_I];
except
DoLogEvent('相电流数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp)= (3*4 +2*2 ) then begin
try
aV4.aXP_BK:= PaserXP_Block(aX,tmp,1); //相有功,
aBLSet:=aBLSet+[X_P];
except
DoLogEvent('相有功数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (2*4 ) then begin
try
aV4.aXQ_BK:= PaserXQ_Block(aX,tmp,1); //相无功,
aBLSet:=aBLSet+[X_Q];
except
DoLogEvent('相无功数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (2*4 ) then begin
try
aV4.aXCos_BK:= PaserXCos_Block(aX,tmp,1);//相功率因数
aBLSet:=aBLSet+[X_Cos];
except
DoLogEvent('相功率因数数据格式错!');
end;
end;
if assigned(FOnPaserBL ) then
FOnPaserBL(self,aJH, aBLSet, aX, aTime, aV4);
DoStopEvent;
exit;
end; //瞬时量集合
/////////////// 断相集合///////////////////////////
if aJH = JH_DX then begin // 断相集合
aX:=X_Block;
S:=Data;
tmp:=StrToken(S);
if length(tmp) = (4+2*4 ) then begin
try
aV4.aDXCNT_BK:= PaserDXCNT_Block(aX,tmp,5); //断相次数,
aBLSet:=aBLSet+[DX_CNT];
except
DoLogEvent('断相次数数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (3*4 ) then begin
try
aV4.aDXT_BK:= PaserDXT_Block(aX,tmp,1); //断相总时间,
aBLSet:=aBLSet+[DX_T];
except
DoLogEvent('断相总时间数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (4*4 ) then begin
try
aV4.aDXT1_BK:= PaserDXT1_Block(aX,tmp,1); //断相时间1
aBLSet:=aBLSet+[DX_T1];
except
DoLogEvent('断相时间1数据格式错!');
end;
end;
tmp:=StrToken(S);
if length(tmp) = (4*4 ) then begin
try
aV4.aDXT2_BK:= PaserDXT2_Block(aX,tmp,1); // 断相时间2
aBLSet:=aBLSet+[DX_T2];
except
DoLogEvent('断相时间2数据格式错!');
end;
end;
if assigned(FOnPaserBL ) then
FOnPaserBL(self,aJH, aBLSet, aX, aTime, aV4);
DoStopEvent;
exit;
end; //断相集合
////////////// 块 或 项 ////////////////////////////////////////////////
aJH:=JH_NO;
aBL:= getBL(ID) ;
aX:=GetBLX(ID);
case aBL of
DX_CNT:try //断相次数,
aV4.aDXCNT_BK:= PaserDXCNT_Block(aX,data,5) ;
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
DX_T : try // 断相时间,
aV4.aDXT_BK:= PaserDXT_Block(aX,data,5);
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
DX_T1:try //断相 起始时间
aV4.aDXT1_BK:= PaserDXT1_Block(aX,data,5) ;
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
DX_T2:try //断相 结束时间,
aV4.aDXT2_BK:= PaserDXT2_Block(aX,data,5) ;
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
X_V:try //相电压,
aV4.aXV_BK:= PaserXV_Block(aX,data,5) ;
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
X_I: try //相电流,
aV4.aXI_BK:= PaserXI_Block(aX,data,5) ;
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
X_P: try //相有功,
aV4.aXP_BK:= PaserXP_Block(aX,data,5) ;
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
X_Q: try //相无功,
aV4.aXQ_BK:= PaserXQ_Block(aX,data,5) ;
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
X_COS:try//相功率因数
aV4.aXCos_BK:= PaserXCos_Block(aX,data,5) ;
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
end; // case getIDBLtype(ID) of
aBLSet:=[aBL] ;
if assigned(FOnPaserBL ) then
FOnPaserBL(self,aJH, aBLSet,aX, aTime, aV4 );
end; // 变量
//////////////////////////////////////
// /////////变量处理结束////
/////// 电表参数设置: //
///////////////////////////////////////
ID1_CS : //电表参数
begin
ID1_3:=strtoInt('$'+ID[1]+ID[2]+ID[3]);
s4:=Id[4];
case ID1_3 of
$C01 : try
aC01:= PaserC01_(s4,data);
DoLogEvent( datetostr( aC01.D )+' '
+ inttostr( aC01.W) +' '
+ timetostr( aC01.T) );
except
DoLogEvent('数据格式错!');
inc(FN); execute; exit;
end;
$C02 : begin
aC02:=PaserC02_(s4,data);
DoLogEvent(' B1:'+ inttoHex( aC02.B1,2 ) +#13#10+ PaserB1(aC02.B1)
+ ' B2:' + inttoHex( aC02.B2 ,2)+#13#10 + PaserB2(aC02.B2)
+ ' B3:' + inttoHex( aC02.B3,2)+ #13#10 + PaserB3(aC02.B3)
);
end;
$C03 : begin
aC03:=PaserC03_(s4,data);
DoLogEvent(' Pkwh:'+ inttostr( aC03.Pkwh )
+ ' Qkwh:' + inttostr( aC03.Qkwh )
+ ' BH:' + ( aC03.BH )
+ ' UseID:' + ( aC03.UseID )
+ ' DEVID:' + ( aC03.DEVID ) );
end;
$C11 : begin
aC11:=PaserC11_(s4,data);
DoLogEvent(' PmT:'+ inttostr( aC11.PmT )
+ ' DelayT:' + inttostr( aC11.DelayT )
+ ' LoopT:' + inttostr( aC11.LoopT )
+ ' DisT:' + inttostr( aC11.DisT )
+ ' DLDot:' + inttostr( aC11.DLDot )
+ ' PmDot:' + inttostr( aC11.PmDot )
+ ' ReadDDHH:' + ( aC11.ReadDDHH )
+ ' FHDay:' + inttostr( aC11.FHDay )
+ ' P_kWh0:' + floattostr( aC11.P_kWh0 )
+ ' Q_kWh0:' + floattostr( aC11.Q_kWh0 )
);
end;
$C21 : begin
aC21:=PaserC21_(s4,data);
DoLogEvent(' PWms:'+ inttostr( aC21.PWms )
+ ' PA:' + inttoHex( aC21.PA ,2)
+ ' p1:' + inttoHex( aC21.p1 ,2)
+ ' p2:' + inttoHex( aC21.p2 ,2)
+ ' p3:' + inttoHex( aC21.p3 ,2)
);
end;
$C31 : begin
aC31:=PaserC31_(s4,data);
DoLogEvent(' p:'+ inttostr( aC31.P )
+ ' q:' + inttostr( aC31.q )
+ ' m:' + inttostr( aC31.m )
+ ' k:' + inttostr( aC31.k )
+ ' n:' + inttostr( aC31.n )
);
end;
$C32 : begin
aC32:=PaserC32_(s4,data);
tmp:='';
for i:=1 to 14 do
tmp:=tmp+aC32[i]+#13#10;
DoLogEvent( tmp);
end;
$C33..$C3A: begin
aC33:=PaserC33_(ID,s4,data);
tmp:='';
for i:=1 to 10 do
tmp:=tmp+aC33[i]+#13#10;
DoLogEvent( tmp);
end;
$C41: begin
aC41:=PaserC41_(s4,data);
tmp:='';
for i:=1 to 14 do
tmp:=tmp+aC41[i]+#13#10;
DoLogEvent( tmp);
end;
end;
end; //电表参数
/////// 电表参数设置: //
///////////////////////////////////////
end;
DoStopEvent;
end;
//****************************************************************************
procedure TDLMeter.Go;
begin
FCom:=GetReadCMD(ID,ADR,stx,CS0);
DataStart:=stx;
FN:=1; FGoing:=true;
Execute;
end;
procedure TDLMeter.stop;
begin
FGoing:=False;
end;
//*******************************************************
// writelog(' 读电压超时' );
// writelog(' 读电压超时' );
// writelog(' 设置时间超时' );
//************************************************************
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -