Kursovoy_2_dubl_2 (2)
.pdfyo:=300;
xm:=900;
ym:=300;
setpencolor(clblack);
setpenwidth(3);
line (100,0,100,500); line (0,300,1300,300); line (90,25,100,0); line (100,0,110,25);
line (1245,290,1275,300); line (1245,310,1275,300); SetFontSize(12); textout(16,16,'Люди'); textout(66,161,'50'); textout(66,36,'100'); textout(1200,351,'t, минут'); textout(250,311,'5'); textout(400,311,'10'); textout(550,311,'15'); textout(700,311,'20'); textout(850,311,'25'); textout(1000,311,'30'); writeln();
for i:=1 to T do
begin { начало отсчёта i секунды времени}
x:=random();
if x<=(3/60) then
P:=1 else
P:=0;
if P=1 then
43
begin {если человек пришёл}
n:=n+1;
if och<2 then
och:=och+1
else
r:=r+1; {количество ушедших } end;{если человек пришёл}
g1[i]:=r;
if (och>0) and (pril1=0) then {переход из очереди к первому прилавку}
begin
pril1:=1; och:=och-1;
end;{переход из очереди к первому прилавку}
if (och>0) and (pril2=0) then {переход из очереди ко второму
прилавку}
begin
pril2:=1;
och:=och-1;
end;
y:=random();{процесс обслуживания в 1 прилавке}
if y<=(1/60) then
obs:=1
else
obs:=0;
if (pril1=1) and (obs=1) then
begin
pril1:=0;
z:=z+1;
end;{процесс обслуживания в 1 прилавке}
y:=random();{процесс обслуживания в 2 прилавке}
44
if y<=(2/60) then
obs:=1
else
obs:=0;
if (pril2=1) and (obs=1) then
begin
pril2:=0;
z:=z+1;
end;{процесс обслуживания в 2 прилавке}
k1[i]:=z;
if pril1=0 then a:=a+1; {количество времени простоя} if pril2=0 then a:=a+1;
end; {по i секунде времени}
setpencolor(clgreen);
for i:=1 to T-1 do
line (scrx(i), scry(k1[i]) ,scrx(i+1),scry(k1[i+1])); setpencolor(clred);
for i:=1 to T-1 do
line (scrx(i), scry(g1[i]),scrx(i+1),scry(g1[i+1]));
textout(10, 330, concat('Количество ушедших = ', floattostr(r))); textout(10, 350, concat('Количество обслуженных = ', floattostr(z))); textout(10, 370, concat('Всего = ', floattostr(n)));
textout(10, 390, concat('Доля обслуженных = ', floattostr(z/n))); textout(10, 410, concat('Средняя доля времени простоя прилавков = ',
floattostr(a/(T*2))));
textout(10, 430, 'Зеленая линия - количество обслуженных клиентов'); textout(10, 450, 'Красная линия - количество отказов клиентам');
END.
45