.model.mvc 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. include "primitives.alh"
  2. AtomicDEVSBlock Generator {
  3. initialState = "generating"
  4. name = "Generator"
  5. intTransition = $
  6. Element function intTransition():
  7. Element retValue
  8. retValue = create_node()
  9. dict_add_fast(retValue, "g_out", 0.3)
  10. return retValue!
  11. $
  12. }
  13. AtomicDEVSBlock Processor {
  14. initialState = "idle"
  15. name = "Processor"
  16. }
  17. AtomicDEVSBlock Collector {
  18. initialState = "waiting"
  19. name = "Collector"
  20. }
  21. OutputPort g_out {name = "g_out"}
  22. InputPort p_in {name = "p_in"}
  23. OutputPort p_out {name = "p_out"}
  24. InputPort c_in {name = "c_in"}
  25. DEVSBlockToPort(Generator, g_out) {}
  26. DEVSBlockToPort(Processor, p_in) {}
  27. DEVSBlockToPort(Processor, p_out) {}
  28. DEVSBlockToPort(Collector, c_in) {}
  29. CoupledDEVSBlock CoupledProcessor {
  30. name = "CoupledProcessor"
  31. }
  32. InputPort cp_in {name = "cp_in"}
  33. OutputPort cp_out {name = "cp_out"}
  34. DEVSBlockToPort (CoupledProcessor, cp_in) {}
  35. DEVSBlockToPort (CoupledProcessor, cp_out) {}
  36. DEVSInstance p1 {
  37. name = "p1"
  38. type = "Processor"
  39. }
  40. DEVSInstance p2 {
  41. name = "p2"
  42. type = "Processor"
  43. }
  44. SubModel (CoupledProcessor, p1) {}
  45. SubModel (CoupledProcessor, p2) {}
  46. InputPort p1_in {name = "p_in"}
  47. OutputPort p1_out {name = "p_out"}
  48. InputPort p2_in {name = "p_in"}
  49. OutputPort p2_out {name = "p_out"}
  50. DEVSInstanceToPort (p1, p1_in) {}
  51. DEVSInstanceToPort (p1, p1_out) {}
  52. DEVSInstanceToPort (p2, p2_in) {}
  53. DEVSInstanceToPort (p2, p2_out) {}
  54. Channel (cp_in, p1_in) {}
  55. Channel (p1_out, p2_in) {}
  56. Channel (p2_out, cp_out) {}
  57. CoupledDEVSBlock Root {
  58. name = "Root"
  59. }
  60. DEVSInstance generator {
  61. name = "generator"
  62. type = "Generator"
  63. }
  64. DEVSInstance coupledprocessor {
  65. name = "coupledprocessor"
  66. type = "CoupledProcessor"
  67. }
  68. DEVSInstance processor {
  69. name = "processor"
  70. type = "Processor"
  71. }
  72. DEVSInstance collector {
  73. name = "collector"
  74. type = "Collector"
  75. }
  76. SubModel (Root, generator) {}
  77. SubModel (Root, coupledprocessor) {}
  78. SubModel (Root, processor) {}
  79. SubModel (Root, collector) {}
  80. OutputPort generator_out {name = "g_out"}
  81. InputPort coupledprocessor_in {name = "cp_in"}
  82. OutputPort coupledprocessor_out {name = "cp_out"}
  83. InputPort processor_in {name = "p_in"}
  84. OutputPort processor_out {name = "p_out"}
  85. InputPort collector_in {name = "c_in"}
  86. DEVSInstanceToPort (generator, generator_out) {}
  87. DEVSInstanceToPort (coupledprocessor, coupledprocessor_in) {}
  88. DEVSInstanceToPort (coupledprocessor, coupledprocessor_out) {}
  89. DEVSInstanceToPort (processor, processor_in) {}
  90. DEVSInstanceToPort (processor, processor_out) {}
  91. DEVSInstanceToPort (collector, collector_in) {}
  92. Channel (generator_out, coupledprocessor_in) {}
  93. Channel (coupledprocessor_out, processor_in) {}
  94. Channel (processor_out, collector_in) {}