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.

137 lines
2.8 KiB

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