FinishElements;
var i: integer;
begin
for i: = 0 to ElementCount-1 do
if IsFinishElement (Elements [i]) then begin
FFinishElements.Add (Elements [i]);
FLastElements.Add (Elements [i]);
end;
end;
function TQSheme.FastestStepPeriod: TCustTime;
var i: integer;
Min: TCustTime;
begin
Min: = FSysPeriod;
for i: = 0 to ElementCount-1 do
if (Elements [i] is TShop) then
with TShop (Elements [i]). Generator do
if Mean-Disp
{$ ifndef Precision}
Result: = Min;
{$ else}
Result: = Min div 10;
{$ endif}
end;
procedure TQSheme.InitAnalize;
begin
FSysTime: = 0;
FStepCount: = 0;
FOrderElementCount: = 0;
FLastElements: = TList.Create;
FSourceElements: = TList.Create;
end;
procedure TQSheme.FreeAnalize;
begin
FLastElements.Free;
FSourceElements.Free;
end;
procedure TQSheme.GetRecipientsOrder;
var i, s: integer;
LastElement: TElement;
begin
if FLastElements.Count = 0 then Exit;
for i: = 0 to FLastElements.Count-1 do begin
LastElement: = TElement (FLastElements [i]);
FOrder [FOrderElementCount]: = FElements.IndexOf (LastElement);
Inc (FOrderElementCount);
for s: = 0 to LastElement.SourceCount - 1 do
if FSourceElements.IndexOf (LastElement.Sources [s]) <0 then
FSourceElements.Add (LastElement.Sources [s]);
end;
SwapPointers (Pointer (FSourceElements), Pointer (FLastElements));
FSourceElements.Clear;
GetRecipientsOrder;
end;
procedure TQSheme.GetOrder;
begin
FindFinishElements;
GetRecipientsOrder;
end;
procedure TQSheme.TakeParcelsFromFinishElements;
var i: integer;
Parcel: TParcel;
begin
for i: = 0 to FFinishElements.Count-1 do
with TElement (FFinishElements [i]) do
if CanDrop then begin
Parcel: = Container;
NewEvent (EV_PASS, nil, FFinishElements [i], Parcel.Info);
DoBeforeDrop (FFinishElements [i]);
DropParcel;
DoAfterDrop (FFinishElements [i]);
Parcel.State: = psPassed;
end;
end;
procedure TQSheme.Step;
var i: integer;
begin
TakeParcelsFromFinishElements;
for i: = 0 to FOrderElementCount-1 do Elements [FOrder [i]]. AskForParcel;
Form1.Gauge1.Progress: = Round (FSysTime/FSysPeriod * 100);
Inc (FSysTime, FStepPeriod);
Inc (FStepCount);
end;
procedure TQSheme.Analize;
begin
try
try
InitAnalize;
GetOrder;
FStep...