ptolemy.domains.fsm.kernel
Class FSMCausalityInterface
java.lang.Object
ptolemy.actor.util.DefaultCausalityInterface
ptolemy.actor.util.CausalityInterfaceForComposites
ptolemy.domains.fsm.kernel.FSMCausalityInterface
- All Implemented Interfaces:
- CausalityInterface
public class FSMCausalityInterface
- extends CausalityInterfaceForComposites
This class infers the causality interface of an FSMActor by checking
the guards and actions of the transitions. If any transition in the
model has an output action that writes to a port and a guard that
references an input port, then there is a direct dependency of
that output on that input. Otherwise, there is no dependency.
Note that this is a conservative analysis in that it may indicate
a dependency when there is none. For example, if all outgoing
transitions from a state produce the same output value, and
a transition is always taken, then irrespective of the guards,
the output has no dependency on the inputs. A precise analysis,
however, is much more difficult (probably undecidable).
All input ports that affect the state (i.e. that are mentioned in
any guard) must be in an equivalence class. Otherwise, we cannot
reliably make a decision about what the next state is. In addition,
if any input in a refinement affects an output, that input must
also be in this equivalence class. Otherwise, the scheduler
will assume there is no relationship between these inputs and
could provide an event that triggers a state transition in an
earlier firing than an event that triggers an output from the
current refinement.
- Since:
- Ptolemy II 8.0
- Version:
- $Id: FSMCausalityInterface.java 57044 2010-01-27 22:41:05Z cxh $
- Author:
- Edward A. Lee
- Accepted Rating:
- Proposed Rating:
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
FSMCausalityInterface
public FSMCausalityInterface(Actor actor,
Dependency defaultDependency)
throws java.lang.IllegalArgumentException
- Construct a causality interface for the specified actor.
- Parameters:
actor
- The actor for which this is a causality interface.
This is required to be an instance of CompositeEntity.defaultDependency
- The default dependency of an output
port on an input port.
- Throws:
java.lang.IllegalArgumentException
- If the actor parameter is not
an instance of CompositeEntity.
getDependency
public Dependency getDependency(IOPort input,
IOPort output)
throws IllegalActionException
- Return the dependency between the specified input port
and the specified output port. This is done by checking
the guards and actions of all the transitions.
When called for the first time since a change in the model
structure, this method performs the complete analysis of
the FSM and caches the result. Subsequent calls just
look up the result.
- Specified by:
getDependency
in interface CausalityInterface
- Overrides:
getDependency
in class CausalityInterfaceForComposites
- Parameters:
input
- The input port.output
- The output port, or null to update the
dependencies (and record equivalence classes) without
requiring there to be an output port.
- Returns:
- The dependency between the specified input port
and the specified output port, or null if a null output
is port specified.
- Throws:
IllegalActionException
- If a guard expression cannot be parsed.