📄 func.~pas
字号:
coilstatearray[(beginaddress div 8)*8 +j-1+i].value:=(k>0);
a:=a*2;
end;
end;}
econv230p.MainForm.Caption := companyname+'----'+getfilename+' '
+timetostr((strtoint64(econfile.holdregisterarray[2].value)*65536+strtoint64(econfile.holdregisterarray[1].value))/MsecsPerDay);
displayholdregister(econfile, mainform.holdregistergrid);
displayprotect(econfile, mainform.protectgrid);
displaypower(econfile, mainform.powergrid);
end;
4:
begin
for i:=1 to (analysbuffer[3]div 2) do
begin
j := analysbuffer[4+(i-1)*2]*256 + analysbuffer[5+(i-1)*2];
if j<=32767 then inputregisterarray[beginaddress+i].value := inttostr(j)
else inputregisterarray[beginaddress+i].value := inttostr(-1 *( 65536-j ));
end;
displayinputregister(econfile, mainform.inputregistergrid);
if econfile.setxiangliangtotal>0 then
begin
displayxiangliang(econfile, mainform.xianglianggrid);
drawxiangliang;
end;
if econfile.setxiebototal>0 then displayxiebo(econfile, mainform.xiebogrid);
end;
24:
begin
{case analysbuffer[8] of
0: ActDot := '第1点';
1: ActDot := '第2点';
2: ActDot := '第3点';
3: ActDot := '第4点';
4: ActDot := '第5点';
5: ActDot := '第6点';
6: ActDot := '第7点';
7: ActDot := '第8点';
end;}
ActDot := '第'+inttostr(analysbuffer[8])+'点';
case (analysbuffer[9]*256 + analysbuffer[10]) of
0: ActType := '1->0';
1: ActType := '0->1';
16: ActType := '启动电流保护动作预告';
17: ActType := '启动电流保护动作';
18: ActType := '启动电流保护撤消';
32: ActType := '超载保护动作预告';
33: ActType := '超载保护动作';
34: ActType := '超载保护撤消';
48: ActType := '欠压保护动作预告';
49: ActType := '欠压保护动作';
50: ActType := '欠压保护撤消';
64: ActType := '过压保护动作预告';
65: ActType := '过压保护动作';
66: ActType := '过压保护撤消';
80: ActType := '零序电流保护动作预告';
81: ActType := '零序电流保护动作';
82: ActType := '零序电流保护撤消';
96: ActType := '负序电流保护动作预告';
97: ActType := '负序电流保护动作';
98: ActType := '负序电流保护撤消';
112: ActType := '直流1保护动作预告';
113: ActType := '直流1保护动作';
114: ActType := '直流1保护撤消';
128: ActType := '直流2保护动作预告';
129: ActType := '直流2保护动作';
130: ActType := '直流2保护撤消';
144: ActType := '空载告警动作预告';
145: ActType := '空载告警动作';
146: ActType := '空载告警撤消';
160: ActType := '零序电压保护动作预告';
161: ActType := '零序电压保护动作';
162: ActType := '零序电压保护撤消';
$B0: ActType := '直流1保护动作预告';
$B1: ActType := '直流1保护动作';
$B2: ActType := '直流1保护撤消';
$C0: ActType := '直流2保护动作预告';
$C1: ActType := '直流2保护动作';
$C2: ActType := '直流2保护撤消';
$D0: ActType := '直流3保护动作预告';
$D1: ActType := '直流3保护动作';
$D2: ActType := '直流3保护撤消';
$E0: ActType := '直流4保护动作预告';
$E1: ActType := '直流4保护动作';
$E2: ActType := '直流4保护撤消';
$F0: ActType := '速断1段保护动作预告';
$F1: ActType := '速断1段保护动作';
$F2: ActType := '速断1段保护撤消';
$F3: ActType := '速断2段保护动作预告';
$F4: ActType := '速断2段保护动作';
$F5: ActType := '速断2段保护撤消';
$F6: ActType := '速断3段保护动作预告';
$F7: ActType := '速断3段保护动作';
$F8: ActType := '速断3段保护撤消';
$F9: ActType := '反时限速断保护动作预告';
$FA: ActType := '反时限速断保护动作';
$FB: ActType := '反时限速断保护撤消';
$FC: ActType := '温度保护动作预告';
$FD: ActType := '温度保护动作';
$FE: ActType := '温度保护撤消';
end;
// TimeValue := analysbuffer[11]*256/MsecsPerDay*65536 + analysbuffer[12]*65536/MsecsPerDay
// + analysbuffer[13]*256/MsecsPerDay + analysbuffer[14]/MsecsPerDay;
TimeValue := analysbuffer[11]*256*65536 + analysbuffer[12]*65536
+ analysbuffer[13]*256 + analysbuffer[14];
TimeValue := TimeValue/MsecsPerDay;
DecodeTime(TimeValue, Hour, Minute, Second, MSecond);
//f := ActDot + ' ' + ActType + ' ' + inttostr(Hour) + ':'
// + inttostr(Minute) + ':' + inttostr(Second) + '.' + inttostr(MSecond);
f := ActDot + ' ' + ActType + ' ' + inttostr(Hour) + ':'
+ inttostr(Minute) + ':' + format( '%2.3f', [Second*1.0+MSecond/1000.0]);
mainform.eventmemo.Lines.Insert(0, f);//插入SOE事件
if mainform.eventmemo.Lines.count>20 then mainform.eventmemo.Lines.clear;
end
else
//for i:=1 to econfile.analysbuffer[3]+3 do econfile.analysbuffer[i] :=0
for j:=1 to 1024 do econfile.analysbuffer[j] :=0
end;//case
for j:=1 to 1024 do econfile.analysbuffer[j] := 0;
end;//with
end;
procedure asclltoapp(var tempstring: string; var econfile: Teconfile);
var i: integer;
begin
delete(TempString, 1, 1);
delete(TempString, length(TempString)-1, 2);
for I:=1 to length(TempString)div 2 do
begin
econfile.analysbuffer[i] := strtohex(copy(TempString, i*2-1, 2), 2);
end;
TempString := '';
end;
function framecheck:integer;
var i, j: word;
begin
with econfile do
begin
if comm.mode='RTU' then
begin
case revbuff[1] of
$81:begin
framecheck := 0;
exit;
end;
5,6:begin
I := crc(revbuff[0], 6);
j := revbuff[6]*256 + revbuff[7];
if i<>j then framecheck := -1
else framecheck := 0;
end;
24:begin
I := crc(revbuff[0], 14);
j := revbuff[14]*256 + revbuff[15];
if i<>j then framecheck := -1
else framecheck := 0;
end;
1, 2, 3, 4:
begin
I := crc(revbuff[0], revbuff[2]+3);
j := revbuff[revbuff[2]+3]*256 + revbuff[revbuff[2]+4];
if i<>j then framecheck := -1
else framecheck := 0;
end;
else
framecheck := 0;
end;
end
else
begin
framecheck := 0;
end;
end;
end;
function Lrc(const Temp: String): String;
var
a, b, c: Cardinal;
t: String;
begin
b := Length(Temp) div 2;
c := 0;
for a:=0 To b-1 do
begin
t := copy(Temp, (2*a + 1), 2);
c := c + StrTohex1(t, 2);
end;
t := IntTohex((not c) + 1, 2);
b := Length(t) - 1;
Lrc := copy(t, b, 2);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -