@enyo-energy/sunspec-sdk 0.0.30 → 0.0.32
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/cjs/sunspec-devices.cjs +26 -1
- package/dist/cjs/sunspec-devices.d.cts +10 -1
- package/dist/cjs/sunspec-interfaces.cjs +82 -1
- package/dist/cjs/sunspec-interfaces.d.cts +173 -0
- package/dist/cjs/sunspec-modbus-client.cjs +576 -234
- package/dist/cjs/sunspec-modbus-client.d.cts +18 -1
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/sunspec-devices.d.ts +10 -1
- package/dist/sunspec-devices.js +26 -1
- package/dist/sunspec-interfaces.d.ts +173 -0
- package/dist/sunspec-interfaces.js +81 -0
- package/dist/sunspec-modbus-client.d.ts +18 -1
- package/dist/sunspec-modbus-client.js +577 -235
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - pad: 0x8000 (always returns this value)
|
|
17
17
|
* - string: all registers 0x0000 (NULL)
|
|
18
18
|
*/
|
|
19
|
-
import { type SunspecInverterControls, type SunspecInverterData, type SunspecInverterSettings, type SunspecMeterData, type SunspecModel, type SunspecMPPTData, type SunspecBatteryData, type SunspecBatteryControls, SunspecStorageMode, type IRetryConfig } from "./sunspec-interfaces.cjs";
|
|
19
|
+
import { type SunspecInverterControls, type SunspecInverterData, type SunspecInverterSettings, type SunspecMeterData, type SunspecModel, type SunspecMPPTData, type SunspecBatteryData, type SunspecBatteryBaseData, type SunspecBatteryControls, SunspecStorageMode, type IRetryConfig } from "./sunspec-interfaces.cjs";
|
|
20
20
|
import { ConnectionRetryManager } from "./connection-retry-manager.cjs";
|
|
21
21
|
import { IConnectionHealth } from "@enyo-energy/energy-app-sdk/dist/implementations/modbus/interfaces.js";
|
|
22
22
|
import { EnergyApp } from "@enyo-energy/energy-app-sdk";
|
|
@@ -141,6 +141,7 @@ export declare class SunspecModbusClient {
|
|
|
141
141
|
* Returns undefined if the value is unimplemented or scale factor is out of range
|
|
142
142
|
*/
|
|
143
143
|
private applyScaleFactor;
|
|
144
|
+
private logRegisterRead;
|
|
144
145
|
/**
|
|
145
146
|
* Read MPPT Scale Factors for a specific module
|
|
146
147
|
* Returns the scale factors for DC Current, DC Voltage, DC Power, and DC Energy
|
|
@@ -173,6 +174,22 @@ export declare class SunspecModbusClient {
|
|
|
173
174
|
* @returns Human-readable state name
|
|
174
175
|
*/
|
|
175
176
|
private mapBatteryChargeState;
|
|
177
|
+
/**
|
|
178
|
+
* Map battery type to human-readable name (Model 802)
|
|
179
|
+
*/
|
|
180
|
+
private mapBatteryType;
|
|
181
|
+
/**
|
|
182
|
+
* Map battery bank state to human-readable name (Model 802)
|
|
183
|
+
*/
|
|
184
|
+
private mapBatteryBankState;
|
|
185
|
+
/**
|
|
186
|
+
* Read Model 802 scale factors (offsets 52-63)
|
|
187
|
+
*/
|
|
188
|
+
private readBatteryBaseScaleFactors;
|
|
189
|
+
/**
|
|
190
|
+
* Read battery base data from Model 802 (Battery Base)
|
|
191
|
+
*/
|
|
192
|
+
readBatteryBaseData(): Promise<SunspecBatteryBaseData | null>;
|
|
176
193
|
/**
|
|
177
194
|
* Read battery data from Model 124 (Basic Storage Controls)
|
|
178
195
|
*/
|
package/dist/cjs/version.cjs
CHANGED
|
@@ -9,7 +9,7 @@ exports.getSdkVersion = getSdkVersion;
|
|
|
9
9
|
/**
|
|
10
10
|
* Current version of the enyo Energy App SDK.
|
|
11
11
|
*/
|
|
12
|
-
exports.SDK_VERSION = '0.0.
|
|
12
|
+
exports.SDK_VERSION = '0.0.32';
|
|
13
13
|
/**
|
|
14
14
|
* Gets the current SDK version.
|
|
15
15
|
* @returns The semantic version string of the SDK
|
package/dist/cjs/version.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SunspecBatteryControls, SunspecStorageMode } from "./sunspec-interfaces.js";
|
|
1
|
+
import { type SunspecBatteryBaseData, type SunspecBatteryControls, SunspecStorageMode } from "./sunspec-interfaces.js";
|
|
2
2
|
import { ApplianceManager, EnergyApp } from "@enyo-energy/energy-app-sdk";
|
|
3
3
|
import { EnyoApplianceName } from "@enyo-energy/energy-app-sdk/dist/types/enyo-appliance.js";
|
|
4
4
|
import { EnyoNetworkDevice } from "@enyo-energy/energy-app-sdk/dist/types/enyo-network-device.js";
|
|
@@ -130,6 +130,15 @@ export declare class SunspecBattery extends BaseSunspecDevice {
|
|
|
130
130
|
* @returns Promise<SunspecBatteryControls | null> - Current control settings or null if error
|
|
131
131
|
*/
|
|
132
132
|
getBatteryControls(): Promise<SunspecBatteryControls | null>;
|
|
133
|
+
/**
|
|
134
|
+
* Read full battery base data from Model 802
|
|
135
|
+
*
|
|
136
|
+
* Returns the complete Model 802 data structure with all fields,
|
|
137
|
+
* including nameplate, SoC/health, status, events, voltage, current, and power.
|
|
138
|
+
*
|
|
139
|
+
* @returns Promise<SunspecBatteryBaseData | null> - Full model 802 data or null if not available
|
|
140
|
+
*/
|
|
141
|
+
readBatteryBaseData(): Promise<SunspecBatteryBaseData | null>;
|
|
133
142
|
/**
|
|
134
143
|
* Write custom battery control settings
|
|
135
144
|
*
|
package/dist/sunspec-devices.js
CHANGED
|
@@ -343,6 +343,16 @@ export class SunspecBattery extends BaseSunspecDevice {
|
|
|
343
343
|
const mpptBatteryPowerW = this.extractBatteryPowerFromMPPT(mpptDataList);
|
|
344
344
|
if (batteryData) {
|
|
345
345
|
const advancedBatteryModel = this.sunspecClient.findModel(801);
|
|
346
|
+
const batteryBaseModel = this.sunspecClient.findModel(SunspecModelId.BatteryBase);
|
|
347
|
+
// Determine battery power: prefer model 802 w field, then MPPT extraction, then undefined
|
|
348
|
+
let batteryPowerW;
|
|
349
|
+
if (batteryBaseModel && (batteryData.chargePower !== undefined || batteryData.dischargePower !== undefined)) {
|
|
350
|
+
// Model 802 provides power directly: positive = charge, negative = discharge
|
|
351
|
+
batteryPowerW = (batteryData.chargePower || 0) - (batteryData.dischargePower || 0);
|
|
352
|
+
}
|
|
353
|
+
else if (!advancedBatteryModel) {
|
|
354
|
+
batteryPowerW = mpptBatteryPowerW;
|
|
355
|
+
}
|
|
346
356
|
const batteryMessage = {
|
|
347
357
|
id: randomUUID(),
|
|
348
358
|
message: EnyoDataBusMessageEnum.BatteryValuesUpdateV1,
|
|
@@ -354,7 +364,7 @@ export class SunspecBattery extends BaseSunspecDevice {
|
|
|
354
364
|
resolution,
|
|
355
365
|
data: {
|
|
356
366
|
batterySoC: batteryData.soc || batteryData.chaState || 0,
|
|
357
|
-
batteryPowerW
|
|
367
|
+
batteryPowerW,
|
|
358
368
|
state: this.mapToEnyoBatteryState(batteryData.chaSt),
|
|
359
369
|
}
|
|
360
370
|
};
|
|
@@ -494,6 +504,21 @@ export class SunspecBattery extends BaseSunspecDevice {
|
|
|
494
504
|
}
|
|
495
505
|
return this.sunspecClient.readBatteryControls();
|
|
496
506
|
}
|
|
507
|
+
/**
|
|
508
|
+
* Read full battery base data from Model 802
|
|
509
|
+
*
|
|
510
|
+
* Returns the complete Model 802 data structure with all fields,
|
|
511
|
+
* including nameplate, SoC/health, status, events, voltage, current, and power.
|
|
512
|
+
*
|
|
513
|
+
* @returns Promise<SunspecBatteryBaseData | null> - Full model 802 data or null if not available
|
|
514
|
+
*/
|
|
515
|
+
async readBatteryBaseData() {
|
|
516
|
+
if (!this.isConnected()) {
|
|
517
|
+
console.error('Battery not connected');
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
return this.sunspecClient.readBatteryBaseData();
|
|
521
|
+
}
|
|
497
522
|
/**
|
|
498
523
|
* Write custom battery control settings
|
|
499
524
|
*
|
|
@@ -178,6 +178,83 @@ export declare enum SunspecBatteryChargeState {
|
|
|
178
178
|
HOLDING = 6,
|
|
179
179
|
TESTING = 7
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Battery Control Mode values for Model 802
|
|
183
|
+
* Offset 17: LocRemCtl - Local/Remote control mode
|
|
184
|
+
*/
|
|
185
|
+
export declare enum SunspecBatteryControlMode {
|
|
186
|
+
REMOTE = 0,
|
|
187
|
+
LOCAL = 1
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Battery Type values for Model 802
|
|
191
|
+
* Offset 21: Typ - Battery type
|
|
192
|
+
*/
|
|
193
|
+
export declare enum SunspecBatteryType {
|
|
194
|
+
NOT_APPLICABLE_UNKNOWN = 0,
|
|
195
|
+
LEAD_ACID = 1,
|
|
196
|
+
NICKEL_METAL_HYDRIDE = 2,
|
|
197
|
+
NICKEL_CADMIUM = 3,
|
|
198
|
+
LITHIUM_ION = 4,
|
|
199
|
+
CARBON_ZINC = 5,
|
|
200
|
+
ZINC_CHLORIDE = 6,
|
|
201
|
+
ALKALINE = 7,
|
|
202
|
+
RECHARGEABLE_ALKALINE = 8,
|
|
203
|
+
SODIUM_SULFUR = 9,
|
|
204
|
+
FLOW = 10,
|
|
205
|
+
SUPER_CAPACITOR = 11,
|
|
206
|
+
OTHER = 99
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Battery Bank State values for Model 802
|
|
210
|
+
* Offset 22: State - Battery bank state
|
|
211
|
+
*/
|
|
212
|
+
export declare enum SunspecBatteryBankState {
|
|
213
|
+
DISCONNECTED = 1,
|
|
214
|
+
INITIALIZING = 2,
|
|
215
|
+
CONNECTED = 3,
|
|
216
|
+
STANDBY = 4,
|
|
217
|
+
SOC_PROTECTION = 5,
|
|
218
|
+
SUSPENDING = 6,
|
|
219
|
+
FAULT = 99
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Battery Event 1 bit positions for Model 802
|
|
223
|
+
* Offset 26-27: Evt1 - Battery event bitfield
|
|
224
|
+
*/
|
|
225
|
+
export declare enum SunspecBatteryEvent1 {
|
|
226
|
+
COMMUNICATION_ERROR = 0,
|
|
227
|
+
OVER_TEMP_ALARM = 1,
|
|
228
|
+
OVER_TEMP_WARNING = 2,
|
|
229
|
+
UNDER_TEMP_ALARM = 3,
|
|
230
|
+
UNDER_TEMP_WARNING = 4,
|
|
231
|
+
OVER_CHARGE_CURRENT_ALARM = 5,
|
|
232
|
+
OVER_CHARGE_CURRENT_WARNING = 6,
|
|
233
|
+
OVER_DISCHARGE_CURRENT_ALARM = 7,
|
|
234
|
+
OVER_DISCHARGE_CURRENT_WARNING = 8,
|
|
235
|
+
OVER_VOLT_ALARM = 9,
|
|
236
|
+
OVER_VOLT_WARNING = 10,
|
|
237
|
+
UNDER_VOLT_ALARM = 11,
|
|
238
|
+
UNDER_VOLT_WARNING = 12,
|
|
239
|
+
UNDER_SOC_MIN_ALARM = 13,
|
|
240
|
+
UNDER_SOC_MIN_WARNING = 14,
|
|
241
|
+
OVER_SOC_MAX_ALARM = 15,
|
|
242
|
+
OVER_SOC_MAX_WARNING = 16,
|
|
243
|
+
VOLTAGE_IMBALANCE_WARNING = 17,
|
|
244
|
+
TEMPERATURE_IMBALANCE_ALARM = 18,
|
|
245
|
+
TEMPERATURE_IMBALANCE_WARNING = 19,
|
|
246
|
+
CONTACTOR_ERROR = 20,
|
|
247
|
+
FAN_ERROR = 21,
|
|
248
|
+
FUSE_ERROR = 22,
|
|
249
|
+
GROUND_FAULT = 23,
|
|
250
|
+
OPEN_DOOR_ERROR = 24,
|
|
251
|
+
CURRENT_IMBALANCE_WARNING = 25,
|
|
252
|
+
OTHER_ALARM = 26,
|
|
253
|
+
OTHER_WARNING = 27,
|
|
254
|
+
RESERVED_1 = 28,
|
|
255
|
+
CONFIGURATION_ALARM = 29,
|
|
256
|
+
CONFIGURATION_WARNING = 30
|
|
257
|
+
}
|
|
181
258
|
/**
|
|
182
259
|
* Storage Control Mode bitfield values for Model 124
|
|
183
260
|
*
|
|
@@ -247,6 +324,102 @@ export interface SunspecBatteryData extends SunspecBlock {
|
|
|
247
324
|
temperature?: number;
|
|
248
325
|
status?: number;
|
|
249
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Battery Base data structure based on Model 802 (Battery Base Model)
|
|
329
|
+
*
|
|
330
|
+
* SunSpec Model 802 Register Map (offsets relative to model start):
|
|
331
|
+
* - 0-1: ID and Length
|
|
332
|
+
* - 2: AHRtg - Nameplate charge capacity (AH) (uint16)
|
|
333
|
+
* - 3: WHRtg - Nameplate energy capacity (WH) (uint16)
|
|
334
|
+
* - 4: WChaRteMax - Maximum rate of charge (W) (uint16)
|
|
335
|
+
* - 5: WDisChaRteMax - Maximum rate of discharge (W) (uint16)
|
|
336
|
+
* - 6: DisChaRte - Self discharge rate (%) (uint16)
|
|
337
|
+
* - 7: SoCMax - Maximum state of charge (%) (uint16)
|
|
338
|
+
* - 8: SoCMin - Minimum state of charge (%) (uint16)
|
|
339
|
+
* - 9: SoCRsvMax - Maximum reserve SOC (%) (uint16)
|
|
340
|
+
* - 10: SoCRsvMin - Minimum reserve SOC (%) (uint16)
|
|
341
|
+
* - 11: SoC - State of charge (%) (uint16)
|
|
342
|
+
* - 12: DoD - Depth of discharge (%) (uint16)
|
|
343
|
+
* - 13: SoH - State of health (%) (uint16)
|
|
344
|
+
* - 14-15: NCyc - Cycle count (uint32)
|
|
345
|
+
* - 16: ChaSt - Charge status (enum16)
|
|
346
|
+
* - 17: LocRemCtl - Local/Remote control (enum16)
|
|
347
|
+
* - 18: Hb - Heartbeat (uint16)
|
|
348
|
+
* - 19: CtrlHb - Controller heartbeat (uint16)
|
|
349
|
+
* - 20: AlmRst - Alarm reset (uint16)
|
|
350
|
+
* - 21: Typ - Battery type (enum16)
|
|
351
|
+
* - 22: State - Battery bank state (enum16)
|
|
352
|
+
* - 23: StateVnd - Vendor-specific state (enum16)
|
|
353
|
+
* - 24-25: WarrDt - Warranty date (uint32)
|
|
354
|
+
* - 26-27: Evt1 - Event bitfield 1 (bitfield32)
|
|
355
|
+
* - 28-29: Evt2 - Event bitfield 2 (bitfield32)
|
|
356
|
+
* - 30-31: EvtVnd1 - Vendor event bitfield 1 (bitfield32)
|
|
357
|
+
* - 32-33: EvtVnd2 - Vendor event bitfield 2 (bitfield32)
|
|
358
|
+
* - 34: V - Battery voltage (V) (uint16)
|
|
359
|
+
* - 35: VMax - Maximum battery voltage (V) (uint16)
|
|
360
|
+
* - 36: VMin - Minimum battery voltage (V) (uint16)
|
|
361
|
+
* - 37: CellVMax - Maximum cell voltage (V) (uint16)
|
|
362
|
+
* - 38: CellVMaxStr - String containing max cell voltage (uint16)
|
|
363
|
+
* - 39: CellVMaxMod - Module containing max cell voltage (uint16)
|
|
364
|
+
* - 40: CellVMin - Minimum cell voltage (V) (uint16)
|
|
365
|
+
* - 41: CellVMinStr - String containing min cell voltage (uint16)
|
|
366
|
+
* - 42: CellVMinMod - Module containing min cell voltage (uint16)
|
|
367
|
+
* - 43: CellVAvg - Average cell voltage (V) (uint16)
|
|
368
|
+
* - 44: A - Battery current (A) (int16)
|
|
369
|
+
* - 45: AChaMax - Maximum charge current (A) (uint16)
|
|
370
|
+
* - 46: ADisChaMax - Maximum discharge current (A) (uint16)
|
|
371
|
+
* - 47: W - Battery power (W) (int16)
|
|
372
|
+
* - 48: ReqInvState - Requested inverter state (enum16)
|
|
373
|
+
* - 49: ReqW - Requested power (W) (int16)
|
|
374
|
+
* - 50: SetOp - Set operation (enum16)
|
|
375
|
+
* - 51: SetInvState - Set inverter state (enum16)
|
|
376
|
+
* Scale factors at offsets 52-63
|
|
377
|
+
*/
|
|
378
|
+
export interface SunspecBatteryBaseData extends SunspecBlock {
|
|
379
|
+
blockNumber: 802;
|
|
380
|
+
ahRtg?: number;
|
|
381
|
+
whRtg?: number;
|
|
382
|
+
wChaRteMax?: number;
|
|
383
|
+
wDisChaRteMax?: number;
|
|
384
|
+
disChaRte?: number;
|
|
385
|
+
soCMax?: number;
|
|
386
|
+
soCMin?: number;
|
|
387
|
+
soCRsvMax?: number;
|
|
388
|
+
soCRsvMin?: number;
|
|
389
|
+
soC?: number;
|
|
390
|
+
doD?: number;
|
|
391
|
+
soH?: number;
|
|
392
|
+
nCyc?: number;
|
|
393
|
+
chaSt?: number;
|
|
394
|
+
chaStName?: string;
|
|
395
|
+
locRemCtl?: number;
|
|
396
|
+
typ?: number;
|
|
397
|
+
typName?: string;
|
|
398
|
+
state?: number;
|
|
399
|
+
stateName?: string;
|
|
400
|
+
evt1?: number;
|
|
401
|
+
evt2?: number;
|
|
402
|
+
evtVnd1?: number;
|
|
403
|
+
evtVnd2?: number;
|
|
404
|
+
v?: number;
|
|
405
|
+
vMax?: number;
|
|
406
|
+
vMin?: number;
|
|
407
|
+
cellVMax?: number;
|
|
408
|
+
cellVMaxStr?: number;
|
|
409
|
+
cellVMaxMod?: number;
|
|
410
|
+
cellVMin?: number;
|
|
411
|
+
cellVMinStr?: number;
|
|
412
|
+
cellVMinMod?: number;
|
|
413
|
+
cellVAvg?: number;
|
|
414
|
+
a?: number;
|
|
415
|
+
aChaMax?: number;
|
|
416
|
+
aDisChaMax?: number;
|
|
417
|
+
w?: number;
|
|
418
|
+
reqInvState?: number;
|
|
419
|
+
reqW?: number;
|
|
420
|
+
setOp?: number;
|
|
421
|
+
setInvState?: number;
|
|
422
|
+
}
|
|
250
423
|
/**
|
|
251
424
|
* Meter data structure
|
|
252
425
|
*/
|
|
@@ -58,6 +58,87 @@ export var SunspecBatteryChargeState;
|
|
|
58
58
|
SunspecBatteryChargeState[SunspecBatteryChargeState["HOLDING"] = 6] = "HOLDING";
|
|
59
59
|
SunspecBatteryChargeState[SunspecBatteryChargeState["TESTING"] = 7] = "TESTING";
|
|
60
60
|
})(SunspecBatteryChargeState || (SunspecBatteryChargeState = {}));
|
|
61
|
+
/**
|
|
62
|
+
* Battery Control Mode values for Model 802
|
|
63
|
+
* Offset 17: LocRemCtl - Local/Remote control mode
|
|
64
|
+
*/
|
|
65
|
+
export var SunspecBatteryControlMode;
|
|
66
|
+
(function (SunspecBatteryControlMode) {
|
|
67
|
+
SunspecBatteryControlMode[SunspecBatteryControlMode["REMOTE"] = 0] = "REMOTE";
|
|
68
|
+
SunspecBatteryControlMode[SunspecBatteryControlMode["LOCAL"] = 1] = "LOCAL";
|
|
69
|
+
})(SunspecBatteryControlMode || (SunspecBatteryControlMode = {}));
|
|
70
|
+
/**
|
|
71
|
+
* Battery Type values for Model 802
|
|
72
|
+
* Offset 21: Typ - Battery type
|
|
73
|
+
*/
|
|
74
|
+
export var SunspecBatteryType;
|
|
75
|
+
(function (SunspecBatteryType) {
|
|
76
|
+
SunspecBatteryType[SunspecBatteryType["NOT_APPLICABLE_UNKNOWN"] = 0] = "NOT_APPLICABLE_UNKNOWN";
|
|
77
|
+
SunspecBatteryType[SunspecBatteryType["LEAD_ACID"] = 1] = "LEAD_ACID";
|
|
78
|
+
SunspecBatteryType[SunspecBatteryType["NICKEL_METAL_HYDRIDE"] = 2] = "NICKEL_METAL_HYDRIDE";
|
|
79
|
+
SunspecBatteryType[SunspecBatteryType["NICKEL_CADMIUM"] = 3] = "NICKEL_CADMIUM";
|
|
80
|
+
SunspecBatteryType[SunspecBatteryType["LITHIUM_ION"] = 4] = "LITHIUM_ION";
|
|
81
|
+
SunspecBatteryType[SunspecBatteryType["CARBON_ZINC"] = 5] = "CARBON_ZINC";
|
|
82
|
+
SunspecBatteryType[SunspecBatteryType["ZINC_CHLORIDE"] = 6] = "ZINC_CHLORIDE";
|
|
83
|
+
SunspecBatteryType[SunspecBatteryType["ALKALINE"] = 7] = "ALKALINE";
|
|
84
|
+
SunspecBatteryType[SunspecBatteryType["RECHARGEABLE_ALKALINE"] = 8] = "RECHARGEABLE_ALKALINE";
|
|
85
|
+
SunspecBatteryType[SunspecBatteryType["SODIUM_SULFUR"] = 9] = "SODIUM_SULFUR";
|
|
86
|
+
SunspecBatteryType[SunspecBatteryType["FLOW"] = 10] = "FLOW";
|
|
87
|
+
SunspecBatteryType[SunspecBatteryType["SUPER_CAPACITOR"] = 11] = "SUPER_CAPACITOR";
|
|
88
|
+
SunspecBatteryType[SunspecBatteryType["OTHER"] = 99] = "OTHER";
|
|
89
|
+
})(SunspecBatteryType || (SunspecBatteryType = {}));
|
|
90
|
+
/**
|
|
91
|
+
* Battery Bank State values for Model 802
|
|
92
|
+
* Offset 22: State - Battery bank state
|
|
93
|
+
*/
|
|
94
|
+
export var SunspecBatteryBankState;
|
|
95
|
+
(function (SunspecBatteryBankState) {
|
|
96
|
+
SunspecBatteryBankState[SunspecBatteryBankState["DISCONNECTED"] = 1] = "DISCONNECTED";
|
|
97
|
+
SunspecBatteryBankState[SunspecBatteryBankState["INITIALIZING"] = 2] = "INITIALIZING";
|
|
98
|
+
SunspecBatteryBankState[SunspecBatteryBankState["CONNECTED"] = 3] = "CONNECTED";
|
|
99
|
+
SunspecBatteryBankState[SunspecBatteryBankState["STANDBY"] = 4] = "STANDBY";
|
|
100
|
+
SunspecBatteryBankState[SunspecBatteryBankState["SOC_PROTECTION"] = 5] = "SOC_PROTECTION";
|
|
101
|
+
SunspecBatteryBankState[SunspecBatteryBankState["SUSPENDING"] = 6] = "SUSPENDING";
|
|
102
|
+
SunspecBatteryBankState[SunspecBatteryBankState["FAULT"] = 99] = "FAULT";
|
|
103
|
+
})(SunspecBatteryBankState || (SunspecBatteryBankState = {}));
|
|
104
|
+
/**
|
|
105
|
+
* Battery Event 1 bit positions for Model 802
|
|
106
|
+
* Offset 26-27: Evt1 - Battery event bitfield
|
|
107
|
+
*/
|
|
108
|
+
export var SunspecBatteryEvent1;
|
|
109
|
+
(function (SunspecBatteryEvent1) {
|
|
110
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["COMMUNICATION_ERROR"] = 0] = "COMMUNICATION_ERROR";
|
|
111
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OVER_TEMP_ALARM"] = 1] = "OVER_TEMP_ALARM";
|
|
112
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OVER_TEMP_WARNING"] = 2] = "OVER_TEMP_WARNING";
|
|
113
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["UNDER_TEMP_ALARM"] = 3] = "UNDER_TEMP_ALARM";
|
|
114
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["UNDER_TEMP_WARNING"] = 4] = "UNDER_TEMP_WARNING";
|
|
115
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OVER_CHARGE_CURRENT_ALARM"] = 5] = "OVER_CHARGE_CURRENT_ALARM";
|
|
116
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OVER_CHARGE_CURRENT_WARNING"] = 6] = "OVER_CHARGE_CURRENT_WARNING";
|
|
117
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OVER_DISCHARGE_CURRENT_ALARM"] = 7] = "OVER_DISCHARGE_CURRENT_ALARM";
|
|
118
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OVER_DISCHARGE_CURRENT_WARNING"] = 8] = "OVER_DISCHARGE_CURRENT_WARNING";
|
|
119
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OVER_VOLT_ALARM"] = 9] = "OVER_VOLT_ALARM";
|
|
120
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OVER_VOLT_WARNING"] = 10] = "OVER_VOLT_WARNING";
|
|
121
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["UNDER_VOLT_ALARM"] = 11] = "UNDER_VOLT_ALARM";
|
|
122
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["UNDER_VOLT_WARNING"] = 12] = "UNDER_VOLT_WARNING";
|
|
123
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["UNDER_SOC_MIN_ALARM"] = 13] = "UNDER_SOC_MIN_ALARM";
|
|
124
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["UNDER_SOC_MIN_WARNING"] = 14] = "UNDER_SOC_MIN_WARNING";
|
|
125
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OVER_SOC_MAX_ALARM"] = 15] = "OVER_SOC_MAX_ALARM";
|
|
126
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OVER_SOC_MAX_WARNING"] = 16] = "OVER_SOC_MAX_WARNING";
|
|
127
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["VOLTAGE_IMBALANCE_WARNING"] = 17] = "VOLTAGE_IMBALANCE_WARNING";
|
|
128
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["TEMPERATURE_IMBALANCE_ALARM"] = 18] = "TEMPERATURE_IMBALANCE_ALARM";
|
|
129
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["TEMPERATURE_IMBALANCE_WARNING"] = 19] = "TEMPERATURE_IMBALANCE_WARNING";
|
|
130
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["CONTACTOR_ERROR"] = 20] = "CONTACTOR_ERROR";
|
|
131
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["FAN_ERROR"] = 21] = "FAN_ERROR";
|
|
132
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["FUSE_ERROR"] = 22] = "FUSE_ERROR";
|
|
133
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["GROUND_FAULT"] = 23] = "GROUND_FAULT";
|
|
134
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OPEN_DOOR_ERROR"] = 24] = "OPEN_DOOR_ERROR";
|
|
135
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["CURRENT_IMBALANCE_WARNING"] = 25] = "CURRENT_IMBALANCE_WARNING";
|
|
136
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OTHER_ALARM"] = 26] = "OTHER_ALARM";
|
|
137
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["OTHER_WARNING"] = 27] = "OTHER_WARNING";
|
|
138
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["RESERVED_1"] = 28] = "RESERVED_1";
|
|
139
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["CONFIGURATION_ALARM"] = 29] = "CONFIGURATION_ALARM";
|
|
140
|
+
SunspecBatteryEvent1[SunspecBatteryEvent1["CONFIGURATION_WARNING"] = 30] = "CONFIGURATION_WARNING";
|
|
141
|
+
})(SunspecBatteryEvent1 || (SunspecBatteryEvent1 = {}));
|
|
61
142
|
/**
|
|
62
143
|
* Storage Control Mode bitfield values for Model 124
|
|
63
144
|
*
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - pad: 0x8000 (always returns this value)
|
|
17
17
|
* - string: all registers 0x0000 (NULL)
|
|
18
18
|
*/
|
|
19
|
-
import { type SunspecInverterControls, type SunspecInverterData, type SunspecInverterSettings, type SunspecMeterData, type SunspecModel, type SunspecMPPTData, type SunspecBatteryData, type SunspecBatteryControls, SunspecStorageMode, type IRetryConfig } from "./sunspec-interfaces.js";
|
|
19
|
+
import { type SunspecInverterControls, type SunspecInverterData, type SunspecInverterSettings, type SunspecMeterData, type SunspecModel, type SunspecMPPTData, type SunspecBatteryData, type SunspecBatteryBaseData, type SunspecBatteryControls, SunspecStorageMode, type IRetryConfig } from "./sunspec-interfaces.js";
|
|
20
20
|
import { ConnectionRetryManager } from "./connection-retry-manager.js";
|
|
21
21
|
import { IConnectionHealth } from "@enyo-energy/energy-app-sdk/dist/implementations/modbus/interfaces.js";
|
|
22
22
|
import { EnergyApp } from "@enyo-energy/energy-app-sdk";
|
|
@@ -141,6 +141,7 @@ export declare class SunspecModbusClient {
|
|
|
141
141
|
* Returns undefined if the value is unimplemented or scale factor is out of range
|
|
142
142
|
*/
|
|
143
143
|
private applyScaleFactor;
|
|
144
|
+
private logRegisterRead;
|
|
144
145
|
/**
|
|
145
146
|
* Read MPPT Scale Factors for a specific module
|
|
146
147
|
* Returns the scale factors for DC Current, DC Voltage, DC Power, and DC Energy
|
|
@@ -173,6 +174,22 @@ export declare class SunspecModbusClient {
|
|
|
173
174
|
* @returns Human-readable state name
|
|
174
175
|
*/
|
|
175
176
|
private mapBatteryChargeState;
|
|
177
|
+
/**
|
|
178
|
+
* Map battery type to human-readable name (Model 802)
|
|
179
|
+
*/
|
|
180
|
+
private mapBatteryType;
|
|
181
|
+
/**
|
|
182
|
+
* Map battery bank state to human-readable name (Model 802)
|
|
183
|
+
*/
|
|
184
|
+
private mapBatteryBankState;
|
|
185
|
+
/**
|
|
186
|
+
* Read Model 802 scale factors (offsets 52-63)
|
|
187
|
+
*/
|
|
188
|
+
private readBatteryBaseScaleFactors;
|
|
189
|
+
/**
|
|
190
|
+
* Read battery base data from Model 802 (Battery Base)
|
|
191
|
+
*/
|
|
192
|
+
readBatteryBaseData(): Promise<SunspecBatteryBaseData | null>;
|
|
176
193
|
/**
|
|
177
194
|
* Read battery data from Model 124 (Basic Storage Controls)
|
|
178
195
|
*/
|