onroute-policy-engine 2.32.2 → 2.32.3
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/helper/policy-check.helper.js +24 -20
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -277,36 +277,37 @@ function CheckNumberOfAxles(_policy, _vehicleConfiguration, axleConfiguration) {
|
|
|
277
277
|
});
|
|
278
278
|
return policyCheckResults;
|
|
279
279
|
}
|
|
280
|
-
|
|
280
|
+
/**
|
|
281
|
+
* This function basically lets us skip Bridge Formula if we know it'll crash.
|
|
282
|
+
*
|
|
283
|
+
* This function is a 'necessary evil.' The Bridge Formula calculation is
|
|
284
|
+
* important legacy code, but with certain inputs it would throw an
|
|
285
|
+
* exception and crash the entire calculation, especially in the ASW table.
|
|
286
|
+
*
|
|
287
|
+
* These "crashing inputs" are always STOW eval errors, so even if we don't
|
|
288
|
+
* run bridge formula the user should be seeing seperate errors, so once they
|
|
289
|
+
* fix those errors then re-run it should include Bridge Formula.
|
|
290
|
+
*
|
|
291
|
+
*/
|
|
292
|
+
function hasInvalidBridgeFormulaInput(axleConfiguration) {
|
|
281
293
|
for (let axleIndex = 0; axleIndex < axleConfiguration.length; axleIndex++) {
|
|
282
294
|
const axleUnit = axleConfiguration[axleIndex];
|
|
283
|
-
const axleUnitNumber = axleIndex + 1;
|
|
284
|
-
let message;
|
|
285
295
|
if (!Number.isFinite(axleUnit.axleUnitWeight) ||
|
|
286
296
|
axleUnit.axleUnitWeight <= 0) {
|
|
287
|
-
|
|
297
|
+
return true;
|
|
288
298
|
}
|
|
289
299
|
else if (axleUnit.numberOfAxles > 1 &&
|
|
290
300
|
(!Number.isFinite(axleUnit.axleSpread) ||
|
|
291
301
|
axleUnit.axleSpread <= 0)) {
|
|
292
|
-
|
|
302
|
+
return true;
|
|
293
303
|
}
|
|
294
304
|
else if (axleIndex > 0 &&
|
|
295
305
|
(!Number.isFinite(axleUnit.interaxleSpacing) ||
|
|
296
306
|
axleUnit.interaxleSpacing <= 0)) {
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
if (message) {
|
|
300
|
-
return {
|
|
301
|
-
id: enum_1.PolicyCheckId.BridgeFormula,
|
|
302
|
-
message,
|
|
303
|
-
result: enum_1.PolicyCheckResultType.Fail,
|
|
304
|
-
startAxleUnit: axleUnitNumber,
|
|
305
|
-
endAxleUnit: axleUnitNumber,
|
|
306
|
-
};
|
|
307
|
+
return true;
|
|
307
308
|
}
|
|
308
309
|
}
|
|
309
|
-
return
|
|
310
|
+
return false;
|
|
310
311
|
}
|
|
311
312
|
/**
|
|
312
313
|
* Performs bridge formula calculations on axle groups and returns policy check results.
|
|
@@ -337,9 +338,12 @@ function getBridgeFormulaInputFailure(axleConfiguration) {
|
|
|
337
338
|
function CheckBridgeFormula(policy, vehicleConfiguration, axleConfiguration) {
|
|
338
339
|
const policyCheckResults = new Array();
|
|
339
340
|
const policyId = enum_1.PolicyCheckId.BridgeFormula;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
// This basically skips Bridge Formula if the input is invalid.
|
|
342
|
+
// This is important for STOW, which in the ASW runs this as well as STOW evals
|
|
343
|
+
// Some of those STOW evals can accept inputs that would make Bridge Formula throw
|
|
344
|
+
// errors and crash.
|
|
345
|
+
if (hasInvalidBridgeFormulaInput(axleConfiguration)) {
|
|
346
|
+
return [];
|
|
343
347
|
}
|
|
344
348
|
const bridgeCalcResults = policy.calculateBridge(axleConfiguration, vehicleConfiguration);
|
|
345
349
|
bridgeCalcResults.forEach((br) => {
|
|
@@ -1252,7 +1256,7 @@ function CheckLegalAxleSpread(policy, vehicleConfiguration, axleConfiguration) {
|
|
|
1252
1256
|
const axleUnitVehicleIndexes = (0, dimensions_helper_1.getAxleUnitVehicleIndexLookup)(policy, vehicleConfiguration, axleConfiguration);
|
|
1253
1257
|
return axleConfiguration.flatMap((axleUnit, axleIndex) => {
|
|
1254
1258
|
const threshold = (0, axle_spread_helper_1.getAxleSpreadThreshold)(vehicleConfiguration, axleUnitVehicleIndexes, axleConfiguration, axleIndex);
|
|
1255
|
-
if (
|
|
1259
|
+
if (axleUnit.axleSpread === undefined ||
|
|
1256
1260
|
!threshold ||
|
|
1257
1261
|
!Number.isFinite(axleUnit.axleSpread)) {
|
|
1258
1262
|
return [];
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "v2.32.
|
|
1
|
+
export declare const version = "v2.32.3";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED