Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Simulation Begin
- ! Common math functions - declaration **********;
- Boolean PDF_values;
- Real pi;
- Real Procedure Integral(Real Procedure F(Real X), Real A, Real B);
- Begin
- Real Sum;
- Real DX;
- Sum := 0;
- DX := 0.5;
- While A < B do
- Begin
- Sum := Sum + F(A);
- A := A + DX;
- End;
- Integral := Sum * DX;
- End of Integral;
- Real Procedure ErrorFunction(Real X);
- Begin
- ErrorFunction := If X <> 0 Then (X/abs(X)) * (sqrt(1-exp((-x**2*(4/pi+((8*(pi-3))/(3*pi*(4-pi)))*x**2))/(1+((8*(pi-3))/(3*pi*(4-pi)))*x**2)))) Else 0;
- End of ErrorFunction;
- Real Procedure Logarithm(Real X, Real B);
- Begin
- Logarithm := ln(x) / ln(b);
- End of Logarithm;
- ! Traffic Distribution - declaration **********;
- Real R;
- Real am; ! max altitude of traffic distribution;
- Real ah; ! probe reciever altitude;
- Real Ko, Rp; ! total traffic count within Rp = Ko;
- Real R1o, fxx;
- Real Dm, D1, Da;
- Real K, Rfo, Rf, R1, tq;
- Real Ro, muu, sigmau;
- Real Procedure pt(Real R);
- Begin
- pt := K * (R/Rf**2) * exp((-1/2)*(R/Rf)**2);
- End of pt;
- Real Procedure Nf(Real R);
- Begin
- Nf := Integral(pt,0,R);
- End of Nf;
- Real Procedure N1_(Real R);
- Begin
- N1_ := (Nf(R1)*(R**tq))/R1;
- End of N1_;
- Real Procedure N1(Real R);
- Begin
- N1 := Integral(N1_,0,R);
- End of N1;
- Real Procedure N2(Real R);
- Begin
- N2 := Integral(pt,R1,R) + N1(R1);
- End of N2;
- Real Procedure Nt(Real R);
- Begin
- If R <= R1 Then
- Nt := N1(R)
- Else
- Nt := N2(R)
- End of Nt;
- ! Received Signal - declaration **********;
- Real U;
- Real MTL;
- Real Procedure Uo(Real Ro, Real R);
- Begin
- Uo := If R <> 0 Then muu + 20 * Logarithm((Ro/R),10) Else 0;
- End;
- Real Procedure Fu(Real Ro, Real R, Real U);
- Begin
- Fu := 0.5 - 0.5 * ErrorFunction((1/sqrt(2))*((U-Uo(Ro,R))/(sigmau)));
- End;
- Real Procedure W1_(Real R);
- Begin
- W1_ := ((Nf(R1)*(R**tq))/(R1))*Fu(Ro,R,U);
- End of W1_;
- Real Procedure W1(Real Ro_new, Real R_new, Real U_new);
- Begin
- Real U_old, R_old, Ro_old;
- Ro_old := Ro;
- R_old := R;
- U_old := U;
- Ro := Ro_new;
- R := R_new;
- U := U_new;
- W1 := Integral(W1_,0,R);
- R := R_old;
- Ro := Ro_old;
- U := U_old;
- End of W1;
- Real Procedure W2_(Real R);
- Begin
- W2_ := pt(R) * Fu(Ro,R,U);
- End of W2_;
- Real Procedure W2(Real Ro_new, Real R_new, Real U_new);
- Begin
- Real R_old, Ro_old, U_old;
- Ro_old := Ro;
- R_old := R;
- U_old := U;
- R := R_new;
- Ro := Ro_new;
- U := U_new;
- W2 := Integral(W2_,R1,R) + W1(Ro,R1,U);
- R := R_old;
- Ro := Ro_old;
- U := U_old;
- End of W2;
- Real Procedure Wt(Real Ro, Real R, Real U);
- Begin
- If R <= R1 Then
- Wt := W1(Ro,R,U)
- Else
- Wt := W2(Ro,R,U)
- End;
- ! Fruit Distribution - declaration **********;
- Real Ra;
- Real gamaa, gamas;
- Real sr, ss, fs, h, ft, ks;
- Real M, g, a, msi;
- Real ENV, ar, SA;
- Real iag, zag, isg, zsg;
- Real tsr, ao, rt, d;
- Real tr;
- Real ist, zst, iat, iatt, zat;
- Real ia, is_, za, zs, zsl;
- Real Procedure Ntc(Real rt);
- Begin
- Ntc := Nt(R) * ft * d;
- End;
- Real Procedure fza(Real Ro, Real R, Real U);
- Begin
- fza := za * Wt(Ro,R,U);
- End;
- Real Procedure fzs(Real Ro, Real R, Real U);
- Begin
- fzs := zs * Wt(Ro,R,U);
- End;
- Real Procedure fr(Real Ro, Real R, Real U);
- Begin
- fr := If fzs(Ro,R,U) <> 0 Then fza(Ro,Rp,U)/fzs(Ro,R,U) Else 0;
- End;
- Real Procedure fzsl(Real Ro, Real R, Real U);
- Begin
- fzsl := zsl * Wt(Ro,R,U);
- End;
- ! Decoder - declaration **********;
- Real Tls, Tss, Ta, Tsy, pf;
- Real Procedure psy(Real Ro, Real R, Real U);
- Begin
- psy := exp(-(Ta+Tsy)*za*(Wt(Ro,R,U-gamas)-Wt(Ro,R,U-gamaa)));
- End;
- Real Procedure p1a(Real Ro, Real R, Real U);
- Begin
- p1a := (Tls+Ta)*za*Wt(Ro,R,U-gamaa)*pf;
- End;
- Real Procedure p2a(Real Ro, Real R, Real U);
- Begin
- p2a := 0.5*(((Tls+Ta)*za*Wt(Ro,R,U-gamaa)*pf)**2)*psy(Ro,R,U);
- End;
- Real Procedure pa(Real Ro, Real R, Real U);
- Begin
- pa := exp(-(Tls+Ta)*za*Wt(Ro,R,U-gamaa))*(1+p1a(Ro,R,U)+p2a(Ro,R,U));
- End;
- Real Procedure ps(Real Ro, Real R, Real U);
- Begin
- ps := exp(-(Tls+Ta)*za*Wt(Ro,R,U-gamas))*exp(-(Tls+Tls)+zsl*Wt(Ro,R,U-gamas));
- End;
- Real Procedure p(Real Ro, Real R, Real U);
- Begin
- p := pa(Ro,R,U)*ps(Ro,R,U);
- End;
- ! Receiver - declaration **********;
- Real T, st, had, S;
- Real mu, sigmac, ny;
- Real Procedure So(Real Ro, Real R, Real mu);
- Begin
- So := If R <> 0 Then mu + 20 * Logarithm(Ro/R,10) Else 0;
- End;
- Real Procedure pS_(Real Ro, Real R, Real S, Real mu, Real sigma);
- Begin
- pS_ := (1/(ro*sqrt(2*pi)))*(exp(-0.5*((S-So(Ro,R,mu))/(sigma))**2));
- End;
- Real Procedure pb(Real S);
- Begin
- pb := 1 - 0.5 * exp(-(10*((MTL+S)/(10)))/(2));
- End;
- Real Procedure Pd(Real S);
- Begin
- Pd := pb(S)**had;
- End;
- Real Procedure Ps__(Real S, Real T);
- Begin
- Ps__ := 0.5 + 0.5 * ErrorFunction((sqrt(2)/2)*((MTL+S-T)/(st)));
- End;
- Real Procedure Pm(Real S, Real T);
- Begin
- Pm := Ps__(S,T)*Pd(S);
- End;
- ! Predicted Performance Model - declaration **********;
- Real Sm, Rdp, sigma;
- Real Procedure Pr_(Real S);
- Begin
- Pr_ := pS_(Ro,Ra,S,mu,sigma)*p(Ro,Rp,S)*Pm(S,T)*ny;
- End;
- Real Procedure Pr(Real Ro_new, Real Ra_new, Real S_new, Real mu_new, Real sigma_new);
- Begin
- Real Ro_old, Ra_old, S_old, mu_old, sigma_old;
- Ro_old := Ro;
- Ra_old := Ra;
- S_old := S;
- mu_old := mu;
- sigma_old := sigma;
- Ro := Ro_new;
- Ra := Ra_new;
- S := S_new;
- mu := mu_new;
- sigma := sigma_new;
- Pr := Integral(Pr_,S,Sm);
- Ro := Ro_old;
- Ra := Ra_old;
- S := S_old;
- mu := mu_old;
- sigma := sigma_old;
- End;
- Real Procedure Prr(Real Ro, Real Ra, Real S, Real mu, Real sigma);
- Begin
- Real SUM;
- SUM := 0;
- For S := -5 step 1 until Sm do
- Begin
- SUM := SUM + pS_(Ro,Ra,S,mu,sigma)*p(Ro,Rp,S)*Pm(S,T)*ny;
- End;
- Prr := SUM*200;
- End;
- ! Common math functions - initalisation **********;
- PDF_values := TRUE;
- pi := 3.14159265358979323846;
- ! Traffic Distribution - initialisation **********;
- am := 40000;
- ah := 40000;
- Ko := 500;
- Rp := 400;
- R1o := 30;
- fxx := 0.24;
- tq := 0.2;
- Dm := 1.23 * sqrt(am);
- D1 := 1.23 * sqrt(ah);
- Da := 2 * D1;
- K := (D1 / Dm) * Ko;
- Rfo := fxx * Rp * sqrt(Dm/D1);
- Rf := Rfo * Da / Rp;
- R1 := R1o * Da /Rp;
- ! Received Signal - initialisation **********;
- Ro := 95;
- sigmau := 3;
- muu := 0;
- MTL := -84;
- ! Fruit Distribution - initalisation **********;
- Ra := Ro;
- gamaa := 3;
- gamas := 7;
- sr := 0.01;
- ss := 1;
- fs := 0.5;
- h := 0.8;
- !ft := fs * h;
- ft := 0.4;
- ks := 1;
- M := 40;
- g := 0.025;
- a := 1;
- msi := 1;
- ENV := 2000;
- ar := fs * a;
- SA := If ENV <= 1999 Then 0 Else ar;
- iag := (4-3*g)*M;
- zag := (4-(3+SA)*g)*M;
- isg := (0.33/msi)*a*g*M;
- zsg := isg * fs;
- tsr := 0.85;
- ao := 2;
- rt := 40;
- d := 1;
- tr := If Ntc(rt) <> 0 Then (1*Ntc(6)+tsr*(Ntc(rt)-Ntc(6)))/Ntc(rt) Else 0;
- !tr := (1*Ntc(6)+tsr*(Ntc(rt)-Ntc(6)))/Ntc(rt);
- ist := tr * ks * Ntc(rt);
- zst := fs * (ist + ss);
- iat := ao * Ntc(rt);
- iatt := If iat >= 40 Then 40 Else iat;
- zat := iatt * (1 - fs);
- ia := iag + iatt;
- is_ := isg + ist;
- za := zag + zat;
- zs := zsg + zst;
- zsl := sr * fs;
- ! Decoder - initialisation **********;
- Tls := 120*(1/10)**6;
- Tss := 64*(1/10)**6;
- Ta := 20.3*(1/10)**6;
- Tsy := 8*(1/10)**6;
- pf := 1 - (Tsy + Ta)/(Tls + Ta) * 0.2;
- ! Receiver - initialisation **********;
- T := 0;
- st := 0.5;
- had := 112;
- mu := 0;
- sigmac := 2;
- ny := 0.95;
- MTL := 11;
- ! Predicted Performance Model - initialisation **********;
- Sm := 20 * Logarithm(Ro/2,10) + 2 * sigmac;
- Rdp := 100;
- ! Traffic Distribution - init and graph data output **********;
- OutText("*** Traffic Distribution ***");
- OutImage;
- OutText("R Nt(R)");
- OutImage;
- ah := 40000;
- D1 := 246;
- Rp := 400;
- Ro := 95;
- muu := 0;
- sigmau := 3;
- am := 40000;
- For R := 0 step 25 until 500 do
- Begin
- OutInt(R,3);
- OutText(" =");
- OutReal(Nt(R),8,15);
- OutImage;
- End;
- OutImage;
- ! Received Signal - initalisation and graph data output **********;
- ah := 22000;
- D1 := 182;
- Rp := 400;
- Ro := 95;
- muu := 0;
- sigmau := 3;
- am := 40000;
- OutText("*** Received Signal ***");
- OutImage;
- !OutText("R Nt(R) Wt(Ro,R,0) Wt(Ro,R,-3) Wt(Ro,R,-7)");
- OutText("R Wt(Ro,R,0) Wt(Ro,R,-3) Wt(Ro,R,-7)");
- OutImage;
- For R := 0 step 25 until 250 do
- Begin
- OutInt(R,3);
- !OutText(" =");
- !OutReal(Nt(R),8,15);
- OutText(" =");
- OutReal(Wt(Ro,R,0),8,15);
- OutText(" =");
- OutReal(Wt(Ro,R,-3),8,15);
- OutText(" =");
- OutReal(Wt(Ro,R,-7),8,15);
- OutImage;
- End;
- OutImage;
- ! Fruit Distribution - initalisation and graph data output **********;
- If PDF_values Then
- Begin
- MTL := -84;
- Rp := 400;
- ah := 22000;
- Ro := 95;
- muu := 0;
- sigmau := 3;
- M := 40;
- msi := 1;
- SA := 0.5;
- rt := 40;
- fs := 0.5;
- ft := 0.4;
- tsr := 0.85;
- ao := 2;
- ks := 1;
- ss := 1;
- ia := 186;
- is_ := 12.7;
- za := 171;
- zs := 6.8;
- zsl := 0;
- End;
- OutText("*** Fruit Distribution ***");
- OutImage;
- OutText("U+MTL fza(Ro,400,U) fzs(Ro,400,U) fzsl(Ro,400,U)");
- OutImage;
- For U := -10 step 2.5 until 30 do
- Begin
- OutInt(U+MTL,3);
- OutText(" =");
- OutReal(fza(Ro,Rp,U),8,15);
- OutText(" =");
- OutReal(fzs(Ro,Rp,U),8,15);
- OutText(" =");
- OutReal(fzsl(Ro,Rp,U),8,15);
- OutImage;
- End;
- OutImage;
- ! Decoder - initalisation and graph data output **********;
- gamaa := 3;
- gamas := 7;
- MTL := -84;
- OutText("*** Decoder ***");
- OutImage;
- OutText("U+MTL p(Ro,400,U) pa(Ro,400,U) ps(Ro,400,U)");
- OutImage;
- For U := -10 step 2.5 until 30 do
- Begin
- OutInt(U+MTL,3);
- OutText(" =");
- OutReal(p(Ro,Rp,U),8,15);
- OutText(" =");
- OutReal(pa(Ro,Rp,U),8,15);
- OutText(" =");
- OutReal(ps(Ro,Rp,U),8,15);
- OutImage;
- End;
- OutImage;
- ! Receiver - initalisation and graph data output **********;
- MTL := 11;
- Rp := 400;
- ah := 22000;
- Ro := 95;
- Ra := Ro;
- mu := 0;
- sigmac := 2;
- sigmau := 3;
- muu := 0;
- If PDF_values Then
- Begin
- fs := 0.5;
- ft := 0.4;
- ks := 1;
- ss := 1;
- M := 40;
- mu := 0;
- za := 170.8;
- zs := 6.8;
- zsl := 0.005;
- End;
- OutText("*** Receiver ***");
- OutImage;
- OutText("S Pm(S,T) p(Ro,Rp,S)*Pm(S,T) pS(Ro,Ra,S,mu,roc)");
- OutImage;
- For S := -6 step 1 until 10 do
- Begin
- OutInt(S,3);
- OutText(" =");
- OutReal(Pm(S,T),8,15);
- OutText(" =");
- OutReal(p(Ro,Rp,S)*Pm(S,T),8,15);
- OutText(" =");
- OutReal(pS_(Ro,Ra,S,mu,sigmac),8,15);
- OutImage;
- End;
- OutImage;
- ! Predicted Performance Model - initalisation and graph data output **********;
- Ro := 95;
- mu := 0;
- sigmac := 2;
- ah := 22000;
- muu := 0;
- sigmau := 3;
- gamaa := 3;
- gamas := 7;
- ny := 0.95;
- OutText("*** Predicted Performance Model ***");
- OutImage;
- OutText("Ra Prr(Ro,Ra,-5,0,0.5) Prr(Ro,Ra,-5,3.3,0.5) Prr(Ro,Ra,-5,-3.3,0.5)");
- OutImage;
- For Ra := 0 step 5 until 100 do
- Begin
- OutInt(Ra,3);
- OutText(" =");
- OutReal(Prr(Ro,Ra,-5,0,0.5),8,15);
- OutText(" =");
- OutReal(Prr(Ro,Ra,-5,3.3,0.5),8,15);
- OutText(" =");
- OutReal(Prr(Ro,Ra,-5,-3.3,0.5),8,15);
- OutImage;
- End;
- End of Program;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement