Une image contenant texte, signe

Description générée automatiquement

Generate N2 View

 

Overview

This helper generates an N2 View for architectural interfaces / object flows on activity diagrams.

 

Applicable To

Structure Diagram, Object Model Diagram, Activity Diagram, Package

Menu Entry

Power Pack Reporting Tools Generate N2 View

Demonstration

Watch the Video (Structure)

Watch the Video (Activities)

N2 Views

An N2 (‘N-squared’) view represents the connections between elements as an N x N matrix of cells. The elements appear on the diagonal and the connections in the cells around them. Row cells (that is rows in the upper quadrant) represents items sent to another diagonal and Column cells (that is cells in the lower quadrant) represent received items, for example A sends data to B and C, C sends data back to A:

 

A screenshot of a quiz

Description automatically generated

 

This helper generates an N2 View either for interfaces between blocks or for object flows between actions on activities as a Microsoft Excel spreadsheet (or a html report for Activities). There are multiple ways to generate the view as detailed below.

Interfaces

Data Gathering - Interfaces

The helper starts by gathering valid links from the current selection which may either be a diagram or a package (that package is checked recursively).

Supported links:

·       Links between proxy ports

·       Links between flow ports with explicit interfaces

 

Delegation links are automatically ignored, and the ports must have the same contract (N2 generation is analysis only, bad port data will result in a bad N2). It is recommended to use the Model Checker to check for invalid port data.

A screenshot of a computer

Description automatically generated

Setting the Generation Style

There are two styles of N2 View that may be generated, controlled by the following property which may be set at project or package level

RhapsodyPowerPack.GenerateN2.GenerationStyle

·       Cells As Interfaces (default)

·       Cells as Interface Items

 

In both cases, Blocks are placed on the diagonals in alphabetical order:

A green squares with white letters

Description automatically generated

Clicking on the diagonal cells will navigate to the Block in Rhapsody.

 

Cells As Interfaces

In this style, multiple sheets are generated into the workbook. The first sheet contains an overview of the connections by placing the Interface Blocks into the quadrant cells. The helper does this in a ‘smart’ way by checking the content of the Interface Block. If there are any interface items from ‘A’ to ‘B’ (where A and B are the diagonals) then the Interface Block is placed in the upper quadrant. If there are any interface items from ‘B’ to ‘A’ then the Interface Block is placed in the lower quadrant. If the Interface Block has mixed directions, then the Interface Block will appear in both quadrants.

 

For example, this view indicates that there is a connection between A and B via ports, those ports were typed by an Interface Block FP_AB and according to the directions of the content along with the port conjugation status, all items in that interface are from B to A. There is also a connection between B and C and since the Interface Block IB_BC appears twice, either the interface contains mixed directions or the conjugation status of one of the ports is wrong (for example if all the items are required but both ports are conjugated …) 

A screenshot of a computer game

Description automatically generated

Each Interface Block is then generated as a separate sheet* in the workbook. Clicking the quadrant cell in the matrix will navigate to that sheet:

 

 A screenshot of a computer

Description automatically generated

*Note that Excel has a limitation on the size of the name allowed for sheets. If the Interface Block name exceeds this limit, the helper generates a truncated name.

All elements presented on the detailed sheet view are clickable for navigation back to Rhapsody.

 

Indicating Conjugation

If the following property is set to true, then conjugation is indicated by adding a tilde as a prefix to the interface name if the port typed by that interface on the sender diagonal is conjugated.

RhapsodyPowerPack.GenerateN2.IndicateConjugation

For example, in the N2 below:

·       A sends data/messages to B and the port on A typed by FP_AB is conjugated. 

·       D sends data/messages to A and the port on D typed by IB_AD is not conjugated.

 

In this N2, IB_BC carries mixed directions, and the port typed by that interface on C is conjugated (if both had a toiled this would indicate both ends were conjugated – which would be erroneous).

A green and white squares with letters and numbers

Description automatically generated

 

Cells as Interface Items

In this style, a single sheet is generated which contains the interface items from the contracts on the proxy ports (in alphabetical order). Elements in the upper quadrant are required (for events) or sent (data) to the next block, elements in the lower quadrant are required or sent to the previous block. Proxy port conjugation is considered so the matrix shows the actual direction regardless of which proxy port was conjugated. For example, ev2 is sent by A and received by B, ev3 is sent by C and received by B. These elements may be tagged as provided/required in the interface and the port conjugation defines the actual direction.

A screenshot of a computer

Description automatically generated

Clicking on an interface item in a quadrant cell will navigate to it in Rhapsody.

Summing

If the following property is set to true (set at either project or package level) then summing cells are generated for both rows and columns (generating summing cells can help in identifying ‘critical’ elements):

RhapsodyPowerPack.GenerateN2.GenerateSums

A screenshot of a computer

Description automatically generated A screenshot of a crossword puzzle

Description automatically generated

Object Flows

By default, the output of an Activity based N2 is a html report, but the following property may be used to switch to a spreadsheet-based report instead:

RhapsodyPowerPack.GenerateN2.UseWebView

For the html-based report, the reporting property below allows the generated report to be opened inside / outside Rhapsody (or both):

RhapsodyPowerPack.ReportingTools.OpenInBrowser

Data Gathering – Object Flows

The helper starts by gathering valid actions and flows from the selected activity diagram (and any referenced activities*).

Valid actions are those with at least one pin.

Valid flows are those between pins where:

·       The pins have the same name.

·       The pins have the same type.

·       The directions of the pins are different.

 

*Reference Activities

If flows are connected via activity parameters, then these are processed to detect the actions at either end. The rules described above apply to the pins on the actions on each diagram (the intermediate activity parameter only requires the same name – the direction/type are not checked). In addition, only one source action (per-pin) on a reference activity is permitted – if an activity parameter has multiple incoming flows only the first one is processed.

 

Example 1 – Target Action in Reference Activity

A screenshot of a computer

AI-generated content may be incorrect.

 

Example 2 – Source Action in Reference Activity

A screenshot of a computer

AI-generated content may be incorrect.

 

Spreadsheet Style

This style of report uses the Cells as Interface Items style automatically.

Diagonal cells contain the source / target actions and quadrant cells contain the type of the source port (it is assumed you have already run consistency checking on the diagram and therefore the types of the source and target port match).

Diagonal cell text depends on the action type:

·       Call operations contain the name of the operation.

·       Opaques actions contain the action body (if the action is empty then the name of the action is used instead).

 

A screenshot of a computer

AI-generated content may be incorrect.

 

Navigation

Spreadsheet

Clicking an element in the sheet navigates to Rhapsody using the windows rhapsody: protocol handler which only supports navigating to the model element in the model browser (not on diagrams). An extra manual navigation step is required to show the element on the diagram (right-click the model element and select Navigate Locate on Diagram)

 

Web-based

If using the web-based option, this uses the Power Pack Web Link Listener and instead navigates directly to the diagram elements.

File Location

By default, the N2 spreadsheet is generated into the project directory with a name [Selected Model Element] N2 View.xlsx.

An alternative generation directory may be specified by setting the following property:

RhapsodyPowerPack.GenerateN2.OutputFolder

The property should contain the path to the generation folder, which may either be:

·       A fully qualified local path, e.g. C:/N2 Views

·       A relative path

If the specified folder does not exist, then the helper attempts to create it. If this fails it reverts to creating the output in the project folder. Note that this property may also be set as part of either a local or profile generation scheme (see below).

 

Relative paths

Relative paths are relative to the project, (that is the .rpyx file) e.g.:

 

·       N2 Views (creates an N2 Views folder in same folder as the rpyx file)

·       ../N2 Views (creates an N2 Views folder one level up from the rpyx file)

·       Doc/N2 Views (creates a Doc folder in same folder as the rpyx file and then creates an N2 Views subfolder inside that)

 

Either forward or backward slashes may be used.

Auto-Resizing

By default, the helper automatically resizes all cells on the main sheet. Since this operation can be process-intensive for larger sheets, it may be disabled using the following property:

RhapsodyPowerPack.GenerateN2.AutoResizeCells

Formatting

There are several ways to control the look and feel of the generated output:

·       Local Properties

·       Local Generation Schemes

·       Profile Generation Schemes

 

Local Properties

The following properties (set at either project or package level) may be used to control the formatting of the generated output locally:

RhapsodyPowerPack.GenerateN2.DiagonalBackground

RhapsodyPowerPack.GenerateN2.DiagonalBoldText

RhapsodyPowerPack.GenerateN2.DiagonalFontColor

RhapsodyPowerPack.GenerateN2.DiagonalFontSize

 

RhapsodyPowerPack.GenerateN2.RowBackground

RhapsodyPowerPack.GenerateN2.RowBoldText

RhapsodyPowerPack.GenerateN2.RowFontColor

RhapsodyPowerPack.GenerateN2.RowFontSize

 

RhapsodyPowerPack.GenerateN2.ColumnBackground

RhapsodyPowerPack.GenerateN2.ColumnBoldText

RhapsodyPowerPack.GenerateN2.ColumnFontColor

RhapsodyPowerPack.GenerateN2.ColumnFontSize

 

RhapsodyPowerPack.GenerateN2.SumBackground

RhapsodyPowerPack.GenerateN2.SumBoldText

RhapsodyPowerPack.GenerateN2.SumFontColor

RhapsodyPowerPack.GenerateN2.SumFontSize

 

Local Generation Schemes

The above properties may be encapsulated into an N2 Generation Scheme (these are new terms based on Comment). Due to limitations in Rhapsody, the properties in such a scheme have an alternative prefix of GenerateN2.ModelElement:

A close up of text

Description automatically generated A screenshot of a computer

Description automatically generated

If the following property is set to the full path of an N2 Generation Scheme, then the properties in that scheme take priority over the local ones. Full paths may be easily obtained using the Get Full Path helper.

RhapsodyPowerPack.GenerateN2.GenerationScheme

Profile Generation Schemes

This last option is intended for profile designers. Before checking for the presence of a local generation scheme, the helper first checks for the presence of a profile generation scheme by looking for the property specified below (this property does not exist by default and must be created either in a property file or directly on a stereotype). If this property exists and has the full path of an N2 generation scheme, then the properties in that scheme take priority. This allows profile designers to supply custom schemes for their profiles and have them automatically used without manual specification by their users. 

RhapsodyPowerPackExtension.GenerateN2.GenerationScheme

For example, a new term based on packages may specify a specific scheme to use:

A screenshot of a computer

Description automatically generated A screenshot of a computer

Description automatically generated

Any N2 generation from such a package will then use that scheme (unless the user overrides the Explicit property – removing its value)