📄 filedefine.~pas
字号:
if pos(temp, temstr)=0 then
begin
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
continue;
end;
temp1 := getdata(temp, i, tempmemo);
econfile.xiangliangarray[j*2 + 1].address3 := temp1;
i := i + 1;
j := j + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
end; //WITH
end;
end;
procedure getxiebodata(tempmemo: Tmemo; econfile: Teconfile);
var
i, j, k: integer;
temstr: string;
temp, temp1: string;
begin
with tempmemo do
begin
j := 0;
k := 0;
for i:=0 to lines.Count do
begin
temp := '[谐波定义]';
temstr := Lines.Strings[i];
k := pos(temp, temstr);
if k>0 then
begin
j := i;
break;
end;
end;
if ((i<>j)or(k=0)) then
begin
econfile.setxiebototal := 0;
// fileerr(NOTFIND+temp);
exit;
end;
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
j := 0;
while k=0 do
begin
temp := '[地址I]';
if pos(temp, temstr)=0 then
begin
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
continue;
end;
temp1 := getdata(temp, i, tempmemo);
if strtointdef(temp1,300)>econfile.inputregistertotal then
begin
fileerr(inttostr(i)+'行 '+ temp + '值超出[输入寄存器数]');
exit;
end;
econfile.xieboarray[j + 1].address1 := temp1;
temp := '[名称]';
if pos(temp, temstr)=0 then
begin
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
continue;
end;
temp1 := getdata(temp, i, tempmemo);
econfile.xieboarray[j + 1].name := temp1;
i := i + 1;
j := j + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
end; // end wihile
j := 0;
k := 0;
for i:=0 to lines.Count do
begin
temp := '[谐波运算基数]';
temstr := Lines.Strings[i];
k := pos(temp, temstr);
if k>0 then
begin
j := i;
break;
end;
end;
if ((i<>j)or(k=0)) then
begin
econfile.setxiebototal := 0;
// fileerr(NOTFIND+temp);
// exit;
end;
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
j := 0;
while k=0 do
begin
temp := '[电压基数]';
if pos(temp, temstr)=0 then
begin
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
continue;
end;
temp1 := getdata(temp, i, tempmemo);
if strtointdef(temp1,-300) < 0 then
begin
// fileerr(temp + '值超出[输入寄存器数]');
// exit;
end;
xiev := temp1;
temp := '[电流基数]';
if pos(temp, temstr)=0 then
begin
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
continue;
end;
temp1 := getdata(temp, i, tempmemo);
if strtointdef(temp1,-300) < 0 then
begin
// fileerr(temp + '值超出[输入寄存器数]');
// exit;
end;
xiei := temp1;
i := i + 1;
j := j + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
end; // end wihile
end;
end;
procedure getsetpowerdata(tempmemo: Tmemo; econfile: Teconfile);
var
i, j, k: integer;
temstr: string;
temp, temp1: string;
begin
with tempmemo do
begin
j := 0;
k := 0;
for i:=0 to lines.Count do
begin
temp := '[电度名称]';
temstr := Lines.Strings[i];
k := pos(temp, temstr);
if k>0 then
begin
j := i;
break;
end;
end;
if ((i<>j)or(k=0)) then
begin
fileerr(NOTFIND + temp);
exit;
end;
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
j := 0;
while k=0 do
begin
temp := '[地址H1]';
if pos(temp, temstr)=0 then
begin
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
continue;
end;
temp1 := getdata(temp, i, tempmemo);
if strtointdef(temp1,300)>econfile.holdregistertotal then
begin
fileerr(inttostr(i)+'行 '+ temp + '值大于[保持寄存器数]');
exit;
end;
econfile.setpowerarray[j + 1].address1 := temp1;
temp := '[地址H2]';
if pos(temp, temstr)=0 then
begin
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
continue;
end;
temp1 := getdata(temp, i, tempmemo);
if strtointdef(temp1,300)>econfile.holdregistertotal then
begin
fileerr(temp + '值大于[保持寄存器数]');
exit;
end;
econfile.setpowerarray[j + 1].address2 :=temp1;
temp := '[名称]';
if pos(temp, temstr)=0 then
begin
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
continue;
end;
temp1 := getdata(temp, i, tempmemo);
econfile.setpowerarray[j + 1].name := temp1;
j := j + 1;
if j=econfile.setpartotal then
begin
// fileerr(inttostr(j)+'超过[电度类型数]的值');
exit;
end;
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
end;
end;
end;
procedure geteventtypedata(tempmemo: Tmemo; econfile: Teconfile);
var
i, j, k, l: integer;
temstr: string;
temp, temp1: string;
begin
with tempmemo do
begin
j := 0;
k := 0;
for i:=0 to lines.Count do
begin
temp := '[事件名称]';
temstr := Lines.Strings[i];
k := pos(temp, temstr);
if k>0 then
begin
j := i;
break;
end;
end;
if ((i<>j)or(k=0)) then
begin
fileerr(NOTFIND + temp);
exit;
end;
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
j := 0;
while k=0 do
begin
temp := '[序号]';
if pos(temp, temstr)=0 then
begin
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
continue;
end;
temp1 := getdata(temp, i, tempmemo);
if strtointdef(temp1,300)>econfile.eventtypetotal then
begin
fileerr(inttostr(i)+'行 '+ temp + '值大于[事件类型数]');
exit;
end;
l := strtointdef(temp1, 0);
temp := '[名称]';
if pos(temp, temstr)=0 then
begin
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---', temstr);
continue;
end;
temp1 := getdata(temp, i, tempmemo);
econfile.eventtypearray[l].name := temp1;
j := j + 1;
if j=econfile.eventtypetotal then
begin
// fileerr(inttostr(j)+'超过[事件类型数]的值');
exit;
end;
i := i + 1;
temstr := Lines.Strings[i];
k := pos('---',temstr);
end;
end;
end;
procedure getcomdata(tempmemo:Tmemo; econfile:Teconfile);
var
i, j, k: integer;
temstr: string;
temp, temp1: string;
flag: bool;
begin
with tempmemo do
begin
j := 0;
k := 0;
for i:=0 to lines.Count do
begin
temp := '[通讯定义]';
temstr := Lines.Strings[i];
k := pos(temp, temstr);
if k>0 then
begin
j := i;
break;
end;
end;
if ((i<>j)or(k=0)) then
begin
fileerr(NOTFIND + temp);
exit;
end;
i := i + 1;
temp := '[数据位]';
temstr := getdata(temp, i, tempmemo);
if temstr='xx' then
begin
fileerr(NOTFIND + temp);
exit;
end
else
econfile.comm.databits := strtoint(temstr);
temp := '[停止位]';
temstr:=getdata(temp, i, tempmemo);
if temstr='xx' then
begin
fileerr(NOTFIND + temp);
exit;
end
else
econfile.comm.stopbits := strtoint(temstr);
temp := '[奇偶校验]';
temstr := getdata(temp, i, tempmemo);
if temstr='xx' then
begin
fileerr(NOTFIND + temp);
exit;
end
else
begin
if temstr='无' then econfile.comm.parity := 0;
if temstr='奇' then econfile.comm.parity := 1;
if temstr='偶' then econfile.comm.parity := 2;
end;
temp := '[波特率]';
temstr := getdata(temp, i, tempmemo);
if temstr='xx' then
begin
fileerr(NOTFIND + temp);
exit;
end
else
begin
econfile.comm.baudrate := strtointdef(temstr, 9600);
econfile.comm.userbaud := strtointdef(temstr, 9600);
end;
temp := '[通讯口]';
temstr := getdata(temp, i, tempmemo);
if temstr='xx' then
begin
fileerr(NOTFIND + temp);
exit;
end
else
begin
econfile.comm.portnum := strtointdef(temstr, 1);
end;
temp := '[终端地址]';
temstr:=getdata(temp, i, tempmemo);
if temstr='xx' then
begin
fileerr(NOTFIND+temp);
exit;
end
else
begin
econfile.comm.rtuaddress := strtointdef(temstr, 1);
end;
temp := '[通讯规约]';
temstr := getdata(temp, i, tempmemo);
if temstr='xx' then
begin
fileerr(NOTFIND+temp);
exit;
end
else
econfile.comm.mode := temstr;
temp := '[发送帧间隔]';
temstr := getdata(temp, i, tempmemo);
if temstr='xx' then
begin
fileerr(NOTFIND + temp);
exit;
end
else
begin
flag := pos('MS', UpperCase(temstr)) > 0;
flag := (flag) or (pos('S', UpperCase(temstr))>0);
if (flag) then
begin
k := pos('MS', UpperCase(temstr));
if (k > 0) then
begin
delete(temstr, k, length(temstr));
econfile.comm.timepoll := strtointdef(temstr, 50);
end
else
begin
k:=pos('S', UpperCase(temstr));
delete(temstr, k, length(temstr));
econfile.comm.timepoll := strtointdef(temstr, 50) * 1000;
end;
end
else econfile.comm.timepoll := strtointdef(temstr, 50);
if econfile.comm.timepoll<10 then econfile.comm.timepoll := 5;
end;
temp := '[超时时间]';
temstr := getdata(temp, i, tempmemo);
if temstr='xx' then
begin
fileerr(NOTFIND + temp);
exit;
end
else
begin
flag := pos('MS', UpperCase(temstr)) > 0;
flag := (flag) or (pos('S', UpperCase(temstr))>0);
if (flag) then
begin
k := pos('MS', UpperCase(temstr));
if (k > 0) then
begin
delete(temstr, k, length(temstr));
econfile.comm.timeout := strtointdef(temstr, 500);
end
else
begin
k:=pos('S', UpperCase(temstr));
delete(temstr, k, length(temstr));
econfile.comm.timeout := strtointdef(temstr, 500) * 1000;
end;
end
else econfile.comm.timeout := strtointdef(temstr, 500);
if econfile.comm.timeout<50 then econfile.comm.timeout := 50;
end;
j := 0;
k := 0;
for i:=0 to lines.Count do
begin
temp := '[计算机发送数据帧序列]';
temstr := Lines.Strings[i];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -