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.

147 lines
3.0 KiB

  1. // bounded retransmission protocol [D'AJJL01]
  2. // gxn/dxp 23/05/2001
  3. dtmc
  4. // number of chunks
  5. const int N = 64;
  6. // maximum number of retransmissions
  7. const int MAX = 4;
  8. // reliability of channels
  9. const double pL;
  10. const double pK;
  11. // timeouts
  12. const double TOMsg=0.4;
  13. const double TOAck=0.6;
  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. // prevents more than one file being sent
  93. module tester
  94. T : bool;
  95. [NewFile] (T=false) -> (T'=true);
  96. endmodule
  97. module channelK
  98. k : [0..2];
  99. // idle
  100. [aF] (k=0) -> pK : (k'=1) + 1-pK : (k'=2);
  101. // sending
  102. [aG] (k=1) -> (k'=0);
  103. // lost
  104. [TO_Msg] (k=2) -> (k'=0);
  105. endmodule
  106. module channelL
  107. l : [0..2];
  108. // idle
  109. [aA] (l=0) -> pL : (l'=1) + 1-pL : (l'=2);
  110. // sending
  111. [aB] (l=1) -> (l'=0);
  112. // lost
  113. [TO_Ack] (l=2) -> (l'=0);
  114. endmodule
  115. rewards
  116. [TO_Msg] true : TOMsg;
  117. [TO_Ack] true : TOAck;
  118. endrewards