@@ -14,7 +14,7 @@ package '2-Parts Interconnection' {
1414 port shaftPort_d: ShaftPort_d;
1515 }
1616
17- class RearAxle specializes Axle { }
17+ class RearAxle specializes Axle;
1818
1919 /**
2020 * Note: This class is used for both the left and
@@ -40,7 +40,7 @@ package '2-Parts Interconnection' {
4040 port shaftPort_b: ShaftPort_b;
4141 port shaftPort_c: ShaftPort_c;
4242 }
43- class Differential { }
43+ class Differential;
4444
4545 /**
4646 * Class Wheel does not include the ports its usages have.
@@ -49,21 +49,21 @@ package '2-Parts Interconnection' {
4949
5050 // Port Types
5151
52- class FuelCmdPort { }
52+ class FuelCmdPort;
5353
54- class DrivePwrPort { }
55- class ClutchPort { }
54+ class DrivePwrPort;
55+ class ClutchPort;
5656
57- class ShaftPort_a { }
58- class ShaftPort_b { }
59- class ShaftPort_c { }
60- class ShaftPort_d { }
57+ class ShaftPort_a;
58+ class ShaftPort_b;
59+ class ShaftPort_c;
60+ class ShaftPort_d;
6161
62- class DiffPort { }
63- class AxlePort { }
64- class AxleToWheelPort { }
65- class WheelToAxlePort { }
66- class WheelToRoadPort { }
62+ class DiffPort;
63+ class AxlePort;
64+ class AxleToWheelPort;
65+ class WheelToAxlePort;
66+ class WheelToRoadPort;
6767
6868 class VehicleToRoadPort {
6969 port wheelToRoadPort: WheelToRoadPort[2];
@@ -80,15 +80,7 @@ package '2-Parts Interconnection' {
8080 end port shaftPort_a: ShaftPort_a;
8181 end port shaftPort_d: ShaftPort_d;
8282
83- /**
84- * The driveshaft part is the "interface medium".
85- *
86- * Note: It would be better if this was a reference rather
87- * than a part, but it is not obvious how to fill in the
88- * actual driveshaft when the association is used to type
89- * a connector.
90- */
91- part driveshaft: Driveshaft {
83+ feature driveshaft: Driveshaft {
9284 port shaftPort_b: ShaftPort_b redefines Driveshaft::shaftPort_b;
9385 port shaftPort_c: ShaftPort_c redefines Driveshaft::shaftPort_c;
9486 }
@@ -102,26 +94,34 @@ package '2-Parts Interconnection' {
10294 vehicle1_c1: VehicleA {
10395 port fuelCmdPort: FuelCmdPort redefines VehicleA::fuelCmdPort;
10496
105- port vehicleToRoadPort: VehicleToRoadPort redefines VehicleA::vehicleToRoadPort {
106- import VehicleToRoadPort::*;
107-
108- port leftWheelToRoadPort: WheelToRoadPort subsets wheelToRoadPort = wheelToRoadPort[1];
109- port rightWheelToRoadPort: WheelToRoadPort subsets wheelToRoadPort = wheelToRoadPort[2];
110- }
97+ connector fuelCmdPort to engine::fuelCmdPort;
11198
11299 part engine: Engine {
113100 port fuelCmdPort: FuelCmdPort redefines Engine::fuelCmdPort;
114101 port drivePwrPort: DrivePwrPort redefines Engine::drivePwrPort;
115102 }
116103
104+ connector :EngineToTransmissionInterface is
105+ engine::drivePwrPort to transmission::clutchPort;
106+
117107 part transmission: Transmission {
118108 port clutchPort: ClutchPort redefines Transmission::clutchPort;
119109 port shaftPort_a: ShaftPort_a;
120110 }
121111
112+ part driveshaft: Driveshaft;
113+
114+ connector :DriveshaftInterface is
115+ transmission::shaftPort_a to rearAxleAssembly::shaftPort_d {
116+ feature driveshaft redefines DriveshaftInterface::driveshaft =
117+ vehicle1_c1::driveshaft;
118+ }
119+
122120 part rearAxleAssembly: RearAxleAssembly {
123121 port shaftPort_d: ShaftPort_d redefines RearAxleAssembly::shaftPort_d;
124122
123+ connector shaftPort_d to differential::shaftPort_d;
124+
125125 /**
126126 * Untyped part.
127127 */
@@ -131,6 +131,9 @@ package '2-Parts Interconnection' {
131131 port rightDiffPort: DiffPort;
132132 }
133133
134+ connector differential::leftDiffPort to rearAxle::leftAxle::axleToDiffPort;
135+ connector differential::rightDiffPort to rearAxle::rightAxle::axleToDiffPort;
136+
134137 part rearAxle: RearAxle {
135138 part leftAxle: WheelAxle {
136139 port axleToDiffPort: AxlePort redefines WheelAxle::axleToDiffPort;
@@ -142,6 +145,9 @@ package '2-Parts Interconnection' {
142145 }
143146 }
144147
148+ connector rearAxle::leftAxle::axleToWheelPort to leftWheel::wheelToAxlePort;
149+ connector rearAxle::rightAxle::axleToWheelPort to rightWheel::wheelToAxlePort;
150+
145151 part rearWheel: Wheel[2] ordered;
146152
147153 part leftWheel: Wheel subsets rearWheel = rearWheel[1] {
@@ -154,27 +160,20 @@ package '2-Parts Interconnection' {
154160 port wheelToRoadPort: WheelToRoadPort;
155161 }
156162
157- connector shaftPort_d to differential::shaftPort_d;
158-
159- connector differential::leftDiffPort to rearAxle::leftAxle::axleToDiffPort;
160- connector differential::rightDiffPort to rearAxle::rightAxle::axleToDiffPort;
161- connector rearAxle::leftAxle::axleToWheelPort to leftWheel::wheelToAxlePort;
162- connector rearAxle::rightAxle::axleToWheelPort to rightWheel::wheelToAxlePort;
163163 }
164164
165- connector fuelCmdPort to engine::fuelCmdPort;
166-
167- connector :EngineToTransmissionInterface is
168- engine::drivePwrPort to transmission::clutchPort;
169-
170- connector :DriveshaftInterface is
171- transmission::shaftPort_a to rearAxleAssembly::shaftPort_d;
172-
173165 connector rearAxleAssembly::leftWheel::wheelToRoadPort to
174166 vehicleToRoadPort::leftWheelToRoadPort;
175167 connector rearAxleAssembly::rightWheel::wheelToRoadPort to
176168 vehicleToRoadPort::rightWheelToRoadPort;
177169
170+ port vehicleToRoadPort: VehicleToRoadPort redefines VehicleA::vehicleToRoadPort {
171+ import VehicleToRoadPort::*;
172+
173+ port leftWheelToRoadPort: WheelToRoadPort subsets wheelToRoadPort = wheelToRoadPort[1];
174+ port rightWheelToRoadPort: WheelToRoadPort subsets wheelToRoadPort = wheelToRoadPort[2];
175+ }
176+
178177 }
179178
180179}
0 commit comments