Skip to content

Commit 881d386

Browse files
committed
Added demo example files.
1 parent b5aec6f commit 881d386

2 files changed

Lines changed: 181 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package 'Parts Tree Demo' {
2+
3+
package 'Create Generic Hierarchical Structure' {
4+
5+
/* Definitions */
6+
7+
class Vehicle {
8+
feature mass;
9+
}
10+
class AxleAssembly { }
11+
class Axle { }
12+
class Wheel { }
13+
14+
/* Usages */
15+
16+
vehicle1: Vehicle {
17+
part frontAxleAssembly: AxleAssembly {
18+
part frontAxle: Axle;
19+
part frontWheel: Wheel[2] ordered;
20+
}
21+
22+
part rearAxleAssembly: AxleAssembly {
23+
part rearAxle: Axle;
24+
part rearWheel: Wheel[2] ordered;
25+
}
26+
}
27+
28+
}
29+
30+
package 'Copy Generic Hierarchical Structure' {
31+
import 'Create Generic Hierarchical Structure'::*;
32+
import 'Create Generic Hierarchical Structure'::vehicle1::*;
33+
import 'Create Generic Hierarchical Structure'::vehicle1::frontAxleAssembly::*;
34+
import 'Create Generic Hierarchical Structure'::vehicle1::rearAxleAssembly::*;
35+
36+
/* Definitions */
37+
38+
/* Usages */
39+
40+
}
41+
}
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
package 'Parts Interconnection Demo' {
2+
import 'Parts Tree'::'Create Generic Hierarchical Structure'::*;
3+
4+
/* DEFINITIONS */
5+
6+
// Blocks
7+
8+
class VehicleA specializes Vehicle {
9+
port fuelCmdPort: FuelCmdPort;
10+
port vehicleToRoadPort: VehicleToRoadPort;
11+
}
12+
13+
class RearAxleAssembly specializes AxleAssembly { }
14+
15+
class FrontAxle specializes Axle { }
16+
class RearAxle specializes Axle { }
17+
18+
class Engine { }
19+
class Transmission { }
20+
class Driveshaft { }
21+
class Differential { }
22+
23+
// Port Types
24+
25+
class FuelCmdPort { }
26+
27+
class DrivePwrPort { }
28+
class ClutchPort { }
29+
30+
class ShaftPort_a { }
31+
class ShaftPort_b { }
32+
class ShaftPort_c { }
33+
class ShaftPort_d { }
34+
35+
class DiffPort { }
36+
class AxlePort { }
37+
class AxleToWheelPort { }
38+
class WheelToAxlePort { }
39+
class WheelToRoadPort { }
40+
41+
class VehicleToRoadPort {
42+
port wheelToRoadPort: WheelToRoadPort[2];
43+
}
44+
45+
// Interfaces
46+
47+
assoc EngineToTransmissionInterface {
48+
end drivePwrPort: DrivePwrPort;
49+
end clutchPort: ClutchPort;
50+
}
51+
52+
assoc DriveshaftInterface {
53+
end port shaftPort_a: ShaftPort_a;
54+
end port shaftPort_d: ShaftPort_d;
55+
56+
part driveShaft: Driveshaft {
57+
port shaftPort_b: ShaftPort_b;
58+
port shaftPort_c: ShaftPort_c;
59+
}
60+
61+
connector shaftPort_a to driveShaft::shaftPort_b;
62+
connector driveShaft::shaftPort_c to shaftPort_d;
63+
}
64+
65+
/* USAGES */
66+
67+
vehicle1_c1: VehicleA {
68+
port fuelCmdPort redefines VehicleA::fuelCmdPort;
69+
70+
port vehicleToRoadPort redefines VehicleA::vehicleToRoadPort {
71+
import VehicleToRoadPort::*;
72+
73+
port wheelToRoadPort_1 subsets wheelToRoadPort = wheelToRoadPort[1];
74+
port wheelToRoadPort_2 subsets wheelToRoadPort = wheelToRoadPort[2];
75+
}
76+
77+
part engine: Engine {
78+
port fuelCmdPort: FuelCmdPort;
79+
port drivePwrPort: DrivePwrPort;
80+
}
81+
82+
part transmission: Transmission {
83+
port clutchPort: ClutchPort;
84+
port shaftPort_a: ShaftPort_a;
85+
}
86+
87+
part rearAxleAssembly_c1: RearAxleAssembly {
88+
port shaftPort_d: ShaftPort_d;
89+
90+
part differential: Differential {
91+
port shaftPort_d: ShaftPort_d;
92+
port leftDiffPort: DiffPort;
93+
port rightDiffPort: DiffPort;
94+
}
95+
96+
part rearAxle: RearAxle {
97+
part leftAxle: Axle {
98+
port axleToDiffPort: AxlePort;
99+
port axleToWheelPort: AxleToWheelPort;
100+
}
101+
part rightAxle: Axle {
102+
port axleToDiffPort: AxlePort;
103+
port axleToWheelPort: AxleToWheelPort;
104+
}
105+
}
106+
107+
part rearWheel_1: Wheel {
108+
port wheelToAxlePort: WheelToAxlePort;
109+
port wheelToRoadPort: WheelToRoadPort;
110+
}
111+
112+
part rearWheel_2: Wheel {
113+
port wheelToAxlePort: WheelToAxlePort;
114+
port wheelToRoadPort: WheelToRoadPort;
115+
}
116+
117+
connector shaftPort_d to differential::shaftPort_d;
118+
119+
connector differential::leftDiffPort to rearAxle::leftAxle::axleToDiffPort;
120+
connector differential::rightDiffPort to rearAxle::rightAxle::axleToDiffPort;
121+
connector rearAxle::leftAxle::axleToWheelPort to rearWheel_1::wheelToAxlePort;
122+
connector rearAxle::rightAxle::axleToWheelPort to rearWheel_2::wheelToAxlePort;
123+
}
124+
125+
connector fuelCmdPort to engine::fuelCmdPort;
126+
127+
connector :EngineToTransmissionInterface is
128+
engine::drivePwrPort to transmission::clutchPort;
129+
130+
connector :DriveshaftInterface is
131+
transmission::shaftPort_a to rearAxleAssembly_c1::shaftPort_d;
132+
133+
connector rearAxleAssembly_c1::rearWheel_1::wheelToRoadPort to
134+
vehicleToRoadPort::wheelToRoadPort_1;
135+
connector rearAxleAssembly_c1::rearWheel_2::wheelToRoadPort to
136+
vehicleToRoadPort::wheelToRoadPort_2;
137+
138+
}
139+
140+
}

0 commit comments

Comments
 (0)