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.

50 lines
997 B

2 months ago
  1. ma
  2. const int N = 2; // num packages
  3. const double inRate = 4;
  4. const double processingRate = 5;
  5. module streamingclient
  6. s : [0..3]; // current state:
  7. // 0: decide whether to start
  8. // 1: buffering
  9. // 2: running
  10. // 3: done
  11. n : [0..N]; // number of received packages
  12. k : [0..N]; // number of processed packages
  13. [buffer] s=0 & n<N -> 1 : (s'=1);
  14. [start] s=0 & k<n -> 1 : (s'=2) & (k'=k+1);
  15. <> s=1 -> inRate : (n'=n+1) & (s'=0);
  16. <> s=2 & n<N & k<n -> inRate : (n'=n+1) + processingRate : (k'=k+1);
  17. <> s=2 & n<N & k=n -> inRate : (n'=n+1) + processingRate : (s'=0);
  18. <> s=2 & n=N & k<n -> processingRate : (k'=k+1);
  19. <> s=2 & n=N & k=N -> processingRate : (s'=3);
  20. <> s=3 -> 1 : true;
  21. endmodule
  22. // All packages received and buffer empty
  23. label "done" = (s=3);
  24. rewards "buffering"
  25. s=1 : 1;
  26. endrewards
  27. rewards "initialbuffering"
  28. s=1 & k = 0: 1;
  29. endrewards
  30. rewards "intermediatebuffering"
  31. s=1 & k > 0: 1;
  32. endrewards
  33. rewards "numRestarts"
  34. [start] k > 0 : 1;
  35. endrewards