|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.verification.kernel.REDUtility
public class REDUtility
This is an utility for Ptolemy model conversion. It performs a systematic traversal of the system and convert the Ptolemy model into communicating timed automata (CTA) with the format acceptable by model checker RED (Regional Encoding Diagram Verification Engine, v.7.0).
The conversion mechanism roughly is based on the technical report UCB/EECS-2008-41 with some modifications. Basically, the token would not be accumulated in the port of the FSMActor - therefore buffer overflow property would no longer exist in this implementation; it would only happen in the TimedDelay or NondeterministicTimedDelay actor.
For a successful conversion, we simply disallow a system to have super dense time tag with the format (\tau, i), where i>0. In our context this only happens when there is a TimedDelay actor with its parameter equals to zero. For systems with super dense time tag with the format (\tau, i), where i>0, the system can still be converted. However, please note that the semantics might no longer be preserved.
One important feature in our converted model is the use of "complementary" edges. This is used to handle the situation where the FSMActor must react to an arrival of token in the incoming port, but the token can not trigger any transition. For this case, the 'present' token should turn to be 'absent' as time advances. To avoid including any unnecessary behavior we add one "invalid" transition, mentioning that the FSMActor will perform a "stable" move, and at the same time the token will be bring to absent state.
For the tool RED, all time constants should be an integer. This is not a problem because the unit is actually not specified by the timed automata. Therefore, we expect users to use integer values to specify their delay or period.
Limitations: Simply following the statement in the technical report, we restate limitations of the conversion. The designer must understand the boundary of variable domain for the model under conversion. Also, due to the use of complementary edges, complex guard conditions are currently not supported.
Red (patrickj) |
Red (patrickj) |
Nested Class Summary | |
---|---|
private static class |
REDUtility.REDModuleNameInitialBean
|
private static class |
REDUtility.REDSingleEntityBean
|
private static class |
REDUtility.REDTransitionBean
|
private static class |
REDUtility.VariableInfo
|
Field Summary | |
---|---|
private static java.util.HashMap<java.lang.String,REDUtility.VariableInfo> |
_variableInfo
|
Constructor Summary | |
---|---|
REDUtility()
|
Method Summary | |
---|---|
private static java.util.HashSet<java.lang.String> |
_decideGuardSignalVariableSet(FSMActor actor)
This private function is used by the private function _translateFSMActor to generate the set of signals used in the guard expression. |
private static java.util.HashSet<java.lang.String> |
_decideSynchronizerVariableSet(Entity entity)
This private function is used to decide the set of global synchronizers used in the entity. |
private static java.util.HashSet<java.lang.String> |
_decideVariableSet(FSMActor actor,
int numSpan)
This private function decides inner variables used in the actor. |
private static java.util.HashSet<State> |
_enumerateStateSet(FSMActor actor)
Perform an enumeration of the state in this actor and return the name of the states. |
private static java.util.ArrayList<java.lang.String> |
_enumerateString(int index,
java.util.ArrayList<java.lang.String> paraEnumerateString)
This private function generates all possible combinations of string with length i with character 0 and 1. |
private static java.util.ArrayList<REDUtility.REDTransitionBean> |
_generateTransition(FSMActor actor,
State state,
java.util.HashSet<java.lang.String> variableSet,
java.util.HashSet<java.lang.String> globalSynchronizerSet)
This private function is used to generate the transition description for a certain state in a certain actor. |
private static java.util.HashMap<java.lang.String,java.lang.String> |
_retrieveVariableInitialValue(FSMActor actor,
java.util.HashSet<java.lang.String> variableSet)
A private function for generating initial values for the initial variable set. |
private static FSMActor |
_rewriteModalModelWithStateRefinementToFSMActor(ModalModel modalmodel)
This is an experimental function which analyzes a ModalModel and flatten it into a single FSMActor. |
private static REDUtility.REDSingleEntityBean |
_translateBBNondeterministicDelayedActor(BoundedBufferNondeterministicDelay delayedActor,
java.lang.String inputSignalName,
java.lang.String outputSignalName)
Translate a bounded buffer, nondeterministic delayed actor. |
private static REDUtility.REDSingleEntityBean |
_translateBBTimedDelayedActor(BoundedBufferTimedDelay delayedActor,
java.lang.String inputSignalName,
java.lang.String outputSignalName)
This is an utility function which performs the translation of a single TimedDelay actor into the format of communicating timed automata (CTA) acceptable by model checker RED. |
private static REDUtility.REDSingleEntityBean |
_translateClockActor(Clock clockActor,
java.lang.String outputSignalName)
This is an utility function which performs the translation of a single clock actor into the format of communicating timed automata (CTA) acceptable by model checker RED. |
private static REDUtility.REDSingleEntityBean |
_translateFSMActor(FSMActor actor,
int span,
java.util.HashSet<java.lang.String> globalSynchronizerSet)
Translate an FSM actor. |
private static REDUtility.REDSingleEntityBean |
_translateTimedDelayedActor(TimedDelay delayedActor,
java.lang.String inputSignalName,
java.lang.String outputSignalName,
int bufferSize)
This is an utility function which performs the translation of a single TimedDelay actor into the format of communicating timed automata (CTA) acceptable by model checker RED. |
static CompositeActor |
generateEquivalentSystemWithoutHierarchy(CompositeActor originalCompositeActor)
This function generates an equivalent system which is flattened. |
static java.lang.StringBuffer |
generateREDDescription(CompositeActor PreModel,
java.lang.String pattern,
MathematicalModelConverter.FormulaType choice,
int span,
int bufferSizeDelayActor)
This is the main function which generates the system description which is acceptable by the tool RED (Regional Encoding Diagram). |
static boolean |
isValidModelForVerification(CompositeActor model)
This function decides if the director of the current actor is DE. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.util.HashMap<java.lang.String,REDUtility.VariableInfo> _variableInfo
Constructor Detail |
---|
public REDUtility()
Method Detail |
---|
public static CompositeActor generateEquivalentSystemWithoutHierarchy(CompositeActor originalCompositeActor) throws NameDuplicationException, IllegalActionException, java.lang.CloneNotSupportedException
originalCompositeActor
- original system under processing
NameDuplicationException
IllegalActionException
java.lang.CloneNotSupportedException
public static java.lang.StringBuffer generateREDDescription(CompositeActor PreModel, java.lang.String pattern, MathematicalModelConverter.FormulaType choice, int span, int bufferSizeDelayActor) throws IllegalActionException, NameDuplicationException, java.lang.CloneNotSupportedException
For hierarchical conversion, here we are able to deal with cases where state refinement exists. For a modalmodel with state refinement, we first rewrite it into an equivalent FSMActor.
PreModel
- The original model in Ptolemy IIpattern
- The temporal formula in TCTLchoice
- Specify the type of formula: buffer overflow detection or
general TCTL formulaspan
- The size of the span used for domain analysis.bufferSizeDelayActor
- The buffer size of the TimedDelay actor.
IllegalActionException
NameDuplicationException
java.lang.CloneNotSupportedException
public static boolean isValidModelForVerification(CompositeActor model)
model
- Model used for testing.
private static java.util.HashSet<java.lang.String> _decideGuardSignalVariableSet(FSMActor actor) throws IllegalActionException
actor
- The actor under analysis.
IllegalActionException
private static java.util.HashSet<java.lang.String> _decideSynchronizerVariableSet(Entity entity) throws IllegalActionException
entity
- entity under analysis
IllegalActionException
- If thrown while getting the initial state
of the actor.private static java.util.HashSet<java.lang.String> _decideVariableSet(FSMActor actor, int numSpan) throws IllegalActionException
actor
- Actor under analysis.numSpan
- The size of the span to expand the variable domain.
IllegalActionException
private static java.util.HashSet<State> _enumerateStateSet(FSMActor actor) throws IllegalActionException
actor
- The actor under analysis
IllegalActionException
private static java.util.ArrayList<java.lang.String> _enumerateString(int index, java.util.ArrayList<java.lang.String> paraEnumerateString)
index
- The size of the index.paraEnumerateString
- Existing strings that need to be attached.
private static java.util.ArrayList<REDUtility.REDTransitionBean> _generateTransition(FSMActor actor, State state, java.util.HashSet<java.lang.String> variableSet, java.util.HashSet<java.lang.String> globalSynchronizerSet) throws IllegalActionException
actor
- Actor under analysisstate
- State under analysisvariableSet
- globalSynchronizerSet
- Set of useful synchronizers. There are some synchronizers
which is not useful. They are not connected to/from a
valid actor where analysis is possible.
IllegalActionException
private static java.util.HashMap<java.lang.String,java.lang.String> _retrieveVariableInitialValue(FSMActor actor, java.util.HashSet<java.lang.String> variableSet)
actor
- variableSet
-
private static FSMActor _rewriteModalModelWithStateRefinementToFSMActor(ModalModel modalmodel) throws IllegalActionException, NameDuplicationException, java.lang.CloneNotSupportedException
In our current implementation we only allow one additional layer for the refinement. Also the additional layer must be a finite state refinement so that the conversion is possible. But it is easy to expand this functionality into multiple layer.
Note that in the current context of ModalModel, when state machine refinement is used, it is not possible to generate further refinements, meaning that the current implementation is powerful enough to deal with state refinements.
modalmodel
- Whole System under analysis.
IllegalActionException
NameDuplicationException
java.lang.CloneNotSupportedException
private static REDUtility.REDSingleEntityBean _translateBBNondeterministicDelayedActor(BoundedBufferNondeterministicDelay delayedActor, java.lang.String inputSignalName, java.lang.String outputSignalName) throws IllegalActionException
delayedActor
- The actor.inputSignalName
- The input signaloutputSignalName
- The output signal
IllegalActionException
- If the delay or
bufferSize parameters of the delayedActor cannot be read.private static REDUtility.REDSingleEntityBean _translateBBTimedDelayedActor(BoundedBufferTimedDelay delayedActor, java.lang.String inputSignalName, java.lang.String outputSignalName) throws IllegalActionException
delayedActor
- actor which needs to be convertedinputSignalName
- The name of the input signal. This must be derived externally.outputSignalName
- The name of the output signal. This must be derived
externally.
IllegalActionException
private static REDUtility.REDSingleEntityBean _translateClockActor(Clock clockActor, java.lang.String outputSignalName) throws IllegalActionException
clockActor
- The actor which requires to be converted.outputSignalName
- The name of the output signal. This must be derived externally.
IllegalActionException
private static REDUtility.REDSingleEntityBean _translateFSMActor(FSMActor actor, int span, java.util.HashSet<java.lang.String> globalSynchronizerSet) throws IllegalActionException
actor
- The actor to be translated.span
- The size of the span to expand the variable domain. This
variable is used to determine the inner variables used by an actorglobalSynchronizerSet
- The set of useful
synchronizers. There are some synchronizers which is not
useful. They are not connected to/from a valid actor where
analysis is possible.
IllegalActionException
- If thrown while getting the initial
state of the actor, deciding the guard signal variable set or
generating transitions.private static REDUtility.REDSingleEntityBean _translateTimedDelayedActor(TimedDelay delayedActor, java.lang.String inputSignalName, java.lang.String outputSignalName, int bufferSize) throws IllegalActionException
delayedActor
- actor which needs to be convertedinputSignalName
- The name of the input signal. This must be derived externally.outputSignalName
- The name of the output signal. This must be derived
externally.bufferSize
- The defined buffer size used in verification
IllegalActionException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |