PTOLEMY II - CiteSeerX
PTOLEMY II - CiteSeerX
PTOLEMY II - CiteSeerX
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Using Vergil<br />
The “free” in these expressions refers to the mode refinement in the free state. Thus, free.initialPosition<br />
is a parameter of that mode refinement. Here, its value is assigned to the value of the parameter<br />
initialPosition. The parameter free.initialVelocity is set to zero.<br />
The reset parameter is set to true, meaning that the destination mode refinement will be initialized<br />
when the transition is taken.<br />
The preemptive parameter is set to false. In this case, it makes no difference, since the init state has<br />
no refinement. Normally, if a transition out of a state is enabled and preemptive is true, then the<br />
transition will be taken without first executing the refinement. Thus, the refinement will not affect<br />
the outputs of the modal model.<br />
A state may have several outgoing transitions. However, it is up to the model builder to ensure that at<br />
no time does more than one guard on these transitions evaluate to true. In other words, Ptolemy <strong>II</strong> does<br />
not allow nondeterministic state machines, and will throw an exception if it encounters one.<br />
Creating Refinements. Both states and transitions can have refinements. To create a refinement, right<br />
click 1 on the state or transition, and select “Add Refinement.” You will see a dialog like that in figure<br />
2.62. As shown in the figure, you will be offered the alternatives of a “Default Refinement” or a “State<br />
Machine Refinement.” The first of these provides a block diagram model as the refinement. The second<br />
provides another finite state machine as the refinement. In the former case (the default), a blank<br />
refinement model will open, as shown in the figure. As before, the output port will appear in an inconvenient<br />
location. You will almost certainly want to move it to a more convenient location. You will<br />
have to create a director in the refinement. The modal model will not operate without a director in the<br />
refinement.<br />
You can also create refinements for transitions, but these have somewhat different behavior. They<br />
will execute exactly once when the transition is taken. For this reason, only certain directors make<br />
sense in such refinements. The most commonly useful is the SDF director. Such refinements are typically<br />
used to perform arithmetic computations that are too elaborate to be conveniently specified as an<br />
action on the transition.<br />
FIGURE 2.62. Adding a refinement to a state.<br />
1. On a Macintosh, control-click.<br />
output port<br />
88 Ptolemy <strong>II</strong>