sccd.xml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?xml version="1.0" ?>
  2. <diagram author="Simon Van Mierlo" name="Timer (Threaded Version)">
  3. <description>
  4. </description>
  5. <top>
  6. from sccd.runtime.accurate_time import time
  7. </top>
  8. <inport name="input" />
  9. <class name="MainApp" default="true">
  10. <method name="MainApp">
  11. <body>
  12. <![CDATA[
  13. ]]>
  14. </body>
  15. </method>
  16. <method name="print_simulated_time">
  17. <body>
  18. print 'SIMTIME = %.2f' % get_simulated_time()
  19. </body>
  20. </method>
  21. <method name="print_wct_time">
  22. <body>
  23. print 'ACTTIME = %.2f' % time()
  24. </body>
  25. </method>
  26. <scxml initial="running">
  27. <parallel id="running">
  28. <state id="print_simulated_time">
  29. <state id="print_simulated_time">
  30. <transition target="." after="0.05">
  31. <script>
  32. self.print_simulated_time()
  33. </script>
  34. </transition>
  35. </state>
  36. <transition target="." event="interrupt" port="input">
  37. <script>
  38. print 'going nowhere'
  39. </script>
  40. </transition>
  41. </state>
  42. <state id="print_wct_time">
  43. <state id="print_wct_time">
  44. <transition target="." after="0.05">
  45. <script>
  46. self.print_wct_time()
  47. </script>
  48. </transition>
  49. </state>
  50. </state>
  51. <transition target="../interrupted" event="interrupt" port="input">
  52. <script>
  53. self.print_simulated_time()
  54. self.print_wct_time()
  55. </script>
  56. </transition>
  57. </parallel>
  58. <state id="interrupted">
  59. <transition target="." event="interrupt" port="input">
  60. <script>
  61. self.print_simulated_time()
  62. self.print_wct_time()
  63. </script>
  64. </transition>
  65. <transition target="../running" event="continue" port="input">
  66. <script>
  67. self.print_simulated_time()
  68. self.print_wct_time()
  69. </script>
  70. </transition>
  71. </state>
  72. </scxml>
  73. </class>
  74. </diagram>