Skip to content

Commit

Permalink
Merge pull request #610 from Systems-Modeling/ST6RI-813
Browse files Browse the repository at this point in the history
ST6RI-813 Transfers across interfaces (SYSML2_-39)
  • Loading branch information
seidewitz authored Jan 9, 2025
2 parents 974eb4b + 8a20b61 commit 9daa7d4
Show file tree
Hide file tree
Showing 5 changed files with 722 additions and 156 deletions.
133 changes: 87 additions & 46 deletions org.omg.sysml.xpect.tests/library.systems/Interfaces.sysml
Original file line number Diff line number Diff line change
@@ -1,48 +1,89 @@
standard library package Interfaces {
doc
/*
* This package defines the base types for interfaces and related structural elements in the SysML language.
*/

private import Connections::Connection;
private import Connections::connections;
private import Connections::BinaryConnection;
private import Connections::binaryConnections;
private import Ports::Port;

abstract interface def Interface :> Connection {
doc
/*
* Interface is the most general class of links between Ports on Parts
* within some containing structure. Interface is the base type of all
* InterfaceDefinitions.
*/
}

abstract interface def BinaryInterface :> Interface, BinaryConnection {
doc
/*
* BinaryInterface is the most general class of links between two Ports
* on Parts within some containing structure. BinaryInterface is the base
* type of all binary InterfaceDefinitions with exactly two ends.
*/

end source: Port :>> BinaryConnection::source;
end target: Port :>> BinaryConnection::target;
}

abstract interface interfaces: Interface[0..*] nonunique :> connections {
doc
/*
* interfaces is the base feature of all InterfaceUsages.
*/
}

abstract interface binaryInterfaces: BinaryInterface[0..*] nonunique :> interfaces, binaryConnections {
doc
/*
* interfaces is the base feature of all binary InterfaceUsages.
*/
}

doc
/*
* This package defines the base types for interfaces and related structural elements in the SysML language.
*/

private import Connections::Connection;
private import Connections::connections;
private import Connections::BinaryConnection;
private import Connections::binaryConnections;
private import Ports::Port;

private import ScalarValues::Natural;
private import SequenceFunctions::size;
private import SequenceFunctions::excludingAt;
private import ControlFunctions::selectOne;

private import SequenceFunctions::notEmpty;

private calc def excludingOnce {
doc
/*
* Return a sequence that is the same as the input sequence, but with a single
* instance of a given value removed. The given value must be in the input sequence.
*/
in seq[1..*] nonunique ordered;
in value[1] :> seq;

private attribute position : Natural[1] = (1..size(seq))->selectOne{in i; seq#(i) == value};
seq->excludingAt(position)
}

abstract interface def Interface :> Connection {
doc
/*
* Interface is the most general class of links between Ports on Parts
* within some containing structure. Interface is the base type of all
* InterfaceDefinitions.
*
* Transfers outgoing from any one of the participant Ports of an Interface
* may be targeted to one of the other participant Ports (depending on any
* other Interfaces in which the Port is also participating).
*/

ref port :>> participant : Port [2..*] nonunique ordered {
doc
/*
* The participants of an Interface must be Ports. The interfacingPorts of
* each participant Port include all the other participants in the Interface.
*/

protected ref thisParticipant :>> self;
protected ref otherParticipants : Port [1..*] nonunique :> interfacingPorts
default participant->excludingOnce(thisParticipant);
}
}

abstract interface def BinaryInterface :> Interface, BinaryConnection {
doc
/*
* BinaryInterface is the most general class of links between two Ports
* on Parts within some containing structure. BinaryInterface is the base
* type of all binary InterfaceDefinitions which have exactly two ends.
*
* Transfers outgoing from each participant Port of a BinaryInterface may be
* targeted to the other participant Port (depending on any other Interfaces
* in which the Port is also participating).
*/

ref port :>> Interface::participant, BinaryConnection::participant[2] nonunique ordered;

end port source: Port :>> BinaryConnection::source;
end port target: Port :>> BinaryConnection::target;
}

abstract interface interfaces: Interface[0..*] nonunique :> connections {
doc
/*
* interfaces is the base feature of all InterfaceUsages.
*/
}

abstract interface binaryInterfaces: BinaryInterface[0..*] nonunique :> interfaces, binaryConnections {
doc
/*
* interfaces is the base feature of all binary InterfaceUsages.
*/
}
}
79 changes: 48 additions & 31 deletions org.omg.sysml.xpect.tests/library.systems/Ports.sysml
Original file line number Diff line number Diff line change
@@ -1,34 +1,51 @@
standard library package Ports {
doc
/*
* This package defines the base types for ports and related structural elements
* in the SysML language.
*/
doc
/*
* This package defines the base types for ports and related structural elements
* in the SysML language.
*/

private import Objects::Object;
private import Objects::objects;

abstract port def Port :> Object {
doc
/*
* Port is the most general class of objects that represent connection points
* for interacting with a Part. Port is the base type of all PortDefinitions.
*/

ref self: Port :>> Object::self;

port subports: Port :> timeEnclosedOccurrences {
doc
/*
* The Ports that are subports of this Port.
*/
}
}

abstract port ports : Port[0..*] nonunique :> objects {
doc
/*
* ports is the base feature of all PortUsages.
*/
}
private import Objects::Object;
private import Objects::objects;

abstract port def Port :> Object {
doc
/*
* Port is the most general class of objects that represent connection points
* for interacting with a Part. Port is the base type of all PortDefinitions.
*
* Transfers outgoing from a Port are always targeted to a Port connected to
* the original Port by an Interface.
*/

ref self: Port :>> Object::self;

port subports: Port [0..*] :> ports, timeEnclosedOccurrences {
doc
/*
* The Ports that are subports of this Port.
*/
}

abstract ref port interfacingPorts : Port[0..*] nonunique :> ports {
doc
/*
* Ports that are connected to this Port by an Interface.
*/
}

ref :>> outgoingTransfersFromSelf :> interfacingPorts.incomingTransfersToSelf {
doc
/*
* The target of each of the outgoingTransfersFromSelf of a Port must be an interfacingPort.
*/
}
}

abstract port ports : Port[0..*] nonunique :> objects {
doc
/*
* ports is the base feature of all PortUsages.
*/
}
}
Loading

0 comments on commit 9daa7d4

Please sign in to comment.