refactor: adopt POSITIONS constants and fix ESLint warnings
Replace hardcoded position strings with POSITIONS.* constants. Prefix unused variables with _ to resolve no-unused-vars warnings. Fix no-prototype-builtins where applicable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const ASM3 = require('./reaction_modules/asm3_class.js');
|
||||
const { create, all, isArray } = require('mathjs');
|
||||
const { assertNoNaN } = require('./utils.js');
|
||||
const { childRegistrationUtils, logger, MeasurementContainer } = require('generalFunctions');
|
||||
const { childRegistrationUtils, logger, MeasurementContainer, POSITIONS } = require('generalFunctions');
|
||||
const EventEmitter = require('events');
|
||||
|
||||
const mathConfig = {
|
||||
@@ -126,7 +126,6 @@ class Reactor {
|
||||
position = measurement.config.functionality.positionVsParent;
|
||||
}
|
||||
const measurementType = measurement.config.asset.type;
|
||||
const key = `${measurementType}_${position}`;
|
||||
const eventName = `${measurementType}.measured.${position}`;
|
||||
|
||||
// Register event listener for measurement updates
|
||||
@@ -160,11 +159,11 @@ class Reactor {
|
||||
}
|
||||
|
||||
|
||||
_updateMeasurement(measurementType, value, position, context) {
|
||||
_updateMeasurement(measurementType, value, position, _context) {
|
||||
this.logger.debug(`---------------------- updating ${measurementType} ------------------ `);
|
||||
switch (measurementType) {
|
||||
case "temperature":
|
||||
if (position == "atEquipment") {
|
||||
if (position == POSITIONS.AT_EQUIPMENT) {
|
||||
this.temperature = value;
|
||||
}
|
||||
break;
|
||||
@@ -320,7 +319,7 @@ class Reactor_PFR extends Reactor {
|
||||
return stateNew;
|
||||
}
|
||||
|
||||
_updateMeasurement(measurementType, value, position, context) {
|
||||
_updateMeasurement(measurementType, value, position, _context) {
|
||||
switch(measurementType) {
|
||||
case "quantity (oxygen)": {
|
||||
let grid_pos = Math.round(position / this.config.length * this.n_x);
|
||||
@@ -328,7 +327,7 @@ class Reactor_PFR extends Reactor {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
super._updateMeasurement(measurementType, value, position, context);
|
||||
super._updateMeasurement(measurementType, value, position, _context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user