Chapter 1. Modeling the State Structure of a System
Items and Parts
- In SysML v2, objects are called items.
- The parts of a system are special items.
- A system, as a composite object, is also classified as a part since it may be a subsystem of a larger system.
Core Modeling Concepts
- Types
- classify things and may have features.
There are two kinds of types: classifiers and features. - Classifiers
- are types that classify things.
Examples: data types, item types, part types, action types. - Features
- model the relations between things.
Examples: attributes, item properties, part properties, action steps.
Types
- The set of things classified by a type is called its extent.
- Each member of its extent is an instance of the type.
- Everything is an instance of the predefined type
Anything. - Types may have features. Consequently, not only classifiers, but also features may have features.
- A type S may specialize another type T. Then S is a subtype of T and T is a supertype of S. A subtype inherits all features of its supertypes.
Examples of Classifiers and Features
An item type definition with two attributes item def Person { attribute name : String; attribute age : Natural; } Two part type definitions part def Engine; part def Wheel;
A part type definition with four features part def Car { attribute mass : ISQ::MassValue; Three part properties part engine : Engine; part wheels[4] : Wheel; ref part driver[0..1] : Person; }
- The data type MassValue is predefined in the library package ISQ.
- wheels[4] means that the part property wheels has the multiplicity 4, implying that it has exactly 4 values.
- driver[0..1] means that this part property has at most one value.
- By default, part properties are "composite" features, representing parts/components, which cannot exist after the whole ceases to exist, unlike "referential" features.
- ref part means that this part property is not composite, but referential.
Terminology
SysML v2 comes with a superfluous jargon: calling classifiers (like data types or item types) "definitions" and calling features (like attributes or item properties) "usages", which is confusing.
| Official SysML v2 Terminology | Preferrable (Classsical) Terminology |
|---|---|
| attribute definition | data type |
| attribute usage | attribute |
| item (part/port/action/etc.) definition | item (part/port/action/etc.) type |
| item (part/port/etc.) usage | item (part/port/etc.) property |
| action usage | action property (or action step) |
Connection Types
A connection is both a relationship between parts and a kind of part.
A connection type is an association that classifies connections between related parts.
part def Axle {...}
part def Wheel {...}
connection def Mounting {
end [1] part mountingAxle : Axle;
end [2] part mountedWheel : Wheel;
}End properties, like mountingAxle and mountedWheel, always have the multiplicity 1.
The yellow multiplicities are called cross multiplicities.
The cross multiplicity [2] of the end property mountedWheel expresses the constraint that for any instance of Axle, there are exactly two links in the extent of Mounting linking the axle to two different wheels.
Connection Properties
An axle assembly consists of one axle, two wheels and two mount connections, such that each of the two wheels is connected to the axle via a mount connection.
part def Axle {...}
part def Wheel {...}
connection def Mounting {
end [1] part mountingAxle : Axle;
end [2] part mountedWheel : Wheel;
}part def AxleAssembly {
part axle : Axle;
part wheels[2] : Wheel;
connection mount[2] : Mounting
connect axle to wheels;
}The connection property mount restricts the connection type Mounting by only allowing links formed with values from the corresponding part properties axle and wheels. It has exactly 2 values: one mount connection for each of the 2 wheels.
Ports and Interfaces
Ports, as values of port properties, are special objects representing connection points. The ports referenced by two port properties can be connected via an interface property for enabling transfers (e.g., of signals or physical quantities) if their types match in the sense that they have the same directed parameters, but with inverse direction.
port def MotorCtrlPort {
out attribute speed : Real;
out attribute dir : Integer;
in errorStatus : Integer;
}
port def CtrlInputPort {
in attribute speed : Real;
in attribute dir : Integer;
out errorStatus : Integer;
} part def Vehicle {
part motorController {
port motorCtrlPort : MotorCtrlPort;
}
part motor {
port ctrlInputPort : CtrlInputPort;
}
interface motorController.motorCtrlPort
to motor.ctrlInputPort;
}An interface property is a special kind of connection property for connecting ports.
Functions as “Calculation Definitions”
A function (with named input parameters and a result parameter specified with return) can be declared as a calculation definition with calc def, like so:
calc def Average {
in values[1..*] : Real;
return : Real = sum(values) / size(values);
}A function declared as a calculation definition can be used in expressions:
part def Sensor {
attribute values[1..*] : Real;
attribute avg : Real = Average( values);
}A function can also be embedded within a type in the form of a calculation property declared with calc and (1) defined by an inline expression or (2) typed by a calculation definition. An example of a calculation property defined by an inline expression is:
part def Sensor {
attribute values[1..*] : Real;
attribute avg : Real = average();
calc average { sum(values) / size(values) }
}Constraints
A constraint definition defines a reusable condition, like so:
constraint def MassConstraint {
in partMasses[0..*] : ISQ::MassValue;
in massLimit : ISQ::MassValue;
sum( partMasses) <= massLimit
}This constraint definition has two input parameters, partMasses and massLimit.
A constraint can be embedded within a type in the form of a constraint property declared with constraint and (1) defined by an inline Boolean expression or (2) typed by a constraint definition. An example of a constraint property typed by a constraint definition is:
part def Vehicle {
attribute chassisMass : ISQ::MassValue;
part engine : Engine {
attribute mass : ISQ::MassValue;
}
constraint massConstraint : MassConstraint {
in partMasses = (chassisMass, engine.mass);
in massLimit = 2500[kg];
}
}An example of a constraint property defined by an inline expression is:
part def Vehicle {
attribute chassisMass : ISQ::MassValue;
part engine : Engine {
attribute mass : ISQ::MassValue;
}
constraint massConstraint { chassisMass + engine.mass <= 2500[kg] }
}Such a constraint may be true or false in a given context. It may be violated (false) without making the model inconsistent. Only if a constraint is asserted in the form of an assert constraint property, it must be true under all circumstances. Otherwise, it indicates an inconsistency. An example of an asserted constraint is the following:
part def Vehicle {
attribute chassisMass : ISQ::MassValue;
part engine : Engine {
attribute mass : ISQ::MassValue;
}
assert constraint { chassisMass + engine.mass <= 2500[kg] }
}