Quellcode durchsuchen

debugger does micro steps \o/

Cláudio Gomes vor 9 Jahren
Ursprung
Commit
194bd6f672

+ 422 - 413
debugging_fsa_cbd_composition/cbdsimulator/cbdsim_parallel_debugging.xml

@@ -1,417 +1,426 @@
 <?xml version="1.0" ?>
 <diagram name="CBDSimulator" author="Sadaf Mustafiz and Claudio Gomes and Simon Van Mierlo">
-    <description>
-        A CBD simulator.
-    </description>
-    
-    <inport name="user_input" />
-    <inport name="user_output" />
-    
-    <top>
-        from sccd.runtime.libs.ui import *
-        from sccd.runtime.libs.utils import *
-        from CBD_Controller import CBDController
-        import Options
-        
-        class Breakpoint:
-            def __init__(self, name, function, enabled, disable_on_trigger):
-                self.name = name
-                self.function = function
-                self.enabled = enabled
-                self.disable_on_trigger = disable_on_trigger
-    </top>
-    
-    <class name="CBDSimulator" default="True">
-        <attribute name="iteration"/>
-        <attribute name="delta"/>
-        <attribute name="clock"/>
-        <attribute name="state"/>
-        <attribute name="model"/>
-        <attribute name="depGraph"/>
-        <attribute name="strongComponentList"/>
-        <attribute name="currentCompIdx"/>
-        <attribute name="cbdController"/>
-        <attribute name="options"/>
-        <method name="CBDSimulator">
-            <parameter name="options"/>
-            <parameter name="model"/>
-            <body>
-            <![CDATA[
-                self.options = options
-                self.delta = self.options.getDeltaT()
-                self.model = model
-            ]]>
-            </body>
-        </method>
-        <method name="initializeSimulation">
-            <body>
-            <![CDATA[
-                self.iteration = 0
-                self.clock = 0.0
-                self.cbdController = CBDController(self.model, self.delta)
-                self.cbdController.initSimulation()
-                self.state = {b.getBlockName(): b.getSignal() for b in self.model.getBlocks()}
-            ]]>
-            </body>
-        </method>
-        <method name="initializeBigStep">
-            <body>
-            <![CDATA[
-                self.currentCompIdx = 0
-                self.depGraph = self.cbdController.createDepGraph(self.iteration)
-                self.strongComponentList = self.cbdController.createStrongComponents(self.depGraph, self.iteration)
-            ]]>
-            </body>
-        </method>
-        <method name="initializeSmallStep">
-            <body>
-            <![CDATA[
-                self.small_step_executed = False
-            ]]>
-            </body>
-        </method>
-        <method name="finalizeSimulation">
-            <body>
-            <![CDATA[
-                from bokeh.plotting import figure, output_file, show    
-                times = []
-                values = []
-                for timeValuePair in self.model.getSignal("neg"):
-                    times.append(timeValuePair.time)
-                    values.append(timeValuePair.value)
+	<description>
+		A CBD simulator.
+	</description>
+	
+	<inport name="user_input" />
+	<inport name="user_output" />
+	
+	<top>
+		from sccd.runtime.libs.ui import *
+		from sccd.runtime.libs.utils import *
+		from CBD_Controller import CBDController
+		import Options
+		
+		class Breakpoint:
+			def __init__(self, name, function, enabled, disable_on_trigger):
+				self.name = name
+				self.function = function
+				self.enabled = enabled
+				self.disable_on_trigger = disable_on_trigger
+	</top>
+	
+	<class name="CBDSimulator" default="True">
+		<attribute name="iteration"/>
+		<attribute name="delta"/>
+		<attribute name="clock"/>
+		<attribute name="state"/>
+		<attribute name="model"/>
+		<attribute name="depGraph"/>
+		<attribute name="strongComponentList"/>
+		<attribute name="currentCompIdx"/>
+		<attribute name="cbdController"/>
+		<attribute name="options"/>
+		<method name="CBDSimulator">
+			<parameter name="options"/>
+			<parameter name="model"/>
+			<body>
+			<![CDATA[
+				self.options = options
+				self.delta = self.options.getDeltaT()
+				self.model = model
+			]]>
+			</body>
+		</method>
+		<method name="initializeSimulation">
+			<body>
+			<![CDATA[
+				self.iteration = 0
+				self.clock = 0.0
+				self.cbdController = CBDController(self.model, self.delta)
+				self.cbdController.initSimulation()
+				self.state = {b.getBlockName(): b.getSignal() for b in self.model.getBlocks()}
+			]]>
+			</body>
+		</method>
+		<method name="initializeBigStep">
+			<body>
+			<![CDATA[
+				self.currentCompIdx = 0
+				self.depGraph = self.cbdController.createDepGraph(self.iteration)
+				self.strongComponentList = self.cbdController.createStrongComponents(self.depGraph, self.iteration)
+			]]>
+			</body>
+		</method>
+		<method name="initializeSmallStep">
+			<body>
+			<![CDATA[
+				self.small_step_executed = False
+			]]>
+			</body>
+		</method>
+		<method name="finalizeSimulation">
+			<body>
+			<![CDATA[
+				from bokeh.plotting import figure, output_file, show    
+				times = []
+				values = []
+				for timeValuePair in self.model.getSignal("neg"):
+					times.append(timeValuePair.time)
+					values.append(timeValuePair.value)
 
-                output_file("./plot.html", title="Plot")
-                p = figure(title="Something vs Otherthing", x_axis_label="Time", y_axis_label="Values")
-                p.line(times, values, legend="Something", line_width=1, line_color="red")
-                show(p)
-                print 'Simulation finalized.'
-            ]]>
-            </body>
-        </method>
-        <method name="finalizeBigStep">
-            <body>
-            <![CDATA[
-                self.advanceTime()
-            ]]>
-            </body>        
-        </method>
-        <method name="finalizeSmallStep">
-            <body>
-            <![CDATA[
-                self.currentCompIdx = self.currentCompIdx + 1
-            ]]>
-            </body>
-        </method>
-        <method name="endConditionSimulation">
-            <body>
-            <![CDATA[
-                return self.iteration >= self.options.getMaxIterations()
-            ]]>
-            </body>
-        </method>
-        <method name="endConditionBigStep">
-            <body>
-            <![CDATA[
-                return self.currentCompIdx >= len(self.strongComponentList)
-            ]]>
-            </body>
-        </method>
-        <method name="endConditionSmallStep">
-            <body>
-            <![CDATA[
-                return self.small_step_executed
-            ]]>
-            </body>
-        </method>
-        <method name="advanceTime">
-            <body>
-            <![CDATA[
-                self.iteration = self.iteration + 1
-                self.cbdController.advanceTimeStep()
-                self.clock = self.clock + self.delta
-            ]]>
-            </body>
-        </method>
-        <method name="currentComponentIsCycle">
-            <body>
-            <![CDATA[
-                return self.cbdController.componentIsCycle(self.strongComponentList[self.currentCompIdx], self.depGraph)
-            ]]>
-            </body>
-        </method>
-        <method name="computeBlock">
-            <body>
-            <![CDATA[
-                if self.currentComponentIsCycle():
-                    self.cbdController.computeNextAlgebraicLoop(self.strongComponentList[self.currentCompIdx], self.iteration)
-                else:
-                    self.cbdController.computeNextBlock(self.strongComponentList[self.currentCompIdx], self.iteration)
-                self.state = {b.getBlockName(): b.getSignal() for b in self.model.getBlocks()}
-            ]]>
-            </body>
-        </method>
-        <!-- Debugging methods /-->
-        <method name="initializeSimulationDebugger">
-            <body>
-            <![CDATA[
-                self.breakpoints = []
-                self.triggered_bp = None
-            ]]>
-            </body>
-        </method>
-        <method name="addBreakpoint">
-            <parameter name="name" />
-            <parameter name="function" />
-            <parameter name="enabled" default="True" />
-            <parameter name="disable_on_trigger" default="True" />
-            <body>
-            <![CDATA[
-                if len([bp for bp in self.breakpoints if bp.name == name]) > 0:
-                    return -1
-                self.breakpoints.append(Breakpoint(name, function, enabled, disable_on_trigger))
-                return 0
-            ]]>
-            </body>
-        </method>
-        <method name="delBreakpoint">
-            <parameter name="name" />
-            <body>
-            <![CDATA[
-                if len([bp for bp in self.breakpoints if bp.name == name]) == 0:
-                    return -1
-                self.breakpoints = [bp for bp in self.breakpoints if bp.name != name]
-                return 0
-            ]]>
-            </body>
-        </method>
-        <method name="toggleBreakpoint">
-            <parameter name="name" />
-            <body>
-            <![CDATA[
-                if len([bp for bp in self.breakpoints if bp.name == name]) == 0:
-                    return -1
-                for bp in self.breakpoints:
-                    if bp.name == name:
-                        bp.enabled = not bp.enabled
-                        break
-                return 0
-            ]]>
-            </body>
-        </method>
-        <method name="breakpointTriggers">
-            <body>
-            <![CDATA[
-                self.triggered_bp = None
-                for bp in self.breakpoints:
-                    if not bp.enabled:
-                        continue
-                    # include the function in the scope...
-                    functionCallable = eval(bp.function)
-                    if functionCallable(self.clock, self.state):
-                        # triggered!
-                        self.triggered_bp = bp.name
-                        if bp.disable_on_trigger:
-                            bp.enabled = False
-                        return True
-                    else:
-                        # not triggered, so continue
-                        continue
-                return False
-            ]]>
-            </body>
-        </method>
-        <scxml initial="Main" final="SimulationComplete">
-            <parallel id="Main">
-                <state id="SimulationState" initial="Paused">
-                    <state id="Paused">
-                        <transition target="../Continuous" event="continuous" port="user_input"/>
-                        <state id="BreakpointTriggered" />
-                    </state>
-                    <state id="Continuous">
-                        <transition target="../Paused" event="pause" port="user_input"/>
-                        <transition target="../Paused/BreakpointTriggered" cond="self.breakpointTriggers()">
-                            <raise event="Breakpoint.Triggered" />
-                        </transition>
-                    </state>
-                </state>
-                <state id="BreakpointManager" initial="Listening">
-                    <state id="Listening">
-                        <transition target="." event="add_breakpoint" port="user_input">
-                            <parameter name="name"/>
-                            <parameter name="function"/>
-                            <parameter name="enabled"/>
-                            <parameter name="disable_on_trigger"/>
-                            <script>
-                                result = self.addBreakpoint(name, function, bool(enabled), bool(disable_on_trigger))
-                            </script>
-                            <raise event="add_breakpoint_result" port="user_output">
-                                <parameter expr="result" />
-                            </raise>
-                        </transition>
-                        <transition target="." event="del_breakpoint" port="user_input">
-                            <parameter name="name"/>
-                            <script>
-                                result = self.delBreakpoint(name)
-                            </script>
-                            <raise event="del_breakpoint_result" port="user_output">
-                                <parameter expr="result" />
-                            </raise>
-                        </transition>
-                        <transition target="." event="toggle_breakpoint" port="user_input">
-                            <parameter name="name"/>
-                            <script>
-                                result = self.toggleBreakpoint(name)
-                            </script>
-                            <raise event="toggle_breakpoint_result" port="user_output">
-                                <parameter expr="result" />
-                            </raise>
-                        </transition>
-                        <transition target="." event="list_breakpoints" port="user_input">
-                            <raise event="list_breakpoints_result" port="user_output">
-                                <parameter expr="[bp.name for bp in self.breakpoints]" />
-                            </raise>
-                        </transition>
-                    </state>
-                </state>
-                <state id="DebugSimulation" initial="Started">
-                    <state id="Stopped"/>
-                    <state id="Started">
-                        <transition target="../Initialized">
-                            <script>
-                            <![CDATA[
-                                self.initializeSimulation()
-                                self.initializeSimulationDebugger()
-                            ]]>
-                            </script>
-                        </transition>
-                    </state>
-                    <state id="Initialized">
-                        <transition target="../CheckTermination" />
-                    </state>
-                    <state id="CheckTermination">
-                        <transition target="../InitializingChild" cond="INSTATE('../../SimulationState/Continuous') and not self.endConditionSimulation()">
-                            <raise event="BigStep.Reset" />
-                        </transition>
-                        <transition target="../Stopped" cond="INSTATE('../../SimulationState/Continuous') and self.endConditionSimulation()">
-                            <script>
-                                print 'Simulation finished'
-                                self.finalizeSimulation()
-                            </script>
-                        </transition>
-                    </state>
-                    <state id="InitializingChild">
-                        <transition target="../Executing" event="BigStep.Initialized">
-                            <raise event="BigStep.Execute" />
-                        </transition>
-                    </state>
-                    <state id="Executing">
-                        <transition target="../CheckTermination" event="BigStep.Finished" />
-                    </state>
-                </state>
-                <state id="ExecuteBigStep" initial="Stopped">
-                    <state id="Stopped">
-                        <transition target="../Started" event="BigStep.Reset" />
-                    </state>
-                    <state id="Started">
-                        <transition target="../Initialized">
-                            <raise event="BigStep.Initialized" />
-                            <script>
-                            <![CDATA[
-                                self.initializeBigStep()
-                            ]]>
-                            </script>
-                        </transition>
-                    </state>
-                    <state id="Initialized">
-                        <transition target="../CheckTermination" event="BigStep.Execute" />
-                    </state>
-                    <state id="CheckTermination">
-                        <transition target="../InitializingChild" cond="not self.endConditionBigStep()">
-                            <raise event="SmallStep.Reset" />
-                        </transition>
-                        <transition target="../Stopped" cond="self.endConditionBigStep()">
-                            <script>
-                                print 'big step executed'
-                                self.finalizeBigStep()
-                                print 'Iteration: ' + str(self.iteration)
-                                print 'Clock: ' + str(self.clock)
-                            </script>
-                            <raise event="BigStep.Finished" />
-                        </transition>
-                    </state>
-                    <state id="InitializingChild">
-                        <transition target="../Executing" event="SmallStep.Initialized">
-                            <raise event="SmallStep.Execute" />
-                        </transition>
-                    </state>
-                    <state id="Executing">
-                        <transition target="../CheckTermination" event="SmallStep.Finished" />
-                    </state>
-                </state>
-                <state id="ExecuteSmallStep" initial="Stopped">
-                    <state id="Stopped">
-                        <transition target="../Started" event="SmallStep.Reset" />
-                    </state>
-                    <state id="Started">
-                        <transition target="../Initialized">
-                            <raise event="SmallStep.Initialized" />
-                            <script>
-                            <![CDATA[
-                                self.initializeSmallStep()
-                            ]]>
-                            </script>
-                        </transition>
-                    </state>
-                    <state id="Initialized">
-                        <transition target="../CheckTermination" event="SmallStep.Execute"/>
-                    </state>
-                    <state id="CheckTermination">
-                        <transition target="../InitializingChild" cond="not self.endConditionSmallStep()">
-                            <raise event="Block.Reset" />
-                        </transition>
-                        <transition target="../Stopped" cond="self.endConditionSmallStep()">
-                            <script>
-                                print 'small step executed'
-                                self.finalizeSmallStep()
-                            </script>
-                            <raise event="SmallStep.Finished" />
-                        </transition>
-                    </state>
-                    <state id="InitializingChild">
-                        <transition target="../Executing" event="Block.Initialized">
-                            <raise event="Block.Execute" />
-                        </transition>
-                    </state>
-                    <state id="Executing">
-                        <transition target="../CheckTermination" event="Block.Finished">
-                            <script>
-                                self.small_step_executed = True
-                            </script>
-                        </transition>
-                    </state>
-                </state>
-                <state id="ExecuteBlock" initial="Stopped">
-                    <state id="Stopped">
-                        <transition target="../Started" event="Block.Reset" />
-                    </state>
-                    <state id="Started">
-                        <transition target="../Initialized">
-                            <raise event="Block.Initialized" />
-                        </transition>
-                    </state>
-                    <state id="Initialized">
-                        <transition target="../Executing" event="Block.Execute" />
-                    </state>
-                    <state id="Executing">
-                        <transition target="../Stopped">
-                            <script>
-                                self.computeBlock()
-                            </script>
-                            <raise event="Block.Finished" />
-                        </transition>
-                    </state>
-                </state>
-            </parallel>
-        </scxml>
-    </class>
+				output_file("./plot.html", title="Plot")
+				p = figure(title="Something vs Otherthing", x_axis_label="Time", y_axis_label="Values")
+				p.line(times, values, legend="Something", line_width=1, line_color="red")
+				show(p)
+				print 'Simulation finalized.'
+			]]>
+			</body>
+		</method>
+		<method name="finalizeBigStep">
+			<body>
+			<![CDATA[
+				self.advanceTime()
+			]]>
+			</body>        
+		</method>
+		<method name="finalizeSmallStep">
+			<body>
+			<![CDATA[
+				self.currentCompIdx = self.currentCompIdx + 1
+			]]>
+			</body>
+		</method>
+		<method name="endConditionSimulation">
+			<body>
+			<![CDATA[
+				return self.iteration >= self.options.getMaxIterations()
+			]]>
+			</body>
+		</method>
+		<method name="endConditionBigStep">
+			<body>
+			<![CDATA[
+				return self.currentCompIdx >= len(self.strongComponentList)
+			]]>
+			</body>
+		</method>
+		<method name="endConditionSmallStep">
+			<body>
+			<![CDATA[
+				return self.small_step_executed
+			]]>
+			</body>
+		</method>
+		<method name="advanceTime">
+			<body>
+			<![CDATA[
+				self.iteration = self.iteration + 1
+				self.cbdController.advanceTimeStep()
+				self.clock = self.clock + self.delta
+			]]>
+			</body>
+		</method>
+		<method name="currentComponentIsCycle">
+			<body>
+			<![CDATA[
+				return self.cbdController.componentIsCycle(self.strongComponentList[self.currentCompIdx], self.depGraph)
+			]]>
+			</body>
+		</method>
+		<method name="computeBlock">
+			<body>
+			<![CDATA[
+				if self.currentComponentIsCycle():
+					self.cbdController.computeNextAlgebraicLoop(self.strongComponentList[self.currentCompIdx], self.iteration)
+				else:
+					self.cbdController.computeNextBlock(self.strongComponentList[self.currentCompIdx], self.iteration)
+				self.state = {b.getBlockName(): b.getSignal() for b in self.model.getBlocks()}
+			]]>
+			</body>
+		</method>
+		<!-- Debugging methods /-->
+		<method name="initializeSimulationDebugger">
+			<body>
+			<![CDATA[
+				self.breakpoints = []
+				self.triggered_bp = None
+			]]>
+			</body>
+		</method>
+		<method name="addBreakpoint">
+			<parameter name="name" />
+			<parameter name="function" />
+			<parameter name="enabled" default="True" />
+			<parameter name="disable_on_trigger" default="True" />
+			<body>
+			<![CDATA[
+				if len([bp for bp in self.breakpoints if bp.name == name]) > 0:
+					return -1
+				self.breakpoints.append(Breakpoint(name, function, enabled, disable_on_trigger))
+				return 0
+			]]>
+			</body>
+		</method>
+		<method name="delBreakpoint">
+			<parameter name="name" />
+			<body>
+			<![CDATA[
+				if len([bp for bp in self.breakpoints if bp.name == name]) == 0:
+					return -1
+				self.breakpoints = [bp for bp in self.breakpoints if bp.name != name]
+				return 0
+			]]>
+			</body>
+		</method>
+		<method name="toggleBreakpoint">
+			<parameter name="name" />
+			<body>
+			<![CDATA[
+				if len([bp for bp in self.breakpoints if bp.name == name]) == 0:
+					return -1
+				for bp in self.breakpoints:
+					if bp.name == name:
+						bp.enabled = not bp.enabled
+						break
+				return 0
+			]]>
+			</body>
+		</method>
+		<method name="breakpointTriggers">
+			<body>
+			<![CDATA[
+				self.triggered_bp = None
+				for bp in self.breakpoints:
+					if not bp.enabled:
+						continue
+					# include the function in the scope...
+					functionCallable = eval(bp.function)
+					if functionCallable(self.clock, self.state):
+						# triggered!
+						self.triggered_bp = bp.name
+						if bp.disable_on_trigger:
+							bp.enabled = False
+						return True
+					else:
+						# not triggered, so continue
+						continue
+				return False
+			]]>
+			</body>
+		</method>
+		<scxml initial="Main" final="SimulationComplete">
+			<parallel id="Main">
+				<state id="SimulationState" initial="Paused">
+					<state id="Paused">
+						<transition target="../Continuous" event="continuous" port="user_input"/>
+						<transition target="../BigStep" event="big_step" port="user_input" />
+						<state id="BreakpointTriggered" />
+					</state>
+					<state id="Continuous">
+						<transition target="../Paused" event="pause" port="user_input"/>
+						<transition target="../Paused/BreakpointTriggered" cond="self.breakpointTriggers()">
+							<raise event="Breakpoint.Triggered" />
+						</transition>
+					</state>
+					<state id="BigStep">
+						<transition target="../Paused" event="BigStep.Finished">
+							<raise event="BigStep.Finished" port="user_output" />
+							<raise event="State" port="user_output">
+								<parameter expr="self.clock" />
+							</raise>
+						</transition>
+					</state>
+				</state>
+				<state id="BreakpointManager" initial="Listening">
+					<state id="Listening">
+						<transition target="." event="add_breakpoint" port="user_input">
+							<parameter name="name"/>
+							<parameter name="function"/>
+							<parameter name="enabled"/>
+							<parameter name="disable_on_trigger"/>
+							<script>
+								result = self.addBreakpoint(name, function, bool(enabled), bool(disable_on_trigger))
+							</script>
+							<raise event="add_breakpoint_result" port="user_output">
+								<parameter expr="result" />
+							</raise>
+						</transition>
+						<transition target="." event="del_breakpoint" port="user_input">
+							<parameter name="name"/>
+							<script>
+								result = self.delBreakpoint(name)
+							</script>
+							<raise event="del_breakpoint_result" port="user_output">
+								<parameter expr="result" />
+							</raise>
+						</transition>
+						<transition target="." event="toggle_breakpoint" port="user_input">
+							<parameter name="name"/>
+							<script>
+								result = self.toggleBreakpoint(name)
+							</script>
+							<raise event="toggle_breakpoint_result" port="user_output">
+								<parameter expr="result" />
+							</raise>
+						</transition>
+						<transition target="." event="list_breakpoints" port="user_input">
+							<raise event="list_breakpoints_result" port="user_output">
+								<parameter expr="[bp.name for bp in self.breakpoints]" />
+							</raise>
+						</transition>
+					</state>
+				</state>
+				<state id="DebugSimulation" initial="Started">
+					<state id="Stopped"/>
+					<state id="Started">
+						<transition target="../Initialized">
+							<script>
+							<![CDATA[
+								self.initializeSimulation()
+								self.initializeSimulationDebugger()
+							]]>
+							</script>
+						</transition>
+					</state>
+					<state id="Initialized">
+						<transition target="../CheckTermination" />
+					</state>
+					<state id="CheckTermination">
+						<transition target="../InitializingChild" cond="(INSTATE('../../SimulationState/Continuous') or INSTATE('../../SimulationState/BigStep')) and not self.endConditionSimulation()">
+							<raise event="BigStep.Reset" />
+						</transition>
+						<transition target="../Stopped" cond="(INSTATE('../../SimulationState/Continuous') or INSTATE('../../SimulationState/BigStep')) and self.endConditionSimulation()">
+							<script>
+								print 'Simulation finished'
+								self.finalizeSimulation()
+							</script>
+						</transition>
+					</state>
+					<state id="InitializingChild">
+						<transition target="../Executing" event="BigStep.Initialized">
+							<raise event="BigStep.Execute" />
+						</transition>
+					</state>
+					<state id="Executing">
+						<transition target="../CheckTermination" event="BigStep.Finished" />
+					</state>
+				</state>
+				<state id="ExecuteBigStep" initial="Stopped">
+					<state id="Stopped">
+						<transition target="../Started" event="BigStep.Reset" />
+					</state>
+					<state id="Started">
+						<transition target="../Initialized">
+							<raise event="BigStep.Initialized" />
+							<script>
+							<![CDATA[
+								self.initializeBigStep()
+							]]>
+							</script>
+						</transition>
+					</state>
+					<state id="Initialized">
+						<transition target="../CheckTermination" event="BigStep.Execute" />
+					</state>
+					<state id="CheckTermination">
+						<transition target="../InitializingChild" cond="not self.endConditionBigStep()">
+							<raise event="SmallStep.Reset" />
+						</transition>
+						<transition target="../Stopped" cond="self.endConditionBigStep()">
+							<script>
+								print 'big step executed'
+								self.finalizeBigStep()
+								print 'Iteration: ' + str(self.iteration)
+								print 'Clock: ' + str(self.clock)
+							</script>
+							<raise event="BigStep.Finished" />
+						</transition>
+					</state>
+					<state id="InitializingChild">
+						<transition target="../Executing" event="SmallStep.Initialized">
+							<raise event="SmallStep.Execute" />
+						</transition>
+					</state>
+					<state id="Executing">
+						<transition target="../CheckTermination" event="SmallStep.Finished" />
+					</state>
+				</state>
+				<state id="ExecuteSmallStep" initial="Stopped">
+					<state id="Stopped">
+						<transition target="../Started" event="SmallStep.Reset" />
+					</state>
+					<state id="Started">
+						<transition target="../Initialized">
+							<raise event="SmallStep.Initialized" />
+							<script>
+							<![CDATA[
+								self.initializeSmallStep()
+							]]>
+							</script>
+						</transition>
+					</state>
+					<state id="Initialized">
+						<transition target="../CheckTermination" event="SmallStep.Execute"/>
+					</state>
+					<state id="CheckTermination">
+						<transition target="../InitializingChild" cond="not self.endConditionSmallStep()">
+							<raise event="Block.Reset" />
+						</transition>
+						<transition target="../Stopped" cond="self.endConditionSmallStep()">
+							<script>
+								print 'small step executed'
+								self.finalizeSmallStep()
+							</script>
+							<raise event="SmallStep.Finished" />
+						</transition>
+					</state>
+					<state id="InitializingChild">
+						<transition target="../Executing" event="Block.Initialized">
+							<raise event="Block.Execute" />
+						</transition>
+					</state>
+					<state id="Executing">
+						<transition target="../CheckTermination" event="Block.Finished">
+							<script>
+								self.small_step_executed = True
+							</script>
+						</transition>
+					</state>
+				</state>
+				<state id="ExecuteBlock" initial="Stopped">
+					<state id="Stopped">
+						<transition target="../Started" event="Block.Reset" />
+					</state>
+					<state id="Started">
+						<transition target="../Initialized">
+							<raise event="Block.Initialized" />
+						</transition>
+					</state>
+					<state id="Initialized">
+						<transition target="../Executing" event="Block.Execute" />
+					</state>
+					<state id="Executing">
+						<transition target="../Stopped">
+							<script>
+								self.computeBlock()
+							</script>
+							<raise event="Block.Finished" />
+						</transition>
+					</state>
+				</state>
+			</parallel>
+		</scxml>
+	</class>
 </diagram>

+ 9 - 2
debugging_fsa_cbd_composition/cbdsimulator/run_cbd_sim_debug.py

@@ -4,8 +4,15 @@ import threading
 from Options import Options
 from CBDMultipleOutput.models.HarmonicOscilator import CircleCBDDerivative
 
-# add_breakpoint breakpoint_a lambda clock, state: clock > 3.0 true true
-# continuous
+"""
+Sample interaction with the debugger:
+
+help
+add_breakpoint breakpoint_a lambda clock, state: clock > 1.0 true true
+continuous
+big_step
+
+"""
 
 if __name__ == '__main__':
     options = Options(delta = 0.1)