Behavioral Diagrams: Sequence Diagrams
SysML Behavioral Diagram Types
Behavioral Related
5. Use Case Diagrams (uc)
what the system can do for the users
6. Activity Diagrams (act)
process & flow
7. State Machine Diagrams (stm)
modes of system
8. Sequence Diagrams (seq)
message flow over time
Sequence Diagrams (seq)
What is a SysML Sequence diagram? Several Different Definitions from the Experts
Definitions
Sequence diagram (sd): A Sequence diagram is a dynamic behavioral diagram that shows interactions (collaborations) among distributed objects or services via sequences of messages exchanged, along with corresponding (optional) events.
collaborating objects or services are Parts depicted as Lifelines (notation: rectangle with a dashed vertical line below)
Combined Fragment operators support recursive nesting and Turing Complete semantics (Alternative [alt], Optional [opt], Parallel [par], Loop [loop], etc.)
compare and contrast: Message Sequence Charts (MSCs).
A Sequence diagram is a type of Interaction diagram that shows the time ordered interaction between objects. The diagram has two axes; the vertical axis represents time and the horizontal axis represents the objects that take part in the interaction, typically ordered in a way that best illuminates the interaction. These diagrams have their origin in the modeling of software interactions, but they can be used with systems engineering to be prescriptive of how elements (such as Blocks) should interact, or descriptive in showing how they do interact, in practice.
Sequence Diagram (seq) Example
In this example, there are 3 lifelines which are the parts interacting in the behavior. Lifelines are always structural elements. In this example the lifelines are part properties, atm:ATM, consortium:Consortium, and bank:Bank.
1. verifyCard() is an operation which occurs 1st in the sequence. The numbers are automatically made by Cameo. (Note this is a setting which can be applied so if you don't see the number's don't worry)
The {100} underneigth 1. verifyCard is a duration constraint which indicates how long in time between step 2 and step 1.
The filled in arrow shown in step 1. verifyCard means atm:ATM is expecting a response in the future, which happens with the dotted line in step 4. reply verifyCard.
Logic (combined fragments) can be added to sequence diagrams for repeating/looping events and conditional events. This logic is depicted by a rectangle. There are no logical elements within the example.
When to use a Sequence Diagram
A sequence diagram should be used within SysML when you need to model the flow of events and messages between two or more objects in a system. Sequence diagrams are useful for modeling scenarios and analyzing interaction scenarios between objects. They can be used to model the sequence of events in a system, identify potential issues, and analyze the behavior of objects. They are particularly useful for modeling the order of events or trying to show relative times of events.
---------
Other Sources
Sequence diagrams can be used to represent system scenarios showing how parts of a system interact together to achieve some specified outcome. Messages are said to be exchanged between lifelines representing the lifetime of the object, the messages represent operations or signals sent and received by the objects.
What is the Purpose of the Sequence Diagram
The purpose of Sequence diagrams is to specify dynamic system behaviors as message-passing collaborations among prototypical Blocks (Parts). When properly applied (See Usage Notes below) Activity diagrams are recursively scalable and simulatable.
Sequence diagrams in SysML are used to model interactions between objects over time. They are used to visualize a system's behavior and its interactions with other parts of the system. Sequence diagrams are used to identify and analyze the behavior of the system, including the order of operations, the timing of events, and the flow of control between objects. They can also be used to identify potential problems and conflicts in the system's behavior.
Cameo seq Toolbar
Elements of a Sequence Diagram
Lifeline
A lifeline is a representation of an object or an actor in a sequence diagram. It is represented as a vertical dashed line and is used to illustrate the interactions between objects/actors. It also shows the timeline of an object/actor’s activities.
Message
A message is a communication between two objects/actors in a sequence diagram and is represented as an arrow pointing from one object/actor to another. There are several different message types used within SysML sequnece diagrams most frequently.
Asynchronous Message: An asynchronous message is a message that does not have a response from the receiver. It is usually used to initiate an action.
Synchronous Message: A synchronous message is a message that requires a response from the receiver. It is usually used to coordinate the actions of two or more objects.
Return Message: A return message is a message sent in response to an asynchronous or synchronous message. It is used to indicate the completion of an action or the results of an action.
Combined Fragment
A combined fragment is a combination of messages to represent the flow of control in the system. It is represented as a rectangle with a dotted line.
Alternative: This combined fragment represents an alternative situation in which exactly one of the enclosed fragments will be executed.
Optional: This combined fragment represents an optional situation in which either none or one of the enclosed fragments will be executed.
Break: This combined fragment represents a situation in which any of the enclosed fragments may be executed, and any may be skipped.
Loop: This combined fragment represents a situation in which the enclosed fragment will be executed repeatedly until the loop condition is satisfied.
Parallell: This combined fragment represents a situation in which all of the enclosed fragments will be executed simultaneously.
Negation: This combined fragment represents a situation in which the enclosed fragment will not be executed.
Critical: This combined fragment represents a situation in which the execution of one or more of the enclosed fragments must be completed before any of the other enclosed fragments can begin.
Constraint
A constraint is a condition or restriction that can be applied to a message such as a duration constraint.
Activation bar constraints: These are used to indicate when a model element is activated (i.e. when a method is called).
Anchor constraints: These are used to connect sequence diagrams with other diagrams, such as activity diagrams.
Message constraints: These are used to indicate the flow of messages between model elements.
Time (duration) constraints: These are used to indicate how long a particular element will take to execute.
Interaction constraint: These are used to indicate how two model elements interact with each other.
Selection constraint: These are used to indicate which model elements are selected for a particular interaction.
Guard constraint: These are used to indicate conditions which must be met for a particular model element to be executed.
----------------
Information From Other Sources
Message: A Message (notation: arrow) represents communication from one object to another, with the expectation that a useful behavior will ensue. Messages may be synchronous (notation: open arrowhead) or asynchronous (notation: black-triangle arrowhead).
Elements
The main elements that can appear in Parametric diagrams are:
Sequence
Fragment
Endpoint
Diagram Gate
State/Continuation
The main connectors that can appear in Parametric diagrams are:
Message
Self Message
Recursion
Dependency
Several More Sequence Diagram Example
We can see below how lifelines can be created (see :Order"). They can also be destroyed.
Additionally, we see the logical combined fragment rectangles on the diagram. All elements such as the messages which occur within the combine fragment rectangle are within the scope of the logic the combined fragment applies.
See https://docs.nomagic.com/display/MD190/Combined+Fragment for additional details.