1 / 87

Understanding and Comparing Model-Based Specification Notations

Understanding and Comparing Model-Based Specification Notations. Jianwei Niu, Joanne Atlee, and Nancy Day University of Waterloo. Pseudo code: (a) For each static reaction X in EN, execute the action associated with X

elroy
Download Presentation

Understanding and Comparing Model-Based Specification Notations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Understanding and Comparing Model-Based Specification Notations Jianwei Niu, Joanne Atlee, and Nancy Day University of Waterloo

  2. Pseudo code: (a) For each static reaction X in EN, execute the action associated with X (b) For each transition X in EN, let Sn and Sx be the set of states exited and entered, respectively; Formal semantics: Expressing a Notation’s Semantics Designers of specification notations document the semantics of their notations, to help specifiers use the notations correctly. Let EN be the set of enabled transitions and static reactions Definition: Let X = (X0,…,Xn) be a sequence of state configurations. Let SC be a system configuration whose state configuration is Xn. Let SC1 be a micro system configuration with respect to SC, and let  be a micro-step from SC1 . Then SC= (X, , , , Y) is the micro system configuration reached by  from SC1 if X = X1 - X1 {*(LCA(t)) | t   } 2. 1 =   {e |  generates e } 3.  = 1 { cr(c) |  does not assign F to c } { cr(c) |  assigns T to c } 4. (v) = x iff 1(v) = x and  does not assign any value to v or  assigns x to v 5. Y = Y1 {C (LCA(t), target(t), X) | t   } - update the history of all the parents of states in Sx - delete the states in Sx from the list of states in which the system resides - execute actions associated with exiting states in Sx - execute the actions of X - execute the actions associated with entering the states in Sn - add to the list of states in which the system resides all of the states in Sn Harel et al. “The STATEMATE Semantics of Statecharts”, TOSEM, July 1996 Harel et al. “On the Formal Semantics of Statecharts”, LICS 1987

  3. Template-Based Approach We propose a template-based approach [FSE’02] to structuring the operational semantics of model-based notations that • Separates a notation’s step semantics from its semantics of composition. CP1 CP2 CP3 CP4 HTS3 HTS4 HTS5 HTS1 HTS2

  4. Template-Based Approach We propose a template-based approach [FSE’02] to structuring the operational semantics of model-based notations that • Separates a notation’s step semantics from its semantics of composition. • Extracts common semantics into templates. User instantiates the templates with parameters, to specify a notation’s distinct semantics. parameters Templates CP1 CP2 CP3 CP4 HTS3 HTS4 HTS5 HTS1 HTS2

  5. Template Parameters RESET NEXT

  6. Comparing Notation Variants statecharts STATEMATE RSML RESET NEXT NEXT RESET RESET NEXT Variables Events States Unused Agreement among All 3 notations Agreement among 2 notations No Agreement

  7. CP1 CP2 CP3 CP4 HTS3 HTS4 HTS5 HTS1 HTS2 Outline of Today's Talk • Template semantics • Step semantics of basic components • Template parameters • Comparing notation variants • Composition operators • Expressing other notations’ semantics • SCR • SDL • Petri Nets

  8. S0 S1 S2 S3 S5 S7 S9 S6 S8 S4 Basic ComponentsHierarchical Transition Systems (HTSs) • Control states, state hierarchy • Internal events • External events • Variables • Transitions: event [condition] / action source dest Nonconcurrent machines – concurrency is introduced when composing multiple HTSs

  9. Step Semantics • Snapshot: observable point in execution (current control states, occurring events, variable values, etc.) • Operational Semantics: admissible steps between consecutive snapshots • micro-steps: execute a single transition • macro-steps: execute a sequence of micro-steps until a stable state is reached inputs micro-step micro-step micro-step macro-step

  10. Step Semantics • Snapshot: observable point in execution (current control states, occurring events, variable values, etc.) • Operational Semantics: admissible steps between consecutive snapshots • micro-steps: execute a single transition • macro-steps: execute a sequence of micro-steps until a stable state is reached inputs micro-step micro-step micro-step macro-step

  11. Step Semantics • Snapshot: observable point in execution (current control states, occurring events, variable values, etc.) • Operational Semantics: admissible steps between consecutive snapshots • micro-steps: execute a single transition • macro-steps: execute a sequence of micro-steps until a stable state is reached inputs micro-step micro-step micro-step macro-step

  12. Step Semantics • Snapshot: observable point in execution (current control states, occurring events, variable values, etc.) • Operational Semantics: admissible steps between consecutive snapshots • micro-steps: execute a single transition • macro-steps: execute a sequence of micro-steps until a stable state is reached inputs micro-step micro-step micro-step macro-step

  13. Step Semantics • Snapshot: observable point in execution (current control states, occurring events, variable values, etc.) • Operational Semantics: admissible steps between consecutive snapshots • micro-steps: execute a single transition • macro-steps: execute a sequence of micro-steps until a stable state is reached inputs micro-step micro-step micro-step macro-step

  14. Step Semantics • Snapshot: observable point in execution (current control states, occurring events, variable values, etc.) • Operational Semantics: admissible steps between consecutive snapshots • micro-steps: execute a single transition • macro-steps: execute a sequence of micro-steps until a stable state is reached inputs micro-step micro-step micro-step Stable snapshot: no transitions enabled in the snapshot macro-step

  15. Common Definitions of Template • enabled transitions:identifies which transitions are enabled by the snapshot’s states, events, and variable values • apply: applies a transition’s actions (new events, variable assignments) to the snapshot • micro-step: selects an enabled transition and applies its actions to the snapshot • macro-step: executes a sequence of micro-steps • reset: resets the snapshot at start of macro-step

  16. Common Definitions of Template • enabled transitions:identifies which transitions are enabled by the snapshot’s states, events, and variable values • apply: applies a transition’s actions (new events, variable assignments) to the snapshot • micro-step: selects an enabled transition and applies its actions to the snapshot • macro-step: executes a sequence of micro-steps • reset: resets the snapshot at start of macro-step

  17. Common Definitions of Template • enabled transitions:identifies which transitions are enabled by the snapshot’s states, events, and variable values • apply:applies a transition’s actions (new events, variable assignments) to the snapshot • micro-step: selects an enabled transition and applies its actions to the snapshot • macro-step: executes a sequence of micro-steps, • reset: resets the snapshot at start of macro-step

  18. Common Definitions of Template • enabled transitions:identifies which transitions are enabled by the snapshot’s states, events, and variable values • apply: applies a transition’s actions (new events, variable assignments) to the snapshot • micro-step:selects an enabled transition and applies its actions to the snapshot • macro-step: executes a sequence of micro-steps • reset: resets the snapshot at start of macro-step

  19. Common Definitions of Template • enabled transitions:identifies which transitions are enabled by the snapshot’s states, events, and variable values • apply: applies a transition’s actions (new events, variable assignments) to the snapshot • micro-step: selects an enabled transition and applies its actions to the snapshot • macro-step:executes a sequence of micro-steps • reset: resets the snapshot at start of macro-step

  20. Common Definitions of Template • enabled transitions:identifies which transitions are enabled by the snapshot’s states, events, and variable values • apply: applies a transition’s actions (new events, variable assignments) to the snapshot • micro-step: selects an enabled transition and applies its actions to the snapshot • macro-step: executes a sequence of micro-steps • reset:resets the snapshot at start of macro-step

  21. Example Functionenabled_trans(ss, T) returns the subset of transitions in T that are enabled in snapshot ss enabled_trans(ss, T) {  T | enabling_states(ss,  )  enabling_events(ss,  )  enabling_cond(ss,  ) } where enabling_states, enabling_events, enabling_cond are template parameters

  22. Template Parameters how snapshot is reset at start of macro-step how snapshot changes when transition executes RESET NEXT how transitions are enabled

  23. Example(Harel’s original statecharts) how snapshot is reset at start of macro-step how snapshot changes when transition  executes NEXT RESET • where • IE- current internal events • Ia - current external events • O -output events • gen() - events generated by  • trig() - ’s triggering events

  24. Example(Harel’s original statecharts) how snapshot is reset at start of macro-step how snapshot changes when transition  executes NEXT RESET • where • IE- current internal events • Ia - current external events • O -output events • gen() - events generated by  • trig() - ’s triggering events

  25. Example(Harel’s original statecharts) how snapshot is reset at start of macro-step how snapshot changes when transition  executes NEXT RESET • where • IE- current internal events • Ia - current external events • O -output events • gen() - events generated by  • trig() - ’s triggering events

  26. Example(Harel’s original statecharts) how snapshot is reset at start of macro-step how snapshot changes when transition  executes NEXT RESET • where • IE- current internal events • Ia - current external events • O -output events • gen() - events generated by  • trig() - ’s triggering events

  27. Example(Harel’s original statecharts) how snapshot is reset at start of macro-step how snapshot changes when transition  executes NEXT RESET • where • IE- current internal events • Ia - current external events • O -output events • gen() - events generated by  • trig() - ’s triggering events

  28. Comparing Notation Variants statecharts STATEMATE RSML RESET NEXT NEXT RESET RESET NEXT Variables Events States Unused Agreement among All 3 notations Agreement among 2 notations No Agreement

  29. Comparing Notation Variants statecharts STATEMATE RSML RESET NEXT NEXT RESET RESET NEXT Variables Events States Unused Agreement among All 3 notations Agreement among 2 notations No Agreement

  30. Comparing Notation Variants statecharts STATEMATE RSML RESET NEXT NEXT RESET RESET NEXT Variables Events States Unused Agreement among All 3 notations Agreement among 2 notations No Agreement

  31. Comparing Notation Variants statecharts STATEMATE RSML RESET NEXT NEXT RESET RESET NEXT Variables Events States Unused Agreement among All 3 notations Agreement among 2 notations No Agreement

  32. Comparing Notation Variants statecharts STATEMATE RSML RESET NEXT NEXT RESET RESET NEXT Variables Events States Unused Agreement among All 3 notations Agreement among 2 notations No Agreement

  33. Variant Variable Semantics statecharts RSML STATEMATE NEXT NEXT NEXT Variables • where • AV- current variable values • AVa - old variable values (from start of macro-step) • asn() - ’s variable assignments • last(asn()) - last of multiple assignments to same variable • eval(X, Y) - evaluates expressions in X wrt values in Y • cond() - ’s enabling conditions

  34. Variant Variable Semantics statecharts RSML STATEMATE NEXT NEXT NEXT Variables • where • AV- current variable values • AVa - old variable values (from start of macro-step) • asn() - ’s variable assignments • last(asn()) - last of multiple assignments to same variable • eval(X, Y) - evaluates expressions in X wrt values in Y • cond() - ’s enabling conditions

  35. Variant Variable Semantics statecharts RSML STATEMATE NEXT NEXT NEXT Variables • where • AV- current variable values • AVa - old variable values(from start of macro-step) • asn() - ’s variable assignments • eval(X, Y) - evaluates expressions in X wrt values in Y • cond() - ’s enabling conditions • last(asn()) - last of multiple assignments to same variable

  36. Variant Variable Semantics statecharts RSML STATEMATE NEXT NEXT NEXT Variables • where • AV- current variable values • AVa - old variable values(from start of macro-step) • asn() - ’s variable assignments • eval(X, Y) - evaluates expressions in X wrt values in Y • cond() - ’s enabling conditions • last(asn()) - last of multiple assignments to same variable

  37. Variant Variable Semantics statecharts RSML STATEMATE NEXT NEXT NEXT Variables • where • AV- current variable values • AVa - old variable values(from start of macro-step) • asn() - ’s variable assignments • eval(X, Y) - evaluates expressions in X wrt values in Y • cond() - ’s enabling conditions • last(asn()) - last of multiple assignments to same variable

  38. Outline of Today's Talk • Template semantics • Step semantics of basic components • Template parameters • Comparing notation variants • Composition operators • Expressing other notations’ semantics • SCR • SDL • Petri Nets

  39. Composition Operators • Constrain which/when components can take a step • Share snapshot information: • communicate events • consistent values among shared variables CP1 CP2 CP3 CP4 HTS3 HTS4 HTS5 HTS1 HTS2

  40. AND-state Composition • IF: Both components are enabled • Both components execute simultaneously1 • Generated events are shared2 • Assignments to shared variables are resolved2 • ELSE: One component is enabled • Enabled component executes in isolation1 • Generated events are shared2 • Assignments to variables are shared2 1Components execute via their micro-step template definition. 2Components use their template parameters to receive shared events and variable values

  41. Outline of Today's Talk • Template semantics • Step semantics of basic components • Template parameters • Comparing notation variants • Composition operators • Expressing other notations’ semantics • SCR • SDL • Petri Nets

  42. Software Cost Reduction (SCR) An SCR specification specifies a system in terms of its variables and a history of how variables change value.

  43. SCR An SCR specification specifies a system in terms of its variables and a history of how variables change value. Variable updates are specified as mathematical functions: Warning= Represented as a table: off if Mode=Off off if Mode Off  Temp < 175 on if ModeOff  Temp  175 where each table entry represents one case in the function’s definition.

  44. SCR Template Parameters RESET NEXT

  45. SCR Condition Tables We define a transition  for every table entry: cond(): table-entry conditions, evaluated wrt current variable values: Mode  {Heat, Maintain}  Temp<175 asn(): bottom-level assignment Warning := off

  46. SCR Condition Tables We define a transition  for every table entry: cond(): table-entry conditions, evaluated wrt current variable values: Mode  {Heat, Maintain}  Temp<175 asn(): bottom-level assignment Warning := off

  47. SCR Condition Tables We define a transition  for every table entry: cond(): table-entry conditions, evaluated wrt current variable values: Mode  {Heat, Maintain}  Temp<175 asn(): bottom-level assignment Warning := off

  48. SCR Condition Tables RESET NEXT • where • AV – current variable values • I – monitored (input) variable values • O – controlled (output) variable values • cond() – ’s enabling conditions • controlled(V) – controlled (output) variables in V

  49. SCR Condition Tables RESET NEXT • where • AV – current variable values • I – monitored (input) variable values • O – controlled (output) variable values • cond() – ’s enabling conditions • controlled(V) – controlled (output) variables in V

  50. SCR Condition Tables RESET NEXT • where • AV – current variable values • I – monitored (input) variable values • O – controlled (output) variable values • cond() – ’s enabling conditions • controlled(V) – controlled (output) variables in V

More Related