onroute-policy-engine 2.18.0 → 2.19.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.
- package/dist/enum/policy-check.d.ts +1 -0
- package/dist/enum/policy-check.js +1 -0
- package/dist/helper/ctr-717.helper.d.ts +2 -0
- package/dist/helper/ctr-717.helper.js +33 -0
- package/dist/helper/policy-check.helper.d.ts +8 -0
- package/dist/helper/policy-check.helper.js +122 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ export declare enum PolicyCheckResultType {
|
|
|
3
3
|
Fail = "fail"
|
|
4
4
|
}
|
|
5
5
|
export declare enum PolicyCheckId {
|
|
6
|
+
AxleGroupMaximumLegalWeightThreshold = "axle-group-maximum-legal-weight-threshold",
|
|
6
7
|
BoosterAxleLimit = "booster-axle-limit",
|
|
7
8
|
BridgeFormula = "bridge-formula",
|
|
8
9
|
CheckPermittableWeight = "check-permittable-weight",
|
|
@@ -8,6 +8,7 @@ var PolicyCheckResultType;
|
|
|
8
8
|
})(PolicyCheckResultType || (exports.PolicyCheckResultType = PolicyCheckResultType = {}));
|
|
9
9
|
var PolicyCheckId;
|
|
10
10
|
(function (PolicyCheckId) {
|
|
11
|
+
PolicyCheckId["AxleGroupMaximumLegalWeightThreshold"] = "axle-group-maximum-legal-weight-threshold";
|
|
11
12
|
PolicyCheckId["BoosterAxleLimit"] = "booster-axle-limit";
|
|
12
13
|
PolicyCheckId["BridgeFormula"] = "bridge-formula";
|
|
13
14
|
PolicyCheckId["CheckPermittableWeight"] = "check-permittable-weight";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCtr717TableValue = getCtr717TableValue;
|
|
4
|
+
const CTR_717_WEIGHT_BANDS = [
|
|
5
|
+
{ minimumSpreadCm: 800, maximumWeightKg: 34000 },
|
|
6
|
+
{ minimumSpreadCm: 760, maximumWeightKg: 33000 },
|
|
7
|
+
{ minimumSpreadCm: 720, maximumWeightKg: 32000 },
|
|
8
|
+
{ minimumSpreadCm: 690, maximumWeightKg: 31000 },
|
|
9
|
+
{ minimumSpreadCm: 650, maximumWeightKg: 30000 },
|
|
10
|
+
{ minimumSpreadCm: 610, maximumWeightKg: 29000 },
|
|
11
|
+
{ minimumSpreadCm: 570, maximumWeightKg: 28000 },
|
|
12
|
+
{ minimumSpreadCm: 530, maximumWeightKg: 27000 },
|
|
13
|
+
{ minimumSpreadCm: 500, maximumWeightKg: 26000 },
|
|
14
|
+
{ minimumSpreadCm: 460, maximumWeightKg: 25000 },
|
|
15
|
+
{ minimumSpreadCm: 420, maximumWeightKg: 24000 },
|
|
16
|
+
{ minimumSpreadCm: 380, maximumWeightKg: 23000 },
|
|
17
|
+
{ minimumSpreadCm: 340, maximumWeightKg: 22000 },
|
|
18
|
+
{ minimumSpreadCm: 300, maximumWeightKg: 21000 },
|
|
19
|
+
{ minimumSpreadCm: 260, maximumWeightKg: 20000 },
|
|
20
|
+
{ minimumSpreadCm: 230, maximumWeightKg: 19000 },
|
|
21
|
+
{ minimumSpreadCm: 190, maximumWeightKg: 18000 },
|
|
22
|
+
{ minimumSpreadCm: 120, maximumWeightKg: 17000 },
|
|
23
|
+
{ minimumSpreadCm: 100, maximumWeightKg: 16500 },
|
|
24
|
+
{ minimumSpreadCm: 0, maximumWeightKg: 9100 },
|
|
25
|
+
];
|
|
26
|
+
/** Returns the authoritative CTR 7.17 table value for a spread in centimetres. */
|
|
27
|
+
function getCtr717TableValue(spreadCm) {
|
|
28
|
+
var _a;
|
|
29
|
+
if (!Number.isFinite(spreadCm) || spreadCm < 0) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
return (_a = CTR_717_WEIGHT_BANDS.find(({ minimumSpreadCm }) => spreadCm >= minimumSpreadCm)) === null || _a === void 0 ? void 0 : _a.maximumWeightKg;
|
|
33
|
+
}
|
|
@@ -14,6 +14,13 @@ import { Policy } from 'onroute-policy-engine';
|
|
|
14
14
|
* @returns Array of PolicyCheckResult objects representing the outcomes of the policy check
|
|
15
15
|
*/
|
|
16
16
|
type PolicyCheck = (policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>) => Array<PolicyCheckResult>;
|
|
17
|
+
/** Applies the standard lower-of rule or the exact 7.16(g) exception. */
|
|
18
|
+
export declare function getMaximumLegalAxleGroupWeightThreshold(individualLegalWeightSum: number, ctr717TableValue: number, isTandemDriveSingleJeepException: boolean): number;
|
|
19
|
+
/**
|
|
20
|
+
* Validates every contiguous axle-unit group within 8 m, excluding groups
|
|
21
|
+
* beginning at axle unit 1, against the CTR 7.17 maximum legal weight.
|
|
22
|
+
*/
|
|
23
|
+
export declare function CheckAxleGroupMaximumLegalWeightThreshold(policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<AxleGroupPolicyCheckResult>;
|
|
17
24
|
/**
|
|
18
25
|
* Validates the number of axles in each axle unit.
|
|
19
26
|
*
|
|
@@ -295,6 +302,7 @@ export declare function CheckDriveJeepLoadEqualization(_policy: Policy, vehicleC
|
|
|
295
302
|
* this map with additional entries.
|
|
296
303
|
*
|
|
297
304
|
* Currently includes:
|
|
305
|
+
* - AxleGroupMaximumLegalWeightThreshold: Validates axle groups within 8 m against CTR 7.17
|
|
298
306
|
* - BridgeFormula: Validates axle groups against bridge formula requirements
|
|
299
307
|
* - CheckPermittableWeight: Validates total vehicle weight against permit limits
|
|
300
308
|
* - MaxTireLoad: Validates tire load capacity for each axle unit
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.policyCheckMap = void 0;
|
|
4
|
+
exports.getMaximumLegalAxleGroupWeightThreshold = getMaximumLegalAxleGroupWeightThreshold;
|
|
5
|
+
exports.CheckAxleGroupMaximumLegalWeightThreshold = CheckAxleGroupMaximumLegalWeightThreshold;
|
|
4
6
|
exports.CheckNumberOfAxles = CheckNumberOfAxles;
|
|
5
7
|
exports.CheckBridgeFormula = CheckBridgeFormula;
|
|
6
8
|
exports.CheckNumTiresPerAxle = CheckNumTiresPerAxle;
|
|
@@ -14,7 +16,120 @@ exports.CheckBoosterAxleLimit = CheckBoosterAxleLimit;
|
|
|
14
16
|
exports.CheckTruckTractorWheelbase = CheckTruckTractorWheelbase;
|
|
15
17
|
exports.CheckDriveJeepLoadEqualization = CheckDriveJeepLoadEqualization;
|
|
16
18
|
const dimensions_helper_1 = require("./dimensions.helper");
|
|
19
|
+
const ctr_717_helper_1 = require("./ctr-717.helper");
|
|
17
20
|
const enum_1 = require("../enum");
|
|
21
|
+
/** Applies the standard lower-of rule or the exact 7.16(g) exception. */
|
|
22
|
+
function getMaximumLegalAxleGroupWeightThreshold(individualLegalWeightSum, ctr717TableValue, isTandemDriveSingleJeepException) {
|
|
23
|
+
const tandemDriveSingleJeepMinimumKg = 24000;
|
|
24
|
+
return isTandemDriveSingleJeepException
|
|
25
|
+
? Math.max(tandemDriveSingleJeepMinimumKg, ctr717TableValue)
|
|
26
|
+
: Math.min(individualLegalWeightSum, ctr717TableValue);
|
|
27
|
+
}
|
|
28
|
+
function getApplicableLegalWeightThreshold(policy, vehicleConfiguration, axleConfiguration, axleUnitVehicleIndexes, axleIndex) {
|
|
29
|
+
var _a;
|
|
30
|
+
const vehicleIndex = axleUnitVehicleIndexes[axleIndex];
|
|
31
|
+
const vehicleType = vehicleConfiguration[vehicleIndex];
|
|
32
|
+
const axle = axleConfiguration[axleIndex];
|
|
33
|
+
if (!vehicleType || !axle) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const weights = vehicleIndex === 0
|
|
37
|
+
? policy.getDefaultPowerUnitWeight(vehicleType, axleConfiguration[0].numberOfAxles * 10 +
|
|
38
|
+
axleConfiguration[1].numberOfAxles)
|
|
39
|
+
: policy.getDefaultTrailerWeight(vehicleType, axle.numberOfAxles);
|
|
40
|
+
if (weights.length === 0) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return (_a = policy.selectCorrectWeightDimension(weights, vehicleConfiguration, axleConfiguration, axleIndex)) === null || _a === void 0 ? void 0 : _a.legal;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Validates every contiguous axle-unit group within 8 m, excluding groups
|
|
47
|
+
* beginning at axle unit 1, against the CTR 7.17 maximum legal weight.
|
|
48
|
+
*/
|
|
49
|
+
function CheckAxleGroupMaximumLegalWeightThreshold(policy, vehicleConfiguration, axleConfiguration) {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
const ctr717MaxSpreadCm = 800;
|
|
52
|
+
const policyCheckResults = new Array();
|
|
53
|
+
const policyId = enum_1.PolicyCheckId.AxleGroupMaximumLegalWeightThreshold;
|
|
54
|
+
if (axleConfiguration.length < 3) {
|
|
55
|
+
return policyCheckResults;
|
|
56
|
+
}
|
|
57
|
+
const hasVehicleIndexes = axleConfiguration.some((axleUnit) => axleUnit.vehicleIndex !== undefined);
|
|
58
|
+
const axleUnitVehicleIndexes = hasVehicleIndexes
|
|
59
|
+
? (0, dimensions_helper_1.getAxleUnitVehicleIndexes)(policy, vehicleConfiguration, axleConfiguration)
|
|
60
|
+
: axleConfiguration.map((_, axleIndex) => axleIndex < 2 ? 0 : axleIndex - 1);
|
|
61
|
+
const legalWeightThresholds = axleConfiguration.map((_, axleIndex) => getApplicableLegalWeightThreshold(policy, vehicleConfiguration, axleConfiguration, axleUnitVehicleIndexes, axleIndex));
|
|
62
|
+
for (let startAxleIndex = 1; startAxleIndex < axleConfiguration.length - 1; startAxleIndex++) {
|
|
63
|
+
const firstAxle = axleConfiguration[startAxleIndex];
|
|
64
|
+
const firstAxleSpread = (_a = firstAxle.axleSpread) !== null && _a !== void 0 ? _a : 0;
|
|
65
|
+
let groupSpread = firstAxleSpread;
|
|
66
|
+
let actualWeight = firstAxle.axleUnitWeight;
|
|
67
|
+
let individualLegalWeightSum = legalWeightThresholds[startAxleIndex];
|
|
68
|
+
if (!Number.isFinite(firstAxleSpread) ||
|
|
69
|
+
firstAxleSpread < 0 ||
|
|
70
|
+
!Number.isFinite(actualWeight)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
for (let endAxleIndex = startAxleIndex + 1; endAxleIndex < axleConfiguration.length; endAxleIndex++) {
|
|
74
|
+
const endAxle = axleConfiguration[endAxleIndex];
|
|
75
|
+
const endAxleSpread = (_b = endAxle.axleSpread) !== null && _b !== void 0 ? _b : 0;
|
|
76
|
+
const interaxleSpacing = endAxle.interaxleSpacing;
|
|
77
|
+
const endAxleLegalWeight = legalWeightThresholds[endAxleIndex];
|
|
78
|
+
if (!Number.isFinite(interaxleSpacing) ||
|
|
79
|
+
interaxleSpacing <= 0 ||
|
|
80
|
+
!Number.isFinite(endAxleSpread) ||
|
|
81
|
+
endAxleSpread < 0 ||
|
|
82
|
+
!Number.isFinite(endAxle.axleUnitWeight)) {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
groupSpread += interaxleSpacing + endAxleSpread;
|
|
86
|
+
actualWeight += endAxle.axleUnitWeight;
|
|
87
|
+
if (individualLegalWeightSum === undefined ||
|
|
88
|
+
endAxleLegalWeight === undefined) {
|
|
89
|
+
individualLegalWeightSum = undefined;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
individualLegalWeightSum += endAxleLegalWeight;
|
|
93
|
+
}
|
|
94
|
+
if (groupSpread > ctr717MaxSpreadCm) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
const ctr717TableValue = (0, ctr_717_helper_1.getCtr717TableValue)(groupSpread);
|
|
98
|
+
const isTandemDriveSingleJeepException = startAxleIndex === 1 &&
|
|
99
|
+
endAxleIndex === 2 &&
|
|
100
|
+
vehicleConfiguration[0] === 'TRKTRAC' &&
|
|
101
|
+
vehicleConfiguration[1] === enum_1.AccessoryVehicleType.Jeep &&
|
|
102
|
+
axleUnitVehicleIndexes[1] === 0 &&
|
|
103
|
+
axleUnitVehicleIndexes[2] === 1 &&
|
|
104
|
+
axleConfiguration[1].numberOfAxles === 2 &&
|
|
105
|
+
axleConfiguration[2].numberOfAxles === 1;
|
|
106
|
+
if (ctr717TableValue === undefined ||
|
|
107
|
+
(!isTandemDriveSingleJeepException &&
|
|
108
|
+
individualLegalWeightSum === undefined)) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const thresholdWeight = getMaximumLegalAxleGroupWeightThreshold(individualLegalWeightSum !== null && individualLegalWeightSum !== void 0 ? individualLegalWeightSum : 0, ctr717TableValue, isTandemDriveSingleJeepException);
|
|
112
|
+
const passes = actualWeight <= thresholdWeight;
|
|
113
|
+
const startAxleUnit = startAxleIndex + 1;
|
|
114
|
+
const endAxleUnit = endAxleIndex + 1;
|
|
115
|
+
const overloadAmount = Math.max(0, actualWeight - thresholdWeight);
|
|
116
|
+
policyCheckResults.push({
|
|
117
|
+
id: policyId,
|
|
118
|
+
result: passes
|
|
119
|
+
? enum_1.PolicyCheckResultType.Pass
|
|
120
|
+
: enum_1.PolicyCheckResultType.Fail,
|
|
121
|
+
message: passes
|
|
122
|
+
? ''
|
|
123
|
+
: `Axle Group ${startAxleUnit} to ${endAxleUnit} exceeds the maximum legal weight threshold of ${thresholdWeight} kg by ${overloadAmount} kg.`,
|
|
124
|
+
startAxleUnit,
|
|
125
|
+
endAxleUnit,
|
|
126
|
+
actualWeight,
|
|
127
|
+
thresholdWeight,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return policyCheckResults;
|
|
132
|
+
}
|
|
18
133
|
function meetsMinimumSteerPercentageOfDriveAxleWeight(steerAxle, driveAxle, minimumPercentage) {
|
|
19
134
|
return (steerAxle.axleUnitWeight >= driveAxle.axleUnitWeight * minimumPercentage);
|
|
20
135
|
}
|
|
@@ -772,7 +887,8 @@ function CheckBoosterAxleLimit(_policy, vehicleConfiguration, axleConfiguration)
|
|
|
772
887
|
message: result
|
|
773
888
|
? ''
|
|
774
889
|
: `No. of Axles for Axle Unit ${boosterAxleUnit} must be less than or equal to No. of Axles for Axle Unit ${trailerAxleUnit}`,
|
|
775
|
-
startAxleUnit
|
|
890
|
+
// startAxleUnit and endAxleUnit should be the same for field highlighting purposes
|
|
891
|
+
startAxleUnit: boosterAxleUnit,
|
|
776
892
|
endAxleUnit: boosterAxleUnit,
|
|
777
893
|
});
|
|
778
894
|
return;
|
|
@@ -894,6 +1010,7 @@ function CheckDriveJeepLoadEqualization(_policy, vehicleConfiguration, axleConfi
|
|
|
894
1010
|
* this map with additional entries.
|
|
895
1011
|
*
|
|
896
1012
|
* Currently includes:
|
|
1013
|
+
* - AxleGroupMaximumLegalWeightThreshold: Validates axle groups within 8 m against CTR 7.17
|
|
897
1014
|
* - BridgeFormula: Validates axle groups against bridge formula requirements
|
|
898
1015
|
* - CheckPermittableWeight: Validates total vehicle weight against permit limits
|
|
899
1016
|
* - MaxTireLoad: Validates tire load capacity for each axle unit
|
|
@@ -914,6 +1031,10 @@ function CheckDriveJeepLoadEqualization(_policy, vehicleConfiguration, axleConfi
|
|
|
914
1031
|
exports.policyCheckMap = new Map([
|
|
915
1032
|
[enum_1.PolicyCheckId.NumberOfAxles, CheckNumberOfAxles],
|
|
916
1033
|
[enum_1.PolicyCheckId.BridgeFormula, CheckBridgeFormula],
|
|
1034
|
+
[
|
|
1035
|
+
enum_1.PolicyCheckId.AxleGroupMaximumLegalWeightThreshold,
|
|
1036
|
+
CheckAxleGroupMaximumLegalWeightThreshold,
|
|
1037
|
+
],
|
|
917
1038
|
[enum_1.PolicyCheckId.CheckPermittableWeight, CheckPermittableWeight],
|
|
918
1039
|
[enum_1.PolicyCheckId.MaxTireLoad, CheckMaxTireLoad],
|
|
919
1040
|
[enum_1.PolicyCheckId.MinDriveAxleWeight, CheckMinDriveAxleWeight],
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "v2.
|
|
1
|
+
export declare const version = "v2.19.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED