|
|
@@ -186,6 +186,18 @@
|
|
|
self.realtime_start_time = accurate_time.time() - (self.clock / self.realtime_scale)
|
|
|
</script>
|
|
|
</transition>
|
|
|
+ <transition target="." event="BigStep.Finished">
|
|
|
+ <parameter name="clock" />
|
|
|
+ <parameter name="iteration" />
|
|
|
+ <parameter name="time_next" />
|
|
|
+ <parameter name="state" />
|
|
|
+ <raise event="BigStep.Finished" scope="narrow" target="'parent'">
|
|
|
+ <parameter expr="clock" />
|
|
|
+ <parameter expr="iteration" />
|
|
|
+ <parameter expr="time_next" />
|
|
|
+ <parameter expr="state" />
|
|
|
+ </raise>
|
|
|
+ </transition>
|
|
|
</state>
|
|
|
<state id="Running" initial="Continuous">
|
|
|
<state id="Continuous">
|
|
|
@@ -240,7 +252,7 @@
|
|
|
</transition>
|
|
|
</state>
|
|
|
</state>
|
|
|
- <state id="BigStepState" initial="Uninitialized">
|
|
|
+ <state id="ChildState" initial="Uninitialized">
|
|
|
<state id="Uninitialized">
|
|
|
<transition event="BigStep.Initialized" target="../Initialized" />
|
|
|
</state>
|
|
|
@@ -252,34 +264,9 @@
|
|
|
</transition>
|
|
|
</state>
|
|
|
</state>
|
|
|
- <state id="Initializer" initial="Started">
|
|
|
- <state id="Started">
|
|
|
- <transition target="../Initialized">
|
|
|
- <script>
|
|
|
- <![CDATA[
|
|
|
- self.initialize()
|
|
|
- ]]>
|
|
|
- </script>
|
|
|
- </transition>
|
|
|
- </state>
|
|
|
- <state id="Initialized">
|
|
|
- <transition target="../InitializeDebugger" />
|
|
|
- </state>
|
|
|
- <state id="InitializeDebugger">
|
|
|
- <transition target="../Waiting">
|
|
|
- <script>
|
|
|
- <![CDATA[
|
|
|
- self.initializeDebugger()
|
|
|
- ]]>
|
|
|
- </script>
|
|
|
- <raise event="Simulation.Initialized" scope="narrow" target="'parent'" />
|
|
|
- </transition>
|
|
|
- </state>
|
|
|
- <state id="SettleBeforeWaiting">
|
|
|
- <transition target="../Waiting" after="self.sccd_yield()" />
|
|
|
- </state>
|
|
|
+ <state id="Initializer" initial="Waiting">
|
|
|
<state id="Waiting">
|
|
|
- <transition target="../CreatingChildSimulator" cond="INSTATE('../../ModeSelector/Running') and INSTATE('../../BigStepState/Uninitialized') and not self.endCondition()">
|
|
|
+ <transition target="../CreatingChildSimulator" cond="INSTATE('../../ModeSelector/Running') and INSTATE('../../ChildState/Uninitialized') and not self.endCondition()">
|
|
|
<raise event="create_instance" scope="cd">
|
|
|
<parameter expr="'child_simulator'" />
|
|
|
<parameter expr="'CBDSimulator_BigStep'" />
|
|
|
@@ -303,46 +290,38 @@
|
|
|
<transition target="../Running" event="BigStep.Initialized" />
|
|
|
</state>
|
|
|
<state id="Running">
|
|
|
- <transition target="../SettleBeforeWaiting" event="BigStep.Finished">
|
|
|
- <parameter name="clock" />
|
|
|
- <parameter name="iteration" />
|
|
|
- <parameter name="time_next" />
|
|
|
- <parameter name="state" />
|
|
|
+ <transition target="../SettleBeforeWaiting" event="BigStep.Finished" />
|
|
|
+ </state>
|
|
|
+ <state id="SettleBeforeWaiting">
|
|
|
+ <transition target="../Waiting" after="self.sccd_yield()" />
|
|
|
+ </state>
|
|
|
+ </state>
|
|
|
+ <state id="SimulationFlow" initial="Started">
|
|
|
+ <state id="Started">
|
|
|
+ <transition target="../Initialized">
|
|
|
<script>
|
|
|
<![CDATA[
|
|
|
- self.clock = clock
|
|
|
- self.iteration = iteration
|
|
|
- self.time_next = time_next
|
|
|
- self.state = state
|
|
|
+ self.initialize()
|
|
|
]]>
|
|
|
</script>
|
|
|
</transition>
|
|
|
</state>
|
|
|
- </state>
|
|
|
- <state id="SimulationFlow" initial="Initializing">
|
|
|
- <state id="Initializing">
|
|
|
- <!-- we make sure we are initialized -->
|
|
|
- <!-- TODO: Probably it's best if we move the initialization states to the SimulationFlow state. -->
|
|
|
- <transition target="../Waiting" cond="INSTATE('../../Initializer/Waiting')" />
|
|
|
+ <state id="Initialized">
|
|
|
+ <transition target="../InitializeDebugger" />
|
|
|
</state>
|
|
|
- <state id="Waiting">
|
|
|
- <transition target="../CheckTermination" cond="INSTATE('../../ModeSelector/Running')" />
|
|
|
- <!-- in case a big step triggers the end condition of the simulation -->
|
|
|
- <!-- TODO: Probably we don't need this anymore, since the simulation will always coordinate big steps... -->
|
|
|
- <transition target="../Stopped" cond="self.endCondition()">
|
|
|
+ <state id="InitializeDebugger">
|
|
|
+ <transition target="../Waiting">
|
|
|
<script>
|
|
|
<![CDATA[
|
|
|
- # print 'simulation executed'
|
|
|
- self.finalize()
|
|
|
+ self.initializeDebugger()
|
|
|
]]>
|
|
|
</script>
|
|
|
- <raise event="Simulation.Finished" />
|
|
|
- <raise event="Simulation.Finished" scope="narrow" target="'parent'">
|
|
|
- <parameter expr="self.clock" />
|
|
|
- <parameter expr="self.state" />
|
|
|
- </raise>
|
|
|
+ <raise event="Simulation.Initialized" scope="narrow" target="'parent'" />
|
|
|
</transition>
|
|
|
</state>
|
|
|
+ <state id="Waiting">
|
|
|
+ <transition target="../CheckTermination" cond="INSTATE('../../ModeSelector/Running')" />
|
|
|
+ </state>
|
|
|
<state id="SettleBeforeCheckTermination">
|
|
|
<transition target="../CheckTermination" after="self.sccd_yield()" />
|
|
|
<transition target="../CheckTermination" cond="INSTATE('../../ModeSelector/Paused')">
|
|
|
@@ -353,13 +332,13 @@
|
|
|
</transition>
|
|
|
</state>
|
|
|
<state id="CheckTermination">
|
|
|
- <transition target="../Executing" cond="(INSTATE('../../ModeSelector/Running/Continuous') or INSTATE('../../ModeSelector/Running/BigStep')) and INSTATE('../../BigStepState/Initialized') and not self.endCondition()">
|
|
|
+ <transition target="../Executing" cond="(INSTATE('../../ModeSelector/Running/Continuous') or INSTATE('../../ModeSelector/Running/BigStep')) and INSTATE('../../ChildState/Initialized') and not self.endCondition()">
|
|
|
<raise event="BigStep.Execute" scope="narrow" target="'child_simulator'" />
|
|
|
</transition>
|
|
|
- <transition target="../Executing" cond="INSTATE('../../ModeSelector/Running/SmallStep') and INSTATE('../../BigStepState/Initialized') and not self.endCondition()">
|
|
|
+ <transition target="../Executing" cond="INSTATE('../../ModeSelector/Running/SmallStep') and INSTATE('../../ChildState/Initialized') and not self.endCondition()">
|
|
|
<raise event="SmallStep.Execute" scope="narrow" target="'child_simulator'" />
|
|
|
</transition>
|
|
|
- <transition target="../WaitingRealtime" cond="INSTATE('../../ModeSelector/Running/Realtime') and INSTATE('../../BigStepState/Initialized') and not self.endCondition()" />
|
|
|
+ <transition target="../WaitingRealtime" cond="INSTATE('../../ModeSelector/Running/Realtime') and INSTATE('../../ChildState/Initialized') and not self.endCondition()" />
|
|
|
<transition target="../Stopped" cond="self.endCondition()">
|
|
|
<script>
|
|
|
<![CDATA[
|
|
|
@@ -394,7 +373,20 @@
|
|
|
</transition>
|
|
|
</state>
|
|
|
<state id="Executing">
|
|
|
- <transition target="../SettleBeforeCheckTermination" event="BigStep.Finished" />
|
|
|
+ <transition target="../SettleBeforeCheckTermination" event="BigStep.Finished">
|
|
|
+ <parameter name="clock" />
|
|
|
+ <parameter name="iteration" />
|
|
|
+ <parameter name="time_next" />
|
|
|
+ <parameter name="state" />
|
|
|
+ <script>
|
|
|
+ <![CDATA[
|
|
|
+ self.clock = clock
|
|
|
+ self.iteration = iteration
|
|
|
+ self.time_next = time_next
|
|
|
+ self.state = state
|
|
|
+ ]]>
|
|
|
+ </script>
|
|
|
+ </transition>
|
|
|
</state>
|
|
|
<state id="Stopped" />
|
|
|
</state>
|