onroute-policy-engine 2.13.0 → 2.15.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,6 +10,7 @@ export declare enum PolicyCheckId {
10
10
  MaxTireLoad = "max-tire-load",
11
11
  MinDriveAxleWeight = "minimum-drive-axle-weight",
12
12
  MinSteerAxleWeight = "minimum-steer-axle-weight",
13
+ MinTandemSteerAxleWeight = "minimum-tandem-steer-axle-weight",
13
14
  NumberOfAxles = "number-of-axles",
14
15
  NumberOfWheelsPerAxle = "number-of-wheels",
15
16
  TruckTractorWheelbase = "truck-tractor-wheelbase"
@@ -15,6 +15,7 @@ var PolicyCheckId;
15
15
  PolicyCheckId["MaxTireLoad"] = "max-tire-load";
16
16
  PolicyCheckId["MinDriveAxleWeight"] = "minimum-drive-axle-weight";
17
17
  PolicyCheckId["MinSteerAxleWeight"] = "minimum-steer-axle-weight";
18
+ PolicyCheckId["MinTandemSteerAxleWeight"] = "minimum-tandem-steer-axle-weight";
18
19
  PolicyCheckId["NumberOfAxles"] = "number-of-axles";
19
20
  PolicyCheckId["NumberOfWheelsPerAxle"] = "number-of-wheels";
20
21
  PolicyCheckId["TruckTractorWheelbase"] = "truck-tractor-wheelbase";
@@ -58,9 +58,9 @@ export declare function CheckBridgeFormula(policy: Policy, _vehicleConfiguration
58
58
  * Validates the number of tires per axle unit against regulatory requirements.
59
59
  *
60
60
  * This function checks that each axle unit has a valid number of tires based on
61
- * the number of axles in that unit. The validation allows for 2, 4, or 8 tires
62
- * per axle (2, 4, or 8 * number of axles). This ensures compliance with tire
63
- * count regulations for commercial vehicles.
61
+ * the number of axles in that unit and the axle unit position. Axle unit 1 is
62
+ * the steer axle unit, axle unit 2 is the drive axle unit, and axle units 3+
63
+ * use the generic axle unit allowance.
64
64
  *
65
65
  * @param _policy - The policy instance (unused in this check, but required by PolicyCheck type)
66
66
  * @param _vehicleConfiguration - Vehicle configuration (unused in this check, but required by PolicyCheck type)
@@ -70,15 +70,15 @@ export declare function CheckBridgeFormula(policy: Policy, _vehicleConfiguration
70
70
  * @example
71
71
  * // For a vehicle with 2 axle units
72
72
  * const results = CheckNumTiresPerAxle(policy, ['TRKTRAC'], [
73
- * { numberOfAxles: 2, numberOfTires: 4 }, // 2 axles × 2 tires = 4 (valid)
74
- * { numberOfAxles: 3, numberOfTires: 12 } // 3 axles × 4 tires = 12 (valid)
73
+ * { numberOfAxles: 2, numberOfTires: 4 }, // tandem steer: 4 (valid)
74
+ * { numberOfAxles: 3, numberOfTires: 12 } // tridem drive: 12 (valid)
75
75
  * ]);
76
76
  * // Returns pass results for both axle units
77
77
  *
78
78
  * @example
79
79
  * // Invalid tire count example
80
80
  * const results = CheckNumTiresPerAxle(policy, ['TRKTRAC'], [
81
- * { numberOfAxles: 2, numberOfTires: 6 } // 2 axles × 3 tires = 6 (invalid - not 2, 4, or 8 per axle)
81
+ * { numberOfAxles: 1, numberOfTires: 8 } // single drive: 8 (invalid)
82
82
  * ]);
83
83
  * // Returns fail result for the axle unit
84
84
  *
@@ -156,7 +156,7 @@ export declare function CheckPermittableWeight(policy: Policy, vehicleConfigurat
156
156
  * @example
157
157
  * // For a single steer, tridem drive configuration
158
158
  * const results = CheckMinSteerAxleWeight(policy, ['TRKTRAC'], [
159
- * { numberOfAxles: 1, axleUnitWeight: 8000 }, // Steer axle
159
+ * { numberOfAxles: 1, axleUnitWeight: 8000 }, // Single steer axle
160
160
  * { numberOfAxles: 3, axleUnitWeight: 30000 } // Tridem drive axle
161
161
  * ]);
162
162
  * // Returns pass if steer axle weight >= 27% of drive axle weight (8100 kgs)
@@ -165,6 +165,17 @@ export declare function CheckPermittableWeight(policy: Policy, vehicleConfigurat
165
165
  * @see AxleGroupPolicyCheckResult
166
166
  */
167
167
  export declare function CheckMinSteerAxleWeight(_policy: Policy, _vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
168
+ /**
169
+ * Validates minimum tandem steer axle weight requirements for tandem steer
170
+ * power units with tandem or tridem drive axle units. The tandem steer axle
171
+ * unit must carry at least 40% of the drive axle unit weight.
172
+ *
173
+ * @param _policy - The policy instance (unused in this check, but required by PolicyCheck type)
174
+ * @param _vehicleConfiguration - Vehicle configuration (unused in this check, but required by PolicyCheck type)
175
+ * @param axleConfiguration - Array of axle configurations containing weight and axle count information
176
+ * @returns Array of AxleGroupPolicyCheckResult objects with validation results
177
+ */
178
+ export declare function CheckMinTandemSteerAxleWeight(_policy: Policy, _vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
168
179
  /**
169
180
  * Validates minimum drive axle weight requirements for tandem and tridem drive power units.
170
181
  *
@@ -284,6 +295,7 @@ export declare function CheckDriveJeepLoadEqualization(_policy: Policy, vehicleC
284
295
  * - MaxTireLoad: Validates tire load capacity for each axle unit
285
296
  * - MinDriveAxleWeight: Validates minimum weight requirements for drive axles
286
297
  * - MinSteerAxleWeight: Validates minimum weight requirements for steer axles
298
+ * - MinTandemSteerAxleWeight: Validates tandem steer minimum weight requirements
287
299
  * - NumberOfAxles: Validates axle count per axle unit
288
300
  * - NumberOfWheelsPerAxle: Validates tire count per axle unit
289
301
  * - BoosterAxleLimit: Validates booster axle count against the preceding trailer
@@ -6,6 +6,7 @@ exports.CheckBridgeFormula = CheckBridgeFormula;
6
6
  exports.CheckNumTiresPerAxle = CheckNumTiresPerAxle;
7
7
  exports.CheckPermittableWeight = CheckPermittableWeight;
8
8
  exports.CheckMinSteerAxleWeight = CheckMinSteerAxleWeight;
9
+ exports.CheckMinTandemSteerAxleWeight = CheckMinTandemSteerAxleWeight;
9
10
  exports.CheckMinDriveAxleWeight = CheckMinDriveAxleWeight;
10
11
  exports.CheckMaxTireLoad = CheckMaxTireLoad;
11
12
  exports.CheckBoosterAxleLimit = CheckBoosterAxleLimit;
@@ -13,6 +14,9 @@ exports.CheckTruckTractorWheelbase = CheckTruckTractorWheelbase;
13
14
  exports.CheckDriveJeepLoadEqualization = CheckDriveJeepLoadEqualization;
14
15
  const dimensions_helper_1 = require("./dimensions.helper");
15
16
  const enum_1 = require("../enum");
17
+ function meetsMinimumSteerPercentageOfDriveAxleWeight(steerAxle, driveAxle, minimumPercentage) {
18
+ return (steerAxle.axleUnitWeight >= driveAxle.axleUnitWeight * minimumPercentage);
19
+ }
16
20
  /**
17
21
  * Validates the number of axles in each axle unit.
18
22
  *
@@ -100,9 +104,9 @@ function CheckBridgeFormula(policy, _vehicleConfiguration, axleConfiguration) {
100
104
  * Validates the number of tires per axle unit against regulatory requirements.
101
105
  *
102
106
  * This function checks that each axle unit has a valid number of tires based on
103
- * the number of axles in that unit. The validation allows for 2, 4, or 8 tires
104
- * per axle (2, 4, or 8 * number of axles). This ensures compliance with tire
105
- * count regulations for commercial vehicles.
107
+ * the number of axles in that unit and the axle unit position. Axle unit 1 is
108
+ * the steer axle unit, axle unit 2 is the drive axle unit, and axle units 3+
109
+ * use the generic axle unit allowance.
106
110
  *
107
111
  * @param _policy - The policy instance (unused in this check, but required by PolicyCheck type)
108
112
  * @param _vehicleConfiguration - Vehicle configuration (unused in this check, but required by PolicyCheck type)
@@ -112,15 +116,15 @@ function CheckBridgeFormula(policy, _vehicleConfiguration, axleConfiguration) {
112
116
  * @example
113
117
  * // For a vehicle with 2 axle units
114
118
  * const results = CheckNumTiresPerAxle(policy, ['TRKTRAC'], [
115
- * { numberOfAxles: 2, numberOfTires: 4 }, // 2 axles × 2 tires = 4 (valid)
116
- * { numberOfAxles: 3, numberOfTires: 12 } // 3 axles × 4 tires = 12 (valid)
119
+ * { numberOfAxles: 2, numberOfTires: 4 }, // tandem steer: 4 (valid)
120
+ * { numberOfAxles: 3, numberOfTires: 12 } // tridem drive: 12 (valid)
117
121
  * ]);
118
122
  * // Returns pass results for both axle units
119
123
  *
120
124
  * @example
121
125
  * // Invalid tire count example
122
126
  * const results = CheckNumTiresPerAxle(policy, ['TRKTRAC'], [
123
- * { numberOfAxles: 2, numberOfTires: 6 } // 2 axles × 3 tires = 6 (invalid - not 2, 4, or 8 per axle)
127
+ * { numberOfAxles: 1, numberOfTires: 8 } // single drive: 8 (invalid)
124
128
  * ]);
125
129
  * // Returns fail result for the axle unit
126
130
  *
@@ -143,7 +147,10 @@ function CheckNumTiresPerAxle(_policy, _vehicleConfiguration, axleConfiguration)
143
147
  message = `Number of axles for axle unit ${axleNum} is not permittable.`;
144
148
  }
145
149
  else {
146
- const checkResult = [numAxles * 2, numAxles * 4, numAxles * 8].includes(numTires);
150
+ const multipliers = axleNum === 1 ? [2] : axleNum === 2 ? [2, 4] : [2, 4, 8];
151
+ const checkResult = multipliers
152
+ .map((multiplier) => numAxles * multiplier)
153
+ .includes(numTires);
147
154
  message = checkResult
148
155
  ? `No. of Wheels for Axle Unit ${axleNum} is permittable.`
149
156
  : `No. of Wheels for Axle Unit ${axleNum} is not permittable.`;
@@ -300,7 +307,7 @@ function CheckPermittableWeight(policy, vehicleConfiguration, axleConfiguration)
300
307
  * @example
301
308
  * // For a single steer, tridem drive configuration
302
309
  * const results = CheckMinSteerAxleWeight(policy, ['TRKTRAC'], [
303
- * { numberOfAxles: 1, axleUnitWeight: 8000 }, // Steer axle
310
+ * { numberOfAxles: 1, axleUnitWeight: 8000 }, // Single steer axle
304
311
  * { numberOfAxles: 3, axleUnitWeight: 30000 } // Tridem drive axle
305
312
  * ]);
306
313
  * // Returns pass if steer axle weight >= 27% of drive axle weight (8100 kgs)
@@ -315,14 +322,13 @@ function CheckMinSteerAxleWeight(_policy, _vehicleConfiguration, axleConfigurati
315
322
  if (axleConfiguration[0].numberOfAxles === 1 &&
316
323
  axleConfiguration[1].numberOfAxles === 3) {
317
324
  // Check minimum load on steer axle
318
- if (axleConfiguration[0].axleUnitWeight >=
319
- axleConfiguration[1].axleUnitWeight * 0.27) {
320
- message = 'Steer axle meets minimum weight requirements';
325
+ if (meetsMinimumSteerPercentageOfDriveAxleWeight(axleConfiguration[0], axleConfiguration[1], 0.27)) {
326
+ message = 'Single steer axle meets minimum weight requirements';
321
327
  result = enum_1.PolicyCheckResultType.Pass;
322
328
  }
323
329
  else {
324
330
  message =
325
- 'Steer axle must be a minimum of 27% of tridem drive axle weight';
331
+ 'Single steer axle must be a minimum of 27% of tridem drive axle weight';
326
332
  result = enum_1.PolicyCheckResultType.Fail;
327
333
  }
328
334
  }
@@ -340,6 +346,47 @@ function CheckMinSteerAxleWeight(_policy, _vehicleConfiguration, axleConfigurati
340
346
  });
341
347
  return policyCheckResults;
342
348
  }
349
+ /**
350
+ * Validates minimum tandem steer axle weight requirements for tandem steer
351
+ * power units with tandem or tridem drive axle units. The tandem steer axle
352
+ * unit must carry at least 40% of the drive axle unit weight.
353
+ *
354
+ * @param _policy - The policy instance (unused in this check, but required by PolicyCheck type)
355
+ * @param _vehicleConfiguration - Vehicle configuration (unused in this check, but required by PolicyCheck type)
356
+ * @param axleConfiguration - Array of axle configurations containing weight and axle count information
357
+ * @returns Array of AxleGroupPolicyCheckResult objects with validation results
358
+ */
359
+ function CheckMinTandemSteerAxleWeight(_policy, _vehicleConfiguration, axleConfiguration) {
360
+ const policyCheckResults = new Array();
361
+ const policyId = enum_1.PolicyCheckId.MinTandemSteerAxleWeight;
362
+ const steerAxle = axleConfiguration[0];
363
+ const driveAxle = axleConfiguration[1];
364
+ let message, result;
365
+ if (steerAxle.numberOfAxles === 2 &&
366
+ (driveAxle.numberOfAxles === 2 || driveAxle.numberOfAxles === 3)) {
367
+ if (meetsMinimumSteerPercentageOfDriveAxleWeight(steerAxle, driveAxle, 0.4)) {
368
+ message = 'Tandem steer axle meets minimum weight requirements';
369
+ result = enum_1.PolicyCheckResultType.Pass;
370
+ }
371
+ else {
372
+ message =
373
+ 'Tandem steer axle must be a minimum of 40% of drive axle weight';
374
+ result = enum_1.PolicyCheckResultType.Fail;
375
+ }
376
+ }
377
+ else {
378
+ message = 'Policy check does not apply to this configuration';
379
+ result = enum_1.PolicyCheckResultType.Pass;
380
+ }
381
+ policyCheckResults.push({
382
+ id: policyId,
383
+ message: message,
384
+ result: result,
385
+ startAxleUnit: 1,
386
+ endAxleUnit: 2,
387
+ });
388
+ return policyCheckResults;
389
+ }
343
390
  /**
344
391
  * Validates minimum drive axle weight requirements for tandem and tridem drive power units.
345
392
  *
@@ -760,6 +807,7 @@ function CheckDriveJeepLoadEqualization(_policy, vehicleConfiguration, axleConfi
760
807
  * - MaxTireLoad: Validates tire load capacity for each axle unit
761
808
  * - MinDriveAxleWeight: Validates minimum weight requirements for drive axles
762
809
  * - MinSteerAxleWeight: Validates minimum weight requirements for steer axles
810
+ * - MinTandemSteerAxleWeight: Validates tandem steer minimum weight requirements
763
811
  * - NumberOfAxles: Validates axle count per axle unit
764
812
  * - NumberOfWheelsPerAxle: Validates tire count per axle unit
765
813
  * - BoosterAxleLimit: Validates booster axle count against the preceding trailer
@@ -777,6 +825,7 @@ exports.policyCheckMap = new Map([
777
825
  [enum_1.PolicyCheckId.MaxTireLoad, CheckMaxTireLoad],
778
826
  [enum_1.PolicyCheckId.MinDriveAxleWeight, CheckMinDriveAxleWeight],
779
827
  [enum_1.PolicyCheckId.MinSteerAxleWeight, CheckMinSteerAxleWeight],
828
+ [enum_1.PolicyCheckId.MinTandemSteerAxleWeight, CheckMinTandemSteerAxleWeight],
780
829
  [enum_1.PolicyCheckId.NumberOfWheelsPerAxle, CheckNumTiresPerAxle],
781
830
  [enum_1.PolicyCheckId.BoosterAxleLimit, CheckBoosterAxleLimit],
782
831
  [enum_1.PolicyCheckId.TruckTractorWheelbase, CheckTruckTractorWheelbase],
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "v2.13.0";
1
+ export declare const version = "v2.15.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.13.0';
5
+ exports.version = 'v2.15.0';
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  ],
92
92
  "testEnvironment": "node"
93
93
  },
94
- "version": "v2.13.0"
94
+ "version": "v2.15.0"
95
95
  }