-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathSysML v2 Spec Annex A SimpleVehicleModel.sysml
More file actions
1581 lines (1495 loc) · 71.8 KB
/
SysML v2 Spec Annex A SimpleVehicleModel.sysml
File metadata and controls
1581 lines (1495 loc) · 71.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package SimpleVehicleModel{
// 2023-02 release
public import Definitions::*;
public import ISQ::*;
package Definitions{
public import PartDefinitions::*;
public import PortDefinitions::*;
public import ItemDefinitions::*;
public import SignalDefinitions::*;
public import InterfaceDefinitions::*;
public import AllocationDefinitions::*;
public import ActionDefinitions::*;
public import StateDefinitions::*;
public import RequirementDefinitions::*;
public import AttributeDefinitions::*;
public import IndividualDefinitions::*;
public import MetadataDefinitions::**;
public import KeyWord_MetadataDefinitions::*;
package PartDefinitions{
part def Vehicle {
attribute mass :> ISQ::mass;
attribute dryMass:>ISQ::mass;
attribute cargoMass:>ISQ::mass;
attribute position:>ISQ::length;
attribute velocity:>ISQ::speed;
attribute acceleration:>ISQ::acceleration;
attribute electricalPower:>ISQ::power;
attribute Tmax:>ISQ::temperature;
attribute maintenanceTime: Time::DateTime;
attribute brakePedalDepressed: Boolean;
port ignitionCmdPort:IgnitionCmdPort;
port pwrCmdPort:PwrCmdPort;
port vehicleToRoadPort:VehicleToRoadPort;
port statusPort:StatusPort;
perform action providePower;
perform action provideBraking;
perform action controlDirection;
perform action performSelfTest;
perform action applyParkingBrake;
perform action senseTemperature;
exhibit state vehicleStates parallel {
ref controller : VehicleController;
state operatingStates {
entry action initial;
state off;
state starting;
state on {
entry performSelfTest;
do providePower;
exit applyParkingBrake;
constraint {electricalPower<=500[W]}
}
transition initial then off;
transition off_To_starting
first off
accept ignitionCmd:IgnitionCmd via ignitionCmdPort
if ignitionCmd.ignitionOnOff==IgnitionOnOff::on and brakePedalDepressed
do send new StartSignal() to controller
then starting;
transition starting_To_on
first starting
accept VehicleOnSignal
then on;
transition on_To_off
first on
accept VehicleOffSignal
do send new OffSignal() to controller
then off;
}
state healthStates {
entry action initial;
do senseTemperature{
out temp;
}
state normal;
state maintenance;
state degraded;
transition initial then normal;
transition normal_To_maintenance
first normal
accept at maintenanceTime
then maintenance;
transition normal_To_degraded
first normal
accept when senseTemperature.temp > Tmax
do send new OverTemp() to controller
then degraded;
transition maintenance_To_normal
first maintenance
accept ReturnToNormal
then normal;
transition degraded_To_normal
first degraded
accept ReturnToNormal
then normal;
}
}
}
part def Engine{
attribute mass :> ISQ::mass;
attribute peakHorsePower:>ISQ::power;
attribute fuelEfficiency:Real;
attribute cost:Real;
attribute displacement :> ISQ::volume;
port engineControlPort: ~ControlPort;
port fuelInPort: ~ FuelPort;
port fuelCmdPort:FuelCmdPort;
port drivePwrPort:DrivePwrPort;
port ignitionCmdPort:IgnitionCmdPort;
port flyWheelPort;
perform action generateTorque;
exhibit state engineStates{
state off;
state starting;
state on{
do generateTorque;
}
}
}
part def StarterMotor{
port gearPort:GearPort;
}
part def Cylinder;
part def Transmission{
attribute gearRatio:Real;
port clutchPort:~DrivePwrPort;
exhibit state transmissionStates;
}
part def Driveshaft;
part def AxleAssembly;
part def Axle{
attribute mass:>ISQ::mass;
}
part def FrontAxle:>Axle{
attribute steeringAngle:>ISQ::angularMeasure;
}
part def HalfAxle{
port shankCompositePort:ShankCompositePort{
}
}
part def Differential;
part def Wheel{
attribute diameter:LengthValue;
port lugNutCompositePort:LugNutCompositePort;
}
part def Hub{
port shankCompositePort:ShankCompositePort;
}
abstract part def Software;
part def VehicleSoftware:>Software;
part def VehicleController:>Software {
port controlPort:ControlPort;
exhibit state controllerStates parallel {
state operatingStates {
entry action initial;
state off;
state on;
transition initial then off;
transition 'off-on'
first off
accept StartSignal
then on;
transition 'on-off'
first on
accept OffSignal
then off;
}
}
}
part def CruiseController:>Software {
port setSpeedPort:~SetSpeedPort;
port speedSensorPort:~SpeedSensorPort;
port cruiseControlPort:CruiseControlPort;
exhibit state cruiseControllerStates;
}
part def SpeedSensor{
port speedSensorPort:SpeedSensorPort;
}
part def FuelTank{
attribute mass :> ISQ::mass;
ref item fuel:Fuel{
attribute :>> fuelMass;
}
attribute fuelKind:FuelKind;
attribute fuelMassMax:>ISQ::mass;
assert constraint fuelConstraint {fuel.fuelMass<=fuelMassMax}
port fuelOutPort:FuelPort;
port fuelInPort:~FuelPort;
}
part def BodyAssy;
part def Body{
attribute color:Colors;
}
part def Thermostat;
part def WaterHose;
part def Road{
attribute incline:Real;
attribute friction:Real;
}
part def Engine4Cyl;
part def Engine6Cyl;
part def TransmissionChoices;
part def TransmissionAutomatic;
part def TransmissionManual;
part def Sunroof;
//logical Components
part def ElectricalGenerator;
part def TorqueGenerator;
part def SteeringSubsystem;
part def BrakingSubsystem;
}
package PortDefinitions{
port def IgnitionCmdPort{
in item ignitionCmd:IgnitionCmd;
}
port def StatusPort;
port def GearPort;
port def PwrCmdPort{
in item pwrCmd:PwrCmd;
}
port def FuelCmdPort:>PwrCmdPort{
in item fuelCmd:FuelCmd redefines pwrCmd;
}
port def FuelPort{
out item fuel:Fuel;
}
port def DrivePwrPort{
out torque:Torque;
}
port def ShaftPort_a;
port def ShaftPort_b;
port def ShaftPort_c;
port def ShaftPort_d;
port def DiffPort;
port def AxlePort;
port def AxleToWheelPort;
port def WheelToAxlePort;
port def WheelToRoadPort;
port def LugNutCompositePort{
port lugNutPort:LugNutPort [*];
}
port def ShankCompositePort{
port shankPort:ShankPort [*];
}
port def LugNutPort{
attribute threadDia;
attribute threadPitch;
}
port def ShankPort{
attribute threadDia;
attribute threadPitch;
attribute shaftLength;
}
port def VehicleToRoadPort;
port def ControlPort;
port def CruiseControlPort:>ControlPort;
port def SpeedSensorPort;
port def SetSpeedPort;
port def DriverCmdPort{
out item driverCmd[*]:DriverCmd;
}
port def HandPort :> DriverCmdPort {
out item ignitionCmd:IgnitionCmd subsets driverCmd;
out item pwrCmd:PwrCmd subsets driverCmd;
}
}
package ItemDefinitions{
item def PwrCmd{
attribute throttleLevel:Real;
}
item def FuelCmd:>PwrCmd;
item def Fuel{
attribute fuelMass:>ISQ::mass;
}
item def SensedSpeed{
attribute speed:>ISQ::speed;
}
}
package SignalDefinitions{
item def Cmd{
}
item def DriverCmd;
item def IgnitionCmd:>DriverCmd{
attribute ignitionOnOff:IgnitionOnOff;
}
item def EngineStatus;
attribute def VehicleStartSignal;
attribute def VehicleOnSignal;
attribute def VehicleOffSignal;
attribute def StartSignal;
attribute def OffSignal;
attribute def OverTemp;
attribute def ReturnToNormal;
attribute def SetSpeed:>Real;
}
package InterfaceDefinitions{
interface def EngineToTransmissionInterface{
end p1:DrivePwrPort;
end p2:~DrivePwrPort;
flow p1.torque to p2.torque;
}
interface def FuelInterface {
end fuelOutPort:FuelPort;
end fuelInPort:~FuelPort;
flow of Fuel from fuelOutPort.fuel to fuelInPort.fuel;
}
interface def WheelFastenerInterface{
end lugNutPort:LugNutPort;
end shankPort:ShankPort;
attribute maxTorque : Torque;
constraint {lugNutPort.threadDia == shankPort.threadDia}
}
interface def WheelHubInterface{
end lugNutCompositePort:LugNutCompositePort;
end shankCompositePort:ShankCompositePort;
interface wheelFastenerInterface:WheelFastenerInterface [5]
connect lugNutCompositePort.lugNutPort to shankCompositePort.shankPort;
}
}
package AllocationDefinitions{
allocation def LogicalToPhysical{
end #logical logicalEnd;
end #physical physicalEnd;
}
}
package ActionDefinitions{
action def ProvidePower {
in item pwrCmd:PwrCmd;
out wheelToRoadTorque:Torque[2];
}
action def GenerateTorque {
in item fuelCmd:FuelCmd;
out engineTorque:Torque;
}
action def AmplifyTorque {
in engineTorque:Torque;
out transmissionTorque:Torque;
}
action def TransferTorque {
in transmissionTorque:Torque;
out driveshaftTorque:Torque;
}
action def DistributeTorque {
in driveshaftTorque:Torque;
out wheelToRoadTorque:Torque[2];
}
action def PerformSelfTest;
action def ApplyParkingBrake;
action def SenseTemperature{
out temp: ISQ::TemperatureValue;
}
}
package StateDefinitions {
state def VehicleStates;
state def ControllerStates;
state def CruiseControllerStates;
}
package RequirementDefinitions{
requirement def MassRequirement{
doc /*The actual mass shall be less than the required mass*/
attribute massRequired:>ISQ::mass;
attribute massActual:>ISQ::mass;
require constraint {massActual<=massRequired}
}
requirement def ReliabilityRequirement{
doc /*The actual reliability shall be greater than the required reliability*/
attribute reliabilityRequired:Real;
attribute reliabilityActual:Real;
require constraint {reliabilityActual>=reliabilityRequired}
}
requirement def TorqueGenerationRequirement {
doc /* The engine shall generate torque as a function of RPM as shown in Table 1. */
subject generateTorque:ActionDefinitions::GenerateTorque;
}
requirement def DrivePowerOutputRequirement {
doc /* The engine shall provide a connection point to transfer torque to the transmission.*/
}
requirement def FuelEconomyRequirement {
doc /* The vehicle shall maintain an average fuel economomy of at least x miles per gallon for the nominal
driving scenario */
attribute actualFuelEconomy :> distancePerVolume;
attribute requiredFuelEconomy :> distancePerVolume;
require constraint {actualFuelEconomy >= requiredFuelEconomy}
}
}
package AttributeDefinitions{
public import ScalarValues::*;
public import Quantities::*;
public import MeasurementReferences::DerivedUnit;
public import SIPrefixes::kilo;
// Numerical Functions provides basic operators such as Sum expression
public import NumericalFunctions::*;
public import SI::*;
public import USCustomaryUnits::*;
alias Torque for ISQ::TorqueValue;
enum def Colors {black;grey;red;}
enum def DiameterChoices:>ISQ::LengthValue{
enum = 60 [mm];
enum = 80 [mm];
enum = 100 [mm];
}
attribute cylinderDiameter: DiameterChoices = 80 [mm];
enum def IgnitionOnOff {on;off;}
enum def FuelKind {gas;diesel;}
distancePerVolume :> scalarQuantities = distance / volume;
timePerDistance :> scalarQuantities = time / distance;
volumePerDistance :> scalarQuantities = volume / distance;
volumePerTime :> scalarQuantities = volume / time;
// kpl is approx .425 * mpg
kpl : DerivedUnit = km / L;
rpm : DerivedUnit = 1 / SI::min;
kW : DerivedUnit = kilo * W;
}
package IndividualDefinitions{
individual def VehicleRoadContext_1:>GenericContext::Context;
individual def Vehicle_1:>Vehicle;
individual def FrontAxleAssembly_1:>AxleAssembly;
individual def FrontAxle_1:>FrontAxle;
individual def Wheel_1:>Wheel;
individual def Wheel_2:>Wheel;
individual def RearAxleAssembly_1:>AxleAssembly;
individual def Road_1:>Road;
}
package MetadataDefinitions {
public import AnalysisTooling::*;
metadata def Safety {
attribute isMandatory : Boolean;
}
metadata def Security;
}
package KeyWord_MetadataDefinitions{
public import Metaobjects::SemanticMetadata;
// the following is used to define the key word failureMode
state failureModes[*] nonunique;
// with alias <fm>
metadata def <fm> failureMode :> SemanticMetadata {
:>> baseType = failureModes meta SysML::StateUsage;
}
occurrence logicalOccurrences [*] nonunique;
metadata def <l> logical :> SemanticMetadata {
:>> baseType = logicalOccurrences meta SysML::Usage;
}
occurrence physicalOccurrences [*] nonunique;
metadata def <p> physical :> SemanticMetadata {
:>> baseType = physicalOccurrences meta SysML::Usage;
}
}
package GenericContext {
part def Context {
attribute time:TimeValue;
attribute spatialCF: CartesianSpatial3dCoordinateFrame[1] { :>> mRefs = (m, m, m); }
attribute velocityCF: CartesianVelocity3dCoordinateFrame[1] = spatialCF/s;
attribute accelarationCF: CartesianAcceleration3dCoordinateFrame[1] = velocityCF/s;
}
}
}
package VehicleLogicalConfiguration{
package PartsTree{
#logical part vehicleLogical:Vehicle{
part torqueGenerator:TorqueGenerator{
action generateTorque;
}
part electricalGenerator:ElectricalGenerator{
action generateElectricity;
}
part steeringSystem:SteeringSubsystem;
part brakingSubsystem:BrakingSubsystem;
}
}
}
package VehicleLogicalToPhysicalAllocation{
public import VehicleConfigurations::VehicleConfiguration_b::PartsTree::**;
public import VehicleLogicalConfiguration::PartsTree::*;
allocation vehicleLogicalToPhysicalAllocation:LogicalToPhysical
allocate vehicleLogical to vehicle_b{
allocate vehicleLogical.torqueGenerator to vehicle_b.engine{
allocate vehicleLogical.torqueGenerator.generateTorque to vehicle_b.engine.generateTorque;
}
allocate vehicleLogical.electricalGenerator to vehicle_b.engine{
allocate vehicleLogical.electricalGenerator.generateElectricity to vehicle_b.engine.alternator.generateElectricity;
}
}
}
package VehicleConfigurations{
package VehicleConfiguration_a{
package PartsTree{
part vehicle_a:Vehicle{
attribute mass redefines Vehicle::mass=dryMass+cargoMass+fuelTank.fuel.fuelMass;
attribute dryMass redefines Vehicle::dryMass=sum(partMasses);
attribute redefines Vehicle::cargoMass=0 [kg];
attribute partMasses [*] nonunique :>ISQ::mass;
part fuelTank:FuelTank{
attribute redefines mass=75[kg];
ref item redefines fuel{
attribute redefines fuelMass=50[kg];
}
}
part frontAxleAssembly:AxleAssembly{
attribute mass :> ISQ::mass=800[kg];
part frontAxle:Axle;
part frontWheels:Wheel[2];
}
part rearAxleAssembly:AxleAssembly{
attribute mass :> ISQ::mass=875[kg];
attribute driveTrainEfficiency:Real = 0.6;
part rearAxle:Axle;
part rearWheels:Wheel[2]{
attribute redefines diameter;
}
}
}
}
package ActionTree{
}
package Requirements{
}
}
package VehicleConfiguration_b{
//Shapes library for simple geometry
public import ShapeItems::Box;
public import ParametersOfInterestMetadata::mop;
public import ModelingMetadata::*; // incudes status info
package PartsTree{
part vehicle_b : Vehicle{
#mop attribute mass redefines mass=dryMass+cargoMass+fuelTank.fuel.fuelMass;
attribute dryMass redefines dryMass=sum(partMasses);
attribute redefines cargoMass default 0 [kg];
attribute partMasses=(fuelTank.mass,frontAxleAssembly.mass,rearAxleAssembly.mass,engine.mass,transmission.mass,driveshaft.mass);
attribute avgFuelEconomy :> distancePerVolume;
port fuelCmdPort: FuelCmdPort redefines pwrCmdPort {
in item fuelCmd redefines pwrCmd;
}
port setSpeedPort:~SetSpeedPort;
port vehicleToRoadPort redefines vehicleToRoadPort{
port wheelToRoadPort1:WheelToRoadPort;
port wheelToRoadPort2:WheelToRoadPort;
}
perform ActionTree::providePower redefines providePower;
perform ActionTree::performSelfTest redefines performSelfTest;
perform ActionTree::applyParkingBrake redefines applyParkingBrake;
perform ActionTree::senseTemperature redefines senseTemperature;
exhibit state vehicleStates redefines vehicleStates;
// Example vehicle with simple enveloping shape that is a solid
item :> envelopingShapes : Box[1] {
length1:>> length = 4800 [mm];
width1:>> width = 1840 [mm];
height1:>> height = 1350 [mm];
}
part fuelTank:FuelTank{
attribute redefines mass=75[kg];
ref item redefines fuel{
attribute redefines fuelMass=60[kg];
}
attribute redefines fuelMassMax=60 [kg];
}
part frontAxleAssembly:AxleAssembly{
attribute mass :> ISQ::mass=800[kg];
port shaftPort_d:ShaftPort_d;
part frontAxle:FrontAxle;
part frontWheels:Wheel[2];
}
part rearAxleAssembly:AxleAssembly{
attribute mass :> ISQ::mass=875[kg];
attribute driveTrainEfficiency:Real = 0.6;
port shaftPort_d:ShaftPort_d;
perform providePower.distributeTorque;
part rearWheel1:Wheel{
attribute redefines diameter;
port wheelToRoadPort:WheelToRoadPort;
port lugNutCompositePort :>> lugNutCompositePort{
port lugNutPort :>> lugNutPort [5];
}
}
part rearWheel2:Wheel{
attribute redefines diameter;
port wheelToRoadPort:WheelToRoadPort;
port lugNutCompositePort :>> lugNutCompositePort{
port lugNutPort :>> lugNutPort [5];
}
}
part differential:Differential{
port shaftPort_d:ShaftPort_d;
port leftDiffPort:DiffPort;
port rightDiffPort:DiffPort;
}
part rearAxle{
part leftHalfAxle:HalfAxle{
port leftAxleToDiffPort:AxlePort;
port shankCompositePort :>> shankCompositePort{
port shankPort :>> shankPort [5];
}
}
part rightHalfAxle:HalfAxle{
port rightAxleToDiffPort:AxlePort;
port shankCompositePort :>> shankCompositePort {
port shankPort :>> shankPort [5];
}
}
}
bind shaftPort_d=differential.shaftPort_d;
connect differential.leftDiffPort to rearAxle.leftHalfAxle.leftAxleToDiffPort;
connect differential.rightDiffPort to rearAxle.rightHalfAxle.rightAxleToDiffPort;
interface wheelToleftHalAxleInterface:WheelHubInterface
connect [1] rearWheel1.lugNutCompositePort to [1] rearAxle.leftHalfAxle.shankCompositePort;
interface wheelTorightHalAxleInterface:WheelHubInterface
connect [1] rearWheel2.lugNutCompositePort to [1] rearAxle.rightHalfAxle.shankCompositePort;
}
part starterMotor:StarterMotor;
part engine:Engine{
perform providePower.generateTorque redefines generateTorque;
part cylinders:Cylinder[4..6];
part alternator{
action generateElectricity;
}
satisfy Requirements::engineSpecification by vehicle_b.engine{
requirement torqueGenerationRequirement :>> torqueGenerationRequirement{
subject generateTorque redefines generateTorque = vehicle_b.engine.generateTorque;
}
requirement drivePowerOuputRequirement :>> drivePowerOutputRequirement{
port torqueOutPort redefines torqueOutPort=vehicle_b.engine.drivePwrPort;
}
}
}
part transmission:Transmission{
attribute mass :> ISQ::mass=100[kg];
port shaftPort_a:ShaftPort_a;
perform providePower.amplifyTorque;
}
part driveshaft:Driveshaft{
attribute mass :> ISQ::mass=100[kg];
port shaftPort_b:ShaftPort_b;
port shaftPort_c:ShaftPort_c;
perform providePower.transferTorque;
}
part vehicleSoftware:VehicleSoftware{
part vehicleController: VehicleController {
exhibit state controllerStates redefines controllerStates;
part cruiseController:CruiseController;
}
}
part speedSensor:SpeedSensor;
// parts in bodyAssy and interioer are marked as safety or security features
part bodyAssy:BodyAssy{
part body:Body{
attribute :>> color = Colors::red;
}
part bumper {@Safety{isMandatory = true;}}
part keylessEntry {@Security;}
}
part interior {
part alarm {@Security;}
part seatBelt[2] {@Safety{isMandatory = true;}}
part frontSeat[2];
part driverAirBag {@Safety{isMandatory = false;}}
}
//connections
bind engine.fuelCmdPort=fuelCmdPort;
interface engineToTransmissionInterface:EngineToTransmissionInterface
connect engine.drivePwrPort to transmission.clutchPort;
interface fuelInterface:FuelInterface
connect fuelTank.fuelOutPort to engine.fuelInPort;
allocate ActionTree::providePower.generateToAmplify to engineToTransmissionInterface;
bind engine.ignitionCmdPort=ignitionCmdPort;
connect starterMotor.gearPort to engine.flyWheelPort;
connect vehicleSoftware.vehicleController.controlPort to engine.engineControlPort;
bind vehicle_b.setSpeedPort = vehicleSoftware.vehicleController.cruiseController.setSpeedPort;
connect speedSensor.speedSensorPort to vehicleSoftware.vehicleController.cruiseController.speedSensorPort;
bind vehicleSoftware.vehicleController.cruiseController.cruiseControlPort = vehicleSoftware.vehicleController.controlPort;
connect transmission.shaftPort_a to driveshaft.shaftPort_b;
connect driveshaft.shaftPort_c to rearAxleAssembly.shaftPort_d;
bind rearAxleAssembly.rearWheel1.wheelToRoadPort=vehicleToRoadPort.wheelToRoadPort1;
bind rearAxleAssembly.rearWheel2.wheelToRoadPort=vehicleToRoadPort.wheelToRoadPort2;
satisfy Requirements::vehicleSpecification by vehicle_b{
requirement vehicleMassRequirement:>>vehicleMassRequirement{
attribute redefines massActual=vehicle_b.mass;
attribute redefines fuelMassActual = vehicle_b.fuelTank.fuel.fuelMass;
}
}
}
}
package ActionTree{
action providePower:ProvidePower{
in item fuelCmd:FuelCmd redefines pwrCmd;
out wheelToRoadTorque redefines wheelToRoadTorque [2] = distributeTorque.wheelToRoadTorque;
action generateTorque:GenerateTorque {
in item = providePower.fuelCmd;
}
action amplifyTorque:AmplifyTorque;
action transferTorque:TransferTorque;
action distributeTorque:DistributeTorque;
//named flow
flow generateToAmplify from generateTorque.engineTorque to amplifyTorque.engineTorque;
//unnamed flows
flow amplifyTorque.transmissionTorque to transferTorque.transmissionTorque;
flow transferTorque.driveshaftTorque to distributeTorque.driveshaftTorque;
}
action performSelfTest: PerformSelfTest;
action applyParkingBrake: ApplyParkingBrake;
action senseTemperature: SenseTemperature;
}
package DiscreteInteractions{
package Sequence{
part def Driver{
port p1;
port p2;
}
part part0{
perform action startVehicle{
action turnVehicleOn send ignitionCmd via driver.p1{
in ignitionCmd:IgnitionCmd;
}
action trigger1 accept ignitionCmd:IgnitionCmd via vehicle.ignitionCmdPort;
flow of IgnitionCmd from trigger1.ignitionCmd to startEngine.ignitionCmd;
action startEngine{
in item ignitionCmd:IgnitionCmd;
out item es:EngineStatus;
}
flow of EngineStatus from startEngine.es to sendStatus.es;
action sendStatus send es via vehicle.statusPort{
in es:EngineStatus;
}
action trigger2 accept es:EngineStatus via driver.p2;
}
part driver : Driver {
perform startVehicle.turnVehicleOn;
perform startVehicle.trigger2;
event occurrence driverReady;
}
part vehicle : Vehicle {
perform startVehicle.trigger1;
perform startVehicle.sendStatus;
event occurrence doorClosed;
}
first vehicle.doorClosed then driver.driverReady;
message of ignitionCmd:IgnitionCmd from driver.turnVehicleOn to vehicle.trigger1;
message of es:EngineStatus from vehicle.sendStatus to driver.trigger2;
}
}
occurrence CruiseControl1{
part vehicle_b:>PartsTree::vehicle_b{
port redefines setSpeedPort{
event occurrence setSpeedReceived;
}
part redefines speedSensor{
port redefines speedSensorPort{
event occurrence sensedSpeedSent;
}
}
part redefines vehicleSoftware{
part redefines vehicleController{
part redefines cruiseController{
port redefines setSpeedPort{
//analagous to gate: event occurrence bound but may not need this since the port is bound
event occurrence setSpeedReceived = vehicle_b.setSpeedPort.setSpeedReceived;
}
port redefines speedSensorPort{
event occurrence sensedSpeedReceived;
}
port redefines cruiseControlPort{
event occurrence fuelCmdSent;
}
}
}
}
part redefines engine{
port redefines fuelCmdPort{
event occurrence fuelCmdReceived;
}
}
message sendSensedSpeed of SensedSpeed
from speedSensor.speedSensorPort.sensedSpeedSent to vehicleSoftware.vehicleController.cruiseController.speedSensorPort.sensedSpeedReceived;
message sendFuelCmd of FuelCmd
from vehicleSoftware.vehicleController.cruiseController.cruiseControlPort.fuelCmdSent to engine.fuelCmdPort.fuelCmdReceived;
}
}
occurrence CruiseControl2{
part vehicle_b:>PartsTree::vehicle_b{
port redefines setSpeedPort{
event occurrence setSpeedReceived;
}
part redefines speedSensor{
port redefines speedSensorPort{
event sendSensedSpeed.sourceEvent;
}
}
part redefines vehicleSoftware{
part redefines vehicleController{
part redefines cruiseController{
port redefines setSpeedPort{
//analagous to gate: event occurrence bound but may not need this since the port is bound
event occurrence setSpeedReceived = vehicle_b.setSpeedPort.setSpeedReceived;
}
port redefines speedSensorPort{
event occurrence setSpeedReceived=setSpeedPort.setSpeedReceived;
then event sendSensedSpeed.targetEvent;
}
port redefines cruiseControlPort{
event sendFuelCmd.sourceEvent;
}
}
}
}
part redefines engine{
port redefines fuelCmdPort{
event sendFuelCmd.targetEvent;
}
}
message sendSensedSpeed of SensedSpeed;
message sendFuelCmd of FuelCmd;
}
}
}
package Requirements{
public import RequirementDerivation::*;
public import ModelingMetadata::*; // incudes status info
item marketSurvey;
dependency from vehicleSpecification to marketSurvey;
requirement vehicleSpecification{
subject vehicle:Vehicle;
requirement <'1'> vehicleMassRequirement: MassRequirement {
doc /* The total mass of the vehicle shall be less than or equal to the required mass.
Assume total mass includes a full tank of gas of 60 kg*/
attribute redefines massRequired=2000 [kg];
attribute redefines massActual default vehicle.dryMass + fuelMassActual;
attribute fuelMassActual:>ISQ::mass;
attribute fuelMassMax:>ISQ::mass = 60 [kg];
assume constraint {fuelMassActual==fuelMassMax}
}
allocate vehicleMassRequirement to PartsTree::vehicle_b.mass;
requirement <'2'> vehicleFuelEconomyRequirements{
doc /* fuel economy requirements group */
attribute assumedCargoMass:>ISQ::mass;
requirement <'2_1'> cityFuelEconomyRequirement:FuelEconomyRequirement{
redefines requiredFuelEconomy= 10 [km / L];
assume constraint {assumedCargoMass<=500 [kg]}
}
requirement <'2_2'> highwayFuelEconomyRequirement:FuelEconomyRequirement{
redefines requiredFuelEconomy= 12.75 [km / L];
assume constraint {assumedCargoMass<=500 [kg]}
//StatusInfo is contained in ModelingMetadata library
// StatusKind has values for open, closed, tbd, tbr, tbd
@StatusInfo {
status = StatusKind::closed;
originator = "Bob";
owner = "Mary";
}
}
}
}
requirement engineSpecification {
subject engine1:Engine;
requirement <'1'> engineMassRequirement: MassRequirement {
doc /* The total mass of the engine shall be less than or equal to the required mass.*/
attribute redefines massRequired=200 [kg];
attribute redefines massActual = engine1.mass;
}
requirement torqueGenerationRequirement : TorqueGenerationRequirement{
subject generateTorque default engine1.generateTorque;
}
requirement drivePowerOutputRequirement : DrivePowerOutputRequirement{
port torqueOutPort{
out torque:Torque;
}
}
}
// the engine mass requirement is derived from the vehicle mass requirement
#derivation connection {
end #original ::> vehicleSpecification.vehicleMassRequirement;
end #derive ::> engineSpecification.engineMassRequirement;
}
}
}
package Engine4Cyl_Variant{
public import ModelingMetadata::*; // incudes refinement
part engine:Engine{
part cylinders:Cylinder[4..8] ordered;
}
part engine4Cyl:>engine{
part redefines cylinders [4];
part cylinder1 subsets cylinders[1];
part cylinder2 subsets cylinders[1];
part cylinder3 subsets cylinders[1];
part cylinder4 subsets cylinders[1];
}
#refinement dependency engine4Cyl to VehicleConfiguration_b::PartsTree::vehicle_b::engine;
}
package WheelHubAssemblies{
// alternative 1 - w/o explicit nesxted interfaces
part wheelHubAssy1{
part wheel1:Wheel{
port :>>lugNutCompositePort:LugNutCompositePort {
port lugNutPort :>> lugNutPort [5];
}
}
part hub1:Hub{
port :>> shankCompositePort:ShankCompositePort {
port shankPort :>> shankPort [5];
}
}
interface wheelHubInterface:WheelHubInterface
connect [1] wheel1.lugNutCompositePort to [1] hub1.shankCompositePort;
}
// alternative 2 - w multiple nesxted interfaces
part wheelHubAssy2{
part wheel1:Wheel{
port :>>lugNutCompositePort:LugNutCompositePort {
port lugNutPort :>> lugNutPort [5];
}
}
part hub1:Hub{
port :>> shankCompositePort:ShankCompositePort {
port shankPort :>> shankPort [5];
}
}
interface wheelHubInterface:WheelHubInterface
connect [1] lugNutCompositePort ::> wheel1.lugNutCompositePort to [1] shankCompositePort ::> hub1.shankCompositePort {
interface wheelFastenerInterface1 :> wheelFastenerInterface
connect [5] lugNutPort ::> lugNutCompositePort.lugNutPort to [5] shankPort ::> shankCompositePort.shankPort;
}
}
// alternative 3 - w explicit nesxted interfaces
part wheelHubAssy3{
part wheel1:Wheel{
port lugNutCompositePort :>> lugNutCompositePort {
port lugNutPort [5] :>> lugNutPort {
attribute :>> threadDia = 14 [mm];
attribute :>> threadPitch = 1.5 [mm];
}
port lugNutPort1 [1] :> lugNutPort;
port lugNutPort2 [1] :> lugNutPort;
port lugNutPort3 [1] :> lugNutPort;
}
}
part hub1:Hub{
port shankCompositePort :>> shankCompositePort {
port shankPort [5] :>> shankPort {
attribute :>> threadDia = 14 [mm];
attribute :>> threadPitch = 1.5 [mm];
attribute :>> shaftLength = 70 [mm];
}
port shankPort1 [1] :> shankPort;
port shankPort2 [1] :> shankPort;
port shankPort3 [1] :> shankPort;
}
}
interface wheelHubInterface:WheelHubInterface
connect [1] lugNutCompositePort ::> wheel1.lugNutCompositePort to [1] shankCompositePort ::> hub1.shankCompositePort {
interface wheelFastenerInterface1 :> wheelFastenerInterface