Skip to content

Commit

Permalink
Merge 7d4cc03 into d40a9e9
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDecan committed Jun 28, 2018
2 parents d40a9e9 + 7d4cc03 commit aec2dc2
Show file tree
Hide file tree
Showing 18 changed files with 494 additions and 137 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -7,10 +7,21 @@ Unreleased
- (Added) Priority can be set for transitions (using *low*, *high* or any integer in yaml). transitions
are selected according to their priorities (still following eventless and inner-first/source state semantics).
- (Added) A ``sismic.testing`` module containing some primitives to ease unit testing.
- (Added) A ``sismic.clock`` module with a ``Clock`` base class and three direct implementations,
namely ``SimulatedClock``, ``UtcClock`` and ``SynchronizedClock``. A ``SimulatedClock`` allows to manually or automatically
change the time, while a ``WallClock`` as the expected behaviour of a wall-clock.
``Clock`` instances are used by the interpreter to get the current time during execution.
See documentation for more information.
- (Added) An ``Interpreter.clock`` attribute that stores an instance of the newly added ``Clock`` class.
- (Changed) ``interpreter.time`` represents the time of the last executed step, not the current
time. Use ``interpreter.clock.time`` instead.
- (Changed) ``helpers.run_in_background`` no longer synchronizes the interpreter clock.
Use the ``start()`` method of ``interpreter.clock`` or an ``UtcClock`` instance instead.
- (Fixed) State *on entry* time (used for ``idle`` and ``after``) is set after the *on entry*
action is executed, making the two predicates more accurate when long-running actions are
executed when a state is entered. Similarly, ``idle`` is reset after the action of a transition
is performed, not before.
- (Deprecated) Setting ``Interpreter.time`` is deprecated, set time with ``Interpreter.clock.time`` instead.


1.2.2 (2018-06-21)
Expand Down
1 change: 1 addition & 0 deletions README.rst
Expand Up @@ -24,6 +24,7 @@ More specifically, Sismic provides:

- An easy way to define and to import statecharts, based on the human-friendly YAML markup language
- A statechart interpreter offering a discrete, step-by-step, and fully observable simulation engine
- Fully controllable simulation clock, with support for real and simulated time
- Built-in support for expressing actions and guards using regular Python code, can be easily extended to other programming languages
- A design-by-contract approach for statecharts: contracts can be specified to express invariants, pre- and postconditions on states and transitions
- Runtime checking of behavioral properties expressed as statecharts
Expand Down
11 changes: 11 additions & 0 deletions docs/api/clock.rst
@@ -0,0 +1,11 @@
Module *clock*
==============

.. automodule:: sismic.clock
:members:
:member-order: bysource
:show-inheritance:
:inherited-members:
:imported-members:


4 changes: 2 additions & 2 deletions docs/examples/stopwatch/stopwatch_gui_external.py
Expand Up @@ -29,8 +29,8 @@ def __init__(self, master=None):
# Create a stopwatch object and pass it to the interpreter
self.stopwatch = Stopwatch()
self.interpreter = Interpreter(statechart, initial_context={'stopwatch': self.stopwatch})
self.interpreter.time = time.time()

self.interpreter.clock.start()
# Run the interpreter
self.run()

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Expand Up @@ -37,6 +37,7 @@ Sismic provides the following features:

- An easy way to define and to import statecharts, based on the human-friendly YAML markup language
- A statechart interpreter offering a discrete, step-by-step, and fully observable simulation engine
- Fully controllable simulation clock, with support for real and simulated time
- Built-in support for expressing actions and guards using regular Python code, can be easily extended to other programming languages
- A design-by-contract approach for statecharts: contracts can be specified to express invariants, pre- and postconditions on states and transitions
- Runtime checking of behavioral properties expressed as statecharts
Expand Down

0 comments on commit aec2dc2

Please sign in to comment.