onroute-policy-engine 2.19.0 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  export declare enum PolicyCheckResultType {
2
2
  Pass = "pass",
3
- Fail = "fail"
3
+ Fail = "fail",
4
+ Warning = "warning"
4
5
  }
5
6
  export declare enum PolicyCheckId {
6
7
  AxleGroupMaximumLegalWeightThreshold = "axle-group-maximum-legal-weight-threshold",
@@ -15,5 +16,5 @@ export declare enum PolicyCheckId {
15
16
  NumberOfAxles = "number-of-axles",
16
17
  NumberOfWheelsPerAxle = "number-of-wheels",
17
18
  PickerTruckTractorWeightRestrictions = "picker-truck-tractor-weight-restrictions",
18
- TruckTractorWheelbase = "truck-tractor-wheelbase"
19
+ WheelbaseLegalLimits = "wheelbase-legal-limits"
19
20
  }
@@ -5,6 +5,7 @@ var PolicyCheckResultType;
5
5
  (function (PolicyCheckResultType) {
6
6
  PolicyCheckResultType["Pass"] = "pass";
7
7
  PolicyCheckResultType["Fail"] = "fail";
8
+ PolicyCheckResultType["Warning"] = "warning";
8
9
  })(PolicyCheckResultType || (exports.PolicyCheckResultType = PolicyCheckResultType = {}));
9
10
  var PolicyCheckId;
10
11
  (function (PolicyCheckId) {
@@ -20,5 +21,5 @@ var PolicyCheckId;
20
21
  PolicyCheckId["NumberOfAxles"] = "number-of-axles";
21
22
  PolicyCheckId["NumberOfWheelsPerAxle"] = "number-of-wheels";
22
23
  PolicyCheckId["PickerTruckTractorWeightRestrictions"] = "picker-truck-tractor-weight-restrictions";
23
- PolicyCheckId["TruckTractorWheelbase"] = "truck-tractor-wheelbase";
24
+ PolicyCheckId["WheelbaseLegalLimits"] = "wheelbase-legal-limits";
24
25
  })(PolicyCheckId || (exports.PolicyCheckId = PolicyCheckId = {}));
@@ -273,12 +273,9 @@ export declare function CheckMaxTireLoad(_policy: Policy, _vehicleConfiguration:
273
273
  */
274
274
  export declare function CheckBoosterAxleLimit(_policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
275
275
  /**
276
- * Validates derived wheelbase for single steer, tandem drive truck tractors.
277
- *
278
- * Wheelbase is derived from the spacing between axle units 1 and 2 plus half
279
- * of axle unit 2 spread. Axle dimensions are stored in centimetres.
276
+ * Validates wheelbase legal limits for supported power unit vehicle sub-types.
280
277
  */
281
- export declare function CheckTruckTractorWheelbase(policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
278
+ export declare function CheckWheelbaseLegalLimits(policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
282
279
  /**
283
280
  * Validates that the drive axle unit and first jeep axle unit are load equalized
284
281
  * within 1000 kg when they have the same number of axles.
@@ -313,7 +310,8 @@ export declare function CheckDriveJeepLoadEqualization(_policy: Policy, vehicleC
313
310
  * - NumberOfAxles: Validates axle count per axle unit
314
311
  * - NumberOfWheelsPerAxle: Validates tire count per axle unit
315
312
  * - BoosterAxleLimit: Validates booster axle count against the preceding trailer
316
- * - TruckTractorWheelbase: Validates derived wheelbase for single steer, tandem drive truck tractors
313
+ * - TruckTractorWheelbaseLegalLimits: Validates derived wheelbase for single steer, tandem drive truck tractors
314
+ * - WheelbaseLegalLimits: Validates wheelbase against legal limits
317
315
  * - DriveJeepLoadEqualization: Validates drive and jeep axle unit load equalization
318
316
  *
319
317
  * @see PolicyCheck
@@ -13,7 +13,7 @@ exports.CheckPickerTruckTractorWeightRestrictions = CheckPickerTruckTractorWeigh
13
13
  exports.CheckMinDriveAxleWeight = CheckMinDriveAxleWeight;
14
14
  exports.CheckMaxTireLoad = CheckMaxTireLoad;
15
15
  exports.CheckBoosterAxleLimit = CheckBoosterAxleLimit;
16
- exports.CheckTruckTractorWheelbase = CheckTruckTractorWheelbase;
16
+ exports.CheckWheelbaseLegalLimits = CheckWheelbaseLegalLimits;
17
17
  exports.CheckDriveJeepLoadEqualization = CheckDriveJeepLoadEqualization;
18
18
  const dimensions_helper_1 = require("./dimensions.helper");
19
19
  const ctr_717_helper_1 = require("./ctr-717.helper");
@@ -618,6 +618,7 @@ function CheckPickerTruckTractorWeightRestrictions(policy, vehicleConfiguration,
618
618
  * @see PolicyCheck
619
619
  * @see AxleGroupPolicyCheckResult
620
620
  */
621
+ // TODO this evaluation should only be applied to certain vehicle subtypes, await spec update
621
622
  function CheckMinDriveAxleWeight(_policy, _vehicleConfiguration, axleConfiguration) {
622
623
  const policyCheckResults = new Array();
623
624
  const policyId = enum_1.PolicyCheckId.MinDriveAxleWeight;
@@ -650,6 +651,7 @@ function CheckMinDriveAxleWeight(_policy, _vehicleConfiguration, axleConfigurati
650
651
  id: policyId,
651
652
  message: message,
652
653
  result: result,
654
+ // TODO both start and end axle units should be the drive axle, is this always the second axle unit in the configuration? Or is it the last axle unit of the power unit configuration?
653
655
  startAxleUnit: 1,
654
656
  endAxleUnit: axleConfiguration.length,
655
657
  });
@@ -905,54 +907,126 @@ function CheckBoosterAxleLimit(_policy, vehicleConfiguration, axleConfiguration)
905
907
  return policyCheckResults;
906
908
  }
907
909
  /**
908
- * Validates derived wheelbase for single steer, tandem drive truck tractors.
909
- *
910
- * Wheelbase is derived from the spacing between axle units 1 and 2 plus half
911
- * of axle unit 2 spread. Axle dimensions are stored in centimetres.
910
+ * Validates wheelbase legal limits for supported power unit vehicle sub-types.
912
911
  */
913
- function CheckTruckTractorWheelbase(policy, vehicleConfiguration, axleConfiguration) {
914
- const policyId = enum_1.PolicyCheckId.TruckTractorWheelbase;
915
- const powerUnitSubtype = vehicleConfiguration[0];
916
- const steerAxle = axleConfiguration[0];
917
- const driveAxle = axleConfiguration[1];
918
- if (powerUnitSubtype !== 'TRKTRAC' ||
919
- !steerAxle ||
920
- !driveAxle ||
921
- steerAxle.numberOfAxles !== 1 ||
922
- driveAxle.numberOfAxles !== 2 ||
923
- driveAxle.interaxleSpacing === undefined ||
924
- driveAxle.axleSpread === undefined) {
925
- return [];
926
- }
927
- const wheelbase = driveAxle.interaxleSpacing + driveAxle.axleSpread / 2;
912
+ function CheckWheelbaseLegalLimits(policy, vehicleConfiguration, axleConfiguration) {
913
+ var _a, _b, _c;
928
914
  const resultBase = {
929
- id: policyId,
915
+ id: enum_1.PolicyCheckId.WheelbaseLegalLimits,
930
916
  startAxleUnit: 1,
931
917
  endAxleUnit: 2,
932
918
  };
933
- if (wheelbase > 720) {
919
+ const powerUnitSubtype = vehicleConfiguration[0];
920
+ const steerAxle = Object.assign(Object.assign({}, axleConfiguration[0]), { axleSpread: (_a = axleConfiguration[0].axleSpread) !== null && _a !== void 0 ? _a : 0 });
921
+ const driveAxle = Object.assign(Object.assign({}, axleConfiguration[1]), { axleSpread: (_b = axleConfiguration[1].axleSpread) !== null && _b !== void 0 ? _b : 0, interaxleSpacing: (_c = axleConfiguration[1].interaxleSpacing) !== null && _c !== void 0 ? _c : 0 });
922
+ // TODO we need to add Truck with PME and Truck Tractor with PME when ready
923
+ const isSupportedVehicleSubtype = (value) => {
924
+ return (value === 'REGTRCK' ||
925
+ value === 'TRKTRAC' ||
926
+ value === 'PICKRTT' ||
927
+ value === 'OGBEDTK');
928
+ };
929
+ const isSingleSteer = steerAxle.numberOfAxles === 1;
930
+ const isTandemSteer = steerAxle.numberOfAxles === 2;
931
+ const isTandemDrive = driveAxle.numberOfAxles === 2;
932
+ const isTridemDrive = driveAxle.numberOfAxles === 3;
933
+ const isTruckTractor = powerUnitSubtype === 'TRKTRAC';
934
+ const isPickerTruckTractor = powerUnitSubtype === 'PICKRTT';
935
+ const isOilfieldBedTruck = powerUnitSubtype === 'OGBEDTK';
936
+ const wheelbase = isSingleSteer
937
+ ? driveAxle.interaxleSpacing + driveAxle.axleSpread / 2
938
+ : steerAxle.axleSpread / 2 +
939
+ driveAxle.interaxleSpacing +
940
+ driveAxle.axleSpread / 2;
941
+ // the following logic covers the ASW 6.2 to 7.2m feature, we are grouping it with CheckWheelBaseLegalLimits because of feature overlap
942
+ if ((isTruckTractor || isPickerTruckTractor) &&
943
+ isSingleSteer &&
944
+ isTandemDrive &&
945
+ wheelbase > 620) {
946
+ if (wheelbase > 720) {
947
+ return [
948
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Fail, message: 'Wheelbase for Axle Unit 1 and Axle Unit 2 is greater than 7.2m.' }),
949
+ ];
950
+ }
951
+ if (wheelbase >= 620) {
952
+ const hasDisallowedTrailer = vehicleConfiguration.slice(1).some((v) => {
953
+ const trailer = policy.getTrailerDefinition(v);
954
+ const isSemiTrailer = (trailer === null || trailer === void 0 ? void 0 : trailer.id) === 'SEMITRL';
955
+ return !isSemiTrailer;
956
+ });
957
+ const hasTrailer = vehicleConfiguration.length > 1;
958
+ return [
959
+ Object.assign(Object.assign({}, resultBase), { result: hasDisallowedTrailer
960
+ ? enum_1.PolicyCheckResultType.Fail
961
+ : enum_1.PolicyCheckResultType.Warning, message: hasTrailer && !hasDisallowedTrailer
962
+ ? 'Wheelbase for Axle Unit X and Axle Unit Y is between 6.2m and 7.2m. Semi-Trailer wheelbase must be within dimensions table found in CTPM 5.3.7.A.'
963
+ : 'Wheelbase for Axle Unit 1 and Axle Unit 2 is between 6.2m and 7.2m. See CTPM 5.3.7.A.' }),
964
+ ];
965
+ }
934
966
  return [
935
- Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Fail, message: 'Wheelbase for Axle Unit 1 and Axle Unit 2 is greater than 7.2m.' }),
967
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Pass, message: '' }),
936
968
  ];
937
969
  }
938
- if (wheelbase >= 620) {
939
- const hasDisallowedTrailer = vehicleConfiguration.slice(1).some((v) => {
940
- if (v === enum_1.AccessoryVehicleType.Jeep ||
941
- v === enum_1.AccessoryVehicleType.Booster) {
942
- return true;
970
+ if (isSupportedVehicleSubtype(powerUnitSubtype)) {
971
+ if (isSingleSteer && isTridemDrive) {
972
+ // TODO we need to add Truck with PME and Truck Tractor with PME when ready
973
+ if (isTruckTractor || isPickerTruckTractor) {
974
+ if (wheelbase < 660) {
975
+ return [
976
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Fail, message: 'Wheelbase for Axle Unit 1 is less than 6.6 m.' }),
977
+ ];
978
+ }
979
+ if (wheelbase > 680) {
980
+ return [
981
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Fail, message: 'Wheelbase for Axle Unit 1 is greater than 6.8 m.' }),
982
+ ];
983
+ }
943
984
  }
944
- const trailer = policy.getTrailerDefinition(v);
945
- return (trailer === null || trailer === void 0 ? void 0 : trailer.category) !== 'semi';
946
- });
985
+ else {
986
+ if (wheelbase < 660) {
987
+ return [
988
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Fail, message: 'Wheelbase for Axle Unit 1 is less than 6.6 m.' }),
989
+ ];
990
+ }
991
+ }
992
+ }
993
+ if (isTandemSteer && isTridemDrive) {
994
+ if (wheelbase < 770) {
995
+ if (isOilfieldBedTruck) {
996
+ if (driveAxle.axleSpread >= 280 &&
997
+ driveAxle.axleSpread < 300 &&
998
+ wheelbase < 780) {
999
+ return [
1000
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Fail, message: 'Wheelbase for Axle Unit 1 is less than 7.8 m.' }),
1001
+ ];
1002
+ }
1003
+ if (driveAxle.axleSpread >= 300 &&
1004
+ driveAxle.axleSpread <= 310 &&
1005
+ wheelbase < 790) {
1006
+ return [
1007
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Fail, message: 'Wheelbase for Axle Unit 1 is less than 7.9 m.' }),
1008
+ ];
1009
+ }
1010
+ }
1011
+ if (!isOilfieldBedTruck &&
1012
+ driveAxle.axleSpread >= 240 &&
1013
+ driveAxle.axleSpread < 280) {
1014
+ return [
1015
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Fail, message: 'Wheelbase for Axle Unit 1 is less than 7.7 m.' }),
1016
+ ];
1017
+ }
1018
+ }
1019
+ if (isOilfieldBedTruck && wheelbase > 1000) {
1020
+ return [
1021
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Fail, message: 'Wheelbase for Axle Unit 1 is greater than 10.0 m.' }),
1022
+ ];
1023
+ }
1024
+ }
947
1025
  return [
948
- Object.assign(Object.assign({}, resultBase), { result: hasDisallowedTrailer
949
- ? enum_1.PolicyCheckResultType.Fail
950
- : enum_1.PolicyCheckResultType.Pass, message: 'Wheelbase for Axle Unit 1 and Axle Unit 2 is between 6.2m and 7.2m. See CTPM 5.3.7.A.' }),
1026
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Pass, message: '' }),
951
1027
  ];
952
1028
  }
953
- return [
954
- Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Pass, message: '' }),
955
- ];
1029
+ return [];
956
1030
  }
957
1031
  /**
958
1032
  * Validates that the drive axle unit and first jeep axle unit are load equalized
@@ -1021,7 +1095,8 @@ function CheckDriveJeepLoadEqualization(_policy, vehicleConfiguration, axleConfi
1021
1095
  * - NumberOfAxles: Validates axle count per axle unit
1022
1096
  * - NumberOfWheelsPerAxle: Validates tire count per axle unit
1023
1097
  * - BoosterAxleLimit: Validates booster axle count against the preceding trailer
1024
- * - TruckTractorWheelbase: Validates derived wheelbase for single steer, tandem drive truck tractors
1098
+ * - TruckTractorWheelbaseLegalLimits: Validates derived wheelbase for single steer, tandem drive truck tractors
1099
+ * - WheelbaseLegalLimits: Validates wheelbase against legal limits
1025
1100
  * - DriveJeepLoadEqualization: Validates drive and jeep axle unit load equalization
1026
1101
  *
1027
1102
  * @see PolicyCheck
@@ -1046,6 +1121,6 @@ exports.policyCheckMap = new Map([
1046
1121
  ],
1047
1122
  [enum_1.PolicyCheckId.NumberOfWheelsPerAxle, CheckNumTiresPerAxle],
1048
1123
  [enum_1.PolicyCheckId.BoosterAxleLimit, CheckBoosterAxleLimit],
1049
- [enum_1.PolicyCheckId.TruckTractorWheelbase, CheckTruckTractorWheelbase],
1050
1124
  [enum_1.PolicyCheckId.DriveJeepLoadEqualization, CheckDriveJeepLoadEqualization],
1125
+ [enum_1.PolicyCheckId.WheelbaseLegalLimits, CheckWheelbaseLegalLimits],
1051
1126
  ]);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "v2.19.0";
1
+ export declare const version = "v2.20.0";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = 'v2.19.0';
5
+ exports.version = 'v2.20.0';
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  ],
92
92
  "testEnvironment": "node"
93
93
  },
94
- "version": "v2.19.0"
94
+ "version": "v2.20.0"
95
95
  }