Modeling Flow-Based Behavior with Activities

Activity Diagram = frame represents an activity; [1]What is the diagram kind of the activity diagram?diagram kind of “act” for activity; has following form:

act [Activity] activity name [diagram name]

Activity name = name to represent the activity; Diagram name = user defined name to describe purpose of diagram;

 

[2]How are an action and its pins typically represented on an activity diagram? Pins = input/output for activity; noted by small box; connected via object flows; object can be data, matter or energy;

Actions = describes how the activity executes and transforms its input/outputs; noted in diagram as rectangle with round corners;

Tokens = values of inputs / outputs and control flow from one action to another; tokens go through pins; pins can have multiplicity on how many tokens it can handle

[3]

 

[3]

[3] What does action a1 in Figure 8.3 require to start executing?

Actions can begin and end based on following:

– Action’s owning activity must be executing

– Required amount of tokens are at each required input pin

– Required token at incoming control flow

– Tokens are consumed when action executes

– Action terminates when required amount of tokens are at each required output pin

– Control token put on output control flow

– When activity terminates, all actions terminate regardless of its state

 

 

Modeling Activities

Activities can have multiple inputs / outputs called parameters. Not the same as constraint parameters. Parameter may have value types; types can be units and dimensions or another block; parameters have a direction (in/out); have multiplicity; parameter is required if lower bound multiplicity is greater than zero, otherwise its optional; if no multiplicity written, defaults to 1 for both lower and upper;

 

[4] How are the parameters of activities shown on activity diagrams? Activity parameters are represented in activity diagram using activity parameter nodes = holds tokens that represent the arguments of the parameters; matches only one of activity’s parameter (each activity parameter needs to have activity parameter node). Noted by rectangles on the boundary of activity diagram frame; by default parameters in activity parameter node are considered required unless stated <<optional>>; Has notation:

parameter name: parameter type[multiplicity]

 

[5] What is the difference in semantics between a streaming and nonstreaming parameter?Non-streaming parameter = only accept input token when activity first starts executing and provides output token only after activity completes. Streaming parameter = can continue to receive input token and produce output token while activity executing. By default, parameters are non-streaming, only streaming when noted as such.

 

[6] How are parameters with a lower-multiplicity bound of 0 identified on an activity diagram? lower multiplicity of 0 is identified as [0..1] as shown above

[7] Draw an activity diagram for an activity “Pump Water, ” which has a streaming input parameter “w in ” typed by block “ Water ” and a streaming output parameter “ w out, ” also typed by “ Water. ” problem

 

Call Behavior action = invokes a behavior when executed; [8] How are the set of pins for a call behavior action determined? has set of pins that take parameters to invoke the behavior, these pins must match the multiplicity and type of their corresponding parameters on the invoked behavior; noted by round cornered box containing name string, name of the action and name of called behavior (ex an activity), for example: action name : behavior

A rake symbol on bottom right corner indicates this behavior/activity being invoked is described on another diagram.

 

[9] What is an object flow used for and how is it represented? Object flows = routes input/output tokens between object nodes (tokens could be data or physical); route items from parameter nodes on the boundary to/from pins on actions and back out of activity; noted with a solid line with arrowhead indicating direction or rectangular symbol called object node symbol (see Figure 8.6 for example).

 

Fork node = one input flow changed to more than one output flow – replicating every input token into each output flow; replication of tokens doesn’t imply replication of items, as for some physical items this is impossible; token != item; noted as solid bar

Join Node = reverse of fork node – has more than one input node and only one output node; the output node is generated only after all input nodes have been received – this can act as flow synchronization (waits for all incoming flows); the output token is a join of all input tokens; can have join specification to describe the logical expression for matching token arrival on different flows. Noted as solid bar.

Decision node = has one input and more than one output; outputs are mutually exclusive with guard expressions (can have “else” guard) which determines logic of which flow the token will follow out; can have decision input behavior that is used to evaluate incoming object token. Noted as diamond.

Merge node = more than one input flow and only one output flow; tokens received are automatically sent to the output flow, does not wait for all incoming flows to have tokens. Noted as diamond.

 

[10] How does the behavior of a join node differ from that of a merge node? Join node differs from merge node in that join requires tokens at all input flows and merge does not.

 

[11] How does the behavior of a fork node differ from that of a decision node? Fork node differs from decision node in that forks replicate the incoming token and decision node does not, rather decides which output flow that token will go.

 

 

[12]What are parameter sets used for and how are they represented, both in the definition and invocation of an activity? Parameter sets = grouping of activity parameters, can be input or output; a single parameter can be in multiple sets; noted with rectangle box on border of frame, can encapsulate those parameters in its set and cross other set boundaries for those parameters in multiple sets; example:

 

 

In this example, parameter set is in the call behavior actions: [13] Figure 8.10 only shows the object flows between the call behavior actions. What else does it need in order to perform as the method for the get camera request in Figure 8.24 ? Draw a revised version of Figure 8.10 with suitable additions. In order to perform as the method in Figure 8.24, this diagram needs …

 

Central Buffer = token store outside of pins and parameter nodes; needed when there are multiple producers and consumers of single buffered stream of tokens at same time; pints and activity parameter nodes on deal with single producer. Data store node = provides copy of stored token rather than the original;

 

[14] What is the difference between a data store node and a central buffer node? data store vs central buffer node = both only store tokens while their parent activity is executing; data store takes copies whereas central buffer is originals

 

 

 

Using Control Flows to specify the Order of Action Execution

Control flow = not object flow where it track object tokens, this is the flow of the activity outside of it; although can be noted with solid line like object flow, to avoid ambiguity use dashed line with arrowhead for direction; Control logic has the following:

Initial node [16] = when activity starts, a control token is placed on each initial node in the activity

Activity final node = activity terminates when control or object token reaches this node

Flow final node [15] What is the difference in behavior between a flow final and an activity final node? = similar to activity final node but the token is consumed and the activity does not terminate; used when activity is proceeding concurrently;

[16] How is an initial node represented on an activity diagram, and what sort of flows can be connected to it?

 

 

Control Value = externally called value sent via control flow; can be set as enabled or disabled; [17] What special capability does a control operator have? Control operator = produces control values via output parameter type by ControlValue; control operator can include complex control logic and be reused, via Call Behavior Actions; Control Operator has keyword “controlOperater” as the model element type;

 

 

[18] An action “pump” invokes the activity “Pump Water ” from Question 7, and can be enabled and disabled by the output of a control operator. What additional features does “pump” need in order to enable this? Problem

[19] Another action “controller ” calls a control operator called “Control Pump ” with a single output parameter of type “Control Value. ” Draw an activity diagram to show how the actions “pump” and “controller ” need to be connected

in order for “controller ” to control the behavior of “pump. ” problem

 

 

Handling Signals and Other Events

Accept event action / accept signal action = accepts signals and send signals through send signal action; communication via signals are asynchronous; other events this action can accept are:

Time event = an expiration of time (a timer); noted by hourglass symbol (figure 8.14)

Change event = condition expression satisfied by involving values of properties

[20]Name three kinds of event that can be accepted by an accept event action. The three types of events an accept event action can handle are signals, time and change events

Signals = noted by rectangle with triangle angle pointing out for outgoing and inwardly for incoming

 

[21] How can an interruptible region be exited?