<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<div class="moz-cite-prefix">On 10/16/13 9:28 AM, Frank White wrote:<br>
</div>
<blockquote cite="mid:525EBEAF.30900@optensity.com" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
Greetings:<br>
I have a couple questions regarding modal models, and one general
modeling question.<br>
<br>
1a. Should I be able to modify extended state parameters from
within transition refinements using SetVariable?<br>
<br>
In the attached simple (but otherwise uninteresting) example, I
can successfully SetVariable from within the state refinement and
via the transition setAction, but apparently not from within the
transition refinement.<br>
</blockquote>
<br>
I works for me. ???<br>
I'm running the model in the current version of Ptolemy (10.0
devel), not in Kepler.<br>
Is Kepler using an older version?<br>
<br>
If I reset all parameters to zero and run the model, all three get
set as intended.<br>
Note that the refinement of the final state does not fire, as
entering the final state causes the model to terminate.<br>
<br>
Transition refinements are deprecated.<br>
The preferred way to to do this is to use immediate transitions.<br>
This is documented in chapters 6 and 8 of the book:
<a class="moz-txt-link-freetext" href="http://ptolemy.org/systems">http://ptolemy.org/systems</a><br>
<br>
Also, I try to avoid SetVariable. It's too much like global
variables :-)<br>
I prefer to set values using the set actions of transitions.<br>
<blockquote cite="mid:525EBEAF.30900@optensity.com" type="cite"> <br>
1b. When I run the attached simple example the first time after
loading it, I get the following error. It works as expected on
subsequent runs. What does this error mean?<br>
<blockquote>ptolemy.kernel.util.IllegalActionException: Failed to
compute schedule:<br>
in .vergiltest.state.SDF Director<br>
Because:<br>
Invalid weight argument, the number of elements for this weight
is zero.<br>
The weight is of class ptolemy.data.expr.Variable and its
description follows:<br>
ptolemy.data.expr.Variable {.vergiltest.relation.Parameter2}
value undefined<br>
A Dump of the offending graph follows.<br>
<br>
**I can send the rest if desired**<br>
</blockquote>
</blockquote>
<br>
Again, I don't get this error.<br>
<br>
<blockquote cite="mid:525EBEAF.30900@optensity.com" type="cite">
<blockquote> </blockquote>
2. Is there any mechanism to reference the current state by name
from within a state refinement? I wish to do this for logging
purposes.<br>
</blockquote>
There is a hack:<br>
Inside a state refinement, a Const actor with value given by
"this.getContainer().getName()" will return the name of the
refinement.<br>
By default, the name of the refinement is the same as the name of
the state.<br>
<br>
This might be a bit of a kludge.<br>
It might be better for a modal model to output the name of a state
(e.g. the destination state) on each transition.<br>
<br>
<blockquote cite="mid:525EBEAF.30900@optensity.com" type="cite"> <br>
3. Is there any mechanism to for a model to reference the current
top-level director's iteration count? (this is for any model -
not just modal models, also for logging purposes)<br>
</blockquote>
The notion of an iteration count is particular to SDF and SR
directors. I don't think the other directors have it.<br>
At the top level, you could feed a Ramp into a SetVariable (OK,
maybe there are valid uses for SetVariable :-)<br>
<br>
Edward<br>
<br>
</body>
</html>