Skip to content

Commit 3b6ebd1

Browse files
committed
SYSML2_-39 Updated the Systems Library models for Ports and Interfaces.
1 parent 72950f6 commit 3b6ebd1

5 files changed

Lines changed: 670 additions & 96 deletions

File tree

Lines changed: 87 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,89 @@
11
standard library package Interfaces {
2-
doc
3-
/*
4-
* This package defines the base types for interfaces and related structural elements in the SysML language.
5-
*/
6-
7-
private import Connections::Connection;
8-
private import Connections::connections;
9-
private import Connections::BinaryConnection;
10-
private import Connections::binaryConnections;
11-
private import Ports::Port;
12-
13-
abstract interface def Interface :> Connection {
14-
doc
15-
/*
16-
* Interface is the most general class of links between Ports on Parts
17-
* within some containing structure. Interface is the base type of all
18-
* InterfaceDefinitions.
19-
*/
20-
}
21-
22-
abstract interface def BinaryInterface :> Interface, BinaryConnection {
23-
doc
24-
/*
25-
* BinaryInterface is the most general class of links between two Ports
26-
* on Parts within some containing structure. BinaryInterface is the base
27-
* type of all binary InterfaceDefinitions with exactly two ends.
28-
*/
29-
30-
end source: Port :>> BinaryConnection::source;
31-
end target: Port :>> BinaryConnection::target;
32-
}
33-
34-
abstract interface interfaces: Interface[0..*] nonunique :> connections {
35-
doc
36-
/*
37-
* interfaces is the base feature of all InterfaceUsages.
38-
*/
39-
}
40-
41-
abstract interface binaryInterfaces: BinaryInterface[0..*] nonunique :> interfaces, binaryConnections {
42-
doc
43-
/*
44-
* interfaces is the base feature of all binary InterfaceUsages.
45-
*/
46-
}
47-
2+
doc
3+
/*
4+
* This package defines the base types for interfaces and related structural elements in the SysML language.
5+
*/
6+
7+
private import Connections::Connection;
8+
private import Connections::connections;
9+
private import Connections::BinaryConnection;
10+
private import Connections::binaryConnections;
11+
private import Ports::Port;
12+
13+
private import ScalarValues::Natural;
14+
private import SequenceFunctions::size;
15+
private import SequenceFunctions::excludingAt;
16+
private import ControlFunctions::selectOne;
17+
18+
private import SequenceFunctions::notEmpty;
19+
20+
private calc def excludingOnce {
21+
doc
22+
/*
23+
* Return a sequence that is the same as the input sequence, but with a single
24+
* instance of a given value removed. The given value must be in the input sequence.
25+
*/
26+
in seq[1..*] nonunique ordered;
27+
in value[1] :> seq;
28+
29+
private attribute position : Natural[1] = (1..size(seq))->selectOne{in i; seq#(i) == value};
30+
seq->excludingAt(position)
31+
}
32+
33+
abstract interface def Interface :> Connection {
34+
doc
35+
/*
36+
* Interface is the most general class of links between Ports on Parts
37+
* within some containing structure. Interface is the base type of all
38+
* InterfaceDefinitions.
39+
*
40+
* Transfers outgoing from any one of the participant Ports of an Interface
41+
* may be targeted to one of the other participant Ports (depending on any
42+
* other Interfaces in which the Port is also participating).
43+
*/
44+
45+
ref port :>> participant : Port [2..*] nonunique ordered {
46+
doc
47+
/*
48+
* The participants of an Interface must be Ports. The interfacingPorts of
49+
* each participant Port include all the other participants in the Interface.
50+
*/
51+
52+
protected ref thisParticipant :>> self;
53+
protected ref otherParticipants : Port [1..*] nonunique :> interfacingPorts
54+
default participant->excludingOnce(thisParticipant);
55+
}
56+
}
57+
58+
abstract interface def BinaryInterface :> Interface, BinaryConnection {
59+
doc
60+
/*
61+
* BinaryInterface is the most general class of links between two Ports
62+
* on Parts within some containing structure. BinaryInterface is the base
63+
* type of all binary InterfaceDefinitions which have exactly two ends.
64+
*
65+
* Transfers outgoing from each participant Port of a BinaryInterface may be
66+
* targeted to the other participant Port (depending on any other Interfaces
67+
* in which the Port is also participating).
68+
*/
69+
70+
ref port :>> Interface::participant, BinaryConnection::participant[2] nonunique ordered;
71+
72+
end port source: Port :>> BinaryConnection::source;
73+
end port target: Port :>> BinaryConnection::target;
74+
}
75+
76+
abstract interface interfaces: Interface[0..*] nonunique :> connections {
77+
doc
78+
/*
79+
* interfaces is the base feature of all InterfaceUsages.
80+
*/
81+
}
82+
83+
abstract interface binaryInterfaces: BinaryInterface[0..*] nonunique :> interfaces, binaryConnections {
84+
doc
85+
/*
86+
* interfaces is the base feature of all binary InterfaceUsages.
87+
*/
88+
}
4889
}

org.omg.sysml.xpect.tests/library.systems/Ports.sysml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,33 @@ standard library package Ports {
1313
/*
1414
* Port is the most general class of objects that represent connection points
1515
* for interacting with a Part. Port is the base type of all PortDefinitions.
16+
*
17+
* Transfers outgoing from a Port are always targeted to a Port connected to
18+
* the original Port by an Interface.
1619
*/
1720

1821
ref self: Port :>> Object::self;
1922

20-
port subports: Port :> timeEnclosedOccurrences {
23+
port subports: Port [0..*] :> ports, timeEnclosedOccurrences {
2124
doc
2225
/*
2326
* The Ports that are subports of this Port.
2427
*/
2528
}
29+
30+
abstract ref port interfacingPorts : Port[0..*] nonunique :> ports {
31+
doc
32+
/*
33+
* Ports that are connected to this Port by an Interface.
34+
*/
35+
}
36+
37+
ref :>> outgoingTransfers :> interfacingPorts.incomingTransfersToSelf {
38+
doc
39+
/*
40+
* The target of each outgoingTransfer of a Port must be an interfacingPort.
41+
*/
42+
}
2643
}
2744

2845
abstract port ports : Port[0..*] nonunique :> objects {

0 commit comments

Comments
 (0)