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.6 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;
  8. // maximum number of retransmissions
  9. const int MAX;
  10. // reliability of channels
  11. const double pL;
  12. const double pK;
  13. module sender
  14. s : [0..6];
  15. // 0 idle
  16. // 1 next_frame
  17. // 2 wait_ack
  18. // 3 retransmit
  19. // 4 success
  20. // 5 error
  21. // 6 wait sync
  22. srep : [0..3];
  23. // 0 bottom
  24. // 1 not ok (nok)
  25. // 2 do not know (dk)
  26. // 3 ok (ok)
  27. nrtr : [0..MAX];
  28. i : [0..N];
  29. bs : bool;
  30. s_ab : bool;
  31. fs : bool;
  32. ls : bool;
  33. // idle
  34. [NewFile] (s=0) -> (s'=1) & (i'=1) & (srep'=0);
  35. // next_frame
  36. [aF] (s=1) -> (s'=2) & (fs'=(i=1)) & (ls'=(i=N)) & (bs'=s_ab) & (nrtr'=0);
  37. // wait_ack
  38. [aB] (s=2) -> (s'=4) & (s_ab'=!s_ab);
  39. [TO_Msg] (s=2) -> (s'=3);
  40. [TO_Ack] (s=2) -> (s'=3);
  41. // retransmit
  42. [aF] (s=3) & (nrtr<MAX) -> (s'=2) & (fs'=(i=1)) & (ls'=(i=N)) & (bs'=s_ab) & (nrtr'=nrtr+1);
  43. [] (s=3) & (nrtr=MAX) & (i<N) -> (s'=5) & (srep'=1);
  44. [] (s=3) & (nrtr=MAX) & (i=N) -> (s'=5) & (srep'=2);
  45. // success
  46. [] (s=4) & (i<N) -> (s'=1) & (i'=i+1);
  47. [] (s=4) & (i=N) -> (s'=0) & (srep'=3);
  48. // error
  49. [SyncWait] (s=5) -> (s'=6);
  50. // wait sync
  51. [SyncWait] (s=6) -> (s'=0) & (s_ab'=false);
  52. endmodule
  53. module receiver
  54. r : [0..5];
  55. // 0 new_file
  56. // 1 fst_safe
  57. // 2 frame_received
  58. // 3 frame_reported
  59. // 4 idle
  60. // 5 resync
  61. rrep : [0..4];
  62. // 0 bottom
  63. // 1 fst
  64. // 2 inc
  65. // 3 ok
  66. // 4 nok
  67. fr : bool;
  68. lr : bool;
  69. br : bool;
  70. r_ab : bool;
  71. recv : bool;
  72. // new_file
  73. [SyncWait] (r=0) -> (r'=0);
  74. [aG] (r=0) -> (r'=1) & (fr'=fs) & (lr'=ls) & (br'=bs) & (recv'=T);
  75. // fst_safe_frame
  76. [] (r=1) -> (r'=2) & (r_ab'=br);
  77. // frame_received
  78. [] (r=2) & (r_ab=br) & (fr=true) & (lr=false) -> (r'=3) & (rrep'=1);
  79. [] (r=2) & (r_ab=br) & (fr=false) & (lr=false) -> (r'=3) & (rrep'=2);
  80. [] (r=2) & (r_ab=br) & (fr=false) & (lr=true) -> (r'=3) & (rrep'=3);
  81. [aA] (r=2) & !(r_ab=br) -> (r'=4);
  82. // frame_reported
  83. [aA] (r=3) -> (r'=4) & (r_ab'=!r_ab);
  84. // idle
  85. [aG] (r=4) -> (r'=2) & (fr'=fs) & (lr'=ls) & (br'=bs) & (recv'=T);
  86. [SyncWait] (r=4) & (ls=true) -> (r'=5);
  87. [SyncWait] (r=4) & (ls=false) -> (r'=5) & (rrep'=4);
  88. // resync
  89. [SyncWait] (r=5) -> (r'=0) & (rrep'=0);
  90. endmodule
  91. module checker
  92. T : bool init false;
  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