Real Time UML: Advances in the UML for Real-Time Systems (3rd Edition)
UML is has a rich set of notations and semantics. This richness makes it applicable to a wide set of modeling applications and domains. In this chapter, we have only discussed the primary structural modeling facilities of UML. In the coming chapters, new notations within UML will be presented when the context requires them. A concise overview of the notation is provided in Appendix A. Some notational elements we wish to present here include the text note, the constraint, and the stereotype because they will be used in a variety of places throughout the book. A text note is a diagrammatic element with no semantic impact. It is visually represented as a rectangle with the upper righthand corner folded down (similar to the icon used to indicate an artifact). Text notes are used to provide textual annotations to diagrams in order to improve understanding. A constraint is some additional restriction (above the normal UML well-formedness rules) applied against a modeling element. Timing and other QoS constraints can be shown on any kind of diagram, but are commonly used in both structural and behavioral diagrams. Constraints are usually shown inside curly brackets, and may appear inside of text notes. Figure 2-20 shows text notes and constraints used together in a class diagram. In the model shown in the figure, two active classes (i.e., classes that own the threads in which they execute) collaborate via a Waveform class resource. The Sensor class monitors the external environment and executes periodically at a rate of 100Hz (10 ms period), with a worst-case execution time of 3 ms. These quantitative properties of the Sensor class are captured in the curly braces commonly used to identify constraints. The constraints themselves are put into a note. As can be seen in the ordering constraint on the WaveformSample class, constraints don't have to be put inside of notes, but since it helps to visually set such annotations off, it is common to do so. The active classes are shown by the double-bordered box indicating that they are classes of the «active» stereotype (the text indication could have been used just as easily). The active classes are further stereotyped; specifically, they are stereotyped «SASchedulable» and «SAAction» from the UML Profile for Schedulability, Performance, and Time, the so-called "Real-Time Profile"[3]. These stereotypes define the specific tags that are used in the constraints, such as isPeriodic, SAPriority, and so on. The tags are called tagged values in the UML and their values are commonly specified inside constraints, just as they are here. Figure 2-20. Constraints in Action
A stereotype is a particular kind of a standard modeling element, such as an «active» class, a «SAAction» kind of action (which is also applied to «active» classes in this model). A «SAResource» is a kind of classifier but has some additional properties, captured as tags, assigned to it. In this case, the capacity of the resource the number of clients it can simultaneously service is set to 1. The tags defined for a stereotype are assigned particular values in constraints. This allows developers to annotate quantitative, schedulability, and performance properties of their models. This is such an important topic, we will devote Chapter 4 to how to use these stereotypes, tagged values, and constraints effectively to model the concurrency and performance aspects of systems later in this book. |