Professional Documents
Culture Documents
iDriverIndex := objPump.iLocalDriver;
iActiveDrive := iDriverIndex;
if arrDrivers[iDriverIndex].iType = 0 then (*tip convertizor*)
xStart_SS:=false;
xStart_CF:=xStartCommand;
else
xStart_CF:=false;
xStart_SS:=xStartCommand;
end_if;
else
(*Urmareste activarea comenzii de start*)
R_TRIG_Command(CLK:=xStartCommand);
if R_TRIG_Command.Q then
xGasit:=false;
iIndex:=0;
iActiveDrive := 0;
if objPump.xActive then (*cauta driver-ul rezervat*)
while not xGasit and (iIndex < iMaxPumps) do
iIndex:=iIndex+1;
if arrDrivers[iIndex].xReserved and arrDrivers[iIndex].iUsedBy=0 then
xGasit:=true;
objPump.iUses:=iIndex;
iActiveDrive := iIndex;
arrDrivers[iIndex].iUsedBy := objPump.iObjNo;
end_if;
end_while;
else (*cauta driver-ul asociat, neutilizat si nerezervat*)
while not xGasit and (iIndex < iMaxPumps) do
iIndex:=iIndex+1;
if not arrDrivers[iIndex].xReserved and arrDrivers[iIndex].iUsedBy=0 and o
bjPump.arrAssoc[iIndex]=byte#1 then
xGasit:=true;
objPump.iUses:=iIndex;
iActiveDrive := iIndex;
arrDrivers[iIndex].iUsedBy := objPump.iObjNo;
end_if;
end_while;
(*!??----------------------??!*)
(*Ce faci daca nu s-a gasit??!*)
(*!??----------------------??!*)
end_if;
end_if;
F_TRIG_Command(CLK:=xStartCommand);
if F_TRIG_Command.Q then
if iIndex>0 and iIndex<11 then
arrDrivers[iIndex].iUsedBy := 0;
end_if;
objPump.iUses := 0;
iActiveDrive := 0;
end_if;