Explorar el Código

made tests better + improved deletion in PypDEVS

sampieters hace 1 año
padre
commit
99746ebff4
Se han modificado 100 ficheros con 437320 adiciones y 7050 borrados
  1. 0 0
      TODOtests/BrokenDeletion/PyDEVS/log.txt
  2. 0 0
      TODOtests/BrokenDeletion/PyDEVS/runner.py
  3. 0 0
      TODOtests/BrokenDeletion/PyDEVS/target.py
  4. 0 0
      TODOtests/BrokenDeletion/Python/log.txt
  5. 0 0
      TODOtests/BrokenDeletion/Python/new_log.txt
  6. 0 0
      TODOtests/BrokenDeletion/Python/runner.py
  7. 0 0
      TODOtests/BrokenDeletion/Python/target.py
  8. 0 0
      TODOtests/BrokenDeletion/sccd.xml
  9. 0 0
      TODOtests/BrokenTest/PyDEVS/log.txt
  10. 0 0
      TODOtests/BrokenTest/PyDEVS/target.py
  11. 0 0
      TODOtests/BrokenTest/Python/log.txt
  12. 0 0
      TODOtests/BrokenTest/Python/runner.py
  13. 0 0
      TODOtests/BrokenTest/Python/target.py
  14. 0 0
      TODOtests/BrokenTest/sccd.xml
  15. 23 23
      tests/Test23/PyDEVS/log.txt
  16. 0 0
      TODOtests/Test23/PyDEVS/target.py
  17. 74 0
      TODOtests/Test23/Python/log.txt
  18. 0 0
      TODOtests/Test23/Python/target.py
  19. 0 0
      TODOtests/Test23/sccd.xml
  20. 0 0
      TODOtests/Test29/Python/log.txt
  21. 2 1
      tests/Test29/Python/target.py
  22. 0 0
      TODOtests/Test29/sccd.xml
  23. 0 0
      TODOtests/Test30/sccd.xml
  24. 235 0
      TraceComparison/TraceChecker.py
  25. 23 0
      TraceComparison/clear.py
  26. 0 189
      TraceComparison/main 2.py
  27. 0 43
      TraceComparison/main.py
  28. 62 0
      TraceComparison/new_process_tests.py
  29. 0 110
      TraceComparison/old_process_tests.py
  30. 436246 5734
      examples/BouncingBalls/Python/trace.txt
  31. 173 5
      examples/BouncingBallsCollision/Python/target.py
  32. 75 16
      examples/BouncingBallsCollision/sccd.xml
  33. 2 1
      sccd/runtime/DEVS_statecharts_core.py
  34. 1 0
      tests/GlobalUI/PyDEVS/faulty_log.txt
  35. 87 4
      tests/GlobalUI/PyDEVS/log.txt
  36. 0 25
      tests/GlobalUI/PyDEVS/runner.py
  37. 4 6
      tests/GlobalUI/PyDEVS/target.py
  38. 5 8
      tests/GlobalUI/Python/log.txt
  39. 0 21
      tests/GlobalUI/Python/runner.py
  40. 0 1
      tests/GlobalUI/Python/target.py
  41. 10 10
      tests/Test1/PyDEVS/log.txt
  42. 0 9
      tests/Test1/PyDEVS/runner.py
  43. 0 16
      tests/Test1/Python/runner.py
  44. 0 0
      tests/Test1/expected_output_trace.txt
  45. 4 0
      tests/Test10/PyDEVS/faulty_log.txt
  46. 31 31
      tests/Test10/PyDEVS/log.txt
  47. 0 0
      tests/Test10/PyDEVS/runner.py
  48. 0 0
      tests/Test10/Python/new_log.txt
  49. 0 16
      tests/Test10/Python/runner.py
  50. 4 0
      tests/Test10/expected_trace.txt
  51. 2 0
      tests/Test12/PyDEVS/faulty_log.txt
  52. 30 30
      tests/Test12/PyDEVS/log.txt
  53. 0 20
      tests/Test12/PyDEVS/runner.py
  54. 0 0
      tests/Test12/Python/new_log.txt
  55. 0 16
      tests/Test12/Python/runner.py
  56. 2 0
      tests/Test12/expected_trace.txt
  57. 4 0
      tests/Test13/PyDEVS/faulty_log.txt
  58. 43 43
      tests/Test13/PyDEVS/log.txt
  59. 0 20
      tests/Test13/PyDEVS/runner.py
  60. 1 2
      tests/Test13/PyDEVS/target.py
  61. 0 0
      tests/Test13/Python/new_log.txt
  62. 0 16
      tests/Test13/Python/runner.py
  63. 1 2
      tests/Test13/Python/target.py
  64. 4 0
      tests/Test13/expected_trace.txt
  65. 4 0
      tests/Test14/PyDEVS/faulty_log.txt
  66. 42 42
      tests/Test14/PyDEVS/log.txt
  67. 0 20
      tests/Test14/PyDEVS/runner.py
  68. 1 1
      tests/Test14/PyDEVS/target.py
  69. 0 0
      tests/Test14/Python/new_log.txt
  70. 0 16
      tests/Test14/Python/runner.py
  71. 1 1
      tests/Test14/Python/target.py
  72. 4 0
      tests/Test14/expected_trace.txt
  73. 4 0
      tests/Test15/PyDEVS/faulty_log.txt
  74. 42 42
      tests/Test15/PyDEVS/log.txt
  75. 0 20
      tests/Test15/PyDEVS/runner.py
  76. 4 3
      tests/Test15/PyDEVS/target.py
  77. 0 0
      tests/Test15/Python/new_log.txt
  78. 0 16
      tests/Test15/Python/runner.py
  79. 4 3
      tests/Test15/Python/target.py
  80. 4 0
      tests/Test15/expected_trace.txt
  81. 1 0
      tests/Test2/PyDEVS/faulty_log.txt
  82. 11 11
      tests/Test2/PyDEVS/log.txt
  83. 0 32
      tests/Test2/PyDEVS/runner.py
  84. 0 24
      tests/Test2/Python/runner.py
  85. 1 0
      tests/Test2/expected_trace.txt
  86. 5 0
      tests/Test22/PyDEVS/faulty_log.txt
  87. 38 38
      tests/Test22/PyDEVS/log.txt
  88. 0 20
      tests/Test22/PyDEVS/runner.py
  89. 0 16
      tests/Test22/Python/runner.py
  90. 6 0
      tests/Test22/expected_trace.txt
  91. 0 20
      tests/Test23/PyDEVS/runner.py
  92. 0 0
      tests/Test23/Python/new_log.txt
  93. 0 16
      tests/Test23/Python/runner.py
  94. 0 4
      tests/Test29/PyDEVS/log.txt
  95. 0 20
      tests/Test29/PyDEVS/runner.py
  96. 0 243
      tests/Test29/PyDEVS/target.py
  97. 0 8
      tests/Test29/Python/log.txt
  98. 0 0
      tests/Test29/Python/new_log.txt
  99. 0 16
      tests/Test29/Python/runner.py
  100. 0 0
      tests/Test3/PyDEVS/faulty_log.txt

examples/BrokenDeletion/PyDEVS/log.txt → TODOtests/BrokenDeletion/PyDEVS/log.txt


examples/BrokenDeletion/PyDEVS/runner.py → TODOtests/BrokenDeletion/PyDEVS/runner.py


examples/BrokenDeletion/PyDEVS/target.py → TODOtests/BrokenDeletion/PyDEVS/target.py


examples/BrokenDeletion/Python/log.txt → TODOtests/BrokenDeletion/Python/log.txt


examples/BrokenDeletion/Python/new_log.txt → TODOtests/BrokenDeletion/Python/new_log.txt


examples/BrokenDeletion/Python/runner.py → TODOtests/BrokenDeletion/Python/runner.py


examples/BrokenDeletion/Python/target.py → TODOtests/BrokenDeletion/Python/target.py


examples/BrokenDeletion/sccd.xml → TODOtests/BrokenDeletion/sccd.xml


examples/BrokenTest/PyDEVS/log.txt → TODOtests/BrokenTest/PyDEVS/log.txt


examples/BrokenTest/PyDEVS/target.py → TODOtests/BrokenTest/PyDEVS/target.py


examples/BrokenTest/Python/log.txt → TODOtests/BrokenTest/Python/log.txt


examples/BrokenTest/Python/runner.py → TODOtests/BrokenTest/Python/runner.py


examples/BrokenTest/Python/target.py → TODOtests/BrokenTest/Python/target.py


examples/BrokenTest/sccd.xml → TODOtests/BrokenTest/sccd.xml


+ 23 - 23
tests/Test23/PyDEVS/log.txt

@@ -25,13 +25,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_37_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x1095657c0>}
+			port <private_36_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1068bb230>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x109565a30>
+		New State: <target.ObjectManagerState object at 0x1061c8a70>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
@@ -46,12 +46,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
-		New State: <target.ObjectManagerState object at 0x109565a30>
+		New State: <target.ObjectManagerState object at 0x1061c8a70>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1095657c0>}
+		New State: {0: <target.MainAppInstance object at 0x1068bb230>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -68,8 +68,8 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>: 
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
 			port <input>: 
-			port <private_37_<narrow_cast>>: 
-		New State: {0: <target.MainAppInstance object at 0x1095657c0>}
+			port <private_36_<narrow_cast>>: 
+		New State: {0: <target.MainAppInstance object at 0x1068bb230>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
@@ -82,7 +82,7 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>: 
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
-		New State: <target.ObjectManagerState object at 0x109565a30>
+		New State: <target.ObjectManagerState object at 0x1061c8a70>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -98,13 +98,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
 			port <input>:
-			port <private_38_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x1095020c0>}
+			port <private_37_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x1068bb800>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1095657c0>}
+		New State: {0: <target.MainAppInstance object at 0x1068bb230>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -113,7 +113,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x109565a30>
+		New State: <target.ObjectManagerState object at 0x1061c8a70>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -128,12 +128,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x109565a30>
+		New State: <target.ObjectManagerState object at 0x1061c8a70>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x1095020c0>}
+		New State: {0: <target.AInstance object at 0x1068bb800>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -149,13 +149,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_37_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x1095657c0>}
+			port <private_36_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1068bb230>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x109565a30>
+		New State: <target.ObjectManagerState object at 0x1061c8a70>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -167,7 +167,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1095657c0>}
+		New State: {0: <target.MainAppInstance object at 0x1068bb230>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -179,7 +179,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1095657c0>}
+		New State: {0: <target.MainAppInstance object at 0x1068bb230>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -196,12 +196,12 @@ __  Current Time:   0.000000 __________________________________________
 			port <input>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
-		New State: <target.ObjectManagerState object at 0x109565a30>
+		New State: <target.ObjectManagerState object at 0x1061c8a70>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1095657c0>}
+		New State: {0: <target.MainAppInstance object at 0x1068bb230>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
@@ -220,8 +220,8 @@ __  Current Time:   0.000000 __________________________________________
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
 			port <input>:
+			port <private_37_<narrow_cast>>:
 			port <private_38_<narrow_cast>>:
-			port <private_39_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x1095020c0>, 1: <target.AInstance object at 0x1095666c0>}
+		New State: {0: <target.AInstance object at 0x1068bb800>, 1: <target.AInstance object at 0x10688c530>}
 		Next scheduled internal transition at time 0.000000
 

tests/Test23/PyDEVS/target.py → TODOtests/Test23/PyDEVS/target.py


+ 74 - 0
TODOtests/Test23/Python/log.txt

@@ -0,0 +1,74 @@
+__  Current Time:   0.000000 __________________________________________ 
+
+EXIT STATE in model <MainApp>
+		State: /state1
+
+ENTER STATE in model <MainApp>
+		State: /state2
+
+OUTPUT EVENT to port <ui>
+	\Event: (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+
+
+OUTPUT EVENT to port <ui>
+	\Event: (event name: statechart_started_succesfully; port: ui; parameters: ['0.00'])
+
+EXIT STATE in model <A>
+		State: /state1
+
+ENTER STATE in model <A>
+		State: /state2
+
+
+EXIT STATE in model <MainApp>
+		State: /state2
+
+ENTER STATE in model <MainApp>
+		State: /state3
+
+OUTPUT EVENT to port <ui>
+	\Event: (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[1]'])
+
+
+OUTPUT EVENT to port <ui>
+	\Event: (event name: statechart_started_succesfully; port: ui; parameters: ['0.00'])
+
+EXIT STATE in model <A>
+		State: /state1
+
+ENTER STATE in model <A>
+		State: /state2
+
+EXIT STATE in model <MainApp>
+		State: /state3
+
+ENTER STATE in model <MainApp>
+		State: /state4
+
+OUTPUT EVENT to port <ui>
+	\Event: (event name: instance_started_succesfully; port: ui; parameters: ['0.00', 'linkA[1]'])
+
+
+EXIT STATE in model <MainApp>
+		State: /state4
+
+ENTER STATE in model <MainApp>
+		State: /state5
+
+OUTPUT EVENT to port <ui>
+	\Event: (event name: instance_disassociated_succesfully; port: ui; parameters: ['0.00', ['linkA[0]', 'linkA[1]']])
+
+
+INPUT EVENT from port <private_2_<narrow_cast>>
+	\Type: <narrow_cast>
+	\Event: (event name: link_check; port: private_2_<narrow_cast>; parameters: ['linkA[1]'])
+
+EXIT STATE in model <A>
+		State: /state2
+
+ENTER STATE in model <A>
+		State: /state2
+
+OUTPUT EVENT to port <ui>
+	\Event: (event name: instance_linked_succesfully; port: ui; parameters: ['0.00', 'linkA[1]'])
+

tests/Test23/Python/target.py → TODOtests/Test23/Python/target.py


tests/Test23/sccd.xml → TODOtests/Test23/sccd.xml


tests/Test23/Python/log.txt → TODOtests/Test29/Python/log.txt


+ 2 - 1
tests/Test29/Python/target.py

@@ -4,7 +4,8 @@ Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van M
 Model author: Sam Pieters
 Model name:   Dissasociate and associate an instance
 Model description:
-Test 13: Dissasociate an instance and then associate an instance again
+TODO: Does not work as I think it does
+        Test 13: Dissasociate an instance and then associate an instance again
 """
 
 from sccd.runtime.statecharts_core import *

tests/Test29/sccd.xml → TODOtests/Test29/sccd.xml


tests/Test30/sccd.xml → TODOtests/Test30/sccd.xml


+ 235 - 0
TraceComparison/TraceChecker.py

@@ -0,0 +1,235 @@
+import os
+import subprocess
+import importlib.util
+import re
+from sccd.runtime.DEVS_loop import DEVSSimulator
+
+def import_target_module(module_name, file_path):
+    spec = importlib.util.spec_from_file_location(module_name, file_path)
+    module = importlib.util.module_from_spec(spec)
+    spec.loader.exec_module(module)
+    return module
+
+def extract_pattern(log_file_path, pattern):
+    with open(log_file_path, 'r') as log_file:
+        lines = log_file.readlines()
+
+    matched_lines = [line.strip() for line in lines if re.search(pattern, line)]
+    return matched_lines
+
+class SCCDTraceChecker:
+    def compile(self, directory):
+        raise NotImplementedError("Compile method must be implemented by the subclass")
+
+    def run(self, directory):
+        raise NotImplementedError("Run method must be implemented by the subclass")
+
+    def check(self, directory):
+        expected_log = os.path.join(directory, "expected_trace.txt")
+        if os.path.exists(expected_log):
+            lines_array = []
+            with open(expected_log, 'r') as file:
+                lines_array = file.readlines()
+            return lines_array
+        else:
+            print(f"The file {expected_log} does not exist.")
+            return None
+
+
+class PythonSCCDTraceChecker(SCCDTraceChecker):
+    def __init__(self) -> None:
+        super().__init__()
+    
+    def __str__(self):
+        return "Python"
+
+    def compile(self, directory):
+        """
+        Convert sccd.xml to target.py for the specified tool.
+        """
+        sccd_file = os.path.join(directory, 'sccd.xml')
+        output_file = os.path.join(directory, 'Python', 'target.py')
+
+        os.makedirs(os.path.join(directory, 'Python'), exist_ok=True)
+
+        command = [
+            "python", 
+            os.path.join("sccd", "compiler", "sccdc.py"), 
+            "-o", output_file, 
+            "-p", "threads", 
+            "-l", "python", 
+            sccd_file
+        ]
+
+        env = os.environ.copy()
+        result = subprocess.run(command, env=env, capture_output=True, text=True)
+        if result.returncode != 0:
+            print(f"Error converting {sccd_file} for python: {result.stderr}")
+        return result.returncode
+
+    def run(self, directory):
+        python_target = os.path.join(directory, "Python", "target.py")
+
+        # Dynamically import the target module
+        target = import_target_module("target", python_target)
+
+        controller = target.Controller()
+        controller.keep_running = False
+
+        # Create the full path for the log file
+        log_file_path = os.path.join(directory, "Python", "log.txt")
+
+        # Set verbose to the log file path
+        controller.setVerbose(log_file_path)
+
+        controller.start()
+
+        controller.tracers.stopTracers()
+    
+    def extract_output_events(self, log_file_path):
+        output_events = []
+        current_time = None
+        
+        with open(log_file_path, 'r') as file:
+            lines = file.readlines()
+            
+            time_pattern = re.compile(r"__  Current Time: +([\d\.]+) +__________________________________________")
+            event_pattern = re.compile(r'^\s*\\Event: \(event name:.*\)$')
+            
+            for line in lines:
+                time_match = time_pattern.match(line)
+                if time_match:
+                    current_time = float(time_match.group(1))
+                
+                event_match = event_pattern.match(line)
+                if event_match and current_time is not None:
+                    event = line.strip()
+                    # Remove everything before '(' in each string
+                    event = event[event.index('('):]
+                    output_events.append(f"{current_time:.2f} {event}")
+        
+        return output_events
+
+    def check(self, directory):
+        log = os.path.join(directory, "Python", "log.txt")
+
+        expected_log = os.path.join(directory, "expected_trace.txt")
+
+        expected_events = []
+        if os.path.exists(expected_log):
+            with open(expected_log, 'r') as file:
+                expected_events = [line.strip() for line in file.readlines()]
+
+        actual_events = self.extract_output_events(log)
+
+        if len(expected_events) != len(actual_events):
+            return 0
+
+        if len(expected_events) == 0 and len(actual_events) == 0:
+            return 2
+
+        for index, (item1, item2) in enumerate(zip(expected_events, actual_events)):
+            if item1 != item2:
+                return 0
+        return 1
+
+
+class PydevsSCCDTraceChecker(SCCDTraceChecker):
+    def __init__(self) -> None:
+        super().__init__()
+
+    def __str__(self):
+        return "PyDEVS"
+    
+    def compile(self, directory):
+        """
+        Convert sccd.xml to target.py for the specified tool.
+        """
+        sccd_file = os.path.join(directory, 'sccd.xml')
+        output_file = os.path.join(directory, "PyDEVS", 'target.py')
+
+        os.makedirs(os.path.join(directory, "PyDEVS"), exist_ok=True)
+
+        command = [
+            "python", 
+            os.path.join("sccd", "compiler", "sccdc.py"), 
+            "-o", output_file, 
+            "-p", "pypDEVS", 
+            sccd_file
+        ]
+
+        env = os.environ.copy()
+        result = subprocess.run(command, env=env, capture_output=True, text=True)
+        if result.returncode != 0:
+            print(f"Error converting {sccd_file} for PyDEVS: {result.stderr}")
+        return result.returncode
+
+    def run(self, directory):
+        pydevs_target = os.path.join(directory, "PyDEVS", "target.py")
+        # Dynamically import the target module
+        target = import_target_module("target", pydevs_target)
+        model = target.Controller(name="controller")
+        refs = {"ui": model.in_ui}
+        sim = DEVSSimulator(model, refs)
+        sim.setRealTime(False)
+
+        # Create the full path for the log file
+        log_file_path = os.path.join(directory, "PyDEVS", "log.txt")
+
+        # Set verbose to the log file path
+        sim.setVerbose(log_file_path)
+
+        sim.simulate()
+
+    def extract_output_events(self, log_file_path):
+        output_events = []
+        current_time = None
+        
+        with open(log_file_path, 'r') as file:
+            lines = file.readlines()
+            
+            time_pattern = re.compile(r"__  Current Time: +([\d\.]+) +__________________________________________")
+            event_pattern = re.compile(r'^\s*\(event name:.*\)$')
+            
+            for line in lines:
+                time_match = time_pattern.match(line)
+                if time_match:
+                    current_time = float(time_match.group(1))
+                
+                event_match = event_pattern.match(line)
+                if event_match and current_time is not None:
+                    event = line.strip()
+                    # Remove everything before '(' in each string
+                    event = event[event.index('('):]
+                    output_events.append(f"{current_time:.2f} {event}")
+        
+        return output_events
+
+    def check(self, directory):
+        log = os.path.join(directory, "PyDEVS", "log.txt")
+        expected_log = os.path.join(directory, "expected_trace.txt")
+
+        expected_events = []
+        if os.path.exists(expected_log):
+            with open(expected_log, 'r') as file:
+                expected_events = [line.strip() for line in file.readlines()]
+
+        actual_events = self.extract_output_events(log)
+
+        return_code = 1
+        if len(expected_events) != len(actual_events):
+            return_code = 0
+
+        if len(expected_events) == 0 and len(actual_events) == 0:
+            return_code = 2
+
+        for index, (item1, item2) in enumerate(zip(expected_events, actual_events)):
+            if item1 != item2:
+                return_code = 0
+
+        if return_code == 0:
+            # Write actual events to a file
+            with open(os.path.join(directory, "PyDEVS", "faulty_log.txt"), 'w') as file:
+                file.writelines([event + '\n' for event in actual_events])
+
+        return return_code

+ 23 - 0
TraceComparison/clear.py

@@ -0,0 +1,23 @@
+import os
+import shutil
+
+# Path to the parent directory containing the test folders
+parent_directory = './tests'
+
+# Iterate over each folder inside the parent directory
+for folder_name in os.listdir(parent_directory):
+    folder_path = os.path.join(parent_directory, folder_name)
+    
+    # Check if the path is a directory and not a file
+    if os.path.isdir(folder_path):
+        # Delete PyDEVS folder if it exists
+        pydevs_path = os.path.join(folder_path, 'PyDEVS')
+        if os.path.exists(pydevs_path):
+            shutil.rmtree(pydevs_path)
+            print(f"Deleted {pydevs_path}")
+        
+        # Delete Python folder if it exists
+        python_path = os.path.join(folder_path, 'Python')
+        if os.path.exists(python_path):
+            shutil.rmtree(python_path)
+            print(f"Deleted {python_path}")

+ 0 - 189
TraceComparison/main 2.py

@@ -1,189 +0,0 @@
-import re
-
-def extract_float(text):
-    # Define a regex pattern to match the float value
-    pattern = r"Current Time:\s+([-+]?\d*\.\d+|\d+)"
-    
-    # Search for the pattern in the text
-    match = re.search(pattern, text)
-    
-    if match:
-        # Extract the matched float value
-        float_value = float(match.group(1))
-        return float_value
-    else:
-        # Handle the case where no match is found
-        return None
-
-def extract_type(text):
-    # Define a regex pattern to match the type value after 'Type:'
-    pattern = r"Type:\s*(\w+)"
-    
-    # Search for the pattern in the text
-    match = re.search(pattern, text)
-    
-    if match:
-        # Extract the matched type value
-        type_value = match.group(1)
-        return type_value
-    else:
-        # Handle the case where no match is found
-        return None
-    
-def extract_event_details(text):
-    #pattern = r"event name:\s*([^;]+);\s*port:\s*([^;]+)(?:;\s*parameters:\s*(\[.*\]))?"
-    pattern = r"event name:\s*([^;]+);\s*port:\s*([^\);]+)(?:;\s*parameters:\s*(\[.*\]))?"
-    match = re.search(pattern, text, re.IGNORECASE)
-    if match:
-        event_name = match.group(1).strip()
-        port = match.group(2).strip()
-        parameters = match.group(3).strip() if match.group(3) else 'None'
-        return event_name, port, parameters
-    else:
-        return None, None, None
-
-
-def generate_input_trace(input_trace, output_file):
-    # Open the file in read mode
-    with open(input_trace, 'r') as file:
-        # Read all lines into a list
-        lines = file.readlines()
-
-    # Open the file in write mode ('w')
-    with open(output_file, 'w') as file:
-        # Traverse each line in the file
-        i = 0
-        current_time = None
-        while i < len(lines):
-            if lines[i].startswith('__'):
-                current_time = extract_float(lines[i].strip())
-
-            # Check if the line starts with 'INPUT'
-            if lines[i].startswith('INPUT'):
-                # Print the line that starts with 'INPUT'
-                print(lines[i].strip())
-                # Check if the next two lines exist and print them
-                the_type = extract_type(lines[i + 1].strip())
-                name, port, parameters = extract_event_details(lines[i + 2].strip())
-
-                if name == None:
-                    name = 'None'
-                if port == None:
-                    port = 'None'
-                if parameters == None:
-                    parameters = 'None'
-
-
-                if the_type is not None:
-                    to_write = str(current_time) + " " + the_type + " Event(\"" + name + "\",\"" + port + "\"," + parameters + ")\n"
-                    file.write(to_write)            
-
-                # Skip the next two lines to avoid reprocessing them
-                i += 2
-            # Move to the next line
-            i += 1
-
-def filter_lines(lines, filter_func):
-    """
-    Filter lines based on the provided filter function.
-    """
-    return [line for line in lines if not filter_func(line)]
-
-def read_and_filter_file(file_path, filter_func):
-    """
-    Read a file and filter its lines using the filter function.
-    """
-    with open(file_path, 'r') as file:
-        lines = file.readlines()
-    return filter_lines(lines, filter_func)
-
-# Fitler, filtering what should be ignored
-temp = False
-def devs_filter(line):
-    global temp
-    if line.startswith('\tEXTERNAL'):
-        temp = True
-    
-    if temp and line.startswith('\n'):
-        temp = False
-
-    condition = not line.startswith('\tEXTERNAL') and not temp
-
-    return condition
-
-i = 0
-def sccd_filter(line):
-    global i 
-
-    if line.startswith('INPUT'):
-        i = 2
-
-    condition = (not line.startswith('INPUT') and not line.startswith('__'))
-
-    if not line.startswith('INPUT') and i != 0:
-        condition = False
-        i -= 1
-    return condition
-
-def write_filtered_lines_to_file(filtered_lines, output_path):
-    """
-    Write the filtered lines to a file.
-    """
-    with open(output_path, 'w') as file:
-        file.writelines(filtered_lines)
-
-def compare_traces(file1_path, file2_path):
-    """
-    Compare two files line by line after filtering them.
-    """
-
-    filtered_lines1 = read_and_filter_file(file1_path, sccd_filter)
-    filtered_lines2 = read_and_filter_file(file2_path, devs_filter)
-
-    # Write the filtered lines to output files
-    write_filtered_lines_to_file(filtered_lines1, "sccd_test.txt")
-    write_filtered_lines_to_file(filtered_lines2, "devs_test.txt")
-
-    line_num = 1
-    differences = []
-
-    max_lines = max(len(filtered_lines1), len(filtered_lines2))
-    for i in range(max_lines):
-        line1 = filtered_lines1[i] if i < len(filtered_lines1) else ''
-        line2 = filtered_lines2[i] if i < len(filtered_lines2) else ''
-
-        if line1 != line2:
-            differences.append((line_num, line1, line2))
-
-        line_num += 1
-
-    return differences
-
-def print_differences(differences):
-    """
-    Print the differences between the filtered files.
-    """
-    if not differences:
-        print("The files are identical after filtering.")
-    else:
-        for line_num, line1, line2 in differences:
-            print(f"Difference at line {line_num}:")
-            print(f"File1: {line1.strip()}")
-            print(f"File2: {line2.strip()}")
-            print()
-
-# Example filter function to exclude lines starting with a certain keyword
-def example_filter_func(line):
-    return line.startswith('IGNORE')
-
-if __name__ == '__main__':
-    SCCDFile = "./examples/BouncingBalls/Python/trace.txt"
-    DEVSFile = "./examples/BouncingBalls/PyDEVS/trace.txt"
-
-    inputTrace = "./examples/BouncingBalls/input_trace.txt"
-
-    option = 2
-    if option == 1:
-        generate_input_trace(SCCDFile, inputTrace)
-    if option == 2:
-        compare_traces(SCCDFile, DEVSFile)

+ 0 - 43
TraceComparison/main.py

@@ -1,43 +0,0 @@
-def parse_line(line):
-    """Parse a line into time and event."""
-    parts = line.strip().split(' (event name: ')
-    time_part, event_part = parts[0], parts[1]
-    time_str = time_part.split()[0]
-    time_val = float(time_str)
-    return time_val, event_part
-
-def compare_files(file1, file2):
-    """Compare two files and return the maximum delta."""
-    max_delta = 0
-    events_match = True
-    
-    with open(file1, 'r') as f1, open(file2, 'r') as f2:
-        lines1 = f1.readlines()
-        lines2 = f2.readlines()
-    
-    # For every line in the two files
-    for line1, line2 in zip(lines1, lines2):
-        # Split it on the time value and the event
-        time1, event1 = parse_line(line1)
-        time2, event2 = parse_line(line2)
-        # Calculate the absolute difference of the two times
-        delta = abs(time1 - time2)
-        # Update max_delta if necessary
-        if delta > max_delta:
-            max_delta = delta
-        # Check if events are the same
-        if event1 != event2:
-            events_match = False
-
-    return max_delta, events_match
-
-# Example usage
-file1 = "./examples/BouncingBalls/Python/output.txt"
-file2 = "./examples/BouncingBalls/PyDEVS/output.txt"
-
-max_delta, file_match = compare_files(file1, file2)
-if file_match:
-    print("Traces match")
-    print("Maximum delta between the times:", max_delta)
-else: 
-    print("Traces don't match")

+ 62 - 0
TraceComparison/new_process_tests.py

@@ -0,0 +1,62 @@
+import os
+import re
+import subprocess
+import importlib.util
+from sccd.runtime.DEVS_loop import DEVSSimulator
+import TraceChecker
+
+def sort_directories(test_directory):
+    with os.scandir(tests_directory) as entries:
+        sorted_entries = sorted(entries, key=lambda entry: entry.name)
+        sorted_items = [entry.name for entry in sorted_entries]
+    
+    # Read directory names
+    all_test_dirs = [d for d in os.listdir(tests_directory) if os.path.isdir(os.path.join(tests_directory, d))]
+    # Sort the list of directories using natural sort
+    return sorted(all_test_dirs, key=natural_sort_key)
+
+def natural_sort_key(s):
+    # Split the string into a list of strings and numbers
+    return [int(text) if text.isdigit() else text.lower() for text in re.split(r'(\d+)', s)]
+
+if __name__ == '__main__':
+    # ANSI color escape codes
+    RED = '\033[91m'    # Red color
+    GREEN = '\033[92m'  # Green color
+    YELLOW = '\033[93m' # Yellow color
+    ENDC = '\033[0m'    # Reset color to default
+
+    tests_directory = "./tests"
+
+    sorted_dirs = sort_directories(tests_directory)
+
+    checkers = {
+        "Python": TraceChecker.PythonSCCDTraceChecker(),
+        "Pydevs": TraceChecker.PydevsSCCDTraceChecker()
+    }
+
+    results = {checker_name: [] for checker_name in checkers}
+
+    for directory_name in sorted_dirs:
+        full_directory = os.path.join(tests_directory, directory_name)
+        if os.path.isdir(full_directory):
+            print(f"Processing {directory_name}...")
+            for checker_name, checker in checkers.items():
+                checker.compile(full_directory)
+                checker.run(full_directory)
+                result = checker.check(full_directory)
+                results[checker_name].append(result)
+                if result == 0:
+                    print(f"{checker_name}: ", RED + "Failed" + ENDC)
+                elif result == 1:
+                    print(f"{checker_name}: ", GREEN + "Passed" + ENDC)
+                else:
+                    print(f"{checker_name}: ", YELLOW + "Need more detailed testing" + ENDC)
+
+    # Print summary
+    print("\nTest Summary:")
+    for checker_name in checkers:
+        print(f"\n{checker_name} Results:")
+        print(f"Passed: {GREEN}{results[checker_name].count(1)}{ENDC}")
+        print(f"Failed: {RED}{results[checker_name].count(0)}{ENDC}")
+        print(f"Warnings: {YELLOW}{results[checker_name].count(2)}{ENDC}")

+ 0 - 110
TraceComparison/old_process_tests.py

@@ -1,110 +0,0 @@
-import os
-import shutil
-import subprocess
-import filecmp
-
-def convert_sccd_to_target(test_path, target_dir, tool_name):
-    """
-    Convert sccd.xml to target.py for the specified tool.
-    """
-    sccd_file = os.path.join(test_path, 'sccd.xml')
-    output_file = os.path.join(test_path, target_dir, 'target.py')
-
-    os.makedirs(os.path.join(test_path, target_dir), exist_ok=True)
-
-    command = []
-    if tool_name == "python":
-        command = [
-            "python", 
-            os.path.join("sccd", "compiler", "sccdc.py"), 
-            "-o", output_file, 
-            "-p", "threads", 
-            "-l", tool_name, 
-            sccd_file
-        ]
-    elif tool_name == "pypDEVS":
-        command = [
-            "python", 
-            os.path.join("sccd", "compiler", "sccdc.py"), 
-            "-o", output_file, 
-            "-p", tool_name, 
-            sccd_file
-        ]
-
-    env = os.environ.copy()
-    result = subprocess.run(command, env=env, capture_output=True, text=True)
-    if result.returncode != 0:
-        print(f"Error converting {sccd_file} for {tool_name}: {result.stderr}")
-    return result.returncode
-
-def run_runner_script(test_path, target_dir, tool):
-    """
-    Run the runner.py script in the context of the generated package.
-    """
-    runner_script = os.path.join(test_path, target_dir, 'runner.py')
-    if not os.path.exists(runner_script):
-        # Path to default runner.py
-        runner_path = ""
-        if tool == 'python':
-            runner_path = os.path.join("TraceComparison", "Python_runner.py")
-        elif tool == 'pypDEVS':
-            runner_path = os.path.join("TraceComparison", "DEVS_runner.py")
-        else:
-            return None
-        # Copy default runner.py to target_dir
-        shutil.copy(runner_path, os.path.join(test_path, target_dir, 'runner.py'))
-    
-    command = ["python", runner_script]
-    result = subprocess.run(command, capture_output=True, text=True)
-    if result.returncode != 0:
-        print(f"Error running {runner_script}: {result.stderr}")
-    return result.stdout, result.stderr
-
-def compare_logs(log1, log2):
-    """
-    Compare two log files and return if they are the same.
-    """
-    return filecmp.cmp(log1, log2, shallow=False)
-
-def process_test(test_name, test_path):
-    """
-    Process a single test by converting, running, and comparing logs.
-    """
-    # Convert sccd.xml to target.py for Python and PyDEVS
-    if convert_sccd_to_target(test_path, 'Python', 'python') != 0:
-        return
-    if convert_sccd_to_target(test_path, 'PyDEVS', 'pypDEVS') != 0:
-        return
-    
-    # Run the runner.py script in the context of the generated package
-    python_log, python_error = run_runner_script(test_path, 'Python', 'python')
-    pydevs_log, pydevs_error = run_runner_script(test_path, 'PyDEVS', 'pypDEVS')
-    
-    # Save logs to files
-    #python_log_file = os.path.join(test_path, 'Python', 'log.txt')
-    #pydevs_log_file = os.path.join(test_path, 'PyDEVS', 'log.txt')
-    
-    #with open(python_log_file, 'w') as f:
-    #    f.write(python_log)
-    #    f.write(python_error)
-    
-    #with open(pydevs_log_file, 'w') as f:
-    #    f.write(pydevs_log)
-    #    f.write(pydevs_error)
-    
-    # Compare logs
-    #if compare_logs(python_log_file, pydevs_log_file):
-    #    print(f"Logs for test {test_name} match.")
-    #else:
-    #    print(f"Logs for test {test_name} do not match.")
-
-if __name__ == '__main__':
-    tests_directory = "./tests"
-    # Read and sort directory names
-    test_dirs = sorted([d for d in os.listdir(tests_directory) if os.path.isdir(os.path.join(tests_directory, d))])
-    
-    for test_name in test_dirs:
-        test_path = os.path.join(tests_directory, test_name)
-        if os.path.isdir(test_path):
-            print(f"Processing {test_name}...")
-            process_test(test_name, test_path)

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 436246 - 5734
examples/BouncingBalls/Python/trace.txt


+ 173 - 5
examples/BouncingBallsCollision/Python/target.py

@@ -10,6 +10,7 @@ Tkinter frame with bouncing balls in it.
 from sccd.runtime.statecharts_core import *
 from sccd.runtime.libs import ui_v2 as ui
 import random
+import numpy as np
 
 CANVAS_DIMS = (800, 550)
 
@@ -377,6 +378,18 @@ class Field(RuntimeClassBase):
         _root_running_deleting_behaviour_running_2.setTrigger(None)
         _root_running_deleting_behaviour_running_2.setGuard(self._root_running_deleting_behaviour_running_2_guard)
         self.states["/root/running/deleting_behaviour/running"].addTransition(_root_running_deleting_behaviour_running_2)
+        _root_running_deleting_behaviour_running_3 = Transition(self, self.states["/root/running/deleting_behaviour/running"], [self.states["/root/running/deleting_behaviour/running"]])
+        _root_running_deleting_behaviour_running_3.setAction(self._root_running_deleting_behaviour_running_3_exec)
+        _root_running_deleting_behaviour_running_3.setTrigger(Event("instance_created", None))
+        self.states["/root/running/deleting_behaviour/running"].addTransition(_root_running_deleting_behaviour_running_3)
+        _root_running_deleting_behaviour_running_4 = Transition(self, self.states["/root/running/deleting_behaviour/running"], [self.states["/root/running/deleting_behaviour/running"]])
+        _root_running_deleting_behaviour_running_4.setAction(self._root_running_deleting_behaviour_running_4_exec)
+        _root_running_deleting_behaviour_running_4.setTrigger(Event("update_vel", None))
+        self.states["/root/running/deleting_behaviour/running"].addTransition(_root_running_deleting_behaviour_running_4)
+        _root_running_deleting_behaviour_running_5 = Transition(self, self.states["/root/running/deleting_behaviour/running"], [self.states["/root/running/deleting_behaviour/running"]])
+        _root_running_deleting_behaviour_running_5.setAction(self._root_running_deleting_behaviour_running_5_exec)
+        _root_running_deleting_behaviour_running_5.setTrigger(Event("delete_physics", None))
+        self.states["/root/running/deleting_behaviour/running"].addTransition(_root_running_deleting_behaviour_running_5)
         
         # transition /root/running/child_behaviour/listening
         _root_running_child_behaviour_listening_0 = Transition(self, self.states["/root/running/child_behaviour/listening"], [self.states["/root/running/child_behaviour/listening"]])
@@ -475,12 +488,30 @@ class Field(RuntimeClassBase):
                     self.collisions.append((link_id, other_id))
     
     def _root_running_deleting_behaviour_running_2_exec(self, parameters):
+        self.big_step.outputEventOM(Event("create_instance", None, [self, "collisions", "CollisionPhysics", self.collisions[-1][0], self.collisions[-1][1], self.balls[self.collisions[-1][0]], self.balls[self.collisions[-1][1]]]))
         print("COLLISION")
-        selected.collisions = []
+        self.collisions = self.collisions[:-1]
     
     def _root_running_deleting_behaviour_running_2_guard(self, parameters):
         return self.collisions
     
+    def _root_running_deleting_behaviour_running_3_exec(self, parameters):
+        association_name = parameters[0]
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, association_name, Event("set_association_name", None, [association_name])]))
+        self.big_step.outputEventOM(Event("start_instance", None, [self, association_name]))
+    
+    def _root_running_deleting_behaviour_running_4_exec(self, parameters):
+        ball1_id = parameters[0]
+        ball2_id = parameters[1]
+        new_vel1 = parameters[2]
+        new_vel2 = parameters[3]
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, ball1_id, Event("update_ball_vel", None, [new_vel1])]))
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, ball2_id, Event("update_ball_vel", None, [new_vel2])]))
+    
+    def _root_running_deleting_behaviour_running_5_exec(self, parameters):
+        association_id = parameters[0]
+        self.big_step.outputEventOM(Event("delete_instance", None, [self, association_id]))
+    
     def _root_running_child_behaviour_listening_0_exec(self, parameters):
         event_name = parameters[0]
         self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("button_pressed", None, [event_name])]))
@@ -682,11 +713,15 @@ class Ball(RuntimeClassBase):
         _main_behaviour_bouncing_0.setAction(self._main_behaviour_bouncing_0_exec)
         _main_behaviour_bouncing_0.setTrigger(Event("_0after"))
         self.states["/main_behaviour/bouncing"].addTransition(_main_behaviour_bouncing_0)
-        _main_behaviour_bouncing_1 = Transition(self, self.states["/main_behaviour/bouncing"], [self.states["/main_behaviour/selected"]])
+        _main_behaviour_bouncing_1 = Transition(self, self.states["/main_behaviour/bouncing"], [self.states["/main_behaviour/bouncing"]])
         _main_behaviour_bouncing_1.setAction(self._main_behaviour_bouncing_1_exec)
-        _main_behaviour_bouncing_1.setTrigger(Event("mouse_press", self.getInPortName("ball_ui")))
-        _main_behaviour_bouncing_1.setGuard(self._main_behaviour_bouncing_1_guard)
+        _main_behaviour_bouncing_1.setTrigger(Event("update_ball_vel", None))
         self.states["/main_behaviour/bouncing"].addTransition(_main_behaviour_bouncing_1)
+        _main_behaviour_bouncing_2 = Transition(self, self.states["/main_behaviour/bouncing"], [self.states["/main_behaviour/selected"]])
+        _main_behaviour_bouncing_2.setAction(self._main_behaviour_bouncing_2_exec)
+        _main_behaviour_bouncing_2.setTrigger(Event("mouse_press", self.getInPortName("ball_ui")))
+        _main_behaviour_bouncing_2.setGuard(self._main_behaviour_bouncing_2_guard)
+        self.states["/main_behaviour/bouncing"].addTransition(_main_behaviour_bouncing_2)
         
         # transition /main_behaviour/dragging
         _main_behaviour_dragging_0 = Transition(self, self.states["/main_behaviour/dragging"], [self.states["/main_behaviour/dragging"]])
@@ -743,12 +778,16 @@ class Ball(RuntimeClassBase):
         self.pos['y'] += self.vel['y']
     
     def _main_behaviour_bouncing_1_exec(self, parameters):
+        new_vel = parameters[0]
+        self.vel = new_vel
+    
+    def _main_behaviour_bouncing_2_exec(self, parameters):
         x = parameters[0]
         y = parameters[1]
         button = parameters[2]
         self.big_step.outputEvent(Event("set_element_color", self.getOutPortName("ui"), [self.canvas_id, self.circle_id, '#ff0']))
     
-    def _main_behaviour_bouncing_1_guard(self, parameters):
+    def _main_behaviour_bouncing_2_guard(self, parameters):
         x = parameters[0]
         y = parameters[1]
         button = parameters[2]
@@ -799,6 +838,130 @@ class Ball(RuntimeClassBase):
         self.default_targets = self.states["/main_behaviour"].getEffectiveTargetStates()
         RuntimeClassBase.initializeStatechart(self)
 
+class CollisionPhysics(RuntimeClassBase):
+    def __init__(self, controller, ball1_id, ball2_id, ball1_info, ball2_info):
+        RuntimeClassBase.__init__(self, controller)
+        
+        self.inports["physics_ui"] = controller.addInputPort("physics_ui", self)
+        
+        self.semantics.big_step_maximality = StatechartSemantics.TakeMany
+        self.semantics.internal_event_lifeline = StatechartSemantics.Queue
+        self.semantics.input_event_lifeline = StatechartSemantics.FirstComboStep
+        self.semantics.priority = StatechartSemantics.SourceParent
+        self.semantics.concurrency = StatechartSemantics.Single
+        
+        # build Statechart structure
+        self.build_statechart_structure()
+        
+        # user defined attributes
+        self.ball2_info = None
+        
+        # call user defined constructor
+        CollisionPhysics.user_defined_constructor(self, ball1_id, ball2_id, ball1_info, ball2_info)
+    
+    def user_defined_constructor(self, ball1_id, ball2_id, ball1_info, ball2_info):
+        self.ball1_id = ball1_id
+        self.ball2_id = ball2_id
+        self.ball1_info = ball1_info
+        self.ball2_info = ball2_info
+    
+    def user_defined_destructor(self):
+        pass
+    
+    
+    # user defined method
+    def resolve_velocity(self, vel, normal):
+        # Resolve the velocity into normal and tangential components.
+        normal_velocity = np.dot(vel, normal) * normal
+        tangential_velocity = vel - normal_velocity
+        return normal_velocity, tangential_velocity
+    
+    
+    # user defined method
+    def handle_collision(self):
+        pos1 = np.array([self.ball1_info['pos']['x'], self.ball1_info['pos']['y']])
+        vel1 = np.array([self.ball1_info['vel']['x'], self.ball1_info['vel']['y']])
+        r1 = self.ball1_info['r']
+        
+        pos2 = np.array([self.ball2_info['pos']['x'], self.ball2_info['pos']['y']])
+        vel2 = np.array([self.ball2_info['vel']['x'], self.ball2_info['vel']['y']])
+        r2 = self.ball2_info['r']
+        
+        # Calculate the normal vector from the center of ball1 to the center of ball2
+        normal = pos2 - pos1
+        normal = normal / np.linalg.norm(normal)  # Normalize the normal vector
+        
+        # Calculate the relative velocity
+        relative_velocity = vel1 - vel2
+        
+        # Calculate the velocities in the normal direction
+        vel1_normal, vel1_tangential = self.resolve_velocity(vel1, normal)
+        vel2_normal, vel2_tangential = self.resolve_velocity(vel2, normal)
+        
+        # Calculate new normal velocities after collision (1D elastic collision formula)
+        vel1_normal_new = ((r1 - r2) * vel1_normal + 2 * r2 * vel2_normal) / (r1 + r2)
+        vel2_normal_new = ((r2 - r1) * vel2_normal + 2 * r1 * vel1_normal) / (r1 + r2)
+        
+        # Combine the new normal and original tangential components
+        vel1_new = vel1_normal_new + vel1_tangential
+        vel2_new = vel2_normal_new + vel2_tangential
+        
+        # Update the velocities in the balls
+        self.ball1_info['vel'] = {'x': vel1_new[0], 'y': vel1_new[1]}
+        self.ball2_info['vel'] = {'x': vel2_new[0], 'y': vel2_new[1]}
+    
+    
+    # builds Statechart structure
+    def build_statechart_structure(self):
+        
+        # state <root>
+        self.states[""] = State(0, "", self)
+        
+        # state /creating
+        self.states["/creating"] = State(1, "/creating", self)
+        self.states["/creating"].setEnter(self._creating_enter)
+        
+        # state /running
+        self.states["/running"] = State(2, "/running", self)
+        
+        # state /delete
+        self.states["/delete"] = State(3, "/delete", self)
+        
+        # add children
+        self.states[""].addChild(self.states["/creating"])
+        self.states[""].addChild(self.states["/running"])
+        self.states[""].addChild(self.states["/delete"])
+        self.states[""].fixTree()
+        self.states[""].default_state = self.states["/creating"]
+        
+        # transition /creating
+        _creating_0 = Transition(self, self.states["/creating"], [self.states["/running"]])
+        _creating_0.setAction(self._creating_0_exec)
+        _creating_0.setTrigger(Event("set_association_name", None))
+        self.states["/creating"].addTransition(_creating_0)
+        
+        # transition /running
+        _running_0 = Transition(self, self.states["/running"], [self.states["/delete"]])
+        _running_0.setAction(self._running_0_exec)
+        _running_0.setTrigger(None)
+        self.states["/running"].addTransition(_running_0)
+    
+    def _creating_enter(self):
+        self.handle_collision()
+    
+    def _creating_0_exec(self, parameters):
+        association_name = parameters[0]
+        self.association_name = association_name
+    
+    def _running_0_exec(self, parameters):
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("update_vel", None, [self.ball1_id, self.ball2_id, self.ball1_info['vel'], self.ball2_info['vel']])]))
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("delete_physics", None, [self.association_name])]))
+    
+    def initializeStatechart(self):
+        # enter default state
+        self.default_targets = self.states["/creating"].getEffectiveTargetStates()
+        RuntimeClassBase.initializeStatechart(self)
+
 class ObjectManager(ObjectManagerBase):
     def __init__(self, controller):
         ObjectManagerBase.__init__(self, controller)
@@ -813,6 +976,7 @@ class ObjectManager(ObjectManagerBase):
             instance.associations = {}
             instance.associations["balls"] = Association("Ball", 0, -1)
             instance.associations["buttons"] = Association("Button", 0, -1)
+            instance.associations["collisions"] = Association("CollisionPhysics", 0, -1)
             instance.associations["parent"] = Association("MainApp", 1, 1)
         elif class_name == "Button":
             instance = Button(self.controller, construct_params[0], construct_params[1], construct_params[2])
@@ -822,6 +986,10 @@ class ObjectManager(ObjectManagerBase):
             instance = Ball(self.controller, construct_params[0], construct_params[1], construct_params[2])
             instance.associations = {}
             instance.associations["parent"] = Association("Field", 1, 1)
+        elif class_name == "CollisionPhysics":
+            instance = CollisionPhysics(self.controller, construct_params[0], construct_params[1], construct_params[2], construct_params[3])
+            instance.associations = {}
+            instance.associations["parent"] = Association("Field", 1, 1)
         else:
             raise Exception("Cannot instantiate class " + class_name)
         return instance

+ 75 - 16
examples/BouncingBallsCollision/sccd.xml

@@ -6,6 +6,7 @@
     <top>
         from sccd.runtime.libs import ui_v2 as ui
         import random
+        import numpy as np
 
         CANVAS_DIMS = (800, 550)
     </top>
@@ -287,15 +288,40 @@
                                     <parameter expr='"CollisionPhysics"' />
                                     <parameter expr="self.collisions[-1][0]" />
                                     <parameter expr="self.collisions[-1][1]" />
+                                    <parameter expr="self.balls[self.collisions[-1][0]]" />
+                                    <parameter expr="self.balls[self.collisions[-1][1]]" />
                                 </raise>
-                                <raise scope="cd" event="start_instance" >
-                                </raise>
-
                                 <script>
-                                    print("COLLISION")
-                                    self.collisions = []
+                                    self.collisions = self.collisions[:-1]
                                 </script>
                             </transition>
+                            <transition event="instance_created" target=".">
+                                <parameter name="association_name" type="string"/>
+                                <raise event="set_association_name" scope="narrow" target="association_name">
+                                    <parameter expr="association_name" />
+                                </raise>
+                                <raise scope="cd" event="start_instance">
+                                    <parameter expr="association_name" />
+                                </raise>
+                            </transition>
+                            <transition event="update_vel" target=".">
+                                <parameter name="ball1_id" />
+                                <parameter name="ball2_id" />
+                                <parameter name="new_vel1" />
+                                <parameter name="new_vel2" />
+                                <raise event="update_ball_vel" scope="narrow" target="ball1_id">
+                                    <parameter expr="new_vel1" />
+                                </raise>
+                                <raise event="update_ball_vel" scope="narrow" target="ball2_id">
+                                    <parameter expr="new_vel2" />
+                                </raise>
+                            </transition>
+                            <transition event="delete_physics" target=".">
+                                <parameter name="association_id" />
+                                <raise scope="cd" event="delete_instance">
+                                    <parameter expr='association_id' />
+                                </raise>
+                            </transition>
                         </state>
                     </state>
                     <state id="child_behaviour" initial="listening">
@@ -489,6 +515,12 @@
                             self.pos['y'] += self.vel['y']
                         </script>
                     </transition>
+                    <transition event="update_ball_vel" target=".">
+                        <parameter name="new_vel" />
+                        <script>
+                            self.vel = new_vel
+                        </script>
+                    </transition>
                     <transition port="ball_ui" event="mouse_press" target="../selected" cond="button == ui.MOUSE_BUTTONS.LEFT">
                         <parameter name="x" />
                         <parameter name="y" />
@@ -569,9 +601,13 @@
             <association name="parent" class="Field" min="1" max="1" />
         </relationships>
         <constructor>
+            <parameter name="ball1_id" />
+            <parameter name="ball2_id" />
             <parameter name="ball1_info" />
             <parameter name="ball2_info" />
             <body>
+                self.ball1_id = ball1_id
+                self.ball2_id = ball2_id
                 self.ball1_info = ball1_info
                 self.ball2_info = ball2_info
             </body>
@@ -588,13 +624,13 @@
         </method>
         <method name="handle_collision">
             <body>
-                pos1 = np.array(ball1['pos'])
-                vel1 = np.array(ball1['vel'])
-                r1 = ball1['r']
+                pos1 = np.array([self.ball1_info['pos']['x'], self.ball1_info['pos']['y']])
+                vel1 = np.array([self.ball1_info['vel']['x'], self.ball1_info['vel']['y']])
+                r1 = self.ball1_info['r']
 
-                pos2 = np.array(ball2['pos'])
-                vel2 = np.array(ball2['vel'])
-                r2 = ball2['r']
+                pos2 = np.array([self.ball2_info['pos']['x'], self.ball2_info['pos']['y']])
+                vel2 = np.array([self.ball2_info['vel']['x'], self.ball2_info['vel']['y']])
+                r2 = self.ball2_info['r']
 
                 # Calculate the normal vector from the center of ball1 to the center of ball2
                 normal = pos2 - pos1
@@ -616,17 +652,40 @@
                 vel2_new = vel2_normal_new + vel2_tangential
 
                 # Update the velocities in the balls
-                ball1['vel'] = vel1_new.tolist()
-                ball2['vel'] = vel2_new.tolist()
+                self.ball1_info['vel'] = {'x': vel1_new[0], 'y': vel1_new[1]}
+                self.ball2_info['vel'] = {'x': vel2_new[0], 'y': vel2_new[1]}
             </body>
         </method>
         <destructor>
         </destructor>
-        <scxml initial="running">
-            <state id="running">
+        <scxml initial="creating">
+            <state id="creating">
                 <onentry>
-
+                    <script>
+                        self.handle_collision()
+                    </script>
                 </onentry>
+                <transition event="set_association_name" target="../running">
+                    <parameter name="association_name" type="str" />
+                    <script>
+                        self.association_name = association_name
+                    </script>
+                </transition>
+            </state>
+            <state id="running">
+                <transition target="../delete">
+                    <raise event="update_vel" scope="narrow" target="'parent'">
+                        <parameter expr="self.ball1_id" />
+                        <parameter expr="self.ball2_id" />
+                        <parameter expr="self.ball1_info['vel']" />
+                        <parameter expr="self.ball2_info['vel']" />
+                    </raise>
+                    <raise event="delete_physics" scope="narrow" target="'parent'">
+                        <parameter expr="self.association_name" />
+                    </raise>
+                </transition>
+            </state>
+            <state id="delete">
             </state>
         </scxml>
     </class>

+ 2 - 1
sccd/runtime/DEVS_statecharts_core.py

@@ -1128,7 +1128,8 @@ class ObjectManagerBase(AtomicDEVS):
                 
                 #instances = []
                 
-                source.addEvent(Event("instance_deleted", parameters = [input[2].parameters[1]]))
+                # TODO: Changed this, write test to check if this is right
+                source.addEvent(Event("instance_deleted", parameters = [input[2].parameters[0]]))
 
 
 

+ 1 - 0
tests/GlobalUI/PyDEVS/faulty_log.txt

@@ -0,0 +1 @@
+0.00 (event name: generate_input; port: ui)

+ 87 - 4
tests/GlobalUI/PyDEVS/log.txt

@@ -1,4 +1,87 @@
-0.00s - Debugger warning: It seems that frozen modules are being used, which may
-0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
-0.00s - to python to disable frozen modules.
-0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
+
+__  Current Time:   0.000000 __________________________________________ 
+
+
+	INITIAL CONDITIONS in model <controller.MainApp>
+		Initial State: None
+		Next scheduled internal transition at time inf
+
+
+	INITIAL CONDITIONS in model <controller.ObjectManager>
+		Initial State: None
+		Next scheduled internal transition at time 0.000000
+
+
+__  Current Time:   0.000000 __________________________________________ 
+
+
+	EXTERNAL TRANSITION in model <controller.MainApp>
+		Input Port Configuration:
+			port <obj_manager_in>:
+				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
+			port <input>:
+			port <private_0_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104821880>}
+		Next scheduled internal transition at time 0.000000
+
+
+	INTERNAL TRANSITION in model <controller.ObjectManager>
+		New State: <target.ObjectManagerState object at 0x1048216a0>
+		Output Port Configuration:
+			port <port1>:
+				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
+		Next scheduled internal transition at time inf
+
+
+__  Current Time:   0.000000 __________________________________________ 
+
+
+	EXTERNAL TRANSITION in model <controller.ObjectManager>
+		Input Port Configuration:
+			port <input>:
+				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
+		New State: <target.ObjectManagerState object at 0x1048216a0>
+		Next scheduled internal transition at time 0.000000
+
+
+	INTERNAL TRANSITION in model <controller.MainApp>
+		New State: {0: <target.MainAppInstance object at 0x104821880>}
+		Output Port Configuration:
+			port <obj_manager_out>:
+				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
+			port <ui>:
+				(event name: generate_input; port: ui)
+		Next scheduled internal transition at time inf
+
+
+__  Current Time:   0.000000 __________________________________________ 
+
+
+	EXTERNAL TRANSITION in model <controller.MainApp>
+		Input Port Configuration:
+			port <obj_manager_in>:
+				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
+			port <input>:
+			port <private_0_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104821880>}
+		Next scheduled internal transition at time 0.000000
+
+
+	INTERNAL TRANSITION in model <controller.ObjectManager>
+		New State: <target.ObjectManagerState object at 0x1048216a0>
+		Output Port Configuration:
+			port <port1>:
+				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
+		Next scheduled internal transition at time inf
+
+
+__  Current Time:   0.000000 __________________________________________ 
+
+
+	INTERNAL TRANSITION in model <controller.MainApp>
+		New State: {0: <target.MainAppInstance object at 0x104821880>}
+		Output Port Configuration:
+			port <obj_manager_out>:
+			port <ui>:
+		Next scheduled internal transition at time inf
+

+ 0 - 25
tests/GlobalUI/PyDEVS/runner.py

@@ -1,25 +0,0 @@
-import target as target
-from sccd.runtime.DEVS_loop import DEVSSimulator
-from sccd.runtime.statecharts_core import Event
-
-class OutputListener:
-	def __init__(self, controller) -> None:
-		self.controller = controller
-
-	def add(self, events):
-		for event in events:
-			if event.port == "ui":
-				#print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				if event.name == "generate_input":
-					self.controller.addInput(Event("test", "in_ui"))
-				
-
-if __name__ == '__main__':
-	controller = target.Controller(name="controller")
-	refs = {"in_ui": controller.in_ui}
-	sim = DEVSSimulator(controller, refs)
-
-	listener = OutputListener(sim)
-	sim.setListenPorts(controller.out_ui, listener.add)
-	sim.simulate()
-

+ 4 - 6
tests/GlobalUI/PyDEVS/target.py

@@ -99,14 +99,12 @@ class ObjectManager(TheObjectManager):
 class Controller(CoupledDEVS):
     def __init__(self, name):
         CoupledDEVS.__init__(self, name)
-        self.in_ui = self.addInPort("in_ui")
-        #Ports.addInputPort("ui")
+        self.in_ui = self.addInPort("ui")
+        Ports.addInputPort("ui")
         self.out_ui = self.addOutPort("ui")
-        #Ports.addOutputPort("ui")
+        Ports.addOutputPort("ui")
         self.objectmanager = self.addSubModel(ObjectManager("ObjectManager"))
         self.atomic0 = self.addSubModel(MainApp("MainApp"))
         self.connectPorts(self.atomic0.obj_manager_out, self.objectmanager.input)
         self.connectPorts(self.objectmanager.output["MainApp"], self.atomic0.obj_manager_in)
-        self.connectPorts(self.atomic0.output, self.out_ui)
-
-        self.connectPorts(self.in_ui, self.atomic0.input)
+        self.connectPorts(self.atomic0.output, self.out_ui)

+ 5 - 8
tests/GlobalUI/Python/log.txt

@@ -1,8 +1,5 @@
-instance_created_succesfully , received on: 0.00 seconds, parameters: ['linkA[0]']
-statechart_started_succesfully , received on: 0.00 seconds, parameters: []
-constructor_initialized_succesfully , received on: 0.00 seconds, parameters: []
-instance_started_succesfully , received on: 0.00 seconds, parameters: ['linkA[0]']
-0.00s - Debugger warning: It seems that frozen modules are being used, which may
-0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
-0.00s - to python to disable frozen modules.
-0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
+__  Current Time:   0.000000 __________________________________________ 
+
+OUTPUT EVENT to port <ui>
+	\Event: (event name: generate_input; port: ui)
+

+ 0 - 21
tests/GlobalUI/Python/runner.py

@@ -1,21 +0,0 @@
-import target as target
-from sccd.runtime.statecharts_core import Event
-import threading
-
-class OutputListener:
-	def __init__(self, controller) -> None:
-		self.controller = controller
-
-	def add(self, event):
-		if event.port == "ui":
-			#print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-			if event.name == "generate_input":
-				 self.controller.addInput(Event("test", "ui"))
-			
-				
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.addMyOwnOutputListener(OutputListener(controller))
-	controller.setVerbose(None)
-	controller.start()

+ 0 - 1
tests/GlobalUI/Python/target.py

@@ -79,7 +79,6 @@ class ObjectManager(ObjectManagerBase):
         if class_name == "MainApp":
             instance = MainApp(self.controller)
             instance.associations = {}
-            instance.associations["linkA"] = Association("A", 0, -1)
         else:
             raise Exception("Cannot instantiate class " + class_name)
         return instance

+ 10 - 10
tests/Test1/PyDEVS/log.txt

@@ -20,13 +20,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_0_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x102be02c0>}
+			port <private_1_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104867800>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x1021a2c00>
+		New State: <target.ObjectManagerState object at 0x102b5aa20>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
@@ -40,12 +40,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
-		New State: <target.ObjectManagerState object at 0x1021a2c00>
+		New State: <target.ObjectManagerState object at 0x102b5aa20>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102be02c0>}
+		New State: {0: <target.MainAppInstance object at 0x104867800>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -61,13 +61,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_0_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x102be02c0>}
+			port <private_1_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104867800>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x1021a2c00>
+		New State: <target.ObjectManagerState object at 0x102b5aa20>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -78,7 +78,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102be02c0>}
+		New State: {0: <target.MainAppInstance object at 0x104867800>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -89,7 +89,7 @@ __  Current Time:   1.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102be02c0>}
+		New State: {0: <target.MainAppInstance object at 0x104867800>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:

+ 0 - 9
tests/Test1/PyDEVS/runner.py

@@ -1,9 +0,0 @@
-import tests.Test1.PyDEVS.target as target
-from sccd.runtime.DEVS_loop import DEVSSimulator
-
-if __name__ == '__main__':
-	model = target.Controller(name="controller")
-	sim = DEVSSimulator(model)
-	sim.setVerbose()
-	sim.simulate()
-

+ 0 - 16
tests/Test1/Python/runner.py

@@ -1,16 +0,0 @@
-import target as target
-from sccd.runtime.statecharts_core import Event
-import threading
-
-class OutputListener:
-	def add(self, event):
-		if event.port == "ui":
-			print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.keep_running = False
-	controller.addMyOwnOutputListener(OutputListener())
-	controller.setVerbose("check.txt")
-	controller.start()

tests/GlobalUI/Python/new_log.txt → tests/Test1/expected_output_trace.txt


+ 4 - 0
tests/Test10/PyDEVS/faulty_log.txt

@@ -0,0 +1,4 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: statechart_started_succesfully; port: ui; parameters: ['0.00'])
+0.00 (event name: constructor_initialized_succesfully; port: ui; parameters: ['0.00'])
+0.00 (event name: instance_started_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])

+ 31 - 31
tests/Test10/PyDEVS/log.txt

@@ -30,13 +30,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_22_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+			port <private_23_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x102c7d730>
+		New State: <target.ObjectManagerState object at 0x1048fe4b0>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
@@ -52,12 +52,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
-		New State: <target.ObjectManagerState object at 0x102c7d730>
+		New State: <target.ObjectManagerState object at 0x1048fe4b0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -75,8 +75,8 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>: 
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
 			port <input>: 
-			port <private_22_<narrow_cast>>: 
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+			port <private_23_<narrow_cast>>: 
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
@@ -90,7 +90,7 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>: 
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
-		New State: <target.ObjectManagerState object at 0x102c7d730>
+		New State: <target.ObjectManagerState object at 0x1048fe4b0>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -107,13 +107,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
 			port <input>:
-			port <private_23_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x102c80f80>}
+			port <private_24_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x104901550>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -123,7 +123,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x102c7d730>
+		New State: <target.ObjectManagerState object at 0x1048fe4b0>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -139,12 +139,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x102c7d730>
+		New State: <target.ObjectManagerState object at 0x1048fe4b0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x102c80f80>}
+		New State: {0: <target.AInstance object at 0x104901550>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -160,13 +160,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_22_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+			port <private_23_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x102c7d730>
+		New State: <target.ObjectManagerState object at 0x1048fe4b0>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -179,7 +179,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -192,7 +192,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -209,12 +209,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x102c7d730>
+		New State: <target.ObjectManagerState object at 0x1048fe4b0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
@@ -232,13 +232,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_23_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x102c80f80>}
+			port <private_24_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x104901550>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x102c7d730>
+		New State: <target.ObjectManagerState object at 0x1048fe4b0>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -254,12 +254,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x102c7d730>
+		New State: <target.ObjectManagerState object at 0x1048fe4b0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x102c80f80>}
+		New State: {0: <target.AInstance object at 0x104901550>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
@@ -277,13 +277,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_22_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+			port <private_23_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x102c7d730>
+		New State: <target.ObjectManagerState object at 0x1048fe4b0>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
@@ -296,7 +296,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -309,7 +309,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102c82360>}
+		New State: {0: <target.MainAppInstance object at 0x1048fd7c0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:

+ 0 - 0
tests/Test10/PyDEVS/runner.py


+ 0 - 0
tests/Test10/Python/new_log.txt


+ 0 - 16
tests/Test10/Python/runner.py

@@ -1,16 +0,0 @@
-import target as target
-from sccd.runtime.statecharts_core import Event
-import threading
-
-class OutputListener:
-	def add(self, event):
-		if event.port == "ui":
-			print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.keep_running = False
-	controller.addMyOwnOutputListener(OutputListener())
-	controller.setVerbose(None)
-	controller.start()

+ 4 - 0
tests/Test10/expected_trace.txt

@@ -0,0 +1,4 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: statechart_started_succesfully; port: ui; parameters: ['0.00'])
+0.00 (event name: constructor_initialized_succesfully; port: ui; parameters: ['0.00'])
+0.00 (event name: instance_started_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])

+ 2 - 0
tests/Test12/PyDEVS/faulty_log.txt

@@ -0,0 +1,2 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', [0]])

+ 30 - 30
tests/Test12/PyDEVS/log.txt

@@ -25,13 +25,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_26_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+			port <private_25_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x107278380>
+		New State: <target.ObjectManagerState object at 0x10486e780>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
@@ -46,12 +46,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
-		New State: <target.ObjectManagerState object at 0x107278380>
+		New State: <target.ObjectManagerState object at 0x10486e780>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -68,8 +68,8 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>: 
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
 			port <input>: 
-			port <private_26_<narrow_cast>>: 
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+			port <private_25_<narrow_cast>>: 
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
@@ -82,7 +82,7 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>: 
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
-		New State: <target.ObjectManagerState object at 0x107278380>
+		New State: <target.ObjectManagerState object at 0x10486e780>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -98,13 +98,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
 			port <input>:
-			port <private_27_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x107279430>}
+			port <private_26_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x10484c590>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -113,7 +113,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x107278380>
+		New State: <target.ObjectManagerState object at 0x10486e780>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -128,12 +128,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x107278380>
+		New State: <target.ObjectManagerState object at 0x10486e780>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x107279430>}
+		New State: {0: <target.AInstance object at 0x10484c590>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -149,13 +149,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_26_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+			port <private_25_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x107278380>
+		New State: <target.ObjectManagerState object at 0x10486e780>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -167,7 +167,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -179,7 +179,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -195,12 +195,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
-		New State: <target.ObjectManagerState object at 0x107278380>
+		New State: <target.ObjectManagerState object at 0x10486e780>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
@@ -217,13 +217,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
 			port <input>:
-			port <private_27_<narrow_cast>>:
+			port <private_26_<narrow_cast>>:
 		New State: {}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x107278380>
+		New State: <target.ObjectManagerState object at 0x10486e780>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -238,7 +238,7 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
-		New State: <target.ObjectManagerState object at 0x107278380>
+		New State: <target.ObjectManagerState object at 0x10486e780>
 		Next scheduled internal transition at time 0.000000
 
 
@@ -259,13 +259,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
 			port <input>:
-			port <private_26_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+			port <private_25_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x107278380>
+		New State: <target.ObjectManagerState object at 0x10486e780>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
@@ -277,7 +277,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -289,11 +289,11 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107278440>}
+		New State: {0: <target.MainAppInstance object at 0x104901ee0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
-				(event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', [0]])
+				(event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
 			port <linkA>:
 		Next scheduled internal transition at time inf
 

+ 0 - 20
tests/Test12/PyDEVS/runner.py

@@ -1,20 +0,0 @@
-import target as target
-from sccd.runtime.DEVS_loop import DEVSSimulator
-from sccd.runtime.statecharts_core import Event
-
-class OutputListener:
-	def add(self, events):
-		for event in events:
-			if event.port == "ui":
-				print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller(name="controller")
-	refs = {"ui": controller.in_ui}
-	sim = DEVSSimulator(controller, refs)
-
-	listener = OutputListener()
-	sim.setListenPorts(controller.out_ui, listener.add)
-	sim.simulate()
-

+ 0 - 0
tests/Test12/Python/new_log.txt


+ 0 - 16
tests/Test12/Python/runner.py

@@ -1,16 +0,0 @@
-import target as target
-from sccd.runtime.statecharts_core import Event
-import threading
-
-class OutputListener:
-	def add(self, event):
-		if event.port == "ui":
-			print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.keep_running = False
-	controller.addMyOwnOutputListener(OutputListener())
-	controller.setVerbose(None)
-	controller.start()

+ 2 - 0
tests/Test12/expected_trace.txt

@@ -0,0 +1,2 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])

+ 4 - 0
tests/Test13/PyDEVS/faulty_log.txt

@@ -0,0 +1,4 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[1]'])
+0.00 (event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', [1]])
+0.00 (event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', [0]])

+ 43 - 43
tests/Test13/PyDEVS/log.txt

@@ -25,13 +25,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_28_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+			port <private_27_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
@@ -46,12 +46,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -68,8 +68,8 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>: 
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
 			port <input>: 
-			port <private_28_<narrow_cast>>: 
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+			port <private_27_<narrow_cast>>: 
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
@@ -82,7 +82,7 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>: 
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -98,13 +98,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
 			port <input>:
-			port <private_29_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x107298fe0>}
+			port <private_28_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x104902720>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -113,7 +113,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -128,12 +128,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x107298fe0>}
+		New State: {0: <target.AInstance object at 0x104902720>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -149,13 +149,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_28_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+			port <private_27_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -167,7 +167,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -179,7 +179,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -195,12 +195,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
@@ -217,14 +217,14 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
 			port <input>:
+			port <private_28_<narrow_cast>>:
 			port <private_29_<narrow_cast>>:
-			port <private_30_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x107298fe0>, 1: <target.AInstance object at 0x107299190>}
+		New State: {0: <target.AInstance object at 0x104902720>, 1: <target.AInstance object at 0x1049003b0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -239,12 +239,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[1]']))
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x107298fe0>, 1: <target.AInstance object at 0x107299190>}
+		New State: {0: <target.AInstance object at 0x104902720>, 1: <target.AInstance object at 0x1049003b0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[1]']))
@@ -260,13 +260,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[1]']))
 			port <input>:
-			port <private_28_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+			port <private_27_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[1]']))
@@ -278,7 +278,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -290,7 +290,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -307,12 +307,12 @@ __  Current Time:   0.000000 __________________________________________
 			port <input>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[1]', [1]]))
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[1]', [1]]))
@@ -331,14 +331,14 @@ __  Current Time:   0.000000 __________________________________________
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[1]', [1]]))
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
 			port <input>:
+			port <private_28_<narrow_cast>>:
 			port <private_29_<narrow_cast>>:
-			port <private_30_<narrow_cast>>:
 		New State: {}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -355,7 +355,7 @@ __  Current Time:   0.000000 __________________________________________
 			port <input>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[1]', [1]]))
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Next scheduled internal transition at time 0.000000
 
 
@@ -378,13 +378,13 @@ __  Current Time:   0.000000 __________________________________________
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[1]', [1]]))
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
 			port <input>:
-			port <private_28_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+			port <private_27_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x1072988c0>
+		New State: <target.ObjectManagerState object at 0x10484d2b0>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[1]', [1]]))
@@ -397,7 +397,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -409,12 +409,12 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x10727bda0>}
+		New State: {0: <target.MainAppInstance object at 0x10484d340>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
-				(event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', [1]])
-				(event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', [0]])
+				(event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', 'linkA[1]'])
+				(event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
 			port <linkA>:
 		Next scheduled internal transition at time inf
 

+ 0 - 20
tests/Test13/PyDEVS/runner.py

@@ -1,20 +0,0 @@
-import target as target
-from sccd.runtime.DEVS_loop import DEVSSimulator
-from sccd.runtime.statecharts_core import Event
-
-class OutputListener:
-	def add(self, events):
-		for event in events:
-			if event.port == "ui":
-				print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller(name="controller")
-	refs = {"ui": controller.in_ui}
-	sim = DEVSSimulator(controller, refs)
-
-	listener = OutputListener()
-	sim.setListenPorts(controller.out_ui, listener.add)
-	sim.simulate()
-

+ 1 - 2
tests/Test13/PyDEVS/target.py

@@ -4,8 +4,7 @@ Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van M
 Model author: Sam Pieters
 Model name:   Create and Delete Multiple Instances of the same type (other than the MainApp)
 Model description:
-# TODO: This is broken in python SCCD, check in PyDEVS
-        Test 13: Check if multiple instances can be deleted after the creation, the instance is not started yet.
+Test 13: Check if multiple instances can be deleted after the creation, the instance is not started yet.
 """
 
 from sccd.runtime.DEVS_statecharts_core import *

+ 0 - 0
tests/Test13/Python/new_log.txt


+ 0 - 16
tests/Test13/Python/runner.py

@@ -1,16 +0,0 @@
-import target as target
-from sccd.runtime.statecharts_core import Event
-import threading
-
-class OutputListener:
-	def add(self, event):
-		if event.port == "ui":
-			print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.keep_running = False
-	controller.addMyOwnOutputListener(OutputListener())
-	controller.setVerbose(None)
-	controller.start()

+ 1 - 2
tests/Test13/Python/target.py

@@ -4,8 +4,7 @@ Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van M
 Model author: Sam Pieters
 Model name:   Create and Delete Multiple Instances of the same type (other than the MainApp)
 Model description:
-# TODO: This is broken in python SCCD, check in PyDEVS
-        Test 13: Check if multiple instances can be deleted after the creation, the instance is not started yet.
+Test 13: Check if multiple instances can be deleted after the creation, the instance is not started yet.
 """
 
 from sccd.runtime.statecharts_core import *

+ 4 - 0
tests/Test13/expected_trace.txt

@@ -0,0 +1,4 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[1]'])
+0.00 (event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', 'linkA[1]'])
+0.00 (event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])

+ 4 - 0
tests/Test14/PyDEVS/faulty_log.txt

@@ -0,0 +1,4 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: statechart_started_succesfully; port: ui; parameters: ['0.00'])
+0.00 (event name: instance_started_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', [0]])

+ 42 - 42
tests/Test14/PyDEVS/log.txt

@@ -25,13 +25,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_31_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+			port <private_30_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
@@ -46,12 +46,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -68,8 +68,8 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>: 
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
 			port <input>: 
-			port <private_31_<narrow_cast>>: 
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+			port <private_30_<narrow_cast>>: 
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
@@ -82,7 +82,7 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>: 
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -98,13 +98,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
 			port <input>:
-			port <private_32_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x1072c4e90>}
+			port <private_31_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x104876270>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -113,7 +113,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -128,12 +128,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x1072c4e90>}
+		New State: {0: <target.AInstance object at 0x104876270>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -149,13 +149,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_31_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+			port <private_30_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -167,7 +167,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -179,7 +179,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -195,12 +195,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
@@ -217,13 +217,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_32_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x1072c4e90>}
+			port <private_31_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x104876270>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -238,12 +238,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x1072c4e90>}
+		New State: {0: <target.AInstance object at 0x104876270>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
@@ -260,13 +260,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_31_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+			port <private_30_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
@@ -278,7 +278,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -290,7 +290,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -306,12 +306,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
@@ -328,13 +328,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
 			port <input>:
-			port <private_32_<narrow_cast>>:
+			port <private_31_<narrow_cast>>:
 		New State: {}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -349,7 +349,7 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Next scheduled internal transition at time 0.000000
 
 
@@ -370,13 +370,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
 			port <input>:
-			port <private_31_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+			port <private_30_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727a8a0>
+		New State: <target.ObjectManagerState object at 0x102d2ef60>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
@@ -388,7 +388,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -400,11 +400,11 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x107279cd0>}
+		New State: {0: <target.MainAppInstance object at 0x1048fcc20>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
-				(event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', [0]])
+				(event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
 			port <linkA>:
 		Next scheduled internal transition at time inf
 

+ 0 - 20
tests/Test14/PyDEVS/runner.py

@@ -1,20 +0,0 @@
-import target as target
-from sccd.runtime.DEVS_loop import DEVSSimulator
-from sccd.runtime.statecharts_core import Event
-
-class OutputListener:
-	def add(self, events):
-		for event in events:
-			if event.port == "ui":
-				print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller(name="controller")
-	refs = {"ui": controller.in_ui}
-	sim = DEVSSimulator(controller, refs)
-
-	listener = OutputListener()
-	sim.setListenPorts(controller.out_ui, listener.add)
-	sim.simulate()
-

+ 1 - 1
tests/Test14/PyDEVS/target.py

@@ -4,7 +4,7 @@ Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van M
 Model author: Sam Pieters
 Model name:   Create and Delete A Running Instance (other than the MainApp)
 Model description:
-Test 14: Check if multiple running instances can be deleted after the creation.
+Test 14: Check if a running instance can be deleted after the creation.
 """
 
 from sccd.runtime.DEVS_statecharts_core import *

+ 0 - 0
tests/Test14/Python/new_log.txt


+ 0 - 16
tests/Test14/Python/runner.py

@@ -1,16 +0,0 @@
-import target as target
-from sccd.runtime.statecharts_core import Event
-import threading
-
-class OutputListener:
-	def add(self, event):
-		if event.port == "ui":
-			print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.keep_running = False
-	controller.addMyOwnOutputListener(OutputListener())
-	controller.setVerbose(None)
-	controller.start()

+ 1 - 1
tests/Test14/Python/target.py

@@ -4,7 +4,7 @@ Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van M
 Model author: Sam Pieters
 Model name:   Create and Delete A Running Instance (other than the MainApp)
 Model description:
-Test 14: Check if multiple running instances can be deleted after the creation.
+Test 14: Check if a running instance can be deleted after the creation.
 """
 
 from sccd.runtime.statecharts_core import *

+ 4 - 0
tests/Test14/expected_trace.txt

@@ -0,0 +1,4 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: statechart_started_succesfully; port: ui; parameters: ['0.00'])
+0.00 (event name: instance_started_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])

+ 4 - 0
tests/Test15/PyDEVS/faulty_log.txt

@@ -0,0 +1,4 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: statechart_started_succesfully; port: ui; parameters: ['0.00'])
+0.00 (event name: instance_started_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', [0]])

+ 42 - 42
tests/Test15/PyDEVS/log.txt

@@ -25,13 +25,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_33_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+			port <private_32_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
@@ -46,12 +46,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -68,8 +68,8 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>: 
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
 			port <input>: 
-			port <private_33_<narrow_cast>>: 
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+			port <private_32_<narrow_cast>>: 
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
@@ -82,7 +82,7 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>: 
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -98,13 +98,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
 			port <input>:
-			port <private_34_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x1072c5a60>}
+			port <private_33_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x1048779e0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -113,7 +113,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -128,12 +128,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x1072c5a60>}
+		New State: {0: <target.AInstance object at 0x1048779e0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -149,13 +149,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_33_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+			port <private_32_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -167,7 +167,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -179,7 +179,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -195,12 +195,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
@@ -217,13 +217,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_34_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x1072c5a60>}
+			port <private_33_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x1048779e0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -238,12 +238,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x1072c5a60>}
+		New State: {0: <target.AInstance object at 0x1048779e0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
@@ -260,13 +260,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_33_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+			port <private_32_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
@@ -278,7 +278,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -290,7 +290,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -306,12 +306,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
@@ -328,13 +328,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: delete_instance; port: None; parameters: ['linkA[0]', [0]]))
 			port <input>:
-			port <private_34_<narrow_cast>>:
+			port <private_33_<narrow_cast>>:
 		New State: {}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -349,7 +349,7 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Next scheduled internal transition at time 0.000000
 
 
@@ -370,13 +370,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
 			port <input>:
-			port <private_33_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+			port <private_32_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10727aea0>
+		New State: <target.ObjectManagerState object at 0x104876ea0>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_deleted; port: None; parameters: ['linkA[0]', [0]]))
@@ -388,7 +388,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -400,11 +400,11 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072f46b0>}
+		New State: {0: <target.MainAppInstance object at 0x104876b40>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
-				(event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', [0]])
+				(event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
 			port <linkA>:
 		Next scheduled internal transition at time inf
 

+ 0 - 20
tests/Test15/PyDEVS/runner.py

@@ -1,20 +0,0 @@
-import target as target
-from sccd.runtime.DEVS_loop import DEVSSimulator
-from sccd.runtime.statecharts_core import Event
-
-class OutputListener:
-	def add(self, events):
-		for event in events:
-			if event.port == "ui":
-				print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller(name="controller")
-	refs = {"ui": controller.in_ui}
-	sim = DEVSSimulator(controller, refs)
-
-	listener = OutputListener()
-	sim.setListenPorts(controller.out_ui, listener.add)
-	sim.simulate()
-

+ 4 - 3
tests/Test15/PyDEVS/target.py

@@ -2,14 +2,15 @@
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration) and Sam Pieters (DEVS)
 
 Model author: Sam Pieters
-Model name:   Create and Delete A Running Instance (other than the MainApp)
+Model name:   Create and Delete Multiple Running Instance (other than the MainApp)
 Model description:
-Test 14: Check if multiple running instances can be deleted after the creation.
+# TODO: Still need to do this
+        Test 15: Check if multiple running instances can be deleted after the creation.
 """
 
 from sccd.runtime.DEVS_statecharts_core import *
 
-# package "Create and Delete A Running Instance (other than the MainApp)"
+# package "Create and Delete Multiple Running Instance (other than the MainApp)"
 
 class MainAppInstance(RuntimeClassBase):
     def __init__(self, atomdevs):

+ 0 - 0
tests/Test15/Python/new_log.txt


+ 0 - 16
tests/Test15/Python/runner.py

@@ -1,16 +0,0 @@
-import target as target
-from sccd.runtime.statecharts_core import Event
-import threading
-
-class OutputListener:
-	def add(self, event):
-		if event.port == "ui":
-			print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.keep_running = False
-	controller.addMyOwnOutputListener(OutputListener())
-	controller.setVerbose(None)
-	controller.start()

+ 4 - 3
tests/Test15/Python/target.py

@@ -2,14 +2,15 @@
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 Model author: Sam Pieters
-Model name:   Create and Delete A Running Instance (other than the MainApp)
+Model name:   Create and Delete Multiple Running Instance (other than the MainApp)
 Model description:
-Test 14: Check if multiple running instances can be deleted after the creation.
+# TODO: Still need to do this
+        Test 15: Check if multiple running instances can be deleted after the creation.
 """
 
 from sccd.runtime.statecharts_core import *
 
-# package "Create and Delete A Running Instance (other than the MainApp)"
+# package "Create and Delete Multiple Running Instance (other than the MainApp)"
 
 class MainApp(RuntimeClassBase):
     def __init__(self, controller):

+ 4 - 0
tests/Test15/expected_trace.txt

@@ -0,0 +1,4 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: statechart_started_succesfully; port: ui; parameters: ['0.00'])
+0.00 (event name: instance_started_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: instance_deleted_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])

+ 1 - 0
tests/Test2/PyDEVS/faulty_log.txt

@@ -0,0 +1 @@
+1.00 (event name: test_event; port: ui; parameters: ['1.00'])

+ 11 - 11
tests/Test2/PyDEVS/log.txt

@@ -20,13 +20,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_1_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x102055c10>}
+			port <private_2_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x10486b7d0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x100eda900>
+		New State: <target.ObjectManagerState object at 0x10486c770>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
@@ -40,12 +40,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
-		New State: <target.ObjectManagerState object at 0x100eda900>
+		New State: <target.ObjectManagerState object at 0x10486c770>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102055c10>}
+		New State: {0: <target.MainAppInstance object at 0x10486b7d0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -61,13 +61,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_1_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x102055c10>}
+			port <private_2_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x10486b7d0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x100eda900>
+		New State: <target.ObjectManagerState object at 0x10486c770>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -78,7 +78,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102055c10>}
+		New State: {0: <target.MainAppInstance object at 0x10486b7d0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -89,7 +89,7 @@ __  Current Time:   1.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102055c10>}
+		New State: {0: <target.MainAppInstance object at 0x10486b7d0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -100,7 +100,7 @@ __  Current Time:   1.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x102055c10>}
+		New State: {0: <target.MainAppInstance object at 0x10486b7d0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:

+ 0 - 32
tests/Test2/PyDEVS/runner.py

@@ -1,32 +0,0 @@
-import target as target
-from sccd.runtime.DEVS_loop import DEVSSimulator
-
-import os
-
-class OutputListener:
-	def add(self, events):
-		for event in events:
-			if event.port == "ui":
-				print(event.name, ":", event.parameters[0], "seconds")
-				
-
-if __name__ == '__main__':
-	model = target.Controller(name="controller")
-	refs = {"ui": model.in_ui}
-	sim = DEVSSimulator(model, refs)
-	sim.setRealTime(True)
-
-	# Get the directory where the currently running Python file is located
-	current_file_directory = os.path.dirname(os.path.abspath(__file__))
-
-	# Create the full path for the log file
-	log_file_path = os.path.join(current_file_directory, "new_log.txt")
-
-	# Set verbose to the log file path
-	sim.setVerbose(log_file_path)
-
-	listener = OutputListener()
-	sim.setListenPorts(model.out_ui, listener.add)
-	sim.simulate()
-
-

+ 0 - 24
tests/Test2/Python/runner.py

@@ -1,24 +0,0 @@
-import target as target
-import os
-
-
-class OutputListener:
-	def add(self, event):
-		if event.port == "ui":
-			print(event.name, ":", event.parameters[0], "seconds")
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.keep_running = False
-	controller.addMyOwnOutputListener(OutputListener())
-	
-	# Get the directory where the currently running Python file is located
-	current_file_directory = os.path.dirname(os.path.abspath(__file__))
-
-	# Create the full path for the log file
-	log_file_path = os.path.join(current_file_directory, "new_log.txt")
-
-	# Set verbose to the log file path
-	controller.setVerbose(log_file_path)
-
-	controller.start()

+ 1 - 0
tests/Test2/expected_trace.txt

@@ -0,0 +1 @@
+1.00 (event name: test_event; port: ui; parameters: ['1.00'])

+ 5 - 0
tests/Test22/PyDEVS/faulty_log.txt

@@ -0,0 +1,5 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: statechart_started_succesfully; port: ui; parameters: ['0.00'])
+0.00 (event name: instance_started_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: instance_disassociated_succesfully; port: ui; parameters: ['0.00', ['linkA[0]']])
+0.00 (event name: instance_linked_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])

+ 38 - 38
tests/Test22/PyDEVS/log.txt

@@ -25,13 +25,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
 			port <input>:
-			port <private_35_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+			port <private_34_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: start_instance; port: None; parameters: ['MainApp[0]']))
@@ -46,12 +46,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -68,8 +68,8 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>: 
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
 			port <input>: 
-			port <private_35_<narrow_cast>>: 
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+			port <private_34_<narrow_cast>>: 
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
@@ -82,7 +82,7 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>: 
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Output Port Configuration:
 			port <port1>:
 				('MainApp', 'MainApp', (event name: instance_started; port: None; parameters: ['MainApp[0]']))
@@ -98,13 +98,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: create_instance; port: None; parameters: ['linkA', 'A']))
 			port <input>:
-			port <private_36_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x10732d580>}
+			port <private_35_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x10484fa10>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -113,7 +113,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -128,12 +128,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x10732d580>}
+		New State: {0: <target.AInstance object at 0x10484fa10>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -149,13 +149,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_35_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+			port <private_34_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_created; port: None; parameters: ['linkA[0]']))
@@ -167,7 +167,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -179,7 +179,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -195,12 +195,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
@@ -217,13 +217,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: start_instance; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_36_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x10732d580>}
+			port <private_35_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x10484fa10>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -238,12 +238,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x10732d580>}
+		New State: {0: <target.AInstance object at 0x10484fa10>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
@@ -260,13 +260,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_35_<narrow_cast>>:
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+			port <private_34_<narrow_cast>>:
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Output Port Configuration:
 			port <port1>:
 				('A', 'MainApp', (event name: instance_started; port: None; parameters: ['linkA[0]']))
@@ -278,7 +278,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -290,7 +290,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -306,12 +306,12 @@ __  Current Time:   0.000000 __________________________________________
 		Input Port Configuration:
 			port <input>:
 				('MainApp', 'A', (event name: link_check; port: None; parameters: ['linkA[0]']))
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.MainApp>
-		New State: {0: <target.MainAppInstance object at 0x1072c74a0>}
+		New State: {0: <target.MainAppInstance object at 0x1048ff7a0>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 				('MainApp', 'A', (event name: link_check; port: None; parameters: ['linkA[0]']))
@@ -329,13 +329,13 @@ __  Current Time:   0.000000 __________________________________________
 			port <obj_manager_in>:
 				('MainApp', 'A', (event name: link_check; port: None; parameters: ['linkA[0]']))
 			port <input>:
-			port <private_36_<narrow_cast>>:
-		New State: {0: <target.AInstance object at 0x10732d580>}
+			port <private_35_<narrow_cast>>:
+		New State: {0: <target.AInstance object at 0x10484fa10>}
 		Next scheduled internal transition at time 0.000000
 
 
 	INTERNAL TRANSITION in model <controller.ObjectManager>
-		New State: <target.ObjectManagerState object at 0x10732d160>
+		New State: <target.ObjectManagerState object at 0x104820710>
 		Output Port Configuration:
 			port <port1>:
 			port <port2>:
@@ -347,7 +347,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x10732d580>}
+		New State: {0: <target.AInstance object at 0x10484fa10>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:
@@ -358,7 +358,7 @@ __  Current Time:   0.000000 __________________________________________
 
 
 	INTERNAL TRANSITION in model <controller.A>
-		New State: {0: <target.AInstance object at 0x10732d580>}
+		New State: {0: <target.AInstance object at 0x10484fa10>}
 		Output Port Configuration:
 			port <obj_manager_out>:
 			port <ui>:

+ 0 - 20
tests/Test22/PyDEVS/runner.py

@@ -1,20 +0,0 @@
-import target as target
-from sccd.runtime.DEVS_loop import DEVSSimulator
-from sccd.runtime.statecharts_core import Event
-
-class OutputListener:
-	def add(self, events):
-		for event in events:
-			if event.port == "ui":
-				print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller(name="controller")
-	refs = {"ui": controller.in_ui}
-	sim = DEVSSimulator(controller, refs)
-
-	listener = OutputListener()
-	sim.setListenPorts(controller.out_ui, listener.add)
-	sim.simulate()
-

+ 0 - 16
tests/Test22/Python/runner.py

@@ -1,16 +0,0 @@
-import target as target
-from sccd.runtime.statecharts_core import Event
-import threading
-
-class OutputListener:
-	def add(self, event):
-		if event.port == "ui":
-			print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.keep_running = False
-	controller.addMyOwnOutputListener(OutputListener())
-	controller.setVerbose(None)
-	controller.start()

+ 6 - 0
tests/Test22/expected_trace.txt

@@ -0,0 +1,6 @@
+0.00 (event name: instance_created_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: statechart_started_succesfully; port: ui; parameters: ['0.00'])
+0.00 (event name: instance_started_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+0.00 (event name: instance_disassociated_succesfully; port: ui; parameters: ['0.00', ['linkA[0]']])
+0.00 (event name: instance_linked_succesfully; port: ui; parameters: ['0.00', 'linkA[0]'])
+

+ 0 - 20
tests/Test23/PyDEVS/runner.py

@@ -1,20 +0,0 @@
-import target as target
-from sccd.runtime.DEVS_loop import DEVSSimulator
-from sccd.runtime.statecharts_core import Event
-
-class OutputListener:
-	def add(self, events):
-		for event in events:
-			if event.port == "ui":
-				print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller(name="controller")
-	refs = {"ui": controller.in_ui}
-	sim = DEVSSimulator(controller, refs)
-
-	listener = OutputListener()
-	sim.setListenPorts(controller.out_ui, listener.add)
-	sim.simulate()
-

+ 0 - 0
tests/Test23/Python/new_log.txt


+ 0 - 16
tests/Test23/Python/runner.py

@@ -1,16 +0,0 @@
-import target as target
-from sccd.runtime.statecharts_core import Event
-import threading
-
-class OutputListener:
-	def add(self, event):
-		if event.port == "ui":
-			print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.keep_running = False
-	controller.addMyOwnOutputListener(OutputListener())
-	controller.setVerbose(None)
-	controller.start()

+ 0 - 4
tests/Test29/PyDEVS/log.txt

@@ -1,4 +0,0 @@
-0.00s - Debugger warning: It seems that frozen modules are being used, which may
-0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
-0.00s - to python to disable frozen modules.
-0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.

+ 0 - 20
tests/Test29/PyDEVS/runner.py

@@ -1,20 +0,0 @@
-import target as target
-from sccd.runtime.DEVS_loop import DEVSSimulator
-from sccd.runtime.statecharts_core import Event
-
-class OutputListener:
-	def add(self, events):
-		for event in events:
-			if event.port == "ui":
-				print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller(name="controller")
-	refs = {"ui": controller.in_ui}
-	sim = DEVSSimulator(controller, refs)
-
-	listener = OutputListener()
-	sim.setListenPorts(controller.out_ui, listener.add)
-	sim.simulate()
-

+ 0 - 243
tests/Test29/PyDEVS/target.py

@@ -1,243 +0,0 @@
-"""
-Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration) and Sam Pieters (DEVS)
-
-Model author: Sam Pieters
-Model name:   Dissasociate an instance
-Model description:
-Test 12: Dissasociate an instance
-"""
-
-from sccd.runtime.DEVS_statecharts_core import *
-
-# package "Dissasociate an instance"
-
-class MainAppInstance(RuntimeClassBase):
-    def __init__(self, atomdevs):
-        RuntimeClassBase.__init__(self, atomdevs)
-        self.associations = {}
-        self.associations["linkA"] = Association("A", 0, -1)
-        
-        self.semantics.big_step_maximality = StatechartSemantics.TakeMany
-        self.semantics.internal_event_lifeline = StatechartSemantics.Queue
-        self.semantics.input_event_lifeline = StatechartSemantics.FirstComboStep
-        self.semantics.priority = StatechartSemantics.SourceParent
-        self.semantics.concurrency = StatechartSemantics.Single
-        
-        # build Statechart structure
-        self.build_statechart_structure()
-        
-        # call user defined constructor
-        MainAppInstance.user_defined_constructor(self)
-        port_name = Ports.addInputPort("<narrow_cast>", self)
-        atomdevs.addInPort(port_name)
-    
-    def user_defined_constructor(self):
-        self.association_name = None
-    
-    def user_defined_destructor(self):
-        pass
-    
-    
-    # builds Statechart structure
-    def build_statechart_structure(self):
-        
-        # state <root>
-        self.states[""] = State(0, "", self)
-        
-        # state /state1
-        self.states["/state1"] = State(1, "/state1", self)
-        self.states["/state1"].setEnter(self._state1_enter)
-        
-        # state /state2
-        self.states["/state2"] = State(2, "/state2", self)
-        
-        # state /state3
-        self.states["/state3"] = State(3, "/state3", self)
-        self.states["/state3"].setEnter(self._state3_enter)
-        
-        # state /state4
-        self.states["/state4"] = State(4, "/state4", self)
-        self.states["/state4"].setEnter(self._state4_enter)
-        
-        # add children
-        self.states[""].addChild(self.states["/state1"])
-        self.states[""].addChild(self.states["/state2"])
-        self.states[""].addChild(self.states["/state3"])
-        self.states[""].addChild(self.states["/state4"])
-        self.states[""].fixTree()
-        self.states[""].default_state = self.states["/state1"]
-        
-        # transition /state1
-        _state1_0 = Transition(self, self.states["/state1"], [self.states["/state2"]])
-        _state1_0.setAction(self._state1_0_exec)
-        _state1_0.setTrigger(Event("instance_created", None))
-        self.states["/state1"].addTransition(_state1_0)
-        
-        # transition /state2
-        _state2_0 = Transition(self, self.states["/state2"], [self.states["/state3"]])
-        _state2_0.setAction(self._state2_0_exec)
-        _state2_0.setTrigger(Event("instance_started", None))
-        self.states["/state2"].addTransition(_state2_0)
-        
-        # transition /state3
-        _state3_0 = Transition(self, self.states["/state3"], [self.states["/state4"]])
-        _state3_0.setAction(self._state3_0_exec)
-        _state3_0.setTrigger(Event("instance_disassociated", None))
-        self.states["/state3"].addTransition(_state3_0)
-    
-    def _state1_enter(self):
-        self.big_step.outputEventOM(Event("create_instance", None, [self, "linkA", "A"]))
-    
-    def _state3_enter(self):
-        self.big_step.outputEventOM(Event("disassociate_instance", None, [self, "linkA"]))
-    
-    def _state4_enter(self):
-        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.association_name, Event("sanity_check", None, [])]))
-    
-    def _state1_0_exec(self, parameters):
-        association_name = parameters[0]
-        self.association_name = association_name
-        self.big_step.outputEvent(Event("instance_created_succesfully", self.getOutPortName("ui"), [str('%.2f' % (self.getSimulatedTime() / 1000.0)), association_name]))
-        self.big_step.outputEventOM(Event("start_instance", None, [self, association_name]))
-    
-    def _state2_0_exec(self, parameters):
-        association_name = parameters[0]
-        self.big_step.outputEvent(Event("instance_started_succesfully", self.getOutPortName("ui"), [str('%.2f' % (self.getSimulatedTime() / 1000.0)), association_name]))
-        self.big_step.outputEventOM(Event("narrow_cast", None, [self, association_name, Event("link_check", None, [association_name])]))
-    
-    def _state3_0_exec(self, parameters):
-        deleted_links = parameters[0]
-        self.big_step.outputEvent(Event("instance_disassociated_succesfully", self.getOutPortName("ui"), [str('%.2f' % (self.getSimulatedTime() / 1000.0)), deleted_links]))
-    
-    def initializeStatechart(self):
-        # enter default state
-        self.default_targets = self.states["/state1"].getEffectiveTargetStates()
-        RuntimeClassBase.initializeStatechart(self)
-
-class MainApp(ObjectManagerBase):
-    def __init__(self, name):
-        ObjectManagerBase.__init__(self, name)
-        self.input = self.addInPort("input")
-        self.output = self.addOutPort("ui")
-        self.outputs["linkA"] = self.addOutPort("linkA")
-        self.instances[self.next_instance] = MainAppInstance(self)
-        self.next_instance = self.next_instance + 1
-    
-    def constructObject(self, parameters):
-        new_instance = MainAppInstance(self)
-        return new_instance
-
-class AInstance(RuntimeClassBase):
-    def __init__(self, atomdevs):
-        RuntimeClassBase.__init__(self, atomdevs)
-        self.associations = {}
-        
-        self.semantics.big_step_maximality = StatechartSemantics.TakeMany
-        self.semantics.internal_event_lifeline = StatechartSemantics.Queue
-        self.semantics.input_event_lifeline = StatechartSemantics.FirstComboStep
-        self.semantics.priority = StatechartSemantics.SourceParent
-        self.semantics.concurrency = StatechartSemantics.Single
-        
-        # build Statechart structure
-        self.build_statechart_structure()
-        
-        # call user defined constructor
-        AInstance.user_defined_constructor(self)
-        port_name = Ports.addInputPort("<narrow_cast>", self)
-        atomdevs.addInPort(port_name)
-    
-    def user_defined_constructor(self):
-        pass
-    
-    def user_defined_destructor(self):
-        pass
-    
-    
-    # builds Statechart structure
-    def build_statechart_structure(self):
-        
-        # state <root>
-        self.states[""] = State(0, "", self)
-        
-        # state /state1
-        self.states["/state1"] = State(1, "/state1", self)
-        self.states["/state1"].setEnter(self._state1_enter)
-        
-        # state /state2
-        self.states["/state2"] = State(2, "/state2", self)
-        
-        # add children
-        self.states[""].addChild(self.states["/state1"])
-        self.states[""].addChild(self.states["/state2"])
-        self.states[""].fixTree()
-        self.states[""].default_state = self.states["/state1"]
-        
-        # transition /state1
-        _state1_0 = Transition(self, self.states["/state1"], [self.states["/state2"]])
-        _state1_0.setTrigger(None)
-        self.states["/state1"].addTransition(_state1_0)
-        
-        # transition /state2
-        _state2_0 = Transition(self, self.states["/state2"], [self.states["/state2"]])
-        _state2_0.setAction(self._state2_0_exec)
-        _state2_0.setTrigger(Event("link_check", None))
-        self.states["/state2"].addTransition(_state2_0)
-        _state2_1 = Transition(self, self.states["/state2"], [self.states["/state2"]])
-        _state2_1.setAction(self._state2_1_exec)
-        _state2_1.setTrigger(Event("sanity_check", None))
-        self.states["/state2"].addTransition(_state2_1)
-    
-    def _state1_enter(self):
-        self.big_step.outputEvent(Event("statechart_started_succesfully", self.getOutPortName("ui"), [str('%.2f' % (self.getSimulatedTime() / 1000.0))]))
-    
-    def _state2_0_exec(self, parameters):
-        link_name = parameters[0]
-        self.big_step.outputEvent(Event("instance_linked_succesfully", self.getOutPortName("ui"), [str('%.2f' % (self.getSimulatedTime() / 1000.0)), link_name]))
-    
-    def _state2_1_exec(self, parameters):
-        self.big_step.outputEvent(Event("not_possible", self.getOutPortName("ui"), [str('%.2f' % (self.getSimulatedTime() / 1000.0))]))
-    
-    def initializeStatechart(self):
-        # enter default state
-        self.default_targets = self.states["/state1"].getEffectiveTargetStates()
-        RuntimeClassBase.initializeStatechart(self)
-
-class A(ObjectManagerBase):
-    def __init__(self, name):
-        ObjectManagerBase.__init__(self, name)
-        self.input = self.addInPort("input")
-        self.output = self.addOutPort("ui")
-    
-    def constructObject(self, parameters):
-        new_instance = AInstance(self)
-        return new_instance
-
-class ObjectManagerState:
-    def __init__(self):
-        self.to_send = [("MainApp", "MainApp", Event("start_instance", None, ["MainApp[0]"], 0))]
-
-class ObjectManager(TheObjectManager):
-    def __init__(self, name):
-        TheObjectManager.__init__(self, name)
-        self.State = ObjectManagerState()
-        self.input = self.addInPort("input")
-        self.output["MainApp"] = self.addOutPort()
-        self.output["A"] = self.addOutPort()
-
-class Controller(CoupledDEVS):
-    def __init__(self, name):
-        CoupledDEVS.__init__(self, name)
-        self.in_ui = self.addInPort("ui")
-        Ports.addInputPort("ui")
-        self.out_ui = self.addOutPort("ui")
-        Ports.addOutputPort("ui")
-        self.objectmanager = self.addSubModel(ObjectManager("ObjectManager"))
-        self.atomic0 = self.addSubModel(MainApp("MainApp"))
-        self.atomic1 = self.addSubModel(A("A"))
-        self.connectPorts(self.atomic0.obj_manager_out, self.objectmanager.input)
-        self.connectPorts(self.objectmanager.output["MainApp"], self.atomic0.obj_manager_in)
-        self.connectPorts(self.atomic0.outputs["linkA"], self.atomic1.input)
-        self.connectPorts(self.atomic1.obj_manager_out, self.objectmanager.input)
-        self.connectPorts(self.objectmanager.output["A"], self.atomic1.obj_manager_in)
-        self.connectPorts(self.atomic0.output, self.out_ui)
-        self.connectPorts(self.atomic1.output, self.out_ui)

+ 0 - 8
tests/Test29/Python/log.txt

@@ -1,8 +0,0 @@
-instance_created_succesfully , received on: 0.00 seconds, parameters: ['linkA[0]']
-statechart_started_succesfully , received on: 0.00 seconds, parameters: []
-constructor_initialized_succesfully , received on: 0.00 seconds, parameters: []
-instance_started_succesfully , received on: 0.00 seconds, parameters: ['linkA[0]']
-0.00s - Debugger warning: It seems that frozen modules are being used, which may
-0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
-0.00s - to python to disable frozen modules.
-0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.

+ 0 - 0
tests/Test29/Python/new_log.txt


+ 0 - 16
tests/Test29/Python/runner.py

@@ -1,16 +0,0 @@
-import target as target
-from sccd.runtime.statecharts_core import Event
-import threading
-
-class OutputListener:
-	def add(self, event):
-		if event.port == "ui":
-			print(event.name, ", received on:", event.parameters[0], "seconds, parameters:", event.parameters[1:])
-				
-
-if __name__ == '__main__':
-	controller = target.Controller()
-	controller.keep_running = False
-	controller.addMyOwnOutputListener(OutputListener())
-	controller.setVerbose(None)
-	controller.start()

+ 0 - 0
tests/Test3/PyDEVS/faulty_log.txt


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio