Items#
Role in SysML v2#
An item definition is a kind of occurrence definition for identifiable objects that may flow through a system or be acted on over time — for example data, signals, or fluids. A part is a specialized kind of item.
An item usage is a usage of one or more item definitions. Items are often used as port payloads and as event data in state machines.
Mapping to C++#
Item definitions are translated to C++ structs or classes in the generated code. Item usages become members of the enclosing part (or nested item). Multiplicity maps to arrays or constrained collections.
Example#
SysML v2 source code:
private import ScalarValues::*;
package Test {
enum def EnumEvent {
evA;
evB;
evC;
}
item def TxItem {
attribute evt : EnumEvent;
attribute data : Integer default 5;
}
port def MyPort {
in item ev : TxItem;
}
part def Host {
item scenario : TxItem[0..5];
action def fill {
assign scenario#(1).data := 100;
}
}
}Items on ports are typically read with an accept in an action:
action def getMsg {
action accept m:TxItem via recvPort {
assign msg := m.evt;
}
}See also States, Ports, and the 7.2 release notes.