A clock that keeps track of model time at a level of the model hierarchy
and relates it to the time of the enclosing model, if there is one. The time
of the enclosing model is referred to as the environment time. This
clock has a notion of local time and committed time. The committed time
is "simultaneous" with the environment time.
<p>The local time is
not allowed to move backwards past the committed time, but ahead
of that time, it can move around at will. </p>
<p>
There is no way of explicitly committing time, but
several methods have the side effect of committing the current
local time. For example, <a href="../../ptolemy/actor/LocalClock.html#setClockDrift">setClockDrift(double)</a> will commit
the current local time and change the clock drift. So will
<a href="../../ptolemy/actor/LocalClock.html#start">start()</a> and <a href="../../ptolemy/actor/LocalClock.html#stop">stop()</a> </p>
<p>
This class implements the AbstractSettableAttribute interface because
we want the localClock to be shown as a parameter in the editor
dialogue of a director. A better implementation would be to derive
LocalClock from Attribute and make changes to vergil such that
Attributes are displayed in the dialogue, however, for the moment,
the required changes are too complex.
The value of the clock is exposed as an attribute that, by default,
is non editable. The clock drift is a contained attribute that can
be modified. </p>
<p> This class also specifies a <i>globalTimeResolution</i>
parameter. This is a double with default 1E-10, which is
10<sup>-10</sup>. All time values are rounded to the nearest
multiple of this value. If the value is changed during a run, an
exception is thrown. This is a shared parameter, which means that
all instances of Director in the model will have the same value
for this parameter. Changing one of them changes all of them. </p>
<p>FIXME: Setting of clock drift must be controlled because it commits
time. </p>
Ilge Akkaya, Patricia Derler, Edward A. Lee, Christos Stergiou, Michael Zimmer
$Id: LocalClock.java 70402 2014-10-23 00:52:20Z cxh $
Ptolemy II 10.0
yellow (eal)
red (eal)
The time precision used by this director. All time values are
rounded to the nearest multiple of this number. This is a double
that defaults to "1E-10" which is 10<sup>-10</sup>.
This is a shared parameter, meaning that changing one instance
in a model results in all instances being changed.
The drift of the local clock with respect to the environment
clock. If this is a top level director the clock drift has no
consequence. The value is a double that is initialized to
1.0 which means that the local clock drift matches the one
of the environment.