Автор: Пользователь скрыл имя, 15 Января 2013 в 22:15, курсовая работа
Моделирование в широком смысле является основным методом исследований во всех областях знаний и научно обоснованным методом оценок характеристик сложных систем, используемым для принятия решений в различных сферах инженерной деятельности. Существующие и проектируемые системы можно эффективно исследовать с помощью математических моделей (аналитических и имитационных), реализуемых на современных ЭВМ, которые в этом случае выступают в качестве инструмента экспериментатора с моделью системы.
RBC2 10016.000
REZERVBC 33.000
SAV 10007.000
VEROYATNOSTREZERVA 10017.000
LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY
1 GENERATE 500 0 0
2 ENTER 500 0 0
3 TRANSFER 500 0 0
METAB1 4 SEIZE 257 0 0
5 LEAVE 257 0 0
6 ASSIGN 257 0 0
7 ADVANCE 257 0 0
8 RELEASE 257 0 0
9 TRANSFER 257 0 0
METAB2 10 SEIZE 243 0 0
11 LEAVE 243 0 0
12 ASSIGN 243 0 0
13 ADVANCE 243 0 0
14 RELEASE 243 0 0
METBC 15 ENTER 500 0 0
16 SAVEVALUE 500 0 0
17 TEST 500 0 0
18 TEST 436 0 0
19 SEIZE 229 0 0
20 LEAVE 229 0 0
21 ADVANCE 229 0 0
22 SAVEVALUE 229 0 0
23 SAVEVALUE 229 0 0
24 RELEASE 229 0 0
25 TERMINATE 229 0 0
METBC2 26 SEIZE 207 0 0
27 LEAVE 207 0 0
28 ADVANCE 207 0 0
29 SAVEVALUE 207 0 0
30 SAVEVALUE 207 0 0
31 RELEASE 207 0 0
32 TERMINATE 207 0 0
REZERVBC 33 TEST 64 0 0
34 SEIZE 28 0 0
35 LEAVE 28 0 0
36 ADVANCE 28 0 0
37 SAVEVALUE 28 0 0
38 SAVEVALUE 28 0 0
39 RELEASE 28 0 0
40 TERMINATE 28 0 0
METRBC2 41 SEIZE 36 0 0
42 LEAVE 36 0 0
43 ADVANCE 36 0 0
44 SAVEVALUE 36 0 0
45 SAVEVALUE 36 0 0
46 RELEASE 36 0 0
47 TERMINATE 36 0 0
48 SAVEVALUE 0 0 0
FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY DELAY
AB1 257 0.897 20.000 1 0 0 0 0 0
AB2 243 0.853 20.118 1 0 0 0 0 0
BC1 229 0.994 24.880 1 0 0 0 0 0
BC2 207 0.903 25.000 1 0 0 0 0 0
RBC1 28 0.073 15.000 1 0 0 0 0 0
RBC2 36 0.094 15.000 1 0 0 0 0 0
STORAGE CAP. REM. MIN. MAX. ENTRIES AVL. AVE.C. UTIL. RETRY DELAY
AB 20 20 0 20 500 1 11.046 0.552 0 0
BC 25 25 0 18 500 1 13.532 0.541 0 0
SAVEVALUE RETRY VALUE
SAV 0 0
COUNTSTANDARTMODE
0 436.000
COUNTREZERVMODE
0 64.000
Приложение В
(обязательное)
Листинг модуля с основным алгоритмом на общесистемном языке программирования
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Spin, Math, ComCtrls, Gauges;
type
MyThread = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
procedure PlusGauge1;
procedure MinusGauge1;
procedure PlusGauge2;
procedure MinusGauge2;
procedure UpdateLabels;
end;
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
SpinEdit3: TSpinEdit;
SpinEdit4: TSpinEdit;
SpinEdit5: TSpinEdit;
SpinEdit6: TSpinEdit;
SpinEdit7: TSpinEdit;
SpinEdit8: TSpinEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
SpinEdit9: TSpinEdit;
SpinEdit10: TSpinEdit;
SpinEdit11: TSpinEdit;
SpinEdit12: TSpinEdit;
SpinEdit13: TSpinEdit;
SpinEdit14: TSpinEdit;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
Label8: TLabel;
Label30: TLabel;
Label31: TLabel;
SpinEdit15: TSpinEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
Button1: TButton;
Button2: TButton;
GroupBox2: TGroupBox;
Gauge1: TGauge;
Gauge2: TGauge;
Label37: TLabel;
Label38: TLabel;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
Label42: TLabel;
Label35: TLabel;
Label36: TLabel;
Label43: TLabel;
Label44: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
co: MyThread;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
transacts, VolumeA, VolumeB, LostTransacts, AB1, AB2, BC1, BC2, RBC1, RBC2, reserve, through_AB1_AB2: integer;
AB1_uses, AB2_uses, BC1_uses, BC2_uses, RBC1_uses, RBC2_uses, exit: boolean;
// + -
function PlusMinus (osnova,dopoln:integer):
var
itog, pp:integer;
begin pp:=random(2);
case pp of
0: itog:=osnova + random (dopoln+1);
1:itog:=osnova - random (dopoln+1);
end;
PlusMinus:=itog;
end;
procedure MyThread.PlusGauge1;
begin
Priority:=tpNormal;
Form1.Gauge1.Progress:=Form1.
end;
procedure MyThread.MinusGauge1;
begin
Form1.Gauge1.Progress:=Form1.
Priority:=tpLower;
end;
procedure MyThread.PlusGauge2;
begin
Form1.Gauge2.Progress:=Form1.
end;
procedure MyThread.MinusGauge2;
begin
Form1.Gauge2.Progress:=Form1.
end;
procedure MyThread.UpdateLabels;
begin
Form1.Label43.Caption:=
Form1.Label35.Caption:=
Form1.Label36.Caption:=
Form1.Label44.Caption:=
end;
procedure MyThread.Execute;
var
AB_way: integer;
begin
FreeOnTerminate:=true;
try
if VolumeA < StrToInt(Form1.SpinEdit3.Text) then
begin
inc(VolumeA);
Synchronize(PlusGauge1);
AB1:=PlusMinus(StrToInt(Form1.
AB2:=PlusMinus(StrToInt(Form1.
while AB1_uses and AB2_uses do
begin end;
if Min(AB1,AB2)=AB1 then
begin
if AB1_uses=False then
begin
AB1_uses:=True;
Sleep(AB1);
dec(VolumeA);
AB1_uses:=False;
AB_way:=1;
inc(through_AB1_AB2);
end
else
begin
AB2_uses:=True;
Sleep(AB2);
dec(VolumeA);
AB2_uses:=False;
AB_way:=2;
inc(through_AB1_AB2);
end;
end
else
begin
if AB2_uses=False then
begin
AB2_uses:=True;
Sleep(AB2);
dec(VolumeA);
AB2_uses:=False;
AB_way:=2;
inc(through_AB1_AB2);
end
else
begin
AB1_uses:=True;
Sleep(AB1);
dec(VolumeA);
AB1_uses:=False;
AB_way:=1;
inc(through_AB1_AB2);
end;
end;
Synchronize(MinusGauge1);
RBC1:=15;
RBC2:=15;
if
(VolumeB < StrToInt(Form1.SpinEdit13.
begin
BC1:=PlusMinus(StrToInt(Form1.
BC2:=PlusMinus(StrToInt(Form1.
if (RBC1_uses or RBC1_uses) then
begin
BC1:=15;
BC2:=15;
end;
inc(VolumeB);
Priority:=tpLowest;
Synchronize(PlusGauge2);
case AB_way of
1: begin
while BC1_uses do begin end;
BC1_uses:=True;
Sleep(BC1);
dec(VolumeB);
BC1_uses:=False;
end;
2: begin
while BC2_uses do begin end;
BC2_uses:=True;
Sleep(BC2);
dec(VolumeB);
BC2_uses:=False;
end;
end;
Priority:=tpLowest;
Synchronize(MinusGauge2);
Priority:=tpLower;
end
else
begin
BC1:=PlusMinus(StrToInt(Form1.
BC2:=PlusMinus(StrToInt(Form1.
case AB_way of
1: begin
while RBC1_uses do begin end;
RBC1_uses:=True;
Sleep(RBC1);
RBC1_uses:=False;
inc(reserve);
end;
2: begin
while RBC2_uses do begin end;
RBC2_uses:=True;
Sleep(RBC2);