From bbc1122a04eee032bd2202bdf067b0c6b6e86945 Mon Sep 17 00:00:00 2001 From: Parag More Date: Sat, 2 May 2026 00:29:45 +0530 Subject: [PATCH] Update the dcs apis to support the new tags --- tests/unit/handlers/coolingSystem.handlers.test.js | 6 +++--- workers/lib/server/handlers/coolingSystem.handlers.js | 6 ++++-- workers/lib/server/handlers/energySystem.handlers.js | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/unit/handlers/coolingSystem.handlers.test.js b/tests/unit/handlers/coolingSystem.handlers.test.js index 3dd46df..966d3e3 100644 --- a/tests/unit/handlers/coolingSystem.handlers.test.js +++ b/tests/unit/handlers/coolingSystem.handlers.test.js @@ -62,8 +62,8 @@ const createMockEquipment = () => ({ { equipment: 'TC-7501', is_active: true, miner_side_out_temp: { value: 37.1, unit: '°C' }, tower_side_in_temp: { value: 29.2, unit: '°C' }, tower_side_out_temp: { value: 36.9, unit: '°C' }, tcv_position: { value: 55, unit: '%' } } ], cooling_towers: [ - { equipment: 'TR-7501', is_running: true, fan_status: 'Running', fan_power: { value: 60, unit: 'kW' }, level: { value: 82, unit: '%' }, vibration: { value: 0.8, unit: 'mm/s', status: 'Normal' } }, - { equipment: 'TR-7502', is_running: true, fan_status: 'Running', fan_power: { value: 45, unit: 'kW' }, level: { value: 85, unit: '%' }, vibration: { value: 0.6, unit: 'mm/s', status: 'Normal' } } + { equipment: 'TR-7501', is_running: true, fan_status: 'Running', fan_cv: { value: 60, unit: 'CV' }, level: { value: 82, unit: '%' }, vibration: { value: 0.8, unit: 'mm/s', status: 'Normal' } }, + { equipment: 'TR-7502', is_running: true, fan_status: 'Running', fan_cv: { value: 45, unit: 'CV' }, level: { value: 85, unit: '%' }, vibration: { value: 0.6, unit: 'mm/s', status: 'Normal' } } ], valves: [ { equipment: 'PCV-7502', position: { value: 12, unit: '%' } }, @@ -408,7 +408,7 @@ test('buildMinersCircuit2View - builds view from enriched equipment', (t) => { t.ok(view.heat_exchangers, 'should have heat_exchangers') t.ok(view.summary, 'should have summary') // Check enriched data with units - t.ok(view.cooling_towers[0].fan_power.unit, 'fan_power should have unit') + t.ok(view.cooling_towers[0].fan_cv.unit, 'fan_cv should have unit') t.ok(view.cooling_towers[0].level.unit, 'level should have unit') // Check tower sensor refs t.ok(view.cooling_towers[0].level_sensor, 'should have level_sensor ref') diff --git a/workers/lib/server/handlers/coolingSystem.handlers.js b/workers/lib/server/handlers/coolingSystem.handlers.js index 1ca0679..b20d922 100644 --- a/workers/lib/server/handlers/coolingSystem.handlers.js +++ b/workers/lib/server/handlers/coolingSystem.handlers.js @@ -278,12 +278,13 @@ function buildMinersCircuit2View (equipment, config) { is_running: ct.is_running, fan_status: ct.fan_status, fan_speed: ct.fan_speed, - fan_power: ct.fan_power, + fan_cv: ct.fan_cv, fan_id: towerFanId, level: ct.level, level_sensor: towerLevelSensor, vibration: ct.vibration, vibration_sensor: towerVibrationSensorId, + vibration_threshold: ct.vibration_threshold || null, capacity_flow: towerConfig.defaults?.tower_capacity || null, capacity_gcal: towerConfig.defaults?.tower_capacity_gcal || null })) @@ -667,12 +668,13 @@ function buildHvacCircuit2View (equipment, config) { is_running: ct.is_running, fan_status: ct.fan_status, fan_speed: ct.fan_speed, - fan_power: ct.fan_power, + fan_cv: ct.fan_cv, fan_id: towerFanId || null, level: ct.level, level_sensor: towerLevelSensorId || null, vibration: ct.vibration, vibration_sensor: towerVibrationSensorId || null, + vibration_threshold: ct.vibration_threshold || null, capacity_mcal: condenserConfig.defaults?.tower_capacity_mcal || null, capacity_flow: condenserConfig.defaults?.tower_flow || null })) diff --git a/workers/lib/server/handlers/energySystem.handlers.js b/workers/lib/server/handlers/energySystem.handlers.js index dc233dc..7592c75 100644 --- a/workers/lib/server/handlers/energySystem.handlers.js +++ b/workers/lib/server/handlers/energySystem.handlers.js @@ -117,6 +117,7 @@ function buildLayoutView (equipment, config, stats) { return { title: 'Energy Layout', + source_label: energyLayout.source_label || null, site_total: siteTotal, site_pm: siteMeter || null, main_protection: mainRelay || null,