@@ -75,6 +75,15 @@ package sfriedenthal_VehicleModel_1_simplified{
7575 port controlPort:ControlPort;
7676 exhibit state controllerStates: ControllerStates;
7777 }
78+ part def CruiseController:>Software {
79+ port setSpeedPort:~SetSpeedPort;
80+ port speedSensorPort:~SpeedSensorPort;
81+ port cruiseControlPort:CruiseControlPort;
82+ exhibit state cruiseControllerStates: CruiseControllerStates;
83+ }
84+ part def SpeedSensor{
85+ port speedSensorPort:SpeedSensorPort;
86+ }
7887 part def FuelTank{
7988 attribute mass :> ISQ::mass;
8089 // should use fuel volume instead of fuel mass and fuelCopacity instead of fuelMassMax
@@ -93,9 +102,9 @@ package sfriedenthal_VehicleModel_1_simplified{
93102 attribute incline:Real;
94103 attribute friction:Real;
95104 }
96- part def VehicleRoadContext{
97- attribute time:TimeValue;
98- }
105+ // part def VehicleRoadContext{
106+ // attribute time:TimeValue;
107+ // }
99108 // Used for Specifying Context for Individuals
100109 // replace SpatialTemporalReference by GenericContext::Context
101110 //part def SpatialTemporalReference;
@@ -109,10 +118,12 @@ package sfriedenthal_VehicleModel_1_simplified{
109118 part def Sunroof;
110119
111120 //create abstract physical element to support allocation def from logical to Physical
112- part def PhysicalComponent:>PhysicalElement;
121+ // Parts::Part is a work around on both Physical Component and Logical Component until 2021-05 release
122+ part def PhysicalComponent:>PhysicalElement, Parts::Part;
113123 //logical Components
114- part def LogicalComponent:>LogicalElement;
124+ part def LogicalComponent:>LogicalElement, Parts::Part ;
115125 part def VehicleLogical:>LogicalComponent;
126+
116127 part def ElectricalGenerator;
117128 part def TorqueGenerator;
118129 part def SteeringSubsystem;
@@ -145,11 +156,15 @@ package sfriedenthal_VehicleModel_1_simplified{
145156 port def WheelToRoadPort;
146157 port def VehicleToRoadPort;
147158 port def ControlPort;
159+ port def CruiseControlPort;
160+ port def SpeedSensorPort;
161+ port def SetSpeedPort;
148162 }
149163 package ItemDefinitions{
150164 item def Fuel{
151165 attribute fuelMass:>ISQ::mass;
152166 }
167+ // should FuelCmd and PwrCmd be attributes vs items
153168 item def FuelCmd:>PwrCmd;
154169 item def PwrCmd{
155170 attribute throttleLevel:Real;
@@ -169,6 +184,8 @@ package sfriedenthal_VehicleModel_1_simplified{
169184 // the following are work arounds until time events and change events are available
170185 attribute def 'at(vehicle::maintenanceTime)';
171186 attribute def 'when(temp>vehicle::Tmax)';
187+ attribute def SensedSpeed:>Real;
188+ attribute def SetSpeed:>Real;
172189 }
173190 package InterfaceDefinitions{
174191 interface def EngineToTransmissionInterface{
@@ -222,6 +239,7 @@ package sfriedenthal_VehicleModel_1_simplified{
222239 package StateDefinitions {
223240 state def VehicleStates;
224241 state def ControllerStates;
242+ state def CruiseControllerStates;
225243 }
226244 package RequirementDefinitions{
227245 requirement def MassRequirement{
@@ -262,7 +280,7 @@ package sfriedenthal_VehicleModel_1_simplified{
262280 import USCustomaryUnits::*;
263281 alias ISQ::TorqueValue as Torque;
264282
265- //examples of enumberations
283+ //examples of enumerations
266284 enum def Colors {black;grey;red;}
267285 enum def DiameterChoices:>ISQ::LengthValue{
268286 enum = 60 [mm];
@@ -290,8 +308,7 @@ package sfriedenthal_VehicleModel_1_simplified{
290308 }
291309 package IndividualDefinitions{
292310 //individual def SpatialTemporalReference_1:>SpatialTemporalReference;
293- individual def Context_1:>GenericContext::Context;
294- individual def VehicleRoadContext_1:>VehicleRoadContext;
311+ individual def VehicleRoadContext_1:>GenericContext::Context;
295312 individual def Vehicle_1:>Vehicle;
296313 individual def FrontAxleAssembly_1:>AxleAssembly;
297314 individual def FrontAxle_1:>FrontAxle;
@@ -322,6 +339,7 @@ package sfriedenthal_VehicleModel_1_simplified{
322339 //import USCustomaryUnits::*;
323340
324341 part def Context {
342+ attribute time:TimeValue;
325343 attribute spatialCS: Cartesian3dSpatialCoordinateSystem[1] { :>> mRefs = (m, m, m); }
326344 attribute velocityCS: Cartesian3dVelocityCoordinateSystem[1] = spatialCS/s { :>> isBound = false; }
327345 attribute accelarationCS: Cartesian3dAccelerationCoordinateSystem[1] = velocityCS/s { :>> isBound = false; }
@@ -400,6 +418,7 @@ package sfriedenthal_VehicleModel_1_simplified{
400418 port fuelCmdPort: FuelCmdPort redefines pwrCmdPort {
401419 in item redefines fuelCmd;
402420 }
421+ port setSpeedPort:~SetSpeedPort;
403422 port vehicleToRoadPort redefines vehicleToRoadPort{
404423 port wheelToRoadPort1:WheelToRoadPort;
405424 port wheelToRoadPort2:WheelToRoadPort;
@@ -514,8 +533,10 @@ package sfriedenthal_VehicleModel_1_simplified{
514533 exhibit States::controllerStates redefines controllerStates{
515534 ref controller = vehicleController;
516535 }
536+ part cruiseController:CruiseController;
517537 }
518538 }
539+ part speedSensor:SpeedSensor;
519540 // parts in bodyAssy and interioer are marked as safety or security features
520541 part bodyAssy:BodyAssy{
521542 part body:Body{
@@ -546,6 +567,9 @@ package sfriedenthal_VehicleModel_1_simplified{
546567 //Do not need to redefine ports if :: is replaced with dot notation
547568 //connect vehicleSoftware::vehicleController::controlPort to engine::engineControlPort;
548569 connect vehicleSoftware.vehicleController.controlPort to engine.engineControlPort;
570+ bind vehicle_b.setSpeedPort = vehicleSoftware.vehicleController.cruiseController.setSpeedPort;
571+ connect speedSensor.speedSensorPort to vehicleSoftware.vehicleController.cruiseController.speedSensorPort;
572+ connect vehicleSoftware.vehicleController.cruiseController.cruiseControlPort to engine.engineControlPort;
549573 connect transmission::shaftPort_a to driveshaft::shaftPort_b;
550574 connect driveshaft::shaftPort_c to rearAxleAssembly::shaftPort_d;
551575 bind rearAxleAssembly::rearWheel1::wheelToRoadPort=vehicleToRoadPort::wheelToRoadPort1;
@@ -685,6 +709,49 @@ package sfriedenthal_VehicleModel_1_simplified{
685709 }
686710 }
687711 }
712+ package DiscreteInteractions{
713+ occurrence def CruiseControl{
714+ part vehicle_b:>PartsTree::vehicle_b{
715+ port redefines setSpeedPort{
716+ event occurrence setSpeedReceived;
717+ }
718+ part redefines speedSensor{
719+ port redefines speedSensorPort{
720+ event occurrence sensedSpeedSent;
721+ }
722+ }
723+ part redefines vehicleSoftware{
724+ part redefines vehicleController{
725+ part redefines cruiseController{
726+ /* introduce loop operand with test when available so that
727+ sensedSpeedSent continues at periodic intervals until cancelSpeedReceived */
728+ port redefines setSpeedPort{
729+ //analagous to gate: event occurrence bound but may not need this since the port is bound
730+ event occurrence setSpeedReceived = vehicle_b.setSpeedPort.setSpeedReceived;
731+ }
732+ port redefines speedSensorPort{
733+ event occurrence setSpeedReceived=setSpeedPort.setSpeedReceived;
734+ then event occurrence sensedSpeedReceived;
735+ }
736+ port redefines cruiseControlPort{
737+ event occurrence sensedSpeedReceived=speedSensorPort.sensedSpeedReceived;
738+ then event occurrence fuelCmdSent;
739+ }
740+ }
741+ }
742+ }
743+ part redefines engine{
744+ port redefines fuelCmdPort{
745+ event occurrence fuelCmdReceived;
746+ }
747+ }
748+ message sendSensedSpeed of SensedSpeed
749+ from speedSensor.speedSensorPort.sensedSpeedSent to vehicleSoftware.vehicleController.cruiseController.speedSensorPort.sensedSpeedReceived;
750+ message sendFuelCmd of FuelCmd
751+ from vehicleSoftware.vehicleController.cruiseController.cruiseControlPort.fuelCmdSent to engine.fuelCmdPort.fuelCmdReceived;
752+ }
753+ }
754+ }
688755 package Requirements{
689756 item marketSurvey;
690757 dependency from vehicleSpecification to marketSurvey;
@@ -831,8 +898,48 @@ package sfriedenthal_VehicleModel_1_simplified{
831898 }
832899 }
833900 package VehicleAnalysis{
834- // recursive import uses double asterist **
901+ // recursive import uses double asterisk **
835902 import VehicleConfigurations::VehicleConfiguration_b::**;
903+ package FuelEconomyAnalysisModel_ModelCenter{
904+ // metadata library
905+ import AnalysisTooling::*;
906+
907+ // specify indviduals to record input and output values
908+ individual def Vehicle_2:>Vehicle;
909+ individual def Engine_2:>Engine;
910+ //individual vehicle_b2:Vehicle_2{
911+ individual vehicle_b2:Vehicle_2:>PartsTree::vehicle_b{
912+ //attribute fuelEconomy:Real;
913+ attribute :>>avgFuelEconomy;
914+ attribute distanceTraveled:LengthValue = 1000 [m];
915+ individual engine_b2:Engine_2 redefines PartsTree::vehicle_b::engine {
916+ attribute :>> peakHorsePower = 200*745.7[W];
917+ attribute :>> fuelEfficiency = .4;
918+ }
919+ }
920+ analysis fuelEconomyAnalysis {
921+ //return attribute calculatedFuelEconomy:KilometersPerLitre;
922+ return attribute calculatedFuelEconomy:>distancePerVolume;
923+ subject v:>vehicle_b2;
924+
925+ objective fuelEconomyAnalysisObjective {
926+ /* the objective of this analysis is to determine whether the vehicle design configuration can
927+ satisfy the fuel economy requirements */
928+ require vehicleSpecification::vehicleFuelEconomyRequirements;
929+ }
930+
931+ action fuelConsumption {
932+ metadata ToolExecution {
933+ toolName = "ModelCenter";
934+ uri = "aserv://localhost/sysml2/vehicleModel/fuelConsumption";
935+ }
936+ in power:PowerValue=v.engine_b2.peakHorsePower { @ToolVariable { name = "pv"; } }
937+ in fuelEfficiency:Real=v.engine_b2.fuelEfficiency { @ToolVariable { name = "fuelEff"; } }
938+ in distanceTraveled:LengthValue=v.distanceTraveled { @ToolVariable { name = "distance"; } }
939+ out fuelEconomy:>distancePerVolume=v.avgFuelEconomy { @ToolVariable { name = "fuelEconomy"; }}
940+ }
941+ }
942+ }
836943 package FuelEconomyAnalysisModel{
837944 //import NonScalarValues::SampledFunctionValue;
838945 import Collections::SampledFunction;
@@ -929,12 +1036,15 @@ package sfriedenthal_VehicleModel_1_simplified{
9291036 package ReliabilityAnalyis{
9301037 }
9311038 package VehicleTradeOffAnalysis{
932- // the following provides the rationale that ould be contained in the vehicle configuration with the selected engine
1039+ // Example: the following provides the rationale for selecting the engine4cyl. The rationale could be contained in the vehicle configuration with the selected engine
9331040 part engine4cyl;
934- // the following should be the explained by relationship that refers to the rationale for selecting the engine4cyl
935- dependency from engine4cyl to EngineSelectionRationale;
936- comment EngineSelectionRationale about engineTradeOffAnalysis
937- /*this is the rationale that refers to the engineTradeOffAnalysis*/
1041+ comment EngineSelectionRationale about engine4cyl
1042+ /*this rationale for selecting the engine4cyl refers to the engineTradeOffAnalysis.
1043+ This could be accomplished by a hyperlink or an explanation relationship. The explanation relationship may be easier to navigate via a quer.
1044+ This should also support relationsips to external sources of data using the external relationship service*/
1045+
1046+ // the following should be the explanation relationship that relates the rationale to the trade-off analysis used to select the engine4cyl
1047+ dependency from EngineSelectionRationale to engineTradeOffAnalysis;
9381048
9391049 import TradeStudies::*;
9401050 //objective function with criterion engine mass, engine power, and engine cost
@@ -1025,13 +1135,19 @@ package sfriedenthal_VehicleModel_1_simplified{
10251135 }
10261136 }
10271137 package VehicleIndividuals{
1028- //individual a:SpatialTemporalReference_1{
1029- individual a:Context_1{
1030- timeslice t0_t2:VehicleRoadContext_1{
1031- snapshot start redefines start{:>>time=0;}
1032- snapshot done redefines done {:>>time=2;}
1138+ // VehicleRoadContext_1 subclasses GenericContext::Context with spatial reference and time attribute
1139+ individual a:VehicleRoadContext_1{
1140+ //timeslice t0_t2:VehicleRoadContext_1{
1141+ timeslice t0_t2_a{
1142+ snapshot start redefines start{
1143+ attribute t0:TimeValue=0;
1144+ }
1145+ snapshot done redefines done{
1146+ attribute t2:TimeValue=2;
1147+ }
10331148 }
1034- snapshot t0:VehicleRoadContext_1{
1149+ //snapshot t0:VehicleRoadContext_1{
1150+ snapshot t0_a {
10351151 attribute t0 redefines time=0;
10361152 snapshot t0_r:Road_1{
10371153 :>>Road::incline =0;
@@ -1049,7 +1165,7 @@ package sfriedenthal_VehicleModel_1_simplified{
10491165 }
10501166 }
10511167 }
1052- snapshot t1:VehicleRoadContext_1 {
1168+ snapshot t1_a {
10531169 attribute t1 redefines time=1;
10541170 snapshot t1_r:Road_1{
10551171 :>>Road::incline =0;
@@ -1067,7 +1183,7 @@ package sfriedenthal_VehicleModel_1_simplified{
10671183 }
10681184 }
10691185 }
1070- snapshot t2:VehicleRoadContext_1 {
1186+ snapshot t2_a {
10711187 attribute t2 redefines time=2;
10721188 snapshot t2_r:Road_1{
10731189 :>>Road::incline =0;
@@ -1133,6 +1249,7 @@ package sfriedenthal_VehicleModel_1_simplified{
11331249 perform transportPassenger::closeDoor_2;
11341250 }
11351251 part vehicle_b_1:>vehicle_b {
1252+ attribute :>> positionVector = (0,0,0) [spatialCS];
11361253 perform transportPassenger::providePower redefines providePower;
11371254 }
11381255 }
@@ -1170,8 +1287,8 @@ package sfriedenthal_VehicleModel_1_simplified{
11701287 variation part sunroof:Sunroof;
11711288 // selection constraint
11721289 assert constraint {
1173- (engine==engine::engine4Cyl & transmissionChoices==TransmissionChoices::transmissionManual) ^
1174- (engine==engine::engine6Cyl & transmissionChoices==TransmissionChoices::transmissionAutomatic)
1290+ (engine==engine::engine4Cyl and transmissionChoices==TransmissionChoices::transmissionManual) xor
1291+ (engine==engine::engine6Cyl and transmissionChoices==TransmissionChoices::transmissionAutomatic)
11751292 }
11761293 }
11771294 }
@@ -1238,4 +1355,3 @@ package sfriedenthal_VehicleModel_1_simplified{
12381355 }
12391356}
12401357
1241-
0 commit comments