onroute-policy-engine 2.30.0 → 2.31.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.
@@ -17,6 +17,7 @@ export declare enum CostFacts {
17
17
  CostPerKilometre = "costPerKilometre",
18
18
  CostPerMonth = "costPerMonth",
19
19
  FixedCost = "fixedCost",
20
+ OverloadAxleCost = "overloadAxleCost",
20
21
  OverloadGvwCost = "overloadGvwCost",
21
22
  OverloadWeightCost = "overloadWeightCost",
22
23
  RangeMatrixCostLookup = "rangeMatrixCostLookup"
@@ -22,6 +22,7 @@ var CostFacts;
22
22
  CostFacts["CostPerKilometre"] = "costPerKilometre";
23
23
  CostFacts["CostPerMonth"] = "costPerMonth";
24
24
  CostFacts["FixedCost"] = "fixedCost";
25
+ CostFacts["OverloadAxleCost"] = "overloadAxleCost";
25
26
  CostFacts["OverloadGvwCost"] = "overloadGvwCost";
26
27
  CostFacts["OverloadWeightCost"] = "overloadWeightCost";
27
28
  CostFacts["RangeMatrixCostLookup"] = "rangeMatrixCostLookup";
@@ -339,6 +339,17 @@ function addRuntimeFacts(engine, policy) {
339
339
  }
340
340
  return getOverloadCost(overloadKg, distance);
341
341
  });
342
+ /**
343
+ * Calculate the STOW fee from the same selected overload used by OCD.
344
+ */
345
+ engine.addFact(enum_1.CostFacts.OverloadAxleCost.toString(), async function (params, almanac) {
346
+ const axleResults = await almanac.factValue(stgvwi_1.AXLE_CALC_RESULTS_FACT);
347
+ const totalDistance = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.TotalDistance);
348
+ if (!totalDistance) {
349
+ return 0;
350
+ }
351
+ return getOverloadCost(axleResults.overload, totalDistance);
352
+ });
342
353
  /**
343
354
  * Add runtime fact to calculate the overload fee for STWSE permits
344
355
  * based on the Weight over 27.5m and Total Distance.
@@ -1105,8 +1105,8 @@ function CheckWheelbaseLegalLimits(_policy, vehicleConfiguration, axleConfigurat
1105
1105
  Object.assign(Object.assign({}, resultBase), { result: hasDisallowedTrailer
1106
1106
  ? enum_1.PolicyCheckResultType.Fail
1107
1107
  : enum_1.PolicyCheckResultType.Warning, message: hasTrailer && !hasDisallowedTrailer
1108
- ? '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.'
1109
- : 'Wheelbase for Axle Unit 1 and Axle Unit 2 is between 6.2m and 7.2m. See CTPM 5.3.7.A.' }),
1108
+ ? `Wheelbase for Axle Unit ${resultBase.startAxleUnit} and Axle Unit ${resultBase.endAxleUnit} is between 6.2m and 7.2m. Semi-Trailer wheelbase must be within dimensions table found in CTPM 5.3.7.A.`
1109
+ : `Wheelbase for Axle Unit ${resultBase.startAxleUnit} and Axle Unit ${resultBase.endAxleUnit} is between 6.2m and 7.2m. See CTPM 5.3.7.A.` }),
1110
1110
  ];
1111
1111
  }
1112
1112
  return [
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "v2.30.0";
1
+ export declare const version = "v2.31.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.30.0';
5
+ exports.version = 'v2.31.0';
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  ],
92
92
  "testEnvironment": "node"
93
93
  },
94
- "version": "v2.30.0"
94
+ "version": "v2.31.0"
95
95
  }