|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.verification.kernel.SMVUtility
public class SMVUtility
This is an utility function for Ptolemy II models. It performs a systematic traversal of the system and generate NuSMV (or Cadence SMV) acceptable files for model checking.
FIXME: A new version for users to specify the integer bound without using abstraction of "LS" and "GT" should be implemented to support complicated update functions. Note that this has already been implemented in REDUtility.java since the format of RED 7.0 does not support these features.
Red (patrickj) |
Red (patrickj) |
Nested Class Summary | |
---|---|
private static class |
SMVUtility.VariableInfo
|
private static class |
SMVUtility.VariableTransitionInfo
|
Field Summary | |
---|---|
private static java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> |
_globalSignalDistributionInfo
|
private static java.util.HashMap<java.lang.String,java.util.HashSet<java.lang.String>> |
_globalSignalNestedRetrivalInfo
|
private static java.util.HashMap<java.lang.String,java.util.HashSet<java.lang.String>> |
_globalSignalRetrivalInfo
|
private static java.util.HashMap<java.lang.String,SMVUtility.VariableInfo> |
_variableInfo
|
private static java.util.HashMap<java.lang.String,java.util.LinkedList<SMVUtility.VariableTransitionInfo>> |
_variableTransitionInfo
|
private static int |
DOMAIN_GT
|
private static int |
DOMAIN_LS
|
Constructor Summary | |
---|---|
SMVUtility()
|
Method Summary | |
---|---|
private static java.util.HashSet<java.lang.String> |
_decideGuardSignalVariableSet(FSMActor actor)
This private function first decides signals used in the guard expression of an actor. |
private static java.util.HashSet<java.lang.String> |
_decideSignalVariableSet(FSMActor actor)
This private function first decides signal variables that is emitted from the actor. |
private static java.util.HashSet<java.lang.String> |
_decideStateVariableSet(FSMActor actor,
int numSpan)
This private function first decides state variables (or called inner variables) that would be used in the Kripke structure. |
private static java.util.HashSet<State> |
_enumerateStateSet(FSMActor actor)
Perform an enumeration of the state in this FmvAutomaton and return a HashSet of states. |
private static void |
_generateAllVariableTransitions(FSMActor actor,
java.util.HashSet<java.lang.String> variableSet)
Generate all premise-action pairs regarding this automaton. |
private static java.util.HashSet<java.lang.String> |
_generateGraphicalSpecificationRecursiveStep(CompositeActor model,
java.lang.String specType,
java.lang.StringBuffer upperLevelStatement)
|
private static void |
_generatePremiseAndResultEachTransition(java.lang.String statePrecondition,
java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.Integer>> valueDomain,
java.lang.String lValue,
java.lang.String offset,
java.lang.String operatingSign)
This function is used to generate detailed pre-conditions and post-conditions in .smv format. |
private static void |
_generatePremiseAndResultEachTransitionRecursiveStep(java.lang.String currentPremise,
int index,
int maxIndex,
java.lang.String[] keySetArray,
java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.Integer>> valueDomain,
java.lang.String lValue,
java.lang.String newVariableValue,
java.lang.String operatingSign)
A private function used as a recursive step to generate all premises for enabling transition in .smv file. |
private static java.util.ArrayList<java.lang.StringBuffer> |
_generateSMVDescriptionModalModelWithRefinement(ModalModel modalmodel,
java.lang.String span,
java.lang.String upperStateName)
This function generates the Kripke structure acceptable by NuSMV from a ModalModel in Ptolemy II. |
private static java.lang.StringBuffer |
_generateSMVDescriptionSubSystem(CompositeActor model,
java.lang.String span,
java.lang.String upperStateName)
This private function generates the system description of a subsystem which has a ModalModel controller as its upper-layer. |
private static java.util.ArrayList<java.lang.String> |
_prescanSystemSignal(CompositeActor model,
java.lang.String span)
Perform a systematic pre-scan to obtain information regarding the visibility of a signal. |
private static java.util.ArrayList<java.lang.StringBuffer> |
_retrieveSubSystemModuleNameParameterInfo(FSMActor controller)
This function is trying to generate the definition for modules contained in a controller. |
private static java.util.HashMap<java.lang.String,java.lang.String> |
_retrieveVariableInitialValue(FSMActor actor,
java.util.HashSet<java.lang.String> variableSet)
A private function used as to generate variable initial values for the initial variable set. |
private static java.lang.StringBuffer |
_translateSingleFSMActor(FSMActor actor,
java.lang.String span,
boolean isController,
java.lang.String refinementStateName)
Translate a single FSMActor into the format acceptable by model checker. |
static java.lang.String |
generateGraphicalSpecification(CompositeActor model,
java.lang.String specType)
This function generates the reachability/risk specification of a system by scanning through the subsystem, and extract states which have special risk or reachability labels. |
static java.lang.StringBuffer |
generateSMVDescription(CompositeActor model,
java.lang.String pattern,
java.lang.String choice,
java.lang.String span)
Return a StringBuffer that contains the converted .smv format of the system. |
static boolean |
isValidModelForVerification(CompositeActor model)
This function decides if the director of the current actor is SR. |
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,java.util.ArrayList<java.lang.String>> _globalSignalDistributionInfo
private static java.util.HashMap<java.lang.String,java.util.HashSet<java.lang.String>> _globalSignalRetrivalInfo
private static java.util.HashMap<java.lang.String,java.util.HashSet<java.lang.String>> _globalSignalNestedRetrivalInfo
private static java.util.HashMap<java.lang.String,SMVUtility.VariableInfo> _variableInfo
private static java.util.HashMap<java.lang.String,java.util.LinkedList<SMVUtility.VariableTransitionInfo>> _variableTransitionInfo
private static int DOMAIN_GT
private static int DOMAIN_LS
Constructor Detail |
---|
public SMVUtility()
Method Detail |
---|
public static java.lang.String generateGraphicalSpecification(CompositeActor model, java.lang.String specType) throws IllegalActionException
model
- The system model under analysis.specType
- The type of the graphical specification, it may be either
"Risk" or "Reachability"
IllegalActionException
public static java.lang.StringBuffer generateSMVDescription(CompositeActor model, java.lang.String pattern, java.lang.String choice, java.lang.String span) throws IllegalActionException, NameDuplicationException
For previous implementation, no matter what token is sent through the
channel, the receiver only senses the existence of the token by the
guard expression XX_isPresent
. We now support Boolean token recognition.
In order to introduce this mechanism,
for each signal XX, two boolean variables are introduced:
1) XX_isPresent
: indicating whether the signal is present or not.
2) XX_value
: indicating the value of the signal.
Therefore, now in the guard expression, it may be possible to have
1) XX_isPresent
(in Ptolemy) ==> XX_isPresent
(in SMV)
2) XX == 0
(in Ptolemy) ==> XX_isPresent && XX_value == 0
(in SMV)
3) XX == 1
(in Ptolemy) ==> XX_isPresent && XX_value == 1
(in SMV)
If XX_isPresent is false, then the value of XX_value is not valid.
In SMV, there is no distinguishing between boolean T, F and numerical values 1, 0. So for the sender side, we only need to check if a sender sends a token whose value is not 0 or 1.
model
- The system under analysis.pattern
- The temporal formula used to be attached in the .smv file.choice
- The type of the formula. It may be either a CTL or LTL
formula.span
- A constant used to expand the domain of the variable.
IllegalActionException
NameDuplicationException
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> _decideSignalVariableSet(FSMActor actor) throws IllegalActionException
MODIFICATION 2008.07.21: We need to have "X_isPresent" and "X_value" to represent a variable for new features (supporting boolean tokens).
actor
- The actor under analysis
IllegalActionException
private static java.util.HashSet<java.lang.String> _decideStateVariableSet(FSMActor actor, int numSpan) throws IllegalActionException
actor
- The actor under analysisnumSpan
- The size to expand the original domain
IllegalActionException
private static java.util.HashSet<State> _enumerateStateSet(FSMActor actor) throws IllegalActionException
actor
- The actor under analysis
IllegalActionException
private static void _generateAllVariableTransitions(FSMActor actor, java.util.HashSet<java.lang.String> variableSet) throws IllegalActionException
actor
- The actor under analysisvariableSet
- The set of variables used
IllegalActionException
private static java.util.HashSet<java.lang.String> _generateGraphicalSpecificationRecursiveStep(CompositeActor model, java.lang.String specType, java.lang.StringBuffer upperLevelStatement) throws IllegalActionException
IllegalActionException
private static void _generatePremiseAndResultEachTransition(java.lang.String statePrecondition, java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.Integer>> valueDomain, java.lang.String lValue, java.lang.String offset, java.lang.String operatingSign) throws IllegalActionException
statePrecondition
- valueDomain
- lValue
- offset
- operatingSign
-
IllegalActionException
private static void _generatePremiseAndResultEachTransitionRecursiveStep(java.lang.String currentPremise, int index, int maxIndex, java.lang.String[] keySetArray, java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.Integer>> valueDomain, java.lang.String lValue, java.lang.String newVariableValue, java.lang.String operatingSign) throws IllegalActionException
currentPremise
- Current precondition for the transition. It is not
completed unless parameter index == maxIndex.index
- Current depth for the recursive function. It would stop
when it reaches maxIndex.maxIndex
- keySetArray
- keySetArray stores all variable names that is used in this
transition.valueDomain
- valueDomain specifies for a particular transition, for
each variable, the set of all possible values to invoke
the transition.lValue
- lValue specifies the variable name that would be set after
the transition.newVariableValue
- newVariableValue can have different meanings based on
different value of variable operatingSign. When
operatingSign is +,-,*,/ it represents the offset.
Remember in the set-action, each sub-statement has formats
either var = var operatingSign offset or var =
rValue. When operatingSign is S or N, it represents
the rValue of the system.operatingSign
-
IllegalActionException
private static java.util.ArrayList<java.lang.StringBuffer> _generateSMVDescriptionModalModelWithRefinement(ModalModel modalmodel, java.lang.String span, java.lang.String upperStateName) throws IllegalActionException, NameDuplicationException
modalmodel
- ModalModel under analysisspan
- The size to expand the original domainupperStateName
-
IllegalActionException
NameDuplicationException
private static java.lang.StringBuffer _generateSMVDescriptionSubSystem(CompositeActor model, java.lang.String span, java.lang.String upperStateName) throws IllegalActionException, NameDuplicationException
model
- The subsystem which is the refinement of a state.span
- The size of span to expand the domain of variable.upperStateName
- The name of the upper level model name. This upper
state has the model as refinement.
IllegalActionException
NameDuplicationException
private static java.util.ArrayList<java.lang.String> _prescanSystemSignal(CompositeActor model, java.lang.String span) throws IllegalActionException, NameDuplicationException
model
- The whole system under analysisspan
- The number to expand the domain of a variable. Note that
it is in fact irrelevant to the signal generation. It is
only used for the reuse of existing functions.
IllegalActionException
NameDuplicationException
private static java.util.ArrayList<java.lang.StringBuffer> _retrieveSubSystemModuleNameParameterInfo(FSMActor controller) throws IllegalActionException
controller
- The controller which contains those modules
IllegalActionException
- Undefined behavior happens.private static java.util.HashMap<java.lang.String,java.lang.String> _retrieveVariableInitialValue(FSMActor actor, java.util.HashSet<java.lang.String> variableSet) throws IllegalActionException
actor
- The actor under analysisvariableSet
- Set of variables that expect to find initial values.
IllegalActionException
private static java.lang.StringBuffer _translateSingleFSMActor(FSMActor actor, java.lang.String span, boolean isController, java.lang.String refinementStateName) throws IllegalActionException
actor
- The FSMActor under analysis.span
- The constant span for expanding the integer domain for state (inner) variablesisController
- Whether the FSMActor is the controller of a ModalModelrefinementStateName
- The name of the refinement state
IllegalActionException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |