You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
2.7 KiB

  1. // bounded retransmission protocol [D'AJJL01]
  2. // gxn/dxp 23/05/2001
  3. // Modified by Ernst Moritz Hahn (emh@cs.uni-sb.de)
  4. mdp
  5. //dtmc
  6. // number of chunks
  7. const int N = 16;
  8. // maximum number of retransmissions
  9. const int MAX = 2;
  10. // reliability of channels
  11. const double pL;
  12. const double pK;
  13. global T : bool;
  14. module sender
  15. s : [0..6];
  16. // 0 idle
  17. // 1 next_frame
  18. // 2 wait_ack
  19. // 3 retransmit
  20. // 4 success
  21. // 5 error
  22. // 6 wait sync
  23. srep : [0..3];
  24. // 0 bottom
  25. // 1 not ok (nok)
  26. // 2 do not know (dk)
  27. // 3 ok (ok)
  28. nrtr : [0..MAX];
  29. i : [0..N];
  30. bs : bool;
  31. s_ab : bool;
  32. fs : bool;
  33. ls : bool;
  34. // idle
  35. [NewFile] (s=0) -> (s'=1) & (i'=1) & (srep'=0);
  36. // next_frame
  37. [aF] (s=1) -> (s'=2) & (fs'=(i=1)) & (ls'=(i=N)) & (bs'=s_ab) & (nrtr'=0);
  38. // wait_ack
  39. [aB] (s=2) -> (s'=4) & (s_ab'=!s_ab);
  40. [TO_Msg] (s=2) -> (s'=3);
  41. [TO_Ack] (s=2) -> (s'=3);
  42. // retransmit
  43. [aF] (s=3) & (nrtr<MAX) -> (s'=2) & (fs'=(i=1)) & (ls'=(i=N)) & (bs'=s_ab) & (nrtr'=nrtr+1);
  44. [] (s=3) & (nrtr=MAX) & (i<N) -> (s'=5) & (srep'=1);
  45. [] (s=3) & (nrtr=MAX) & (i=N) -> (s'=5) & (srep'=2);
  46. // success
  47. [] (s=4) & (i<N) -> (s'=1) & (i'=i+1);
  48. [] (s=4) & (i=N) -> (s'=0) & (srep'=3);
  49. // error
  50. [SyncWait] (s=5) -> (s'=6);
  51. // wait sync
  52. [SyncWait] (s=6) -> (s'=0) & (s_ab'=false);
  53. endmodule
  54. module receiver
  55. r : [0..5];
  56. // 0 new_file
  57. // 1 fst_safe
  58. // 2 frame_received
  59. // 3 frame_reported
  60. // 4 idle
  61. // 5 resync
  62. rrep : [0..4];
  63. // 0 bottom
  64. // 1 fst
  65. // 2 inc
  66. // 3 ok
  67. // 4 nok
  68. fr : bool;
  69. lr : bool;
  70. br : bool;
  71. r_ab : bool;
  72. recv : bool;
  73. // new_file
  74. [SyncWait] (r=0) -> (r'=0);
  75. [aG] (r=0) -> (r'=1) & (fr'=fs) & (lr'=ls) & (br'=bs) & (recv'=T);
  76. // fst_safe_frame
  77. [] (r=1) -> (r'=2) & (r_ab'=br);
  78. // frame_received
  79. [] (r=2) & (r_ab=br) & (fr=true) & (lr=false) -> (r'=3) & (rrep'=1);
  80. [] (r=2) & (r_ab=br) & (fr=false) & (lr=false) -> (r'=3) & (rrep'=2);
  81. [] (r=2) & (r_ab=br) & (fr=false) & (lr=true) -> (r'=3) & (rrep'=3);
  82. [aA] (r=2) & !(r_ab=br) -> (r'=4);
  83. // frame_reported
  84. [aA] (r=3) -> (r'=4) & (r_ab'=!r_ab);
  85. // idle
  86. [aG] (r=4) -> (r'=2) & (fr'=fs) & (lr'=ls) & (br'=bs) & (recv'=T);
  87. [SyncWait] (r=4) & (ls=true) -> (r'=5);
  88. [SyncWait] (r=4) & (ls=false) -> (r'=5) & (rrep'=4);
  89. // resync
  90. [SyncWait] (r=5) -> (r'=0) & (rrep'=0);
  91. endmodule
  92. module checker
  93. [NewFile] (T=false) -> (T'=false);
  94. [NewFile] (T=false) -> (T'=true);
  95. endmodule
  96. module channelK
  97. k : [0..2];
  98. // idle
  99. [aF] (k=0) -> pK : (k'=1) + 1-pK : (k'=2);
  100. // sending
  101. [aG] (k=1) -> (k'=0);
  102. // lost
  103. [TO_Msg] (k=2) -> (k'=0);
  104. endmodule
  105. module channelL
  106. l : [0..2];
  107. // idle
  108. [aA] (l=0) -> pL : (l'=1) + 1-pL : (l'=2);
  109. // sending
  110. [aB] (l=1) -> (l'=0);
  111. // lost
  112. [TO_Ack] (l=2) -> (l'=0);
  113. endmodule