Skip to content
ImagineWorld

System Specifications

node_idnode-book_agile-model-based-systems-engineering_chapter-02-system-specifications
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num2
chapter_titleSystem Specifications
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph
  • Functional Analysis with Scenarios
  • Functional Analysis with Activities
  • Functional Analysis with State Machines
  • Functional Analysis with User Stories
  • Model-Based Safety Analysis
  • Model-Based Threat Analysis
  • Specifying Logical System Interfaces
  • Creating the Logical Data Schema

This chapter contains recipes to do with the capturing and analysis of requirements. The first four recipes are alternative ways to achieve essentially the same thing. Functional analysis generates high-quality requirements, use cases, and user stories – all means to understand what the system must be.

By “high-quality requirements,” I mean requirements focused on a use case that are demonstrably:

  • Complete
  • Accurate
  • Correct
  • Consistent
  • Verifiable

The problem is that natural language is ambiguous, imprecise, and only weakly verifiable. Keeping the human-readable text is very useful, especially for non-technical stakeholders, but insufficient to ensure we are building the right system. Let’s look at why that is.

There are many reasons why textual requirements by themselves fail to result in usable, high-quality systems.

First, it is difficult to ensure all the functionality is present:

  • All normal (sunny day) functionality?
  • All edge-cases?
  • All variations of inputs, sequences, and timings?
  • All exception, error, and fault cases?
  • Qualities of service such as performance, range, precision, timing, safety, security, and reliability?
  • All stakeholders appropriately represented?

Getting that much detail is a daunting task indeed. But even beyond that, there is an “air gap” between realizing a possibly huge set of “shall” statements and actually meeting the stakeholder needs. The stakeholder believes that if the system performs a specific function, then in practice, their needs will be met. Experience has shown that this is not always true. Customers often ask for features that don’t address their true needs. Further, requirements are volatile and interact often in subtle but potentially catastrophic ways.

We address this issue by capturing requirements both in textual and formal means via modeling. The textual requirements are important because they are human-readable by anyone even without modeling training and often appear in binding legal contracts. The model representation of the requirement is more formal and lends itself to more rigorous thought and analysis, including simulation. In general, both forms are necessary.

Before we get into the recipes, let’s agree on common terms.

RequirementA stakeholder requirement is a statement of what a stakeholder needs. A system requirement is a statement of what the system must do to satisfy a stakeholder’s need. We will focus on system requirements in this chapter. Normally, requirements are written in an active voice using the shall keyword to indicate a normative requirement, as in The system shall move the robot arm to comply with the user directive.
ActorAn actor is an element outside the scope of the system we are specifying that has interactions with the system that we care about. Actors may be human users, but they can also be other systems, software applications, or environments.
Use caseA use case is a collection of scenarios and/or user stories around a common usage of a system. One may alternatively think of a use case as a collection of requirements around a usage-centered capability of the system. Still another way to think about use cases is that they are a sequenced set of system functions that execute in a coherent set of system-actor interactions. These all come down to basically the same thing. In practice, a use case is a named usage of a system that traces to anywhere from 10-100 requirements and 3-25 scenarios or user stories.
ActivityAn activity in SysML is a composite behavior of some portion of a system. Activities are defined in terms of sequences of actions that, in this context, correspond to either - A system function - An input - An output Activities can model the behavior of use cases. Activities are said to be fully constructive in the sense that they model all possible behavior of the use case.
State machineA state machine in SysML is a classifier behavior of a system element, such as a block or use case. In this context, a state machine is a fully constructive behavior focusing on the conditions of the system (states) and how the system changes from state to state, executing system functions along the way.
ScenarioA scenario is an interaction of a set of elements in a particular case or flow. In this usage, a scenario represents a partially complete behavior showing the interaction of the actors with the system as it executes a use case. The reason that it is partially complete is that a given scenario only shows one or a very small number of possible flows within a use case. Scenarios are roughly equivalent to user stories. In SysML, scenarios are generally captured using sequence diagrams.
User StoryA user story is a statement about system usage from a user or actor’s point of view that achieves a user goal. User stories describe singular interactions and so are similar in scope to scenarios. User stories use a canonical textual formulation such as “As a” <user> “I want” <feature> “so that” <output or outcome>. For example, As a pilot, I want to control the rudder of the aircraft using foot pedals so that I can set the yaw of the aircraft. User stories tend to be most beneficial for simpler interactions, as complex interactions are difficult to write out in an understandable text. Scenarios are generally preferred for complex interactions or when there is a lot of precise detail that must be specified. Consider this somewhat unwieldy user story: As a navigation system, I want to measure the position of the aircraft in 3 dimensions with an accuracy of +/- 1 m every 0.5s so that I can fly to the destination. And that’s still a rather simple scenario. We will talk about user stories more later in this chapter in the Functional Analysis with User Stories recipe.

Table 2.1: Some important specification terms

Now that we have defined the most important terms used in system specification, let’s look at different recipes that allow us to understand what we want the system to do.

As stated in the chapter introduction, functional analysis is a means to both capture and improve requirements through analysis. In this case, we’ll begin with scenarios as a way to elicit the scenarios from the stakeholder and create the requirements from those identified interactions. We then develop an executable model of the requirements that allows us to verify that the requirements interact how we expect them to, identify missing requirements, and perform “what-if” analyses for additional interactions.

The purpose of this recipe is to create a high-quality set of requirements by working with the stakeholders to identify and characterize interactions of the system with its actors. This is particularly effective when the main focus of the use case is the interaction between the actors and the system, or when trying to gather requirements from non-technical stakeholders.

A use case naming a capability of the system from an actor-use point of view.

There are several outcomes, the most important of which is a set of requirements accurately and appropriately specifying the behavior of the system for the use case. Additional outputs include an executable use case model, logical system interfaces to support the use case behavior along with a supporting logical data schema, and a set of scenarios that can be used later as specifications of test cases.

Figure 2.1 shows the workflow for this recipe. There are many steps in common with the next two recipes:

Figure 2.1: Functional analysis with scenarios

This first step is to identify the generic usage of which the scenarios of interest, user stories, and requirements are aspects.

The description of the use case should include its purpose, and a general description of the flows, preconditions, postconditions, and invariants (assumptions). Some modelers add the specific actors involved, user stories, and scenarios, but I prefer to use the model itself to contain those relations.

The related actors are those people or systems outside our scope that interact with the system while it executes the current use case. These actors can send messages to the system, receive messages from the system, or both.

The execution context is a kind of modeling “sandbox” that contains an executable component consisting of elements representing the use case and related actors. The recommended way to achieve this is to create separate blocks representing the use case and the actors, connected via ports. Having an isolated simulation sandbox allows different system engineers to progress independently on different use case analyses.

Scenarios are singular interactions between the system and the actors during the execution of the use case. When working with non-technical stakeholders, it is an effective way to understand the desired interactions of the use case. We recommend starting with normal, “sunny day” scenarios before progressing to edge case and exceptional “rainy day” scenarios. It is important to understand that every message identifies or represents one or more requirements.

Create ports and interface in execution context

Section titled “Create ports and interface in execution context”

Once we have a set of scenarios, we’ve identified the flow from the use case to the actors and from the actors to the system. By inference, this identifies ports relating the actors and the system, and the specific flows within the interfaces that define them.

This step creates what I call the “normative state machine.” Executing this state machine can recreate each of the scenarios we drew in the Capture use case scenarios step. All states, transitions, and actions represent requirements. Any state elements added only to assist in the execution that do not represent requirements should be stereotyped as «non-normative» to clearly identify this fact. It is also common to create state behavior for the actors in a step known as “instrumenting the actor” to support the execution of the use case in the execution context.

Running the execution context for the use case allows us to demonstrate that our normative state machine in fact represents the flows identified by working with the stakeholder. It also allows us to identify flows and requirements that are missing, incomplete, or incorrect. These result in Requirements_change change requests to fix the identified requirements defects.

Parallel to the development and execution of the use case model, we maintain the textual requirements. This workflow event indicates the need to fix an identified requirements defect.

In response to an identified requirements defect, we fix the textual requirements by adding, deleting, or modifying requirements. This will then be reflected in the updated model.

Once the use case model and requirements stabilize, we add trace links using the «trace» relation or something similar. These relations allow the backtrace to stakeholder requirements as well as forward links to any architectural elements that might already exist. For relations forward to design elements, we generally prefer «satisfy».

Once the work has stabilized, a review for correctness and compliance with standards may be done. This allows subject matter experts and stakeholders to review the requirements, use cases, states, and scenarios for correctness, and for quality assurance staff to ensure compliance with modeling and requirements standards.

This example will examine the Emulate Basic Gearing use case. The use case is shown in Figure 2.2:

Figure 2.2: Emulate Basic Gearing Use Case

All model elements deserve a useful description. In the case of a use case, we typically use the format shown here:

Figure 2.3: Use Case Description

The related actors in this example are the Rider and the Training App. The rider signals the system to change the gearing via the gears control and receives a response in terms of changing resistance. The training app, when connected, is notified of the current gearing so that it can be displayed. The relation of the actors to the use case is shown in Figure 2.2.

The execution context creates blocks that represent the actors and the use case for the purpose of the analysis. In this example, the following naming conventions are observed:

  • The block representing the use case has the use case name (with white space removed) preceded by uc_. Thus, for this example, the use case block is named uc_EmulateBasicGearing.
  • Blocks representing the actors are given the actor name preceded with a and an abbreviation of the use case. For this use case, the prefix is aEBG_ so the actor blocks are named aEBG_Rider and aEBG_TrainingApp.
  • The interface blocks are named i + <use case block>_<actor block>. The names of the two interface blocks are iEmulateBasicGearing_Rider and iEmulateBasicGearing_TrainingApp. The normal form of the interface block is associated with the proxy port on the use case block; the conjugated form is associated with the corresponding proxy port on the actor block.

All these elements are shown on the block definition diagram in Figure 2.4. This diagram uses a Cameo feature to display the contents of a diagram – in this case, the IBD for the Emulate Basic Gearing Context block – on another:

Figure 2.4: Emulate Basic Gearing Execution Context

Creating continuous flows in Cameo sequence diagrams isn’t obvious. You’ll need to do a few preparatory steps:

  1. First, create the «continuous» stereotype. Add this into a profile in the project and use the default Element for the base metaclass.
  2. Add flow properties to the blocks that you want to flow. In this first scenario, we want resistance to flow from the aEBG_Rider block to the uc_Emulate Basic Gearing block and appliedTorque to flow in the opposite direction.
  3. Add value types AppliedTorque and Resistance (as subtypes of Real) and use these to type the above flow properties.
  4. On the context internal block diagram, add item flows of the created types to the connector between the rider and EBG parts. Make sure the directions are correct!
  5. On the sequence diagram, add a message that you want to convey the flow. Add the item flow to that message with the Item Flow Manager.
  6. Add the «continuous» stereotype to the message, as it is a continuous rather than discrete message.
  7. I use a critical region interaction operator to provide the context over which the continuous flow applies. Note that ordinary sequence diagram rules of ordering do not apply to continuous flows. I also apply the «continuous» stereotype to the interaction operator as well. In this case, the use of the «continuous» stereotype declares an intent but doesn’t really change the execution semantics of the model.

Cameo note: The Item Flow Manager is best found by selecting the relation or message and selecting the item flow manager from the hovering quick tools menu that appears.

This results in the flow being defined as shown in Figure 2.5. You can see the flow properties in the actor and use case blocks, the types that define them, the item flows between the blocks, and the item flows on the connector relating the parts on the included internal block diagram.

All of this is to support adding the item flows in the sequence diagram (Figure 2.6):

Figure 2.5: Blocks with value types and item flows added

Scenarios here are captured to show the interaction of the system with the actors using this use case. Note that continuous flows are shown as flows with the «continuous» stereotype. This resistance at a specific level is applied continuously until the level of resistance is changed. As is usual in use case analysis, messages between the actors are modeled as events, and invocation of system functions on the use case lifeline are modeled as operations.

The first scenario (Figure 2.6) shows normal gear changes from the rider. Note that the messages to self on the use case block lifeline indicate system functions identified during the scenario development. The state invariants show the state of the instance fulfilling the part role in the scenario at various points in the interaction. States, of course, are conditions of the instance, and may also be used to imply pre and postconditions:

Figure 2.6: Emulate basic gearing scenario 1

The next scenario shows what happens when the rider tries to increment the gearing beyond the maximum gearing allowed by the current configuration.

It is shown in Figure 2.7:

Figure 2.7: Emulate basic gearing scenario 2

The last scenario for this use case, shown in Figure 2.8, shows the rejection of a requested gear change below the provided gearing:

Figure 2.8: Emulate basic gearing scenario 3

Based on these sequences, we identify the following requirements:

  • The system shall respond to applied pedal torque with resistance calculated from the base level of resistance, current gearing, and applied torque to simulate pedal resistance during road riding.
  • The system shall send the current gearing to the training app when the current gearing changes.
  • The system shall respond to a rider-initiated increase in gear by applying the new level of gearing provided that it does not exceed the maximum gearing of the gearing configuration.
  • The system shall respond to a ride-initiated decrease in gear by applying the new level of gearing provided that it does not exceed the minimum gearing of the gearing configuration.

Create ports and interfaces in execution context

Section titled “Create ports and interfaces in execution context”

It is a simple matter to update the ports and interface blocks to contain the messages going between the actors and the use case. The sequence diagrams identify the messages between the use case and actor blocks, so the interface blocks must support those specific flows (Figure 2.9):

Figure 2.9: Emulate basic gearing with properties and interfaces

After updating the block and interface block definitions, we need to connect the flow properties to the port on the Emulate Basic Gearing Context block. This is done by showing the flow properties in both the parts and the ports and connecting them with connectors. In Cameo, this is done by right-clicking on the part or port and selecting Display > Flow Properties in the pop-up menu.

See Figure 2.10:

Figure 2.10: Internal block diagram with connected flow properties

This step constructs the normative state machine for the use case as well as instrumenting the actors with their own state machines. The state machine of the use case block is the most interesting because it represents the requirements. Figure 2.11 shows the state machine for the Emulate Basic Gearing use case. The figure also shows the simple activity send gearing to training app that is referenced on the transition inside the Basic Gearing and Handing Gear Change states:

Figure 2.11: Emulate Basic Gearing State Machine

The when () trigger used in the state machine is a SysML change event. The trigger is invoked when the expression value appliedTorque!= oldTorque (i.e., then the value of appliedTorque changes) transitions from false to true.

To support the execution, the system functions must be elaborated enough to support the execution and simulation. These system functions include applyResistance(), checkGearing(), and changeGear() operations. Each of these is defined by a support opaque behavior method. Table 2.2 shows their simple implementation.

Note that this is a “low-fidelity” simulation so the precise calculation relating resistance, torque, and gearing need not be implanted here. The designers will certainly need to do so, however:

OperationMethodOpaque Behavior
applyResistanceapplyResistance methodResistance = gear * 100
changeGear(newGear: Real)changeGear method (newGear: Real)gear = newGear
checkGearing(newGear: Real): BooleancheckGearing method(newGear:Real): Booleanreturn (newGear <= MAX_GEARING) and (newGear >= MIN_GEARING)

Table 2.2: Emulate Basic Gearing operations and methods

Note that all opaque behaviors in this book are implemented in Cameo’s Groovy action language. To set this as the default action language for your projects, simply access the Options > Project menu, enter “language” in the dialog’s filter field, and set each language option to Groovy.

The system variable gear is represented as a Real (from the SysML value type library), representing the gear multiplier, in a fashion similar to gear inches, a commonly used measure in cycling. The flow properties appliedTorque and resistance are likewise implemented as Reals.

The state machines for the actor blocks are even simpler than that of the use case block. Figure 2.12 shows the Rider state machine and Figure 2.13 shows the Training App state machine and implementation of its displayGearing() function.

I have a convention that I commonly use for naming signals; external signals generated by the user running the simulation have an “ex” prefix (for external event) while internal signals generated within the context have an “ev” (for event) prefix:

Figure 2.12: Rider Actor Block state machine

Figure 2.13: Training App Actor Block state machine

The displayGearing operation is realized by a displayGearing method with a simple implementation:

displayedGear = gear
print “Training App: Gear = “ + displayedGear

Lastly, some constants are defined. DEFAULT_GEARING is set to the same value as MIN_GEARING; in this case, 30 gear inches. MAX_GEARING is set to about the same as a 53x10 gearing, 140. The GEAR_INCREMENT is used for incrementing or decrementing the gearing and is set to 5 gear inches for the purpose of simulation.

To facilitate control of the execution, a user interface display can be created. To do this in Cameo, the basic steps are:

  1. Create a Sim Support Pkg package to hold it all (optional).
  2. Add a Configuration diagram with a single configuration. Name this configuration Emulate Basic Gearing Sim Config.
  3. Drag the Emulate Basic Gearing Context block and drop it on the simulation configuration to make that block the simulation target.
  4. If you want to automatically create a sequence diagram every time you run a simulation, add a Sequence Diagram Generator to the diagram and then drag it onto the simulation configuration to add it as a listener.
  5. Create a User Interface Modeling diagram (it’s in the expert view of the menu).
  6. Add a frame to this diagram:
    1. Drag the Emulate Basic Gearing Context block and drop it on this frame to set its represents property. 2. In the specification for the frame, change the title property to Emulate Basic Gearing UI Panel. That will be the title of the dialog when it pops up during the simulation.
  7. Add three panels:
    1. Drag the rider part (not the block, but the part) owned by the Emulate Basic Gearing Context block and drop it on the leftmost pane. 2. Drag the EBG part owned by the Emulate Basic Gearing Context block and drop it on the middle pane. 3. Drag the trainingApp part owned by the Emulate Basic Gearing Context block and drop it on the right pane.
  8. In each pane, add text labels for fixed text fields, text fields for the values you want to display from those parts, and buttons for the events you want to insert into the running simulation.
  9. Drag the relevant property from the blocks defining those parts onto the appropriate control.
  10. Once you have defined the frame and its properties, drag the frame onto the simulation configuration you created in Step 2 to add that as a UI element.

When that’s done, you’ll have a UI diagram that looks like Figure 2.14 (note I added a view of the simulation configuration diagram as well):

Figure 2.14: Emulate basic gearing simulation user interface

To run the simulation with Cameo’s Simulation Toolkit, you’ll need to select the configuration to run from the configuration list menu just below the Analyze menu. To run without the configuration, simply right-click the element you want to simulate and select Simulation > Run.

The control panel you created will pop up when you run the configuration. Then on the dialog, click Start Pedaling, Augment Gear, and Decrement Gear, waiting for things to stabilize between clicking.

The execution of the state model recreates the sequence diagrams. Figure 2.15 shows the first part of the recreation of Scenario 1 (Figure 2.6) by the executing model. That is, the Simulation Toolkit creates the diagram from the running simulation. The user lifeline (created by Cameo during the simulation run) represents you, the simulation driver, as you insert events by clicking buttons or otherwise entering events.

The assignments in curly braces denote values being changed, whether through operation execution or the flow of values across the ports:

Figure 2.15: Animated sequence diagram from model simulation

While in review, the project lead notices that there is no requirement initial starting value for the gearing before a specific gear has been selected. Additionally, we see that the requirement to notify the training app was missing. These are identified missing requirements that must be added. In general, any message flowing into the use case indicates requirements to receive a request or flow, and then invoke an internal behavior (system function) to handle the request or process the flow. Any message flowing from the use case to an actor indicates requirements to send information, results, or flows to the actor. Messages from the use case to itself indicate requirements for a transformation of some kind.

In this example, we notice that we omitted a requirement to update the rider display of the gearing. The change has already been made to the state machine.

We add the following requirements to the requirements set:

  • The system shall display the currently selected gear.
  • The system shall default to the minimum gear during initialization.

In this case, we ensure there are trace links back to stakeholder requirements as well as from the use case to the requirements. This is shown in the use case diagram in Figure 2.16. The newly identified requirements are highlighted with a bold border:

Figure 2.16: Emulate basic gearing requirements

The requirements model can now be reviewed by relevant stakeholders. The work products that should be included in the review include all the diagrams shown in this section, the requirements, and the executing model. The use of the executing model allows for what-if examination of the requirements set to be easily done during the review. Such questions as “What happens to the gearing if the Rider turns the system off and back on?” or “What is the absolute maximum gearing to be allowed?” can be asked. Simulation of the model allows the questions to either be answered by running the simulation case or can be identified as an item that requires resolution.

Functional analysis can be performed in subtly different ways. In the previous recipe, we started with the sequence diagram to analyze the use case. That is particularly useful when the interesting parts of the use case are the interactions. The workflow in this recipe is slightly different, although it achieves exactly the same objectives. This workflow starts with the development of an activity model and generates scenarios from that. In this recipe, just as in the previous one, when the work is all complete, it is the state machine that forms the normative specification of the use case; the activity diagram is used as a stepping stone along the way. The objective of the workflow, as with the previous recipe, is to create an executable model to identify and fix defects in the requirements, such as missing requirements, or requirements that are incomplete, incorrect, or inaccurate. Overall, this is the most favored workflow among model-based systems engineers.

The purpose of the recipe is to create a set of high-quality requirements by identifying and characterizing the key system functions performed by the system during the execution of the use case capability. This recipe is particularly effective when the main focus of the use case is the set of system functions and not the interaction of the system with the actors.

A use case naming a capability of the system from an actor-use point of view.

There are several outcomes, the most important of which is a set of requirements accurately and appropriately specifying the behavior of the system for the use case. Additional outputs include an executable use case model, logical system interfaces to support the use case behavior and a supporting logical data schema, and a set of scenarios that can be used later as specifications of test cases.

Figure 2.17 shows the workflow for this recipe. It is similar to the previous recipe. The primary difference is that rather than beginning the analysis by creating scenarios with the stakeholders, it begins by creating an activity model of the set of primary flows from which the scenarios will be derived:

Figure 2.17: Functional Analysis with Activities

This first step is to identify the generic usage of which the scenarios of interest, user stories, and requirements are aspects.

The description of the use case should include its purpose, and a general description of the flows, preconditions, postconditions, and invariants (assumptions). Some modelers add the specific actors involved, user stories, and scenarios, but I prefer to use the model itself to contain those relations.

The related actors are those people or systems outside our scope that interact with the system while it executes the current use case. These actors can send messages to the system, receive messages from the system, or both.

The execution context is a kind of modeling “sandbox” that contains an executable component consisting of elements representing the use case and related actors. The recommended way to achieve this is to create separate blocks representing the use case and the actors, connected via ports. Having an isolated simulation sandbox allows different system engineers to progress independently on different use case analyses.

The activity model identifies the functional flows of the system while it executes the use case capability. These consist of a sequenced set of actions, connected by control flows, with control nodes (notably, decision, merge, fork, and join nodes) where appropriate. In this specific recipe step, the focus is on the primary flows of the system – also known as “sunny day” flows – and less on the secondary and fault scenarios (known as “rainy day” scenarios). The actions are either system functions, reception of messages from the actors, sending a message to the actors, or waiting for timeouts.

This activity model is not complete in the sense that it will not include all possible flows within the use case. The activity diagram can be made complete, but it is usually easier to do that with a state machine. If you prefer to work entirely in the activity diagram, then evolve the activity model to be executable rather than develop a state machine for this purpose. The later recipe step Create executable state model will include all flows, which is why the state machine, rather than the activity model, is the normative specification of the use case. This activity model allows the systems engineer to begin reasoning about the necessary system behavior. Most systems engineers feel very comfortable with activity models and prefer to begin the analysis here rather than with the scenarios or with the state machine.

The activity model identifies multiple flows, as indicated by control nodes, such as decision nodes. A specific scenario takes a singular path through the activity flow so that a single activity model results in multiple scenarios. The scenarios are useful because they are easy to review with non-technical stakeholders and because they aid in the definition of the logical interfaces between the system and the actors.

Create ports and interface in execution context

Section titled “Create ports and interface in execution context”

Once we have a set of scenarios, we’ve identified the flow from the use case to the actors and from the actors to the system. By inference, this identifies ports relating the actors and the system, and the specific flows within the interfaces that define them.

This step identifies what I call the “normative state machine.” Executing this state machine can recreate each of the scenarios we drew in the Capture use case scenarios step. All states, transitions, and actions represent requirements. Any state elements added only to assist in the execution that do not represent requirements should be stereotyped as «non-normative» to clearly identify this fact. It is also common to create state behavior for the actors in a step known as “instrumenting the actor” to support the execution of the use case in the execution context.

Running the execution context for the use case allows us to demonstrate that our normative state machine in fact represents the flows identified by working with the stakeholder. It also allows us to identify flows and requirements that are missing, incomplete, or incorrect. These result in Requirements_change change requests to fix the identified requirements defects.

Parallel to the development and execution of the use case model, we maintain the textual requirements. This workflow event indicates the need to fix an identified requirements defect.

In response to an identified requirements defect, we fix the textual requirements by adding, deleting, or modifying requirements. This will then be reflected in the updated model.

Once the use case model and requirements stabilize, we add trace links using the «trace» relation or something similar. These relations allow the backtrace to stakeholder requirements as well as forward links to any architectural elements that might already exist. For relations forward to design elements, we generally prefer «satisfy».

Once the work has stabilized, a review for correctness and compliance with standards may be done. This allows subject matter experts and stakeholders to review the requirements, use cases, activities, states, and scenarios for correctness, and for quality assurance staff to ensure compliance with modeling and requirements standards.

The example used for this recipe is the Control Resistance use case, shown in Figure 2.18 along with some other use cases:

Figure 2.18: Use Cases for Analysis

All model elements deserve a useful description. In the case of a use case, we typically use a format as shown in Figure 2.19. To show an element’s description on a diagram in Cameo, attach a note, right-click the note, and select Text Display Mode > Show Documentation:

Figure 2.19: Control Resistance Use Case Description

The related actors in this example are the Rider and the Training App. The rider signals the system to change the gearing via the gears control and receives a response in terms of changing resistance as well as setting resistance mode to ERG or SIM mode. The training app, when connected, is notified of the current gearing so that it can be displayed, provides a simulated input of incline, and can, optionally, change between SIM and ERG modes. The relation of the actors to the use case is shown in Figure 2.18.

The execution context creates blocks that represent the actors and the use case for the purpose of the analysis. In this example, the following naming conventions are observed:

  • The block representing the use case has the use case name (with white space removed) preceded by uc. Thus, for this example, the use case block is named ucControlResistance.
  • Blocks representing the actors are given the actor name preceded with “a” and an abbreviation of the use case. For this use case, the prefix is aCR_ so the actor blocks are named aCR_Rider and aCR_TrainingApp.
  • The interface blocks are named i + <use case block>_<actor block>. The names of the two interface blocks are iControlResistance_Rider and iControlResistance_TrainingApp. The normal form of the interface block is associated with the proxy port on the use case block; the conjugated form is associated with the corresponding proxy port on the actor block.

All these elements are shown on the internal block diagram in Figure 2.20:

Figure 2.20: Control Resistance Execution Context

This step creates an activity model for the primary flows in the use case. We will create an activity diagram to get us started, but we will also create a state machine for the actual simulation. We do this because state machines are usually more appropriate for use case behaviors, but activity diagrams allow us to get started with the analysis more easily. Thus, the activity diagram is notional but the state machine is normative. This is a common way that system engineers do use case analysis. In Cameo, a block can own multiple behaviors. In our example here, the block will own both the activity diagram and the state machine but the classifier behavior of the block will be the state machine. This can be set in the block’s Specification Dialog.

The flow consists of a set of steps sequenced by control flows and mediated by a set of control nodes. The actual system generates resistance in two different ways: SIM mode, in which the resistance is generated as a function of gearing, pedal cadence, force applied to the pedal, and simulated values of bike inertia, speed, acceleration, and drag; and ERG mode, in which a constant power is generated by the user by the system adjusting the resistance to pedal cadence.

The high-level flow is shown in Figure 2.21. Note that some actions – such as Read Self – are in the Any Actions list in the Cameo activity diagram toolbar:

Figure 2.21: Activity for Compute Resistance

Directly from the activity diagram, we can identify several requirements, shown in tabular form in Figure 2.22:

Figure 2.22: Control Resistance initial requirements

The activity flow in Figure 2.21 can be used to create scenarios in sequence diagrams. It is typical to create a set of scenarios such that each control flow is shown at least once.

This is called the minimal-spanning set of scenarios. In this case, because of the nature of parallelism, a high-level scenario (Figure 2.23) is developed with more detailed flows put on reference scenarios:

Figure 2.23: Compute Resistance Main Scenario

The first reference scenario (Figure 2.24) reflects the inputs, gathered via system sensors, of the pedal status. This part of the overall scenario flow provides the necessary data for the computation of resistance:

Figure 2.24: Process Pedal Inputs Scenario

Create ports and interfaces in execution context

Section titled “Create ports and interfaces in execution context”

Now that we have defined some interactions between the system and the actors, we can elaborate on the interfaces to support those message exchanges. This shows the flow properties supported by actor and use case blocks and the interfaces. The interfaces are defined so that the use case block is the unconjugated side and shows not only the flow properties that pass through the ports but also the signal receptions from the sequence diagrams.

In the example shown, several flow properties are typed by elements in the ISO-80000 SI standard units library. To get this library, select “Use Basic Units Library” in the New Project dialog when you create your model. RPM is not in the standard units library, but can be easily added as a specialization of the Real type from the SysML primitive types library.

This is shown in the BDD in Figure 2.25:

Figure 2.25: Compute resistance interfaces

Because we added the activity diagram first, Cameo made that the classifier behavior for the use case block. We will need to change the classifier behavior property of this block to the state machine in the specification dialog for the use case block for the execution to proceed.

Figure 2.26 shows the state machine for the use case Control Resistance:

Figure 2.26: Control resistance use case state machine

This state machine uses orthogonal regions. Two of these regions use change events, as indicated by when (<condition>). Change events are triggered when the condition changes from false to true. In both uses, the old value of a flow property is stored, and the change event transition fires when the current value of the flow property changes from its old value. In this way, the transitions are triggered when either the gearing is changed or when the pedal speed changes. Another and-state has a transition triggered when the signal evGradient is received from the Training App, indicating that the gradient from the virtual terrain has changed.

In all these cases, a signal is sent that causes the physics model to be reevaluated, resulting in a changed resistance at the pedal. Figure 2.27 shows a very simplified behavior to update the pedal resistance, speed, acceleration, cadence, and power. Several of these values are passed to the Training App via signals. Note that this physics model is not correct, but getting the physics right is not relevant to the purpose of this simulation. Certainly, the designers must create a proper physics model.

We are doing a low-fidelity simulation for the purpose of ensuring that the right system functions are being called at the right time and the correct interactions between the system and the actors. This model is adequate for that purpose:

Figure 2.27: Compute resistance activity

We also need to “instrument the actors” for simulation support. A simple state behavioral model for the Rider is shown in Figure 2.28 and the state machine for the Training App is shown in Figure 2.29:

Figure 2.28: Rider state machine

For the purposes of the simulation, two user events were added: exRideEasy and exRideHard. These just set the flow properties appliedPower, pedalSpeed, and gearing to values representative of those conditions. You can always set the flow property values individually during simulation if desired. The aCR_Rider block processes those events as internal transitions in the Riding state:

Figure 2.29: Training app state machine for the control resistance use case

Before we run the simulation, we also need to connect the flow properties on the Control Resistance Context internal block diagram. This is done by adding connectors between the flow properties in the ports (defined by the interface blocks) and the flow properties in the blocks. See Figure 2.30:

Figure 2.30: Connecting the flow properties on the IBD

The simulation is not meant to be a high-fidelity physics simulation of all the forces and values involved, but really to give a medium-fidelity simulation to help validate the set of requirements and to identify missing or incorrect ones. A control panel was created to visualize the behavior and provide input of values (Figure 2.31) using the same techniques as in the previous recipe. This is done in a Cameo “User Interface Modeling Diagram,” which is just a repurposed package diagram with specialized controls. The text controls are bound to the flow and value properties in the different blocks. The buttons send external (simulation user) events to the elements to make things happen:

Figure 2.31: Control Resistance simulation user interface

This frame is used as the UI for a simulation configuration named Control Resistance Sim Config. I’ve also added a sequence diagram listener so that when the configuration is run, an animated sequence diagram will be created. You can also see in Figure 2.32 that the Control Resistance Context is set as the execution target:

Figure 2.32: Control resistance simulation configuration

Simulation of difference scenarios results in many sequence diagrams capturing the behavior, such as the (partial) one shown in Figure 2.33.

The User lifeline is created by Cameo to represent you, as a simulation operator, and show when you insert events into the running simulation:

Figure 2.33: (Partial) animated sequence diagram example of control resistance use case

A number of minor requirements defects are identified and flagged to be added to the requirements set.

The creation and execution of the use case simulation uncovers a couple of new requirements related to timing:

  • The system shall update the physics model frequently enough to provide the rider with a smooth and road-line experience with respect to resistance.
  • The system shall update the training app with pedal cadence at least every 1.0 seconds.
  • The system shall update the training app with rider-filtered power output at least every 0.5 seconds.
  • The system shall update the training app with simulated bike speed at least every 1.0 seconds.

Also, we discover a missing data transmission to the training app:

  • The system shall send current watts per kilogram to the training app for the current power output at least every 1.0 seconds.

Trace links are updated in the model. The trace links for this and the previous example are shown in matrix form in Figure 2.34:

Figure 2.34: Control Requirements use case requirements trace matrix

The requirements model can now be reviewed by relevant stakeholders. The work products that should be included in the review include all the diagrams shown in this section, the requirements, and the executing model. The use of the executing model allows for what-if examination of the requirements set to be easily done during the review. Such questions as “How quickly does the resistance control need to be updated to simulate the road riding experience?” or “What is the absolute maximum resistance supported to be allowed?”. Simulation of the model allows the questions to either be answered by running the simulation case or can be identified as an item that requires resolution.

Sometimes beginning with the state machine is the best approach to do use case analysis. This is particularly true when the use case is obviously “modal” in nature with different operational modes. This approach generally requires systems engineers who are very comfortable with state machines. The recipe is much like the previous use case analyses and can be used instead; the output is basically the same for all three of these recipes.

The primary differences are that no activity diagram is created and the sequence diagrams are created from the executing use case state behavior.

The purpose of the recipe is to create a set of high-quality requirements by identifying and characterizing the key system functions performed by the system during the execution of the use case capability. This recipe is particularly effective when the use case is clearly modal in nature and the system engineers are highly skilled in developing state machines.

A use case naming a capability of the system from an actor-use point of view.

There are several outcomes, the most important of which is a set of requirements accurately and appropriately specifying the behavior of the system for the use case. Additional outputs include an executable use case model, logical system interfaces to support the use case behavior and a supporting logical data schema, and a set of scenarios that can be used later as specifications of test cases.

Figure 2.35 shows the workflow for this recipe. It is similar to the previous recipe. The primary difference is that rather than beginning the analysis by creating scenarios with the stakeholders, it begins by creating a state machine model of the set of primary flows from which the scenarios will be derived:

Figure 2.35: Functional analysis with states

The first step is to identify the generic usage of which the scenarios of interest, user stories, and requirements are aspects.

The description of the use case should include its purpose, and a general description of the flows, preconditions, postconditions, and invariants (assumptions). Some modelers add the specific actors involved, user stories, and scenarios, but I prefer to use the model itself to contain those relations.

The related actors are those people or systems outside our scope that interact with the system while it executes the current use case. These actors can send messages to the system, receive messages from the system, or both.

The execution context is a kind of modeling “sandbox” that contains an executable component consisting of executable elements representing the use case and related actors. The recommended way to achieve this is to create separate blocks representing the use case and the actors, connected via ports. Having an isolated simulation sandbox allows different system engineers to progress independently on different use case analyses.

Create ports and interface in execution context

Section titled “Create ports and interface in execution context”

In this step, we create or update the ports and their defining interface blocks to specify the flows between the use case block and the actors.

This step creates a state machine that represents the textual requirements in the formal language of state machines. Executing this state machine can recreate each of the scenarios we drew in the Capture use case scenarios step of the Functional Analysis with Scenarios recipe. Almost all states, transitions, and actions represent requirements. Any state elements added only to assist in the execution that do not represent requirements should be stereotyped as «non-normative» to clearly identify this fact. It is also common to create state behavior for the actors in a step known as “instrumenting the actor” to support the execution of the use case in the execution context.

The state model identifies multiple flows, driven by event receptions and transitions, executing actions along the way. A specific scenario takes a singular path through the state flow so that a single state machine model results in multiple scenarios. The scenarios are useful because they are easy to review with non-technical stakeholders and because they aid in the definition or refinement of the logical interfaces between the system and the actors. Because the state machine is executable, it can be automatically created from the execution of the state machine if you are using a supportive tool.

Running the execution context for the use case allows us to demonstrate that our normative state machine in fact represents the flows identified by working with the stakeholder. It also allows us to identify flows and requirements that are missing, incomplete, or incorrect. These result in Requirements_change change requests to fix the identified requirements defects.

Parallel to the development and execution of the use case model, we maintain the textual requirements. This workflow event indicates the need to fix an identified requirements defect.

In response to an identified requirements defect, we fix the textual requirements by adding, deleting, or modifying requirements. This will then be reflected in the updated model.

Once the use case model and requirements stabilize, we add trace links using the «trace» relation or something similar. These relations allow the backtrace to stakeholder requirements as well as forward links to any architectural elements that might already exist. For relations forward to design elements, we generally prefer «satisfy».

Once the work has stabilized, a review for correctness and compliance with standards may be done. This allows subject matter experts and stakeholders to review the requirements, use cases, states, and scenarios for correctness, and for quality assurance staff to ensure compliance with modeling and requirements standards.

The example used for this recipe is the Emulate Front and Rear Gearing use case. This use case is shown in Figure 2.36 along with some closely related use cases:

Figure 2.36: Emulate front and rear gearing use cases

All model elements deserve a useful description. In the case of a use case, we typically use a format as shown in Figure 2.37:

Figure 2.37: Emulate front and rear gearing use case description

The related actors in this example are the Rider and the Training App. The rider signals the system to change the gearing via the gears control and receives a response in terms of changing resistance as well as setting resistance mode to ERG or SIM mode. The training app, when connected, is notified of the current gearing so that it can be displayed, provides a simulated input of incline, and can, optionally, change between SIM and ERG modes. The relation of the actors to the use case is shown in Figure 2.36.

The execution context creates blocks that represent the actors and the use case for the purpose of the analysis. In this example, the following naming conventions are observed:

  • The block representing the use case has the use case name (with white space removed) preceded by uc_. Thus, for this example, the use case block is named uc_EmulateFrontandRearGearing.
  • Blocks representing the actors are given the actor name preceded with “a” and an abbreviation of the use case. For this use case, the prefix is aEFRG so the actor block is named aEFRG_Rider.
  • The interface blocks are named i + <use case block>_<actor block>. The name of the interface block is iuc_EmulateFrontandRearGearing_aEFRG_Rider. The normal form of the interface block is associated with the proxy port on the use case block; the conjugated form is associated with the corresponding proxy port on the actor block.

All these elements are shown on the internal block diagram in Figure 2.38:

Figure 2.38: Emulate Front and Rear Gearing use case execution context

Create ports and interface in execution context

Section titled “Create ports and interface in execution context”

The (empty) ports and interfaces are added between the use case block and the actor blocks, as shown in Figure 2.38. These will be elaborated on as the development proceeds in the next step.

Figure 2.39 shows the state machine for the use case Emulate Front and Rear Gearing. It is important to remember that the state machine is a restatement of textual requirements in a more formal language and not a declaration of design. The purpose of creating this state machine during this analysis is to identify requirement defects, not to design the system:

Figure 2.39: State machine for Emulate Front and Rear Gearing

The state machine starts off initializing the gearing and sending that gearing to the Rider (presumably via a display on the bike). This activity uses a loop node to initialize the set of 12 rear cassette cogs. Using the loop node in Cameo is a little tricky. One key is that the action in the test compartment returns a Boolean value named result, and this is set as the Decider property of the loop node.

See Figure 2.40:

Figure 2.40: Initialize Gearing Activity

This activity invokes another via a call behavior action named update rider with gear info. This latter activity is also invoked from the main behavior state machine when gears are changed. It updates a value property known as gear inches; this is the distance the bike travels with one turn of the pedals. It also sends the gearing information to the rider. It is shown in Figure 2.41:

Figure 2.41: Update rider with gear info activity

The Rider state machine accepts the evFrontAndRearGear signal from the use case block to update it when the gears have changed. All this block does with this information is print the gearing to the console during the simulation. It also accepts the ex signals from the user running the simulation and sends these signals out of the port that is connected to the use case part. In this way, the Rider actor block can gear up and down for both the front chain ring and rear cassette:

Figure 2.42: Rider actor block state machine

Similar to the example in the last recipe, I created a simple UI to allow easier control of the simulation and visualization of the result. This UI is shown in Figure 2.43. The UI uses text fields for scalar values and list control for the front chain ring and rear cassette arrays. It defines the UI for a simulation configuration:

Figure 2.43: Emulate Front and Rear Gearing UI

Scenarios are specifically sequenced interaction sets that identify sequencing, timing, and values of different exemplar uses of a system. Sequence diagrams are generally easy to understand, even for non-technical stakeholders. In this recipe, sequences are created by exercising the use case state machine by changing the inputs to exercise different transition paths in the state machine. It is important to understand that there are usually an infinite set of possible scenarios, so we must constrain ourselves to consider a small representative set. The criteria we recommend is the minimal-spanning set; this is a set of scenarios such that each transition path and action is executed at least once. More scenarios of interest can be added, but the set of sequences should at least meet this basic criterion.

Let’s consider a scenario showing the rider changing gears while riding (Figure 2.44). The figure skips over the initialization of the gearing and gets directly to the changing of the front chain ring and the rear cassette:

Figure 2.44: Scenario for gear changes while riding

The creation of the state machines in the previous section and their execution allows us to identify missing, incorrect, or incomplete requirements. The panel diagram in Figure 2.44 allows us to drive different scenarios and perform “what if” analyses to explore the requirements.

Parallel to the development and execution of the use case model, we maintain the textual requirements. This workflow event indicates the need to fix an identified requirements defect.

In this example, we’ll show the requirements in a table in the modeling tool. Figure 2.45 shows the newly added requirements:

Figure 2.45: Emulate Front and Rear Gearing requirements

Now that we’ve identified the requirements, we can add them to the model and add trace links to the Emulate Front and Rear Gearing use case. This is shown in the table in Figure 2.46:

Figure 2.46: Emulate Front and Rear Gearing requirements trace matrix

With the analysis complete and the requirements added, a review can be conducted to evaluate the set of requirements. This review typically includes various subject matter experts in addition to the project team.

The other functional analysis recipes in this chapter are fairly rigorous and use executable models to identify missing and incorrect requirements. User stories can be used for simple use cases that don’t have complex behaviors. In the other functional analysis recipes, validation of the use case requirements can use a combination of subject matter expert review, testing, and even formal mathematical analysis prior to their application to the system design. User stories only permit validation via review and so are correspondingly harder to verify as complete, accurate, and correct.

User stories are approximately equivalent to scenarios in that both scenarios and user stories describe a singular path through a use case. Both are “partially constructive” in the sense that individually, they only describe part of the overall use case. User stories do it with natural language text, while scenarios do it with a SysML sequence diagram. The difference between user stories and scenarios is summarized in Figure 2.47:

Figure 2.47: User story or scenarios

User stories have a canonical form:

“As a” <user> “I want” <feature> “so that” <reason>|<outcome>

A few examples of user stories are provided in Chapter 1, Basics of Agile Systems Modeling, in the recipe for Estimating Effort, such as:

User Story: Set Resistance Under User Control:

As a rider, I want to set the resistance level provided to the pedals to increase or decrease the effort for a given gearing, cadence, and incline so that the system simulates road riding effort.

Each user story represents a small set of requirements. A complete set of user stories includes all or most requirements traced to by the use case.

In SysML, we represent user stories as stereotypes of use cases and use the «include» relations to indicate the use case to which the user story applies. The stereotype adds the acceptance_criteria tag to the user story so that it is clear what it means to satisfy the user story. An example, relating a use case, user stories, and requirements, is shown in Figure 2.48:

Figure 2.48: User Story as a stereotype of use case

Here are some guidelines for developing good user stories:

  1. Focus on the users.

Avoid discussing or referencing design, but instead, focus on the user-system interaction.

  1. Use personae to discover the stories.

Most systems have many stakeholders with needs to be met. Each user story represents a single stakeholder role. Represent all the users with the set of user stories.

  1. Develop user stories collaboratively.

User stories are a lightweight analytic technique and can foster good discussions among the product owner and stakeholders, resulting in the identification of specific requirements.

  1. Keep the stories simple and precise.

Each story should be easy to understand; if it is complex, then try to break it up into multiple stories.

  1. Start with epics or use cases.

User stories are small, finely-grained things, while epics and use cases provide a larger context.

  1. Refine your stories.

As your understanding deepens and requirements are uncovered, the stories should be updated to reflect this deeper understanding.

  1. Be sure to include acceptance criteria.

Acceptance criteria complete the narrative by providing a clear means by which the system design and implementation can be judged to appropriately satisfy the user’s needs.

  1. Stay within the scope of the owning epic or use case.

While it is true that in simple systems, user stories may not have an owner epic or use case, most will. When there is an owner epic or use case, the story must be a subset of that capability.

  1. Cover all the stories.

The set of user stories should cover all variant interaction paths of the owning epic or use case.

  1. Don’t rely solely on user stories.

Because user stories are a natural language narrative, it isn’t clear how they represent all the quality of service requirements. Be sure to include safety, reliability, security, performance, and precision requirements by tracing the user story to those requirements.

User stories are a simple way to understand and organize requirements. Most commonly, these are stories within the larger capability context of an epic or use case. User stories are approximately equivalent to a scenario.

A use case naming a capability of the system from an actor-use point of view.

The most important outcome is a set of requirements accurately and appropriately specifying the behavior of the system for the use case and acceptance criteria for what it means to satisfy them.

Figure 2.49 shows the workflow for this recipe. It is a more informal approach than the preceding recipes but may be useful for simple use cases. Note that, unlike previous recipes, it does not include a behavioral specification in a formal language such as activities or state machines:

Figure 2.49: Functional analysis with user stories

This first step is to identify the generic usage of which the scenarios of interest, user stories, and requirements are aspects.

The description of the use case should include its purpose, and a general description of the flows, preconditions, postconditions, and invariants (assumptions). Some modelers add the specific actors involved, user stories, and scenarios, but I prefer to use the model itself to contain those relations.

The related actors are those people or systems outside our scope that interact with the system while it executes the current use case. These actors can send messages to the system, receive messages from the system, or both.

This step includes more than creating the “As a <role> …” statements. It also includes creating «include» relations from the owning use case and the addition of acceptance criteria for each user story. If this is the first time this is being done, you will also have to create a «user story» stereotype that applies to use cases to be able to create the model elements, as illustrated in Figure 2.48.

Clearly state the criteria that will be applied to the system to demonstrate that the user story is acceptably implemented.

Identify quality of service as requirements

Section titled “Identify quality of service as requirements”

It is very common to forget to include various kinds of qualities of service. This step is an explicit reminder to specify how well the services are provided. Common qualities of service include safety, security, reliability, performance, precision, fidelity, and accuracy.

For this recipe, validating the requirements is done with a review with the relevant stakeholders. This should involve looking at the use, the set of user stories, the user stories themselves and their acceptance criteria, and the functional and quality of service requirements.

Parallel to the development and execution of the use case model, we maintain the textual requirements. This workflow event indicates the need to fix an identified requirements defect.

In response to an identified requirements defect, we fix the textual requirements by adding, deleting, or modifying requirements. This will then be reflected in the updated model.

Once the use case model and requirements stabilize, we add trace links using the «trace» relation or something similar. These relations allow the backtrace to stakeholder requirements as well as forward links to any architectural elements that might already exist. For relations forward to design elements, we generally prefer «satisfy».

Once the work has stabilized, a review for correctness and compliance with standards may be done. This allows subject matter experts and stakeholders to review the requirements, use cases, and user stories for correctness, and for quality assurance staff to ensure compliance with modeling and requirements standards.

For this recipe, we will analyze the Emulate DI Shifting use case. In many ways, this use case is an ideal candidate for user stories because the use case is simple and not overly burdened with quality-of-service requirements.

Interested readers can learn more about DI shifting here: https://en.wikipedia.org/wiki/Electronic_gear-shifting_system.

The use case description is shown in Figure 2.50:

Figure 2.50: Description of the emulate DI shifting use case

The only actor in this use case is the Rider, as shifting gears is one of the three key ways that the Rider interacts with the system (the other two being pedaling and applying brakes).

Figure 2.51 shows the three identified user stories for the use case: using buttons to shift gears, handling gearing crossover on upshifting, and handling gearing cross-over on downshifting:

Figure 2.51: Emulate DI shifting user stories

As these are simple user stories, there are a small number of functional requirements. See Figure 2.52:

Figure 2.52: Emulate DI shifting functional requirements

Identify quality of service as requirements

Section titled “Identify quality of service as requirements”

The previous step specified a small number of requirements but didn’t clarify how well these system functions are to be performed. Most notably, performance and reliability requirements are missing. These are added in Figure 2.53, shown this time in a requirements table:

Figure 2.53: Emulate DI Shifting QoS and Functional Requirements

The next step is to validate the user stories and related requirements with the stakeholders to ensure their correctness and look for missing, incorrect, or incomplete requirements.

During this analysis, a stakeholder notes that nothing is said about how the system transitions between mechanical shifting and DI shifting. The following requirements are added:

  • The system shall enter DI Shifting mode by selecting that option in the Configuration App.
  • Once the DI Shifting mode is selected, this selection shall persist across resets, power resets, and software updates.
  • Mechanical shifting shall be the default on initial startup or after a factory-settings reset.
  • The system shall leave DI Shifting mode when the user selects the Mechanical Shifting option in the Configuration App.

The requirements are updated to reflect the stakeholder input from above.

Trace links from both the use case and user stories to the requirements are added. These are shown in diagrammatic form in Figure 2.54.

Note: the figure does not show that use case Emulate DI Shifting traces to all these requirements just to simplify the diagram:

Figure 2.54: Emulate DI Shifting trace links

Perform use case, user story and requirements review

Section titled “Perform use case, user story and requirements review”

With the analysis complete and the requirements added, a review can be conducted to evaluate the set of requirements. This review typically includes various subject matter experts in addition to the project team.

The term safety can be defined as freedom from harm. Safety is one of the three pillars of the more general concern of system dependability. Safety is generally considered with respect to the system causing or allowing physical harm to persons, up to and including death. Depending on the industry, different systems must conform to different safety standards, such as DO-178 (airborne software), ARP4761 (aerospace systems), IEC 61508 (electronic systems), ISO 26262 (automotive safety), IEC 63204 and IEC 60601 (medical), and EN50159 (railway), just to name a few. While there is some commonality among the standards, there are also a number of differences that you must take into account when developing systems to comply with those standards.

The recipe in this chapter provides a generic workflow applicable to all these standards but you may want to tailor it to your specific needs. Note that we recommend this analysis is done on a per-use case basis so that the analysis of each relevant use case includes safety requirements in addition to the functional and quality of services requirements.

Some key terms for safety analysis are:

  • Accident – A loss of some kind, such as injury, death, equipment damage, or financial. Also known as a mishap or harm.
  • Risk – The product of the likelihood of an accident times its severity, so R = L * S.
  • Hazard – A set of conditions and/or events that inevitably results in an accident.
  • Fault Tolerance Time – The period of time a system can manifest a fault before an accident is likely to occur.
  • Safety control measure – An action or mechanism that improves systems safety either by 1) reducing its likelihood or 2) reducing its severity.

The terms faults, failures, and errors are generally used in one of three ways, depending on the standard employed:

  1. Faults lead to Failures, which lead to Errors:
    1. Fault – An incorrect step, process, or data 2. Failure – The inability of a system or component to perform its required function 3. Error – A discrepancy between an actual value or action and the theoretically correct value or action 4. A fault at one level can lead to a failure one level up
  2. Faults are actual behaviors that conflict with specified or desired behaviors:
    1. Fault – Either a failure or an error 2. Failure – An event that occurs at a point in time when a system or component performs incorrectly: Failures are random and may be characterized by a probability distribution
    2. Error – A condition in which a system or component systematically fails to achieve its required function: Errors are systematic and always exist, even if they are not manifest Errors are the result of requirement, design, implementation, or deployment mistakes, such as a software bug
    3. Manifest – When a fault is visible. Faults may be manifest or latent
  3. Faults are undesirable anomalies in systems or software (ARP-4761):
    1. Failure – A loss of function or a malfunction of a system 2. Error –
      • An occurrence arising as a result of an incorrect action or decision by personnel operating or maintaining a system, or - A mistake in specification, design, or implementation

The most common form to perform the analysis is with a Fault Tree Analysis (FTA) diagram. This is a causality diagram that relates normal conditions and events, and abnormal conditions and events (such as faults and failures) with undesirable conditions (hazards). A Hazard Analysis is generally a summary of safety analysis from one or more FTAs.

An FTA diagram connects nodes with logic flows to aid understanding of the interactions of elements relevant to the safety concept. Nodes are either events, conditions, outcomes, or logical operators as shown in Figure 2.55. See https://www.sae.org/standards/content/arp4761/ for a good discussion of FTA diagrams.

Cameo provides the Cameo Safety and Risk Analyzer that supports table-based representations of information, mostly relying on Failure Means and Effect (FMEA) tables. Although this profile does not support diagrammatic representations such as FTAs, it is a viable approach for doing safety analysis. An introduction to this profile can be seen on the No Magic YouTube channel at https://www.youtube.com/watch?v=NwuTV5-HAws. See also Fault Tree Analysis and Simulation at https://www.youtube.com/watch?v=A86q00kF8Eo.

I have long used the Dependability Profile I developed over a decade ago that supports FTA diagrams and safety analysis, along with support for reliability and security analysis. Recently, however, the Risk Analysis and Assessment Modeling Language (RAAML) has been released by OMG (see https://www.omg.org/spec/RAAML/). There is a prototype implementation of the RAAML standard available for Cameo at the time of this writing.

The Cameo prototype is available at https://www.dropbox.com/s/g20itfxpdnyolzg/FTA%20RAAML%20Sample.mdzip?dl=0. A Rhapsody RAAML prototype can be downloaded at https://jazz.net/blog/index.php/2021/10/20/model-based-risk-analysis-with-raaml-in-ibm-engineering-systems-design-rhapsody/.

Much of this Cameo profile is based on the internals of my Dependability Profile as well as RAAML, and I am completely in favor of the reuse of my profile in this context. RAAML is more expansive than the Dependability Profile in its safety analysis in that it supports some other analytic approaches; the two are similar in their support for reliability analysis, but the Cameo profile lacks any explicit security analysis. I hear from the team working on the RAAML standard that they are looking at a 1.1 revision to the RAAML standard that will address security analysis in the future. I will provide a simple profile for security analysis based on the Dependability Profile for the next recipe, Model-Based Threat Analysis.

I will use the Cameo prototype implementation in this book. Interested readers can download my Dependability Profile from my website at https://www.bruce-douglass.com/models, but be aware that it is only available for the Rhapsody tool.

Figure 2.55 shows the symbology in the Cameo RAAML prototype. It is slightly less complete than the Dependability Profile but is a serviceable set of elements.

Figure 2.55: FTA symbology

At its core, an FTA is a causality diagram with conditions connected via logical operators showing a chain of causality. The logical operators take one or more inputs and produce a singular output. The AND operator, for example, produces a TRUE output if both its inputs are TRUE, while the OR operator returns TRUE if either of its inputs is TRUE.

Figure 2.56 shows an example FTA diagram. This diagram shows the safety concerns around an automotive braking system. The hazard under consideration is Failure to Brake. The diagram shows that this happens when the driver intends to brake and at least one of three conditions is present: a pedal input fault, an internal fault, or a wheel assembly fault:

Figure 2.56: Example FTA diagram

A cut is a collection of faults that, taken together, can lead to a hazard. A cut set is the set of such collections such that all possible paths from the primitive conditions and events to the hazard have been accounted for. In general, if you consider n primitive conditions as binary (present or non-present), then there are 2 n cuts that must be examined. Consider the simple FTA in Figure 2.57. The primitive conditions are marked as a through e:

Figure 2.57: Cut set example

With 5 primitive conditions, there are 32 prospective cut sets that should be considered, of which only 3 can lead to the hazard manifestation, as shown in Figure 2.58. Only these three need to be subject to the addition of a safety measure:

Figure 2.58: Cut sets example (2)

There is normally one FTA diagram per identified hazard, although that FTA can be decomposed into multiple FTA diagrams (although the Cameo profile lacks the transfer operator from the FTA standard, there are other means to accomplish this decomposition). A system, however, normally has multiple hazards. These are summarized into a hazard analysis. A hazard analysis summarizes the hazard-relevant metadata, including the hazard name, description, severity, likelihood, risk, tolerance time, and possibly, related safety-relevant requirements, and design elements.

It should be noted that safety analysis is a rich and deep topic, the details of which are beyond the scope of this book. In this recipe, we will provide a simple FTA-based approach for performing safety analysis.

The purpose of this recipe is to create a set of safety-relevant requirements for the system under development by analyzing safety needs.

A use case naming a capability of the system from an actor-use point of view that has been identified, described, and for which relevant actors have been identified. Note: this recipe is normally performed in parallel to one of the functional analysis recipes from earlier in this chapter.

The most important outcome is a set of requirements specifying how the system will mitigate or manage the safety concerns of the system. Additionally, a safety concept is developed identifying the need for a set of safety control measures, which is summarized in a hazard analysis.

Figure 2.59 shows the workflow for the recipe:

Figure 2.59: Model-based safety analysis workflow

A hazard is a condition that leads to an accident or loss. This step identifies the hazards relevant to the use case under consideration that could arise from the system behavior in its operational context.

Hazards are specified by their safety-relevant metadata. This generally includes the hazard name, description, likelihood, severity, risk, and safety integrity level, adopted from the relevant safety standard.

This step identified the conditions and events related to the hazard, including:

  • Required conditions
  • Normal events
  • Hazardous events
  • Fault conditions
  • Resulting conditions

Each condition and event should be described. A typical set of aspects of such a description includes:

  • Overview
  • Effect
  • Cause
  • Current controls
  • Detection mechanisms
  • Failure mode
  • Likelihood, or Mean Time Between Failure (MTBF)
  • Severity
  • Recommended action
  • Risk priority (product of likelihood and severity or MTBF/severity)

This step constructs an FTA connecting the various nodes with logic flows and logic operators flowing from primitive conditions up to resulting conditions and, ultimately, to the hazard.

Identify the relevant cuts from all possible cut sets to ensure that each is “safe enough” to meet the safety standard being employed. This typically requires the addition of safety measures, as discussed in the next step.

Safety measures are technical means or usage procedures by which safety concerns are mitigated. All safety measures reduce either the likelihood or the severity of an accident. In this analysis, care should be taken to specify the effect of the measures rather than their implementation, as much as possible. Design-level hazard analysis will be conducted later to ensure the adequacy of the design realization of the safety measures specified here.

This step reviews the analysis and the set of safety measures to ensure their adequacy.

The safety requirements specify needs that the design, context, or usage must meet in order to make the system adequately safe. These requirements may be specially annotated to indicate their safety relevance or may just be treated as requirements that the system must satisfy.

Once the use case model and requirements stabilize, we add trace links using the «trace» relation or something similar. It is especially important to trace the safety measures to the elements of the FTAs that identify the need for those requirements.

Once the work has stabilized, a review for correctness and compliance with standards may be done. This allows subject matter experts and stakeholders to review the requirements, use cases, and user stories in light of the safety concerns.

The Pegasus example problem isn’t optimal to show safety analysis because it isn’t a safety-critical system. For that reason, we will use a different example to illustrate the use of this recipe.

The Medical Gas Mixer (MGM) takes in gas from wall supplies for O 2, He, N 2, and air and mixes them, and delivers a flow to a medical ventilator. When operational, the flow must be in the range of 100 ml/min to 1500 ml/min with a delivered O 2 percentage (known as Fraction of Inspired Oxygen, or FiO2) of no less than 21%. The flow from individual gas sources is selected by the physician via the Ventilator interface.

Neonates face an additional hazard of hyperoxia – too much oxygen in the blood – as this can damage their retina and lungs.

In this example, the focus of our analysis is the use case Mix Gases.

The fundamental hazard of this system is hypoxia – delivering too little oxygen to sustain health.

The average adult breathes about 7-8 liters of air per minute, resulting in a delivered oxygen flow of around 1450 ml O 2 /minute. For neonates, the required flow can be as low as 40 ml O 2 /minute, while for large adults, the need might be as high as 4000 ml O 2 /minute at rest.

The «Hazard» stereotype includes a set of tags for capturing the hazard metadata. This is shown in Figure 2.60. An explanation of the tags of this stereotype is in order:

  • Probability – This is the likelihood of occurrence of the item, event, or condition.
  • ftt – Fault Tolerance Time – How long a fault can be tolerated before a mishap is likely to occur.
  • fftu – Fault Tolerance Time Units – The time units for the fault tolerance time.
  • Severity – The negative impact of the mishap. Different standards specify this in various ways.
  • Risk – The product of the probability and the severity of the item.
  • SIL – Safety Integrity Level – This is a safety-standard-specific risk categorization:

Figure 2.60: Mix Gases Hazards

For the rest of this example, we will focus exclusively on the Hypoxia hazard. There are two required conditions (or assumptions/invariants). First, that the gas mixer is in operation, and second, that there is a physician in attendance. This latter assumption means that the physician can be part of the “safety loop.”

There are a number of faults that are relevant to the Hypoxia hazard:

  • The gas supply runs out of either air or O 2, depending on which is selected
  • The gas supply valve fails for either air or O 2, depending on which is selected
  • The patient is improperly intubated
  • Faults in the breathing circuit, such as disconnected hoses or leak
  • The ventilator commands a FiO 2 that is too low
  • The ventilator commands a total flow of a specified mixture that is too low

The «BasicFault» stereotype provides tags to hold fault metadata. The metadata for three of these faults, Gas Supply Valve Fault, Improper Intubation, and Commanded FiO2Too Low, are shown in Figure 2.61. Since the latter has more primitive underlying causes, it will be changed to a Resulting Condition and the primitive faults added:

Figure 2.61: Fault Metadata

Figure 2.62 shows the initial FTA. This FTA doesn’t include any safety mechanisms, which will be added shortly. Nevertheless, this FTA shows a causality tree linking the faults to the hazard with a combination of logic operators and logic flows:

Figure 2.62: Initial FTA

There are 10 primitive fault elements, so there are potentially 2 10 (1024) cuts in the cut set, although we are only considering cases in which the assumptions are true so that immediately reduces the set to 2 8 (256) possibilities. All of these are ORed together so it is enough to independently examine just the 8 basic faults.

Adding a safety measure reduces either the likelihood or the severity of the outcome of a fault to an acceptable level. This is done on the FTA by creating anding-redundancy. This means that for the fault to have its original effort, both the original fault must occur and the safety measure must fail. The likelihood of both failing is the product of their probabilities. For example, if the Gas Supply Valve Fault has a probability of 8 x 10 -5, and we add a safety measure of a gas supply backup that automatically kicks in that has a probability of failure of 2 x 10 -6, then the resulting probability of both failing is 16 x 10 -11. Acceptable probabilities of hazards can be determined from the safety standard being used.

For the identified faults, we will add the following safety measures:

  • Gas Supply Valve Fault safety measure: Secondary Gas Supply
  • Gas Supply Exhausted fault safety measure: Secondary Gas Supply
  • Improper Intubation fault safety measures: CO2 Sensor on Expiratory Flow and Alarm on Fault
  • Breathing Circuit Fault safety measures: Inspiratory Limb Flow Sensor and Alarm on Fault
  • Physician Error in Commanded O2 safety measures: Range Check Commanded O2 and Alarm on Fault
  • Computation Error fault safety measures: Secondary Parallel Computation and Alarm on Fault
  • Message Corruption fault safety measure: Message CRC
  • Commanded Flow Too Low fault safety measures: Inspiratory Limb Flow Sensor and Alarm on Fault

Adding these results in a more detailed FTA

Section titled “Adding these results in a more detailed FTA”

To ensure readability, the inputs to the resulting condition are shown in another diagram for FiO2 Too Low (Figure 2.64). Figure 2.63 shows the high-level FTA diagram with safety measures added. Note that they are added in terms of what happens when they fail. Failure of safety measures is indicated with a red bold font for emphasis:

Figure 2.63: Elaborated FTA diagram

Figure 2.64: FIO2 flow too low sub-FTA

The set of safety measures addresses all the identified safety concerns.

Now that we have identified the safety measures necessary to develop a safe system, we must create the requirements that mandate their inclusion. These are shown in Figure 2.65:

Figure 2.65: Safety requirements

It used to be that most systems were isolated and disconnected; the only way to attack such a system required physical presence. Those days are long gone.

These days, most systems are internet-enabled and connected via apps to cloud-based servers and social media. This presents opportunities to attack these systems, compromise their security, violate their privacy, steal their information, and cause damage through malicious software.

Unfortunately, little has been done to protect systems in a systematic fashion. The most common response I hear when consulting is “Security. Yeah, I need me some of that,” and the issue is ignored thereafter. Sometimes, some thought is given to applying security tests ex post facto, or perhaps doing some code scans for software vulnerabilities, but very little is done to methodically analyze a system from a cyber-physical security posture standpoint. This recipe addresses that specific need.

Security is the second pillar of dependability. The first, safety, was discussed in the previous recipe. Key concepts for a systematic approach to cyber-security needs are:

Security – resilience to attack

Asset – a security-relevant feature of a system that the system has a responsibility to protect. Assets have the following properties:

  • Access Level Permitted
  • Accountability
  • Asset Kind
    • Actor
      • Information Asset
      • Currency Asset
      • Resource Asset
      • Physical Asset
      • Service Asset
      • Security Asset
      • Tangible Asset
      • Intangible Asset
  • Availability
  • Clearance Required
  • ID
  • Integrity
  • Value

Asset context – The system or extra-system elements enshrouding one or more assets; e.g., a safe in which money is kept is a simple example of an asset context. An asset context may be decomposed into contained asset context elements.

Security field – The set of assets, asset contexts, vulnerabilities, and countermeasures for a system (also known as the system security posture).

Vulnerability – A weakness in the security field of an asset that may be exploited by an attack.

Threat – A means by which a vulnerability of the security field of an asset may be exploited.

Attack – The realization of a threat invoked by a threat agent.

Attack chain – A type of attack that is composed of sub-attacks. Sometimes known as a Cyber Killchain. Most modern attacks are of this type.

Threat agent – A human or automated threat source that invokes an attack, typically intentionally.

Security countermeasure – A means by which a vulnerability is protected from attack. Countermeasures may be passive or active and may be implemented by design elements, policies, procedures, labeling, training, or obviation. Countermeasure types include (but are not limited to):

  • Access Control
  • Accounting
  • Active Detection
  • Authentication
  • Recovery
  • Boundary Control
  • Backup
  • Encryption
  • Deterrence
  • Obviation
  • Nonrepudiation
  • Policy Action
  • Response
  • Scanning Detection

Role – A part a person plays in a context, e.g., a user, administrator, or trusted advisor.

Authenticated role – A role with explicit authentication, which typically includes a set of permissions.

Permission – The right or ability to perform an action that deals with an asset. A role may be granted permission to perform different kinds of access to an asset.

Access – A type of action that can be performed on a resource. This includes (and this list may be extended):

  • No access
  • Unrestricted access
  • Read access
  • Modify access
  • Open access
  • Close access
  • Entry access
  • Exit access
  • Create access
  • Delete access
  • Remove access
  • Invoke access
  • Configure access
  • Interrupt access
  • Stop access

Security violation – The undesired intrusion, interference, or theft of an asset; this may be the result of an attack (intentional) or failure (unintentional).

Risk – The possibility of an undesirable event occurring or an undesirable situation manifesting. Risk is the product of (at least) two values: likelihood and severity. Severity in this case is a measure of the asset value.

Risk number – The numeric value associated with risk (likelihood x severity).

The UML Dependability Profile used in the previous recipe also includes cyber-physical threat modeling using the above concepts. The security information can be captured and visualized in a number of diagrammatic and tabular views. It may be downloaded at https://www.bruce-douglass.com/safety-analysis-and-design; however, it is profile-specific for the Rhapsody tool. For the purpose of this recipe, I created a simplistic security analysis profile for Cameo. The stereotypes used in this recipe are shown in Figure 2.66.

Icons I commonly use to represent those elements are shown next to the relevant stereotypes:

Figure 2.66: Bruce’s simplified security analysis profile stereotypes

Some of the stereotypes have tagged values to hold security-relevant metadata. Figure 2.67 shows two stereotypes that have tags – Asset and Asset Context – and some value types used to define those tags:

Figure 2.67: Security profile stereotype tags and types

The Security Analysis Diagram (SAD) is a logical causality diagram very similar to the Fault Tree Analysis diagram used in the previous recipe. A SAD shows how assets, events, and conditions combine to express vulnerabilities, how countermeasures address vulnerabilities, and how attacks cause security violations. The intention is to identify when and where countermeasures are or should be added to improve system security. This diagram uses logical operations (AND, OR, NOT, XOR, and so on) to combine the presence of assets, asset context, situations, and events. Figure 2.68 shows a typical SAD. You can identify the kind of element by the stereotype, such as asset, asset context, countermeasure, vulnerability, and threat:

Figure 2.68: Security analysis diagram example

Another useful diagram is the asset diagram. The asset diagram is meant to show the relationships among assets, asset contexts, vulnerabilities, countermeasures, supporting security requirements, and other security-relevant elements.

Figure 2.69 shows an asset diagram in use:

Figure 2.69: Asset diagram

The last diagram of particular interest is the attack flow diagram. It is a specialized activity diagram with stereotyped actions to match the canonical attack chain, shown in Figure 2.70:

Figure 2.70: Canonical attack chain

The purpose of this diagram is to allow us to reason about how attacks unfold so that we can identify appropriate spots to insert security countermeasure actions. Figure 2.71 shows an example of use:

Figure 2.71: Example attack flow diagram

The stereotyped actions either identify the action as a part of the attack chain or identify the action as a countermeasure. The actions without stereotypes are normal user actions.

Tables and matrices can easily be constructed to summarize the threat analysis. The Security Posture Table, for example, is a tabular summary of assets, asset context, vulnerabilities, and countermeasures, and their important security-relevant metadata, including name, description, risk number, severity, probability, consequence, and impact.

The purpose of this recipe is to identify system assets subject to attack, how they can be attacked, and where to best apply countermeasures.

A use case naming a capability of the system from an actor-use point of view that has been identified, described, and for which relevant actors have been identified. Note: this recipe is normally performed in parallel to one of the functional analysis recipes from earlier in this chapter.

The most important outcome is a set of requirements specifying how the system will mitigate or manage security concerns of the system. Additionally, a security posture concept is developed identifying the need for a set of security control measures, which is summarized in cyber-physical threat analysis.

The workflow for this recipe is shown in Figure 2.72:

Figure 2.72: Security analysis workflow

Assets are system or environmental features of value that the system is charged to protect. Assets can be classified as being one of several types, including:

  • Information – information of value, such as a credit card number
  • Currency – money, whether in physical or virtual form
  • Resource – a capability, means, source, system, or feature of value, such as access to GPS for vehicle navigation
  • Physical – a tangible resource that can be physically compromised, threatened, or damaged, such as a gas supply for a medical ventilator
  • Service – a behavior of the system that provides value, such as delivering cardiac therapy
  • Security – a security measure that can be compromised as a part of an attack chain, such as a firewall

Of course, these categories overlap to a degree, so categorize your assets in a way that makes sense to you and your stakeholders.

Asset diagrams can be used to create and visualize assets. Assets are system or environmental features that have a value that your system is responsible to protect. Create one or more asset diagrams to capture the assets and asset contexts. You can optionally add access roles, permissions, and vulnerabilities, but the primary purpose is to identify and understand the assets.

Assets have several properties you may want to represent. At a minimum, you want to identify the asset kind and the value of the asset. Asset value is important because you will be willing to spend greater cost and effort to protect more valuable assets. You may also want to specify the asset availability, clearance, or access level required.

Vulnerabilities are weaknesses in the system security field; in this context, we are especially concerned with vulnerabilities specific to asset and asset contexts. If you are using known technology, then sources such as the Common Vulnerability Enumeration (CVE, see https://cve.mitre.org/cve/) or Common Weakness Enumeration (CWE, see https://cwe.mitre.org/) are good sources of information.

Most attacks are not a single action, but an orchestrated series of actions meant to defeat countermeasures, gain access, compromise a system, and then perform “actions on objective” to exploit the asset. Use the attack flow or attack scenario diagrams to model and understand how an attack achieves its goals and where countermeasures might be effective.

Express your understanding of the causal relations between attacks, vulnerabilities, and countermeasures on security analysis diagrams. These diagrams are similar to FTAs used in safety analysis.

Once a good understanding is achieved of the assets, their vulnerabilities, the attack chains used to penetrate the security field, and the causality model, you’re ready to identify what security countermeasures are appropriate and where in the security field they belong.

Review the updated security posture to ensure that you’ve identified the correct set of vulnerabilities, attack vectors, and countermeasures. It is especially important to review this in the context of the CVE and CWE.

When you’re satisfied with the proposed countermeasures, add requirements for them. As with all requirements, these should specify what needs to be done and not specifically how, since the latter concern is one of design.

Add trace links from your security analysis to the newly added requirements, from the associated use case to the requirements, and from the use case to the security analysis. If an architecture already exists, also add «satisfy» relations from the architectural elements to the security requirements, as appropriate.

This final step of the recipe reviews the set of requirements for the use case, including any requirements added as a result of this recipe.

For this example, we’ll consider the use case Measure Performance Metrics. This use case is about measuring metrics such as heart rate, cadence, power, (virtual) speed, and (virtual) distance and uploading them to the connected app. The use case is shown in Figure 2.73:

Figure 2.73: Measure performance metrics use case

There are two kinds of assets that might be exposed; the login ID and password used during the connection to the app and the rider’s privacy-sensitive performance data. The assets of concern are the Ride Login Data and Rider Performance Metrics.

Other use cases potentially expose other assets, such as the Update Firmware use case exposing the system to malware, but those concerns would be dealt with during the analysis of the latter use case.

The asset metadata is captured during the analysis. It is shown in Figure 2.74. Both assets are of asset kind INFORMATION_ASSET. The Rider Login Data is a High valued asset, while the Rider Performance Data is of Medium value. To create this table, apply the «asset» stereotype to the elements in the table, add the security metadata to those elements, then create a table with Tools > Generic Table Wizard. Once the table is created, add the columns for the tagged values with the Columns > Select Columns tool:

Figure 2.74: Asset metadata

Next, we look to see how the assets express vulnerabilities. We can identify three vulnerabilities that apply to both assets: impersonation of a network, impersonation of the connected app, and sniffing the data as it is sent between the system and the app. See Figure 2.75:

Figure 2.75: Asset vulnerabilities

Figure 2.76 shows the attack chain for the Measure Performance Metrics use case. It is further decomposed into a call behavior, shown in Figure 2.77.

These attack chains show the normal processing behavior along with the attack behaviors of the adversary and the mitigation behaviors of the system:

Figure 2.76: Measure performance metrics attack chain

Figure 2.77: Process messages attack chain

Now that we’ve identified and characterized the assets, vulnerabilities, and attacks, we can put together a causality model. This is shown in Figure 2.78 for the compromising of login data and credentials, and in Figure 2.79 for the rider metric data:

Figure 2.78: Security analysis diagram for rider login data

Figure 2.79: Security analysis diagram for rider metric data

We can see in the previous two figures that our causality diagram has identified two security countermeasures: the use of credentials for Bluetooth connection and the addition of encryption for message data.

In this step, we review our security posture. The security posture is the set of assets, asset contexts, vulnerabilities, and countermeasures. In this case, the assets are the rider login data and the rider metrics data. The login data includes the username and password.

The metrics data includes all the metrics gathered, including speed, distance, elapsed time, date and time of workout, power, cadence, and heart rate.

There are two asset contexts: the system itself and the phone hosting the app. The latter context is out of the system’s scope and we have limited ability to influence its security, but we can require the use of the protections it provides. Notably, this includes Bluetooth credentials and encryption of data during transmission. Other use cases may allow us better control over the security measures in this asset context. For example, the use case Configure System uses a configuration app of our own design, which we can ensure stores data internally in encrypted form; we have no such control over the third-party training apps.

We identified three vulnerabilities. During login, the system can be compromised either with network or app impersonation. By pretending to be a trusted conduit or trusted actor, an adversary can steal login information. We address these concerns with two explicit countermeasures: message encryption and the use of credentials. Security could be further enhanced by requiring multi-factor authentication, but that was not seen as necessary in this case. During rides, the system transmits metric data to the app for storage, display, and virtual simulation. An adversary could monitor such communications and steal that data. This is addressed by encrypting messages between the system and the app.

The security requirements are simply statements requiring the countermeasure design and implementation. In this case, there are only two such requirements:

  • The system shall require the use of a Bluetooth credential agreement between the system and the app to permit message traffic.
  • The system shall encrypt all traffic between itself and the app with at least 128-bit encryption.

The new requirements trace to the Measure Performance Metrics use case. Further, trace links are added from the countermeasures to the requirements, linking our analysis to the requirements.

We can now review the use case, functional analysis, and dependability analyses for completeness, accuracy, and correctness.

System interfaces identify the sets of services, data, and flows into and out of a system. By logical interfaces, we mean abstract interfaces that specify the content and precision of the flows but not their physical realization. For example, a system interface to a radar might include a message herezaRadarTrack(r: RadarTrack) as a SysML event carrying a radar track as a parameter without specifying what communication means will be used, let alone the bit-mapped structure of the realizing 1553 Bus message. Nevertheless, the specification of the interface allows us to consider the set of services requested of the system by actors, the set of services needed by the system from actors, and the physical and information flow across the system boundary.

The initial set of interfaces is a natural outcome of use case analysis. Each use case characterizes a set of interactions of the system with a group of actors for a similar purpose. These interactions necessitate system interfaces. This recipe will focus on the identification of these interfaces and the identification of the data and flows that they carry; the actual definition of these data elements is described in the last recipe in this chapter, Creating the Logical Data Schema.

The logical interfaces from a single use case analysis are only a part of the entire set of system interfaces. The set interfaces from multiple use cases are merged together during system architecture definition. This topic is discussed in the recipes of the next chapter, Developing Systems Architectures. Those are still logical interfaces, however, and abstract away implementation detail. The specification of physical interfaces from their logical specification is described in Chapter 4, Handoff to Downstream Engineering.

SysML supports a few different ways to model interfaces, and this is intricately bound up with the topic of ports. SysML has the standard port (from UML), which is typed by an interface. An interface is similar to an abstract class; it contains specifications of services but no implementation. A block that realizes an interface must provide an implementation for each operation specified within that interface. UML ports are typed by the interfaces they support. A port may either provide or require one or more interfaces. If an interface is provided by the system, that means that the system must provide an implementation that realizes the requested services. If an interface is required, then the system can request an actor to provide those services. These services can be synchronous calls or asynchronous event receptions and can carry data in or out, as necessary. Note that the difference between provided and required determines where the services are implemented and not the direction of the data flow.

These interfaces are fundamentally about services that can, incidentally, carry data. SysML also defines flow ports that allow data or flow to be exchanged without services being explicitly involved. Flow ports are bound to a single data or flow element and have an explicit flow direction: either into or out of the element. Block instances could bind flow ports to internal value properties and connect them to flow ports on other blocks that were identically typed.

SysML 1.3 and later deprecate these standard and flow ports and added the proxy port. To be clear, “deprecated” means that the use of these ports is “discouraged” but they are still part of the standard, so feel free to use them. Proxy ports essentially combine both the standard ports and flow ports. The flows specified sent or received by a proxy part are defined to be flow properties rather than value properties, a small distinction in practice. More importantly, proxy ports are not typed by interfaces but rather by interface blocks. Interface blocks are more expressive than interfaces in that they can contain flow properties, nested parts, and proxy ports themselves. This allows the modeling of some complex situations that are difficult with simple interfaces. With proxy ports, gone are the “lollipop” and the “socket” notations; they are replaced by the port and port conjugate (”~”) notation. In short, standard ports use interfaces but proxy ports use interface blocks. The examples in this book exclusively use proxy ports and interface blocks and not standard ports.

This recipe specifically refers to the identification and specification of logical interfaces during use case specification, as experience has shown this is a highly effective means for identifying the system interfaces.

Systems engineering must contend with something that software development does not: continuous flows. These flows may be information but are often physical in nature, such as material, fluids, or energy. SysML extends the discrete nature of UML activities with the «continuous» stereotype for continuous flows. The «stream» stereotype (from UML) refers to object flows (“tokens”) that arrive as a series of flow elements at a given rate. «continuous» is a special case where the time interval between streaming flow elements approaches zero. In practice, «stream» is used for a flowing stream of discrete elements, often at a rate specified with the SysML «rate» stereotype, while «continuous» is used for truly continuous flows. An example of «stream» might be a set of discrete images sent from a video camera at a rate of 40 frames per second. An example of a «continuous» flow might be water flowing through a pipe or the delivery of electrical power.

In my work, I use these stereotypes on flows in sequence diagrams as well. I do this by applying the stereotypes to messages and through the use of a continuous interaction operator. To create the flows, I use a standard Message on the sequence diagram and add item flows to it with Cameo’s Item Flow Manager. To enable that, the relations between the elements typing the lifelines must have such flows defined. Figure 2.80 shows such a context for a system that heats water for bathing:

Figure 2.80: Structural context for continuous flows example

Since the flows are defined, they can be added to the messages sent between the lifelines defined by those blocks. While the Rhapsody tool allows me to create new interaction operators, Cameo does not. Thus, in Cameo, I use a Critical Region interaction operator and apply the continuous stereotype to it.

The resulting sequence diagram is shown in Figure 2.81:

Figure 2.81: Continuous flows on sequence diagrams

The figure shows flows (messages with item flows) marked with the «continuous» stereotype. This indicates that the flow is continuous throughout its execution context. That context can be the entire diagram or limited to an interaction operator, as it is in this case. Within a context, there is no ordering among «continuous» flows; this is in contrast to the normal partial ordering semantics of SysML sequence diagrams in which “lower in the diagram” corresponds (roughly) to “later in time.” However, «continuous» flows are active throughout their execution context and so the ordering of continuous flows is inherently meaningless.

The use of the interaction operator with the continuous stereotype defines the context during which the flows are continuous and unordered. Any normal (non-continuous) messages within the interaction operator still operate via the normal partial ordering semantics.

The purpose of this recipe is to identify the exchange of services and flows that occur between a system and a set of actors, especially during use case analysis.

The precondition is that a use case and set of associated actors have been identified.

Interfaces or interface blocks are identified, as well as which actors must support which interfaces or interface blocks.

Figure 2.82 shows the workflow for this recipe. This overlaps with some of the other recipes in this chapter but focuses specifically on the identification of the system interfaces:

Figure 2.82: Specify logical interfaces workflow

This first step is to identify the generic usage of the system that will use the to-be-identified system interfaces.

The related actors are those people or systems outside our scope that interact with the system while it executes the current use case. These actors can send messages to the system, receive messages from the system, or both using the system interfaces.

The use case execution context is a kind of modeling “sandbox” that contains an executable component consisting of executable elements representing the use case and related actors. The recommended way to achieve this is to create separate blocks representing the use case and the actors, connected via ports. Having an isolated simulation sandbox allows different system engineers to progress independently on different use case analyses.

This step is optional but is a popular way to begin to understand the set of flows in the use case. This step identifies the actions – event reception actions, event send actions, and internal system functions – that define the set of flows of the use case.

Scenarios are singular interactions between the system and the actors during the execution of the use case. When working with non-technical stakeholders, they are an effective way to understand the desired interactions of the use case. We recommend starting with normal, “sunny day” scenarios before progressing to edge case and exceptional “rainy day” scenarios. It is important to understand that every message identifies or represents one or more requirements and results in messages that must be supported in the derived interfaces. If the Create Activity Flow task is performed, then the sequence diagrams can be derived from those flows.

Use asynchronous events for all actor > system and system > actor service invocations. This is specifying the logical interfaces and so the underlying communication mechanism should be abstracted away. Later, in the definition of the physical interfaces and data schema, these can be specified in a technology-specific fashion.

These signals often carry data. This data should be explicitly modeled as signal attributes that become message arguments.

Use UML “flows” to indicate discrete flows of information, material, fluids, or energy exchanges between the system and an actor that are not intimately bound to a service request. Stereotype these flows as «continuous» when appropriate, such as the flows of energy or fluids.

The event arguments must be typed by elements in the logical data schema (see the recipe Creating the Logical Data Schema). The same is true for flow types. Because these types are specifications, they will include not only some (logical) base types, but also units, ranges, and other kinds of metadata.

Based on the defined interaction of the system with the actors while executing the use case, add ports between the actor and use case blocks and type these ports with interfaces. These interfaces will enumerate the services and flow going between the actors and the system. Technically speaking, this can be done using UML standard ports and SysML flow ports, or the more modern SysML 1.3 proxy ports.

This example will use the Control Resistance use case but we will a different approach than was used for this use case in the Functional Analysis with Activities recipe, just to demonstrate that there are alternative means to achieve similar goals in MBSE.

The Control Resistance use case focuses on how resistance is applied to the pedals in response to simulated gearing, conditions, and user-applied force. The description was shown previously in Figure 2.19.

There are two actors here for this use case: Rider and Training App. The Rider provides power to and receives resistance from the pedals. The Training App is sent the rider power information.

Creating the execution context creates blocks that represent the actors and use cases for the purpose of analysis and simulation. They contain proxy ports that will be defined by the interfaces identified in this workflow:

Figure 2.83: Control resistance execution context for interface definition

The activity flow shows the object and control flows for the use case. In this example, we will show continuous flows in addition to discrete flows. The activity is decomposed into three diagrams. The top level is shown in Figure 2.84. This diagram shows the system sending bike data to the Training App on the left. The center part, containing the Determine Base Pedal Resistance call behavior, does the bulk of the functional work of the use case.

Note that it takes the computed base resistance on the pedal and adjusts it for its current angular position. On the right, pedal cadence is computed from pedal speed.

Discrete events, such as turning the system on and off or changing the gears, are simple to model in the activity diagrams; they can easily be modeled as either signal receptions for incoming events or send signal actions for outgoing events. Of course, these events can carry information as arguments as needed.

It is somewhat less straightforward to model continuous inputs and outputs. These are modeled on the flow properties pedalSpeed and pedalResistance. The activity uses a change event for monitoring when the pedal speed changes and uses this, along with other information, to compute and apply resistance at the point of the pedal:

Figure 2.84: Control resistance activity flow for creating interfaces

Figure 2.85 shows the details for the Determine Pedal Resistance call behavior from the previous figure. In it, we see the base pedal resistance is computed using another call behavior, Compute Bike Physics. The Determine Pedal Resistance behavior never terminates (at least until the entire behavior terminates) so it uses a «rate» stereotype to indicate the data output on these activity parameter streams, although Cameo doesn’t show it graphically. I added a constraint to show the rate.

Remember that normal activity parameters require the activity to terminate before they can output a value:

Figure 2.85: Determine base pedal resistance activity

Lastly, we have the call behavior Compute Physics, shown in Figure 2.86. This simulates the physics of the bike using the rider mass, current incline, current speed, and the power applied by the rider to the pedal to compute the resistance to movement, and couples that with the combined bike and rider inertia to compute the simulated bike speed and acceleration:

Figure 2.86: Compute bike physics activity

The interfaces can be produced directly from the activity model but it is often easier to produce them from a set of sequence diagrams derived from the activity model. Accept event actions and flows on activities don’t indicate the source but this is clearly shown in the sequences. If you do create a set of sequence diagrams, it is adequate to produce the set of scenarios such that all inputs and outputs and internal flows are represented in at least one sequence diagram.

The next three diagrams show the functional behavior modeled to follow the same structure as the activity model. Figure 2.87 shows the high-level behavior. Note the use of «continuous» flows for the resistance to movement supplied by the system (pedal resistance) and the speed of the pedal (pedal speed). The critical region interaction operator is stereotyped as «continuous» and defines a scope for continuous flows. Note the use of a parallel interaction operator to show things that are going on concurrently, and loops and critical regions nested within it. The referenced interaction occurrence Determine Pedal Resistance Scenario references the sequence diagram shown in Figure 2.7:

Figure 2.87: Control resistance scenario

Throughout the entire scenario shown in Figure 2.88, the continuous flows are active, so no scoping continuous interaction occurrence is required. This scenario also includes a nested scenario, the referenced Compute Physics, shown in Figure 2.89. This scenario includes a continuous flow but doesn’t need a critical region stereotyped as continuous because the scope of the continuous flow is the entire sequence diagram:

Figure 2.88: Determine pedal resistance scenario

Figure 2.89: Compute bike physics

Rather than show all the stages of development of the scenarios, the previous step is shown already including the message parameters.

Rather than show all the stages of development of the scenarios, the previous step is shown already including the continuous flows.

The detail of how to create all the types is the subject of the next recipe, Creating the Logical Data Schema. The reader is referred to that recipe for more information.

Now that we have the set of flows between the actors and the system and have characterized them, we can create the interfaces. In this example, we are using the SysML 1.3 standard approach of using proxy ports and interface blocks, rather than standard ports, flow ports, and standard interfaces. This is a bit more work than using the older approach but is more modern and descriptive.

Figure 2.83 shows the execution context of the use case analysis for the Control Resistance use case. Although the diagram is itself a block definition diagram, Cameo allows you to show diagrams within diagrams; thus the corresponding internal block diagram is shown at the bottom of the figure. The IBD parts of the use case block Uc_ControlResistance and the actor blocks aCR_Rider and aCR_TrainingApp with SysML connectors between the appropriate ports. Note that, by convention, the unconjugated form interface is referenced at the use case block end of the connector and the conjugated form is used at the actor end, as indicated by the tilde (“~”) in front of the interface block name.

At the top of the diagram are the (current empty) interface blocks that will be elaborated on in this step. Later, during architecture development, these interface blocks will be added to the interfaces provided by the system and decomposed and allocated to the subsystems.

The package Functional Analysis Pkg::Control Resistance Pkg holding the model used in this recipe provides a sandbox for the purpose of analyzing the Control Resistance use case. To that end, a block representing the use case is created and given the name uc_ControlResistance.

For the actors, local blocks are created for the purpose of analysis and are given the names of a (for actor), followed by the initials of the use case (CR) followed by the name of the actor (with white space removed). So, these sandbox actor blocks are named aCR_Rider and aCR_TrainingApp. The interfaces are all named i <use case block name> “_” <actor block name>, as in iControlResistance_ Rider. This makes it easy to enforce naming consistency at the expense of sometimes creating lengthy names.

Since the flows are shown on the sequence diagrams, it is a simple matter to add these elements to the interface blocks:

  • For each message from the use case to an actor, add that signal reception as required to the interface block defining that port.
  • For each message from an actor to the use case, add that signal reception as provided to the interface block defining that port.
  • For each flow from the use case to an actor, add that flow as an output flow property to the interface block defining that port.
  • For each flow from an actor to the use case, add that flow as an input flow property to the interface block defining that port.

The result is shown in Figure 2.90. Note that the event receptions are either provided (prov) or required (reqd) while the flow properties are either in or out (from the use case block perspective):

Figure 2.90: Created interface blocks

You should note that these are, of course, logical interfaces. As such, they reflect the intent and content of the messages but not their physical realization. For example, bike data sent to the training app is modeled in the logical interface as an event, but the implementation will actually be as a Bluetooth message. The creation of physical interfaces from logical ones is discussed in the last chapter.

A big part of the specification of systems is specifying the inputs and outputs of the system as well as what information a system must retain and manage. The input and outputs are data or flows and may be direct flows or may be carried via service requests or responses. Early in the system engineering process, the information captured about these elements is logical. The definition of a logical schema is provided below, along with a set of related definitions.

Data Schema: a data or type model of a specific problem domain that includes blocks, value properties, value types, dimensions, units, their relations, and other relevant aspects collectively known as metadata. This model includes a type model consisting of a set of value types, units, and dimensions, and a usage model showing the blocks and value properties that use the type model.

Logical Schema: a data schema expressed independently from its ultimate implementation, storage, or transmission means.

Value Property: a property model element that can hold values. Also known as a variable or attribute (UML).

Value Type: specify value sets applied to value properties, message arguments, or other parameters that may carry values. The system predefines primitive scalar types including number, integer, real, complex, Boolean, and string. These base types may have additional properties or constraints, specified as metadata.

Metadata: literally “data about data,” this term refers to ancillary properties or constraints on data, including:

  • Extent – the set of values of an underlying base value type that are allowed. This can be specified as:
    • a subrange, as in 0.. 10
      • a low-value and high-value pair, as in “low value =-1, high value = 1”
      • an enumerated list of acceptable values
      • a specification of prohibited values
      • the specification of a rule or constraint from which valid values can be determined
  • Precision – the degree exactness of specified values; for scalar numeric values, this is often denoted as the “number of significant digits”
  • Accuracy – the degree of conformance to an actual value, often expressed as ±<value>, as in “± 0.25”. Accuracy is generally applied to an output or outcome
  • Fidelity – the degree of exactness with which value may be specified. Fidelity is generally applied to an input value
  • Latency – how long after a value property occurs is the value representation updated
  • Availability – a measure of what percentage of the system lifecycle value is actually accessible

Note that these properties are sometimes not properties of the value type but of the value property specified by that value type. In any case, in SysML, these properties are often expressed in tags, metadata added to describe model elements:

Quantity Kind: specifies the kind of value (its dimensionality). Examples include length, weight, pressure, and color. Also known as Dimension in SysML 1.

Unit: specifies a standard against which values in a dimension may be directly compared. Examples include meters, kilograms, kilopascals, and RGB units. The SysML provides a model library of SI units that are directly available for use in models. However, it is not uncommon to define your own as needed.

Recommendation: Each value property should be typed by a unit, unless it is unitless, in which case, it should be typed by a defined value type.

Schematically, these definitions are shown in Figure 2.91 in the data schema metamodel:

Figure 2.91: Data schema metamodel

Although this is called the data schema, it is really an information schema as it applies to elements that are not data per se, such as physical flows. In this book, we will use the common term data schema to apply to flows as well.

Beyond the underlying type model of the schema, described above, the blocks and their value properties and the relations among them constitute the remainder of the data schema. These relations are the standard SysML relations: association, aggregation, composition, generalization, and dependency.

So, what does a diagram showing a logical data schema look like?

Typically, a data schema is visualized within a block definition diagram and shows the data elements and relevant properties. Consider an aircraft navigation system that must account for “own craft” position, velocity, acceleration, flight plans, attitude, and so on. See Figure 2.92:

Figure 2.92: Data schema for flight property set

You can see in the figure, a Flight Property Set contains Airframe_Position, Airframe_Velocity, Airframe_Acceleration, and so on. These composed blocks contain value properties that detail their value properties; in the case of Airframe_Position, these are altitude, latitude, and longitude. Altitude is expressed in the unit Meters (defined in the Cameo SysML type library) while latitude and longitude are defined in terms of the unit Meridian_Degrees, which is not in the SysML model library (and so is defined in the model).

On the left of the diagram, you can see that a Flight Plan contains multiple Flight Property Sets identifying planned waypoints along the commanded flight path. These Flight Property Sets may be actual current information (denoted with the actual Flight Path role end) or commanded (denoted with the commanded Flight Path role end). The latter forms a list of commanded flight property sets and so stores the set of commanded waypoints.

Figure 2.93 shows the scalar types, units, and quantity kind used in Figure 2-92:

Figure 2.93: Types, units, and quantity kinds

This is a serviceable data schema, however, details about the data (metadata) are missing. What are the allowed ranges of values (known as a type’s extent); what is acceptable precision (degree of detail in representation), accuracy (conformance to a value’s specification), and fidelity (degree of precision of inputs)? Figure 2.94 shows an example of applying a stereotype with tags that define this metadata. In this case, «qualified» adds low-value and high-value tags for specifying an extent, as well as accuracy and fidelity tags:

Figure 2.94: Specifying metadata with tags

The purpose of the logical data schema is to understand the information received, stored, manipulated, and transmitted by a system. In the context of the capture of system specification, it is to understand and characterize data and flows that cross the system boundary to conceptually solidify the interfaces a system provides or requires.

The precondition is that a use case and set of associated actors have been identified or that structural elements (blocks) have been identified in an architecture or design.

The output is a set of units, dimensions, and types (the type model), and value properties that they specify along with the relations among the value types and blocks that own them (the usage model).

The workflow has a number of small, well-defined steps. The overall workflow for this recipe is shown in Figure 2.95:

Figure 2.95: Creating the logical data schema

This workflow contains two elaborated call behaviors: Construct Type Model and Specify Metadata Aspects. The first of these is detailed in Figure 2.96 and the latter in Figure 2.97:

Figure 2.96: Construct the type model

Figure 2.97: Specify metadata aspects

This task creates the collaboration of elements that will own or use the elements defined within the data schema. This provides the context in which the types may be considered. In the case of system specification, this purpose is served by defining the use case and its related actors, or by the execution context of block stand-ins for those elements. In a design context, it is generally some set of design elements that relate to some larger-scale purpose, such as showing an architectural aspect or realizing a use case.

This structured activity adds blocks and other elements to the collaboration, detailed in the steps Identify Block, Add Relation, Identify Value Properties, and Add Flow Property.

These are the basic structural element of the collaboration, although rarely value properties may be created without an owning block.

These relations link the structural element together allowing them to send messages to support the necessary interactions. They might be associations to add reference properties, compositions to add part properties, or generalizations to define specialization relations.

This step identified the data property features of the blocks.

This step identified the flow property features of the blocks. Remember, a flow property is nothing more than a value property that flows across a block’s encapsulation boundary without the explicit use of services.

The interaction consists of a set of message exchanges among elements in the collaboration. This is most often shown as sequence diagrams. This structured activity defines an internal workflow.

Messages are the primitive elements of interaction. These may be synchronous (such as function calls), asynchronous (as in asynchronous signal receptions), or flows (represented as flow items on a synchronous or asynchronous message). A single interaction contains a set of ordered messages.

For synchronous call operation messages, the block receiving the message must define an operation to be invoked. The step includes the operation signature, as defined by its parameters, and any return values.

For asynchronous signal receptions, a signal must be defined.

Signals can carry information, just as operation calls can. The signal attributes specify the information passed along with the signal.

As we have seen in previous recipes, flows can be sent between elements of collaboration, as defined with flow properties and item flows. These are represented in the scenarios as flow messages – that is, messages with flow items.

For correctness and consistency, the flow items must correspond to flow properties defined in the collaborating elements.

Most messages, whether synchronous or asynchronous, carry information in the form of parameters (sometimes called arguments). The types of this data must be specified in the data model.

Once a datum is identified, it must be typed. This call behavior is detailed in the following steps.

Most data relies on units for proper functioning and too often, units are implied rather than explicitly specified. This step references existing units or creates the underlying unit and then uses it to type the relevant value properties. The SysML defines a non-normative extension to include a model library of SI units. Cameo, the tool being used here, has a rich set of units and quantity kinds as defined by the SI standard. Not all types are present, and it is common to add additional units and quantity kinds, as needed.

Most units rely on a quantity kind (aka dimension). For example, the unit Meter might represent the quantity kind of distance, length, height, or width. Quantity kinds have many different units available. Length, for example, can be expressed in units of cm, inches, feet, yards, meters, miles, kilometers, and so on.

The underlying value type is expressed in the action language for the model. This might be C, C++, Java, Ada, or any common programming or data language. OMG also defined an abstract action language called Action Language for Foundational (ALF) UML, which may be used for this purpose. See https://www.omg.org/spec/ALF/About-ALF/ for more information. This book uses Groovy as the action language because it is supported in the Cameo tool, but there are equally valid alternatives.

This step applies the defined type to the relevant value and flow properties owned by the elements of the collaboration.

It is almost always inadequate to just specify the value type from the underlying action language. There are other properties of considerable interest. As described earlier in this section, they include extent, precision, latency, and availability. There are many additional metadata properties that may be of concern, including some that may be domain-specific. This call behavior action defines a simple workflow for the identification and application of metadata to the value and flow properties.

The first step in this nested workflow is to identify which metadata properties should be represented. These will be properties of the data, such as the extent, precision, fidelity, latency, and so on.

The recommendation here is to use stereotypes with tags that define the metadata properties of interest.

Add tags to represent the metadata of interest. Not all value or flow properties to which the stereotype is applied must use or provide values for all tags.

Once the stereotypes are defined, the value and flow properties can be stereotyped so that they can own the metadata. Sometimes the stereotypes will be applied to value types or units.

Different value types will provide different values for the metadata tags. For example, consider a stereotype Defined Extent that has tags Low Value (specifying the lowest acceptable value for the property) and High Value (specifying the largest acceptable value). A block Hand might have a value property fingerCount for which the lowest value is 0 and the highest value is 10. Another block – say, Car – might have a value type numberOfDoors with a lowest possible value of 2 and a highest possible value of 5.

This example will use the Measure Performance Metrics use case. The earlier recipe Model-Based Threat Analysis used this use case to discuss modeling cybersecurity. We will use it to model the logical data schema. For the most part, the data of interest is the performance data itself, although the threat model identified some additional security-relevant data that can be modeled as well.

The use case diagram in Figure 2.73 provides the context for the data schema, but usually, the corresponding block definition and internal block diagrams of the execution context are used.

That diagram is shown in Figure 2.98:

Figure 2.98: Measure performance metrics execution context

This task is mostly done by defining the execution context, shown in Figure 2.98. In this case, the structure is pretty simple.

As a part of defining the structure, we identified the primary functional blocks in the previous figure. But now we need to begin thinking about the data elements as blocks and value types. Figure 2.99 shows a first cut at the likely blocks. Note that we don’t need to represent the data schema for the actors because we don’t care. We are not designing the actors since they are, by definition, out of our scope of concern. We must, on the other hand, define the data schema for information passed between the actors and the system:

Figure 2.99: Blocks for measure performance data schema-initial

The instances of the core functional blocks are shown in Figure 2.98. Relations of the data elements to the use case block are shown in Figure 2.100. This is the data that the use case block knows (owns) or uses:

Figure 2.100: Data schema with relations

The blocks provide owners with the actual data of interest, which is held in the value properties. Figure 2.101 shows the blocks populated with value properties relevant to the use case:

Figure 2.101: Data schema value properties

Another way to find data elements to structure is to look at the messaging; this is particularly relevant for use case and functional analysis since the data on which we focus during this analysis is the data that is sent or received. This is represented as a structured action in Figure 2.95. We will employ all its contained actions together.

The first interaction we’ll look at is for uploading real-time ride metrics during a ride. This is shown in Figure 2.102:

Figure 2.102: Real-time ride metrics scenario

The second interaction is for uploading an entire stored ride to the app. This is in Figure 2.103:

Figure 2.103: Upload saved ride

Note that these are just two of many scenarios for the use case, as these do not consider concerns such as dropped messages, reconnecting sessions, and other rainy-day situations. However, this is adequate for our discussion.

In this step, when we draw a “message to self,” this will be realized as an operation in the owning block; received signals will be realized as a signal reception, and flows are realized as flow properties.

Figure 2.101 goes a long way for the definition of the type model. The blocks define the structured data elements, but at the value property level, there is still work to be done. The underlying value types must be identified, their units and dimensions specified, and constraints placed on their extent and precision.

Most, but not all, value properties must be defined in terms of units and quantity kinds.

It is common for engineers to just reference base types – Integer, Real, and so on – to type value properties, but this can lead to avoidable design errors. This is because value types may not be directly comparable, such as when distanceA and distanceB are both typed as Real but in one case are captured in Kilometers and in the other, Miles. Further, one cannot reason about the extent of a type (the permitted set of values) without specified units. For this reason, we recommend – and will use here – unit definitions to disambiguate the values we’re specifying.

The SI Units model library of the SysML specification is an optional compliance point for the standard, and Cameo does an excellent job of providing a set of units and quantity kinds. In this model, we will reference some that exist in that library and create those that do not.

Figure 2.101 uses a number of special units for value properties and operation arguments, including:

  • Degrees of Arc
  • Newton
  • DateTime
  • Kilometers per Hour
  • Kilometers per Hour Squared
  • Kilocalorie
  • RPM
  • Kilometer
  • Resistance Mode

Some of these exist in the SI library and are included in the Cameo tool, such as Newton and Kilometer (although Cameo uses the English spelling of the latter, Kilometre). Others could have been expected to be included, but are not, such as Degrees of Arc, Kilocalorie, and RPM. Still others are application-specific, including Resistance Mode.

Degrees of Arc are a measure of angular displacement and are used for the cycling incline. RPM is a measure of rotational velocity used for pedaling cadence. DateTime is a measure of when data was measured. Kilometer is a measure of linear distance, while Kilometers per hour is a measure of speed, and Kilometers Per Hour Squared is a measure of acceleration. Kilocalorie is a measure of energy used to represent the Rider’s energy output. In our model, we will define all these as units. They will be defined in terms of their dimension in the next section.

Cameo uses a naming convention for value types in its SI library. A value type is given the name of the quantity kind + [ + unit + ], as in speed[kilometre per hour]. This is a useful naming convention telling the modeler about the type, quantity kind, and units in a simple, consistent way.

Figure 2.104 shows the value types, units, and dimensions defined for this logical data schema. Resistance Mode is an enumeration value type with two possible values, RESISTANCE_MODE and ERG_MODE:

Figure 2.104: Value types, units, and quantity kinds

Once the units and quantity kinds are defined, we can define the value types. Once again, the Cameo SI Types library provides a large set of values types. The naming convention for value types is quantity kind + [ + unit ], so you get a value type such as power[watt]. Knowing this allows you to find these value types in the types library. We will mostly follow that naming convention here. The value type acceleration[kilometers per hour squared] in Figure 2.104 follows that convention, although Degrees of Arc does not (to demonstrate an alternative).

Now that we have the value types, we can use them to type the value properties in our model.

Define value type and properties for metadata

Section titled “Define value type and properties for metadata”

The last thing we must do is specify the relevant value type properties. In the logical data schema, this means specifying the extent and precision of the values. This can be done at the unit/value type level; in this case, the properties apply to all values of that unit or type. These properties can also be applied at the value property level, in which case the scope of the specification is limited to the specific values but not to other values of the same unit or type.

One way to specify these properties is to specify them as SysML tags within a stereotype, apply the stereotype to the relevant model elements, and then elaborate on the specific values. To that end, we will create a stereotype, «tempered». This stereotype applies to object nodes, types, parameters, and variables (and therefore, also to pins, value types, units, and value properties) in the SysML metamodel.

The stereotype provides three ways to specify the extent. The first is the extent tag, which is a string in which the engineer can specify a range or list of values, such as [0.00.. 0.99] or 0.1, 0.2, 0.4, 0.8, 1.0. Alternatively, for a continuous range, the tags lowValue and highValue, both of type Real, can serve as well; in the previous example, you can set lowValue to 0.0 and the highValue to 0.99. Lastly, you can provide a range or list of prohibited values in the prohibitedValues tag, such as -1, 0.

The stereotype also provides three means for specifying scale. The scaleOfPrecision tag, of type integer, allows you to define the number of significant digits for the value or type. Numeric values are also further refined with fidelity (precision of an input) and accuracy (degree of conformance to the specified value). Both fidelity and accuracy are usually specified as a ± value to give a range, as in ± 2 mm.

Precision technically refers to the number of significant digits in a number, while scale is the number of significant digits to the right of the decimal point. The number 123.45 has a precision of 5, but a scale of 2. People usually speak of precision while meaning scale.

Another stereotype tag is maxLatency, using a time[second] value type from the SI library to allow specification of the maximum allowable latency of the data. Other metadata can be added to the stereotype as needed for your system specification.

This level of detail in the specification of quantities is important for downstream design. Requiring 2 digits of scale is far different than requiring 6 and drives the selection of hardware and algorithms with effects on system cost and required effort. These stereotypes can be applied at different levels of specification: the value property, the value type, or the unit:

Figure 2.105: Measure performance metrics metadata

Figure 2.105 shows the application of the tempered stereotype to a number of value properties of relevant data blocks in the model. Different metadata may be relevant to different value properties; for example, latency is not a concern for Ride Session::Ride Time but is relevant for more real-time data, such as Compute Performance Data::acceleration.

And there you have it: a logical data schema for the values and flows specified as a part of the Measure Performance Metrics use case. These, along with data schema from other use cases, will be merged into the architecture in the architecture design work.

In the next chapter, we move to the topic of design. This, as we will see, is a topic rich with recipes.