onroute-policy-engine 2.10.1 → 2.11.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.
@@ -10,5 +10,6 @@ export declare enum PolicyCheckId {
10
10
  MinDriveAxleWeight = "minimum-drive-axle-weight",
11
11
  MinSteerAxleWeight = "minimum-steer-axle-weight",
12
12
  NumberOfAxles = "number-of-axles",
13
- NumberOfWheelsPerAxle = "number-of-wheels"
13
+ NumberOfWheelsPerAxle = "number-of-wheels",
14
+ TruckTractorWheelbase = "truck-tractor-wheelbase"
14
15
  }
@@ -16,4 +16,5 @@ var PolicyCheckId;
16
16
  PolicyCheckId["MinSteerAxleWeight"] = "minimum-steer-axle-weight";
17
17
  PolicyCheckId["NumberOfAxles"] = "number-of-axles";
18
18
  PolicyCheckId["NumberOfWheelsPerAxle"] = "number-of-wheels";
19
+ PolicyCheckId["TruckTractorWheelbase"] = "truck-tractor-wheelbase";
19
20
  })(PolicyCheckId || (exports.PolicyCheckId = PolicyCheckId = {}));
@@ -249,6 +249,13 @@ export declare function CheckMaxTireLoad(_policy: Policy, _vehicleConfiguration:
249
249
  * @returns Array of AxleGroupPolicyCheckResult objects, one for each booster tested
250
250
  */
251
251
  export declare function CheckBoosterAxleLimit(_policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
252
+ /**
253
+ * Validates derived wheelbase for single steer, tandem drive truck tractors.
254
+ *
255
+ * Wheelbase is derived from the spacing between axle units 1 and 2 plus half
256
+ * of axle unit 2 spread. Axle dimensions are stored in centimetres.
257
+ */
258
+ export declare function CheckTruckTractorWheelbase(policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
252
259
  /**
253
260
  * Map of policy check functions keyed by their corresponding PolicyCheckId.
254
261
  *
@@ -266,6 +273,7 @@ export declare function CheckBoosterAxleLimit(_policy: Policy, vehicleConfigurat
266
273
  * - NumberOfAxles: Validates axle count per axle unit
267
274
  * - NumberOfWheelsPerAxle: Validates tire count per axle unit
268
275
  * - BoosterAxleLimit: Validates booster axle count against the preceding trailer
276
+ * - TruckTractorWheelbase: Validates derived wheelbase for single steer, tandem drive truck tractors
269
277
  *
270
278
  * @see PolicyCheck
271
279
  * @see PolicyCheckId
@@ -9,6 +9,7 @@ exports.CheckMinSteerAxleWeight = CheckMinSteerAxleWeight;
9
9
  exports.CheckMinDriveAxleWeight = CheckMinDriveAxleWeight;
10
10
  exports.CheckMaxTireLoad = CheckMaxTireLoad;
11
11
  exports.CheckBoosterAxleLimit = CheckBoosterAxleLimit;
12
+ exports.CheckTruckTractorWheelbase = CheckTruckTractorWheelbase;
12
13
  const dimensions_helper_1 = require("./dimensions.helper");
13
14
  const enum_1 = require("../enum");
14
15
  /**
@@ -595,6 +596,56 @@ function CheckBoosterAxleLimit(_policy, vehicleConfiguration, axleConfiguration)
595
596
  });
596
597
  return policyCheckResults;
597
598
  }
599
+ /**
600
+ * Validates derived wheelbase for single steer, tandem drive truck tractors.
601
+ *
602
+ * Wheelbase is derived from the spacing between axle units 1 and 2 plus half
603
+ * of axle unit 2 spread. Axle dimensions are stored in centimetres.
604
+ */
605
+ function CheckTruckTractorWheelbase(policy, vehicleConfiguration, axleConfiguration) {
606
+ const policyId = enum_1.PolicyCheckId.TruckTractorWheelbase;
607
+ const powerUnitSubtype = vehicleConfiguration[0];
608
+ const steerAxle = axleConfiguration[0];
609
+ const driveAxle = axleConfiguration[1];
610
+ if (powerUnitSubtype !== 'TRKTRAC' ||
611
+ !steerAxle ||
612
+ !driveAxle ||
613
+ steerAxle.numberOfAxles !== 1 ||
614
+ driveAxle.numberOfAxles !== 2 ||
615
+ driveAxle.interaxleSpacing === undefined ||
616
+ driveAxle.axleSpread === undefined) {
617
+ return [];
618
+ }
619
+ const wheelbase = driveAxle.interaxleSpacing + driveAxle.axleSpread / 2;
620
+ const resultBase = {
621
+ id: policyId,
622
+ startAxleUnit: 1,
623
+ endAxleUnit: 2,
624
+ };
625
+ if (wheelbase > 720) {
626
+ return [
627
+ 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.' }),
628
+ ];
629
+ }
630
+ if (wheelbase >= 620) {
631
+ const hasDisallowedTrailer = vehicleConfiguration.slice(1).some((v) => {
632
+ if (v === enum_1.AccessoryVehicleType.Jeep ||
633
+ v === enum_1.AccessoryVehicleType.Booster) {
634
+ return true;
635
+ }
636
+ const trailer = policy.getTrailerDefinition(v);
637
+ return (trailer === null || trailer === void 0 ? void 0 : trailer.category) !== 'semi';
638
+ });
639
+ return [
640
+ Object.assign(Object.assign({}, resultBase), { result: hasDisallowedTrailer
641
+ ? enum_1.PolicyCheckResultType.Fail
642
+ : 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.' }),
643
+ ];
644
+ }
645
+ return [
646
+ Object.assign(Object.assign({}, resultBase), { result: enum_1.PolicyCheckResultType.Pass, message: '' }),
647
+ ];
648
+ }
598
649
  /**
599
650
  * Map of policy check functions keyed by their corresponding PolicyCheckId.
600
651
  *
@@ -612,6 +663,7 @@ function CheckBoosterAxleLimit(_policy, vehicleConfiguration, axleConfiguration)
612
663
  * - NumberOfAxles: Validates axle count per axle unit
613
664
  * - NumberOfWheelsPerAxle: Validates tire count per axle unit
614
665
  * - BoosterAxleLimit: Validates booster axle count against the preceding trailer
666
+ * - TruckTractorWheelbase: Validates derived wheelbase for single steer, tandem drive truck tractors
615
667
  *
616
668
  * @see PolicyCheck
617
669
  * @see PolicyCheckId
@@ -626,4 +678,5 @@ exports.policyCheckMap = new Map([
626
678
  [enum_1.PolicyCheckId.MinSteerAxleWeight, CheckMinSteerAxleWeight],
627
679
  [enum_1.PolicyCheckId.NumberOfWheelsPerAxle, CheckNumTiresPerAxle],
628
680
  [enum_1.PolicyCheckId.BoosterAxleLimit, CheckBoosterAxleLimit],
681
+ [enum_1.PolicyCheckId.TruckTractorWheelbase, CheckTruckTractorWheelbase],
629
682
  ]);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "v2.10.1";
1
+ export declare const version = "v2.11.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.10.1';
5
+ exports.version = 'v2.11.0';
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  ],
92
92
  "testEnvironment": "node"
93
93
  },
94
- "version": "v2.10.1"
94
+ "version": "v2.11.0"
95
95
  }