onroute-policy-engine 2.12.0 → 2.13.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.
@@ -235,7 +235,7 @@ export declare function CheckMinDriveAxleWeight(_policy: Policy, _vehicleConfigu
235
235
  * @see AxleGroupPolicyCheckResult
236
236
  * @see AxleConfiguration
237
237
  */
238
- export declare function CheckMaxTireLoad(_policy: Policy, _vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
238
+ export declare function CheckMaxTireLoad(_policy: Policy, _vehicleConfiguration: string[], axleConfiguration: AxleConfiguration[]): PolicyCheckResult[];
239
239
  /**
240
240
  * Validates that each booster has no more axles than the trailer it follows.
241
241
  *
@@ -449,85 +449,137 @@ function CheckMinDriveAxleWeight(_policy, _vehicleConfiguration, axleConfigurati
449
449
  function CheckMaxTireLoad(_policy, _vehicleConfiguration, axleConfiguration) {
450
450
  const policyCheckResults = new Array();
451
451
  const policyId = enum_1.PolicyCheckId.MaxTireLoad;
452
- // Steer axle tire load check
453
- const steerTireSize = axleConfiguration[0].tireSize;
454
- if (!steerTireSize) {
452
+ const powerUnitType = _vehicleConfiguration[0];
453
+ const isRubberTiredLoader = powerUnitType === 'RBTRLDR';
454
+ const isAllTerrainCrane = powerUnitType === 'CRANEAT';
455
+ const isMobileCrane = powerUnitType === 'CRANEMB';
456
+ const addFailResult = (axleUnit) => {
455
457
  policyCheckResults.push({
456
458
  id: policyId,
457
459
  result: enum_1.PolicyCheckResultType.Fail,
458
- message: `Steer axle tire size is invalid`,
459
- axleUnit: 1,
460
+ message: `Tire Size for Axle Unit ${axleUnit} exceeds its load capacity.`,
461
+ axleUnit,
460
462
  });
461
- }
462
- else if (steerTireSize > 455) {
463
- policyCheckResults.push({
464
- id: policyId,
465
- result: enum_1.PolicyCheckResultType.Fail,
466
- message: `Steer axle tire size must not exceed 455mm`,
467
- axleUnit: 1,
468
- });
469
- }
470
- else if (steerTireSize >= 445) {
471
- if (axleConfiguration[0].axleUnitWeight > 9100) {
472
- policyCheckResults.push({
473
- id: policyId,
474
- result: enum_1.PolicyCheckResultType.Fail,
475
- message: `Steer axle weight exceeds maximum of 9100kg for ${steerTireSize}mm tire size`,
476
- axleUnit: 1,
477
- });
478
- }
479
- }
480
- else {
481
- const maxWeightOnSteerAxle = (axleConfiguration[0].numberOfTires || 0) * (steerTireSize * 10);
482
- if (axleConfiguration[0].axleUnitWeight > maxWeightOnSteerAxle) {
483
- policyCheckResults.push({
484
- id: policyId,
485
- result: enum_1.PolicyCheckResultType.Fail,
486
- message: `Steer axle weight exceeds maximum of ${maxWeightOnSteerAxle}kg for ${steerTireSize}mm tire size`,
487
- axleUnit: 1,
488
- });
489
- }
490
- }
491
- // Non-steer axle tire load checks
492
- axleConfiguration.slice(1).forEach((a, i) => {
493
- const tireSize = a.tireSize;
494
- const numberOfTires = a.numberOfTires;
495
- const axleUnitNum = i + 2;
496
- let maxWeight = 0;
463
+ };
464
+ /**
465
+ * Both the kg/cm rate and the explicit axle cap apply for all axle types.
466
+ * The lower of the two is the binding limit:
467
+ * maxAllowedWeight = min((tireSize / 10) * rateKgPerCm * numberOfTires, capWeight)
468
+ *
469
+ * When capWeight is omitted, only the rate applies.
470
+ */
471
+ const exceedsRateOrCapLimit = (axleWeight, tireSize, numberOfTires, rateKgPerCm, capWeight) => {
472
+ const rateLimitWeight = (tireSize / 10) * rateKgPerCm * numberOfTires;
473
+ const maxAllowedWeight = capWeight !== undefined
474
+ ? Math.min(rateLimitWeight, capWeight)
475
+ : rateLimitWeight;
476
+ return axleWeight > maxAllowedWeight;
477
+ };
478
+ axleConfiguration.forEach((ac, index) => {
479
+ var _a, _b;
480
+ const axleUnit = index + 1;
481
+ const tireSize = ac.tireSize;
482
+ const numberOfTires = (_a = ac.numberOfTires) !== null && _a !== void 0 ? _a : 0;
483
+ const axleWeight = (_b = ac.axleUnitWeight) !== null && _b !== void 0 ? _b : 0;
497
484
  if (!tireSize) {
498
- policyCheckResults.push({
499
- id: policyId,
500
- result: enum_1.PolicyCheckResultType.Fail,
501
- message: `Axle unit ${axleUnitNum} tire size is invalid`,
502
- axleUnit: axleUnitNum,
503
- });
485
+ addFailResult(axleUnit);
486
+ return;
504
487
  }
505
- else if (!numberOfTires) {
506
- policyCheckResults.push({
507
- id: policyId,
508
- result: enum_1.PolicyCheckResultType.Fail,
509
- message: `Axle unit ${axleUnitNum} number of wheels is invalid`,
510
- axleUnit: axleUnitNum,
511
- });
488
+ if (!numberOfTires) {
489
+ addFailResult(axleUnit);
490
+ return;
512
491
  }
513
- else {
514
- if (tireSize >= 445) {
515
- maxWeight = numberOfTires * 3850;
492
+ const isSteeringAxle = index === 0;
493
+ /**
494
+ * Rubber Tired Loader
495
+ *
496
+ * All axle units — rate 110 kg/cm; lower of rate or cap is binding:
497
+ * >=600 mm => min(110 kg/cm rate, 12,000 kg/axle)
498
+ * >=520 mm => min(110 kg/cm rate, 11,000 kg/axle)
499
+ *
500
+ * For RTL the 110 kg/cm rate always yields more than the cap at these
501
+ * tire sizes (e.g. 520mm * 110 * 2 = 11,440 > 11,000), so the cap
502
+ * will always be the binding constraint in practice.
503
+ */
504
+ if (isRubberTiredLoader) {
505
+ if (tireSize >= 600) {
506
+ if (exceedsRateOrCapLimit(axleWeight, tireSize, numberOfTires, 110, 12000)) {
507
+ addFailResult(axleUnit);
508
+ }
516
509
  }
517
- else if (tireSize > 300) {
518
- maxWeight = numberOfTires * 3000;
510
+ else if (tireSize >= 520) {
511
+ if (exceedsRateOrCapLimit(axleWeight, tireSize, numberOfTires, 110, 11000)) {
512
+ addFailResult(axleUnit);
513
+ }
519
514
  }
520
- else {
521
- maxWeight = numberOfTires * tireSize * 10;
515
+ return;
516
+ }
517
+ /**
518
+ * Crane - All Terrain
519
+ *
520
+ * All axle units — rate 100 kg/cm; lower of rate or cap is binding:
521
+ * >=520 mm => min(100 kg/cm rate, 11,000 kg/axle)
522
+ *
523
+ * For tires where the rate yields less than the cap
524
+ * (e.g. 520mm * 100 * 2 = 10,400 < 11,000), the rate is binding.
525
+ * For tires where the rate yields more than the cap
526
+ * (e.g. 609mm * 100 * 2 = 12,180 > 11,000), the cap is binding.
527
+ */
528
+ if (isAllTerrainCrane) {
529
+ if (tireSize >= 520) {
530
+ if (exceedsRateOrCapLimit(axleWeight, tireSize, numberOfTires, 100, 11000)) {
531
+ addFailResult(axleUnit);
532
+ }
522
533
  }
523
- if (a.axleUnitWeight > maxWeight) {
524
- policyCheckResults.push({
525
- id: policyId,
526
- result: enum_1.PolicyCheckResultType.Fail,
527
- message: `Axle unit ${axleUnitNum} weight exceeds maximum of ${maxWeight}kg for ${numberOfTires} ${tireSize}mm tires`,
528
- axleUnit: axleUnitNum,
529
- });
534
+ return;
535
+ }
536
+ /**
537
+ * Mobile Crane
538
+ *
539
+ * Non-steering axle units only — rate 100 kg/cm; lower of rate or cap is binding:
540
+ * >=520 mm => min(100 kg/cm rate, 11,000 kg/axle)
541
+ *
542
+ * Same rate/cap interaction as Crane - All Terrain above.
543
+ * Steering axle falls through to the standard steer axle rules below.
544
+ */
545
+ if (isMobileCrane && !isSteeringAxle) {
546
+ if (tireSize >= 520) {
547
+ if (exceedsRateOrCapLimit(axleWeight, tireSize, numberOfTires, 100, 11000)) {
548
+ addFailResult(axleUnit);
549
+ }
530
550
  }
551
+ return;
552
+ }
553
+ /**
554
+ * Steer axle — all vehicles except Crane - All Terrain, Mobile Crane
555
+ * (steering), Rubber Tired Loader
556
+ *
557
+ * Rate 100 kg/cm; lower of rate or cap is binding:
558
+ * <445 mm => rate only (no cap)
559
+ * >=445 mm => min(100 kg/cm rate, 9,100 kg/axle)
560
+ *
561
+ * e.g. 445mm * 2 tires => min(8,900, 9,100) = 8,900 kg <- rate binding
562
+ * e.g. 457mm * 2 tires => min(9,140, 9,100) = 9,100 kg <- cap binding
563
+ */
564
+ if (isSteeringAxle) {
565
+ const capWeight = tireSize >= 445 ? 9100 : undefined;
566
+ if (exceedsRateOrCapLimit(axleWeight, tireSize, numberOfTires, 100, capWeight)) {
567
+ addFailResult(axleUnit);
568
+ }
569
+ return;
570
+ }
571
+ /**
572
+ * Standard non-steering axle — all vehicles except Crane - All Terrain,
573
+ * Mobile Crane (non-steering), Rubber Tired Loader
574
+ *
575
+ * Rate 100 kg/cm; lower of rate or per-tire cap is binding:
576
+ * >=445 mm => min(100 kg/cm rate, 4,550 kg/tire * numberOfTires)
577
+ * <=444 mm => min(100 kg/cm rate, 3,000 kg/tire * numberOfTires)
578
+ */
579
+ const perTireCap = tireSize >= 445 ? 4550 : 3000;
580
+ const axleCap = perTireCap * numberOfTires;
581
+ if (exceedsRateOrCapLimit(axleWeight, tireSize, numberOfTires, 100, axleCap)) {
582
+ addFailResult(axleUnit);
531
583
  }
532
584
  });
533
585
  if (policyCheckResults.length === 0) {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "v2.12.0";
1
+ export declare const version = "v2.13.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.12.0';
5
+ exports.version = 'v2.13.0';
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  ],
92
92
  "testEnvironment": "node"
93
93
  },
94
- "version": "v2.12.0"
94
+ "version": "v2.13.0"
95
95
  }