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