Scrigroup - Documente si articole

     

HomeDocumenteUploadResurseAlte limbi doc
AstronomieBiofizicaBiologieBotanicaCartiChimieCopii
Educatie civicaFabule ghicitoriFizicaGramaticaJocLiteratura romanaLogica
MatematicaPoeziiPsihologie psihiatrieSociologie


PROIECT SIMULARE - Cibernetica

Fizica



+ Font mai mare | - Font mai mic



ACADEMIA DE STUDII ECONOMICE

FACULTATEA DE CIBERNETICa, STATISTICa Si informatica economica



Proiect simulare

Sectia: Cibernetica

Formularea Problemei

Fie Camera 43, etajul 3 , in cadrul ITMB, servind sectorul 3. In respectivul birou, lucreaza 4 inspectoare. Programul de lucru este de luni pana joi intre orele 09.00 si 14.00. Problemele pe care biroul le poate rezolva sunt de doua feluri: intocmire de noi dosare de munca, si adaugarea la dosare a statelor de plata ale salariatilor (lunar) si a noi angajati.

Ipoteze de lucru:

-sosirile sunt intamplatoare

-intervalul intre cele doua sosiri succesive urmeaza o lege de repartitie data:

2 1 1 2 2 3

15% 25% 30% 15% 5% 5%

-servirile se fac dupa prioritati:cei cu dosare noi, avand prioritate fata de ceilalti clienti, durata servirii urmeaza o lege de repartitie data.

-legea de servire pentru clientii cu prioritate:

5% 15% 25% 30% 20% 5%

-legea de servire pentru clientii fara prioritate:

8 6 5 7 8

10% 15% 25% 30% 20%

-la ora 09.00, cand incepe programul, fiecare birou este ocupat.In momentul intrarii unui noi client in sistem, acesta este repartizat la biroul cu coada de asteptare cea mai mica. Clientul ajunge la coada; in momentul in care biroul se elibereaza, se verifica daca la coada respectiva sunt clienti cu prioritate. In eventualitatea in care sunt mai multi, alegerea celui care urmeaza sa intre se face in functie de ordinea sa la coada.

Rezolvarea problemei de simulare se face cu ajutorul unui program PASCAL.

Variabilele folosite in program sunt urmatoarele

TA: timpul de asteptare al urmatorului client ce va veni la ghiseu;

TTA: suma timpilor de asteptare a clientilor la ghiseu, intr-un orizont de simulare;

TN: timpul in care ghiseul nu este solicitat

TTN: suma timpilor in care ghiseul nu este solicitat intr-un ciclu de simulare;

TS: intervalul de timp dintre doua sosiri succesive (variabila aleatoare generata in program);

TD:durata servirii clientilor cu state de plata sau anexe la dosare existente(variabila aleatoare generata in program);

TDP: durata servirii clientilor cu dosare noi(variabila aleatoare generata in program);

NUA:numarul de unitati care asteapta in sistem;

NUS:variabila booleana ce desemneaza starea statiei de servire

M:nr. de clienti intrati in sistem;

ITIMP:incrementul de timp;

IMAX:programul de lucru al sitemului(minute);

N:nr. iteratiilor

K:indexul iteratiei

ETA = TTA / M: timpul mediu de asteptare la ghiseu al unui client intr-un ciclu de simulare;

ETN = TTN / T: procentul de nefolosire al ghiseului intr-un ciclu de simulare;

SETA = S ETA: suma timpilor medii de asteptare

SETN = S ETN: suma procentelor de nefolosire ai ghiseului in cele N cicluri de simulare;

ESETA = SETA / N: timpul mediu de asteptare al unui client in cele NRC cicluri de asteptare;

ESETN = SETN / N: ponderea timpului mediu de nefolosire al ghiseului in timpul total, in cele N cicluri de simulare;

P=nr. clienti prioritari

Schema logica a programului utilizat este urmatoarea:


Programului PASCAL utilizat in rezolvarea problemei:

unit SimulareMain;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls;

type

TMainForm = class(TForm)

Label1: TLabel;

eIMAX: TEdit;

Label2: TLabel;

eN: TEdit;

btnSimulare: TButton;

Label3: TLabel;

eOra: TEdit;

btnIesire: TButton;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

Label10: TLabel;

Label11: TLabel;

Label12: TLabel;

Label13: TLabel;

Label14: TLabel;

Label15: TLabel;

Label16: TLabel;

Label17: TLabel;

Label18: TLabel;

Label19: TLabel;

Label20: TLabel;

Label21: TLabel;

Label22: TLabel;

Label23: TLabel;

Label24: TLabel;

Label25: TLabel;

Label26: TLabel;

Label27: TLabel;

Label28: TLabel;

Label29: TLabel;

Label30: TLabel;

Label31: TLabel;

Label32: TLabel;

Label33: TLabel;

ListBox1: TListBox;

ListBox2: TListBox;

ListBox3: TListBox;

Label34: TLabel;

Label35: TLabel;

Label36: TLabel;

Label37: TLabel;

Label38: TLabel;

Label39: TLabel;

Label40: TLabel;

Label41: TLabel;

Label42: TLabel;

Label43: TLabel;

ListBox4: TListBox;

lTotal: TLabel;

procedure btnSimulareClick(Sender: TOBJECT);

procedure btnIesireClick(Sender: TObject);

private

public

end;

const TSMin1 = 5;

TSMin2 = 20;

TSMin3 = 45;

TSMin4 = 75;

TSMin5 = 90;

TSMin6 = 95;

TSMin7 = 100;

var

MainForm: TMainForm;

implementation

Function GenereazaTS:Integer;

Var a:Integer;

Begin

a := Random(100);

If (a >= 0) And (a <= TSMin1) Then // 5%

a := 3;

If (a > TSMin1) And (a <= TSMin2) Then // 15%

a := 2;

If (a > TSMin2) And (a <= TSMin3) Then // 25%

a := 1;

If (a > TSMin3) And (a <= TSMin4) Then // 30%

a := 1;

If (a > TSMin4) And (a <= TSMin5) Then // 15%

a := 2;

If (a > TSMin5) And (a <= TSMin6) Then // 5%

a := 2;

If (a > TSMin6) And (a <= TSMin7) Then // 5%

a := 3;

Result := a;

End;

Function GenereazaTDP:Integer;

Var a:Integer;

Begin

a := Random(100);

If (a >= 0) And (a <= TSMin1) Then // 5%

a := 10;

If (a > TSMin1) And (a <= TSMin2) Then // 15%

a := 11;

If (a > TSMin2) And (a <= TSMin3) Then // 25%

a := 12;

If (a > TSMin3) And (a <= TSMin4) Then // 30%

a := 13;

If (a > TSMin4) And (a <= TSMin5) Then // 15%

a := 14;

If (a > TSMin5) And (a <= TSMin6) Then // 5%

a := 12;

If (a > TSMin6) And (a <= TSMin7) Then // 5%

a := 14;

Result := a;

End;

Function GenereazaTD:Integer;

Var a:Integer;

Begin

a := Random(100);

If (a >= 0) And (a <= TSMin1) Then // 5%

a := 8;

If (a > TSMin1) And (a <= TSMin2) Then // 15%

a := 6;

If (a > TSMin2) And (a <= TSMin3) Then // 25%

a := 5;

If (a > TSMin3) And (a <= TSMin4) Then // 30%

a := 5;

If (a > TSMin4) And (a <= TSMin5) Then // 15%

a := 6;

If (a > TSMin5) And (a <= TSMin6) Then // 5%

a := 7;

If (a > TSMin6) And (a <= TSMin7) Then // 5%

a := 8;

Result := a;

End;

Function Space(i:Integer):String;

var c:Integer;

s:String;

Begin

s := '';

for c := 1 to i do begin

s := s + ' ';

end;

Result := s;

End;

Function Formateaza(CeTimp:Integer):String;

Var Ora, Minut:Integer;

s:String;

Begin

Ora := StrToInt(MainForm.eOra.Text);

Ora := Ora + (CeTimp Div 60);

Minut := CeTimp Mod 60;

s:=Trim(IntToStr(Minut));

If Length(s) = 1 Then

s := '0' + s;

s := Trim(IntToStr(Ora)) + ':' + s;

Result := s;

End;

procedure TMainForm.btnSimulareClick(Sender: TObject);

var

IMAX, N, SETA, SETN, SM, K, ITIMP, TTA, TTS, TTN:Array[1..4] Of Integer;

TS:Array[0..1000] Of Byte;

N2, TS1:Integer;

NUS, NUA, M, TD, ETA, ETN, ESETA, ESETN, ESM:Array[1..4] Of Integer;

ESP, SP, P :Array[1..4] Of Integer;

SePoate, SePoate2:Boolean;

Lista:TListBox;

Post:Byte;

Post1:Integer;

Prioritate:Array[1..4] Of Boolean;

GenPrioritate:Integer;

TotalM, TotalP:Integer;

i:Integer;

begin

For i := 0 To 1000 Do

TS[i] := 0;

TotalM := 0;

TotalP := 0;

Prioritate[1] := False;

Prioritate[2] := False;

Prioritate[3] := False;

Prioritate[4] := False;

Randomize;

If Trim(eOra.Text) = '' Then

eOra.Text := '8';

If Trim(eIMAX.Text) = '' Then

eIMAX.Text := '360';

If Trim(eN.Text) = '' Then

eN.Text := '30';

ListBox1.Clear;

ListBox2.Clear;

ListBox3.Clear;

ListBox4.Clear;

IMAX[1] := StrToInt(eIMAX.Text); IMAX[2] := IMAX[1]; IMAX[3] := IMAX[1]; IMAX[4] := IMAX[1];

N[1] := StrToInt(eN.Text); N[2] := N[1]; N[3] := N[1]; N[4] := N[1];

SETA[1] := 0; SETA[2] := 0; SETA[3] := 0; SETA[4] := 0;

SETN[1] := 0; SETN[2] := 0; SETN[3] := 0; SETN[4] := 0;

SM[1] := 0; SM[2] := 0; SM[3] := 0; SM[4] := 0;

SP[1] := 0; SP[2] := 0; SP[3] := 0; SP[4] := 0;

K[1] := 1; K[2] := 1; K[3] := 1; K[4] := 1;

N2 := 1;

For Post := 1 To 4 Do Begin

Case Post Of

1:Begin

Lista := ListBox1;

End;

2:Begin

Lista := ListBox2;

End;

3:Begin

Lista := ListBox3;

End;

4:Begin

Lista := ListBox4;

End;

End;

Lista.Items.Add('======================================');

Lista.Items.Add('Ziua: '+IntToStr(K[Post]));

Lista.Items.Add('======================================');

ITIMP[Post] := 0;

TTA[Post] := 0;

TTS[Post] := 0;

TTN[Post] := 0;

NUS[Post] := 0;

NUA[Post] := 1;

P[Post] := 0;

M[Post] := 0;

End;

Repeat

If (K[1]> N2) And (K[2]> N2) And (K[3]> N2) And (K[4]> N2) Then Begin

If N2 < N[1] Then Begin

N2 := N2 + 1;

For i := 0 To 1000 Do

TS[i] := 0;

End;

End;

SePoate2 := False;

Repeat

Post1 := 9999;

For i := 1 To 4 Do Begin

If K[i] <= N2 Then Begin

If NUA[i] < Post1 Then Begin

Post1 := NUA[i];

Post := i;

End;

If NUS[i] = 0 Then Begin

Post1 := NUA[i];

Post := i;

End;

End;

End;

If TS[ITIMP[Post]] = 0 Then Begin

If Prioritate[Post] Then Begin

P[Post] := P[Post] + 1;

TotalP := TotalP + 1;

End;

M[Post] := M[Post] + 1;

TotalM := TotalM + 1;

NUA[Post] := NUA[Post] + 1;

End;

// Alegere Post

Case Post Of

1:Begin

Lista := ListBox1;

End;

2:Begin

Lista := ListBox2;

End;

3:Begin

Lista := ListBox3;

End;

4:Begin

Lista := ListBox4;

End;

End;

If TS[ITIMP[Post]] = 0 Then Begin

TS1 := GenereazaTS;

For i := ITIMP[Post] To ITIMP[Post] + TS1 Do Begin

TS[i] := TS1 - i + ITIMP[Post];

End;

End Else Begin

TS1 := TS[ITIMP[Post]];

End;

TTS[Post] := TTS[Post] + TS1;

SePoate := False;

Repeat

If NUS[Post] = 0 Then Begin

If NUA[Post] = 0 Then Begin

TTN[Post] := TTN[Post] + 1;

End Else Begin

NUA[Post] := NUA[Post] - 1;

NUS[Post] := 1;

Lista.Items.Add('-------- ----- ------ -----');

GenPrioritate := Random(10);

If GenPrioritate > 7 Then

Prioritate[Post] := True

Else

Prioritate[Post] := False;

If Prioritate[Post] Then

TD[Post] := GenereazaTDP

Else

TD[Post] := GenereazaTD;

End;

End Else Begin

If NUA[Post] <> 0 Then Begin

TTA[Post] := TTA[Post] + 1;

End;

End;

If Prioritate[Post] Then

Lista.Items.Add('*'+

Space(5-Length(Formateaza(ITIMP[Post]))) + Formateaza(ITIMP[Post]) +

Space(4-Length(IntToStr(M[Post]))) + IntToStr(M[Post]) +

Space(4-Length(IntToStr(TS1))) + IntToStr(TS1) +

Space(4-Length(IntToStr(TTS[Post]))) + IntToStr(TTS[Post]) +

Space(4-Length(IntToStr(TD[Post]))) + IntToStr(TD[Post]) +

Space(4-Length(IntToStr(TTA[Post]))) + IntToStr(TTA[Post]) +

Space(4-Length(IntToStr(TTN[Post]))) + IntToStr(TTN[Post]) +

Space(4-Length(IntToStr(NUS[Post]))) + IntToStr(NUS[Post]) +

Space(4-Length(IntToStr(NUA[Post]))) + IntToStr(NUA[Post]))

Else

Lista.Items.Add(' '+

Space(5-Length(Formateaza(ITIMP[Post]))) + Formateaza(ITIMP[Post]) +

Space(4-Length(IntToStr(M[Post]))) + IntToStr(M[Post]) +

Space(4-Length(IntToStr(TS1))) + IntToStr(TS1) +

Space(4-Length(IntToStr(TTS[Post]))) + IntToStr(TTS[Post]) +

Space(4-Length(IntToStr(TD[Post]))) + IntToStr(TD[Post]) +

Space(4-Length(IntToStr(TTA[Post]))) + IntToStr(TTA[Post]) +

Space(4-Length(IntToStr(TTN[Post]))) + IntToStr(TTN[Post]) +

Space(4-Length(IntToStr(NUS[Post]))) + IntToStr(NUS[Post]) +

Space(4-Length(IntToStr(NUA[Post]))) + IntToStr(NUA[Post]));

ITIMP[Post] := ITIMP[Post] + 1;

If ITIMP[Post] > IMAX[Post] Then Begin

ETA[Post] := TTA[Post] Div M[Post];

ETN[Post] := (TTN[Post] * 100) Div IMAX[Post];

Lista.Items.Add('-------- ----- ------ -----');

Lista.Items.Add('ETA: ' + IntToStr(ETA[Post]) +

', ETN: ' + IntToStr(ETN[Post]) +

'%, M: ' + IntToStr(M[Post]) +

', P: ' + IntToStr(P[Post]));

Lista.Items.Add('');

Lista.Items.Add('');

Lista.Items.Add('');

SETA[Post] := SETA[Post] + ETA[Post];

SETN[Post] := SETN[Post] + ETN[Post];

SM[Post] := SM[Post] + M[Post];

SP[Post] := SP[Post] + P[Post];

K[Post] := K[Post] + 1;

If K[Post]<=N[Post] Then Begin

Lista.Items.Add('======================================');

Lista.Items.Add('Ziua: '+IntToStr(K[Post]));

Lista.Items.Add('======================================');

End;

ITIMP[Post] := 0;

TTA[Post] := 0;

TTS[Post] := 0;

TTN[Post] := 0;

NUS[Post] := 0;

NUA[Post] := 0;

P[Post] := 0;

M[Post] := 0;

SePoate := True;

SePoate2 := True;

End Else Begin

If TD[Post] > 1 Then Begin

TD[Post] := TD[Post] - 1;

End Else Begin

If TD[Post] = 1 Then Begin

TD[Post] := 0;

NUS[Post] := 0;

End;

End;

If ITIMP[Post] = TTS[Post] Then Begin

SePoate := True;

End;

End;

Until SePoate;

Until SePoate2;

Until (k[1] > n[1]) and (k[2] > n[2]) and (k[3] > n[3]) and (k[4] > n[4]);

For Post := 1 To 4 Do Begin

ESETA[Post] := SETA[Post] Div N[Post];

ESETN[Post] := SETN[Post] Div N[Post];

ESM[Post] := SM[Post] Div N[Post];

ESP[Post] := SP[Post] Div N[Post];

Case Post Of

1:Begin

Lista := ListBox1;

End;

2:Begin

Lista := ListBox2;

End;

3:Begin

Lista := ListBox3;

End;

4:Begin

Lista := ListBox4;

End;

End;

Lista.Items.Add('__________ ______ ____ _______');

Lista.Items.Add('');

Lista.Items.Add('');

Lista.Items.Add('');

Lista.Items.Add('ESETA: ' + IntToStr(ESETA[Post]) +

', ESETN: ' + IntToStr(ESETN[Post]) + '%');

Lista.Items.Add('Clienti(ESM): ' + IntToStr(ESM[Post]) +

', Prioritari(ESP): ' + IntToStr(ESP[Post]));

Lista.ItemIndex := Lista.Items.Count-1;

End;

lTotal.Caption := 'Total: Dosare firma: ' + IntToStr(TotalP) +

', State de plata: ' + IntToStr(TotalM-TotalP);

end;

procedure TMainForm.btnIesireClick(Sender: TObject);

begin

MainForm.Close;

end;

end.

Am introdus urmatoarele date de intrare

Au fost obtinute urmatoarele rezultate:

-in prima zi:

-post1:

47 clienti, din care 15 au avut de rezolvat dosare noi

-post2:

-44 clienti, din care 24 au avut de rezolvat dosare noi

-post3:

-47 clienti, din care 8 au avut de rezolvat dosare noi

-post4:

-42 clienti, din care 4 au avut de rezolvat dosare noi

-in ultima zi:

-post1:

-44 clienti, din care 11 au avut de rezolvat dosare noi

-post2:

-53 clienti, din care 4 au avut de rezolvat dosare noi

-post3:

-49 clienti, din care 16 au avut de rezolvat dosare noi

-post2:

-48 clienti, din care 8 au avut de rezolvat dosare noi

Rezultatul final este urmatorul:

In intervalul de lucru (o luna de zile) s-au preluat 2742 state de plata salarii, si s-au intocmit 1165 de dosare noi.

Timpul mediu de asteptare in coada al unei persoane: 2 min;

Timpul mediu in care ghiseele nu vor fi solicitate:

-post1-2% din timpul total de lucru

-post2-2% din timpul total de lucru

-post3-3% din timpul total de lucru

-post4-5% din timpul total de lucru



Politica de confidentialitate | Termeni si conditii de utilizare



DISTRIBUIE DOCUMENTUL

Comentarii


Vizualizari: 1464
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved