Search in sources :

Example 1 with SymmetricPowerImpl

use of io.openems.core.utilities.power.symmetric.SymmetricPowerImpl in project openems by OpenEMS.

the class Bem125ktla01Ess method defineModbusProtocol.

/*
	 * Methods
	 */
@Override
protected ModbusProtocol defineModbusProtocol() throws ConfigException {
    ModbusProtocol protocol = new // 
    ModbusProtocol(new // 
    ModbusRegisterRange(// 
    0x0100, new // 
    UnsignedWordElement(// 
    0x100, // 
    new ModbusBitWrappingChannel("SysAlarmInfo", this, this.thingState).warningBit(0, // 
    WarningEss.WarningState).warningBit(1, // 
    WarningEss.ProtectionState).warningBit(2, // 
    WarningEss.DeratingState).warningBit(3, // 
    WarningEss.ChargeForbidden).warningBit(4, // 
    WarningEss.DischargeForbidden)), new // 
    UnsignedWordElement(// 
    0x101, sysWorkStatus = // 
    new ModbusReadLongChannel("SysWorkStatus", this).label(1, // 
    "Initial").label(2, // 
    "Fault").label(4, // 
    "Stop").label(8, // 
    "Hot Standby").label(16, // 
    "Monitoring").label(32, // 
    "Standby").label(64, // 
    "Operation").label(128, // 
    "Debug")), new // 
    UnsignedWordElement(// 
    0x102, sysControlMode = // 
    new ModbusReadLongChannel("SysControlMode", this).label(1, // 
    "Remote").label(2, // 
    "Local")), new DummyElement(0x103)), new // 
    ModbusRegisterRange(// 
    0x0110, new // 
    UnsignedWordElement(// 
    0x110, // 
    new ModbusBitWrappingChannel("SysAlarmInfo", this, thingState).warningBit(1, // Status abnormal of AC surge protector
    WarningEss.StatusAbnormalOfACSurgeProtector).warningBit(2, // Close of control switch
    WarningEss.CloseOfControlSwitch).warningBit(3, // Emergency stop
    WarningEss.EmergencyStop).warningBit(5, // Status_abnormal_of_frog_detector
    WarningEss.StatusAbnormalOfFrogDetector).warningBit(6, // Serious_leakage
    WarningEss.SeriousLeakage).warningBit(7, // Normal_leakage
    WarningEss.NormalLeakage)), new // 
    UnsignedWordElement(// 
    0x111, // 
    new ModbusBitWrappingChannel("SysAlarmInfo2", this, thingState).warningBit(0, // Failure of temperature sensor in control cabinet
    WarningEss.FailureOfTemperatureSensorInControlCabinet).warningBit(9, // Failure_of_humidity_sensor_in_control_cabinet
    WarningEss.FailureOfHumiditySensorInControlCabinet).warningBit(12, // Failure_of_storage_device
    WarningEss.FailureOfStorageDevice).warningBit(13, // Exceeding_of_humidity_in_control_cabinet
    WarningEss.ExceedingOfHumidityInControlCabinet))), new ModbusRegisterRange(0x1300, new // 
    UnsignedWordElement(// 
    0x1300, batteryStackVoltage = new ModbusReadLongChannel("BatteryStackVoltage", this).multiplier(2).unit("mV")), new // 
    UnsignedWordElement(// 
    0x1301, batteryStackCurrent = new ModbusReadLongChannel("BatteryStackCurrent", this).multiplier(2).unit("mA")), new // 
    UnsignedWordElement(// 
    0x1302, batteryStackPower = new ModbusReadLongChannel("BatteryStackPower", this).multiplier(2).unit("W")), new // 
    UnsignedWordElement(// 
    0x1303, batteryStackSoc = soc = new ModbusReadLongChannel("BatteryStackSoc", this).unit("%")), new // 
    UnsignedWordElement(// 
    0x1304, batteryStackSoh = new ModbusReadLongChannel("BatteryStackSoh", this).unit("%")), new // 
    UnsignedWordElement(// 
    0x1305, batteryStackMaxChargeCurrent = new ModbusReadLongChannel("BatteryStackMaxChargeCurrent", this).multiplier(2).unit("mA")), new // 
    UnsignedWordElement(// 
    0x1306, batteryStackMaxDischargeCurrent = new ModbusReadLongChannel("BatteryStackMaxDischargeCurrent", this).multiplier(2).unit("mA")), new // 
    UnsignedWordElement(// 
    0x1307, batteryStackMaxChargePower = new ModbusReadLongChannel("BatteryStackMaxChargePower", this).multiplier(2).unit("W")), new // 
    UnsignedWordElement(// 
    0x1308, batteryStackMaxDischargePower = new ModbusReadLongChannel("BatteryStackMaxDischargePower", this).multiplier(2).unit("W")), new // 
    UnsignedWordElement(// 
    0x1309, batteryStackTotalCapacity = new ModbusReadLongChannel("BatteryStackTotalCapacity", this).unit("Wh")), new // 
    UnsignedDoublewordElement(// 
    0x130A, batteryStackTotalCharge = new ModbusReadLongChannel("BatteryStackTotalCharge", this).unit("kWh")), new // 
    UnsignedDoublewordElement(// 
    0x130C, batteryStackTotalDischarge = new ModbusReadLongChannel("BatteryStackTotalDischarge", this).unit("kWh"))));
    this.power = new SymmetricPowerImpl(125000, setActivePower, setReactivePower, getParent().getBridge());
    return protocol;
}
Also used : ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) DummyElement(io.openems.impl.protocol.modbus.internal.DummyElement) SymmetricPowerImpl(io.openems.core.utilities.power.symmetric.SymmetricPowerImpl) UnsignedWordElement(io.openems.impl.protocol.modbus.internal.UnsignedWordElement) UnsignedDoublewordElement(io.openems.impl.protocol.modbus.internal.UnsignedDoublewordElement) ModbusProtocol(io.openems.impl.protocol.modbus.internal.ModbusProtocol) ModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.ModbusRegisterRange)

Example 2 with SymmetricPowerImpl

use of io.openems.core.utilities.power.symmetric.SymmetricPowerImpl in project openems by OpenEMS.

the class RefuEss method defineModbusProtocol.

@Override
protected ModbusProtocol defineModbusProtocol() throws ConfigException {
    ModbusProtocol protocol = new // 
    ModbusProtocol(new // 
    ModbusInputRegisterRange(// 
    0x100, new // 
    UnsignedWordElement(// 
    0x100, systemState = // 
    new ModbusReadLongChannel("SystemState", this).label(0, // 
    STOP).label(1, // 
    "Init").label(2, // 
    "Pre-operation").label(3, // 
    STANDBY).label(4, // 
    START).label(5, FAULT)), new // 
    UnsignedWordElement(// 
    0x101, // 
    new ModbusBitWrappingChannel("SystemError1", this, this.thingState).faultBit(0, // 
    FaultEss.BMSInError).faultBit(1, // 
    FaultEss.BMSInErrorSecond).faultBit(2, // 
    FaultEss.BMSUndervoltage).faultBit(3, // 
    FaultEss.BMSOvercurrent).faultBit(4, // 
    FaultEss.ErrorBMSLimitsNotInitialized).faultBit(5, // 
    FaultEss.ConnectError).faultBit(6, // 
    FaultEss.OvervoltageWarning).faultBit(7, // 
    FaultEss.UndervoltageWarning).faultBit(8, // 
    FaultEss.OvercurrentWarning).faultBit(9, // 
    FaultEss.BMSReady).faultBit(10, // 
    FaultEss.TREXReady)), new UnsignedWordElement(0x102, communicationInformations = // 
    new StatusBitChannel("CommunicationInformations", this).label(1, // 
    "Gateway Initialized").label(2, // 
    "Modbus Slave Status").label(4, // 
    "Modbus Master Status").label(8, // 
    "CAN Timeout").label(16, // 
    "First Communication Ok")), new UnsignedWordElement(0x103, inverterStatus = // 
    new StatusBitChannel("InverterStatus", this).label(1, // 
    "Ready to Power on").label(2, // 
    "Ready for Operating").label(4, // 
    "Enabled").label(8, // 
    "Fault").label(256, // 
    "Warning").label(512, // 
    "Voltage/Current mode").label(1024, // 
    "Power mode").label(2048, // 
    "AC relays close").label(4096, // 
    "DC relays 1 close").label(8192, // 
    "DC relays 2 close").label(16384, // 
    "Mains OK")), new UnsignedWordElement(0x104, errorCode = new ModbusReadLongChannel("ErrorCode", this)), new UnsignedWordElement(0x105, dcDcStatus = // 
    new StatusBitChannel("DCDCStatus", this).label(1, // 
    "Ready to Power on").label(2, // 
    "Ready for Operating").label(4, // 
    "Enabled").label(8, // 
    "DCDC Fault").label(128, // 
    "DCDC Warning").label(256, // 
    "Voltage/Current mode").label(512, // 
    "Power mode")), new UnsignedWordElement(0x106, dcDcError = new ModbusReadLongChannel("DCDCError", this)), new SignedWordElement(0x107, batteryCurrentPcs = new ModbusReadLongChannel("BatteryCurrentPcs", this).unit("mA").multiplier(// 
    2)), new SignedWordElement(0x108, batteryVoltagePcs = new ModbusReadLongChannel("BatteryVoltagePcs", this).unit("mV").multiplier(// 
    2)), new SignedWordElement(0x109, // 
    current = new ModbusReadLongChannel("Current", this).unit("mA").multiplier(2)), new SignedWordElement(0x10A, // 
    currentL1 = new ModbusReadLongChannel("CurrentL1", this).unit("mA").multiplier(2)), new SignedWordElement(0x10B, // 
    currentL2 = new ModbusReadLongChannel("CurrentL2", this).unit("mA").multiplier(2)), new SignedWordElement(0x10C, // 
    currentL3 = new ModbusReadLongChannel("CurrentL3", this).unit("mA").multiplier(2)), new SignedWordElement(0x10D, // 
    activePower = new ModbusReadLongChannel("ActivePower", this).unit("W").multiplier(2)), new SignedWordElement(0x10E, activePowerL1 = new ModbusReadLongChannel("ActivePowerL1", this).unit("W").multiplier(// 
    2)), new SignedWordElement(0x10F, activePowerL2 = new ModbusReadLongChannel("ActivePowerL2", this).unit("W").multiplier(// 
    2)), new SignedWordElement(0x110, activePowerL3 = new ModbusReadLongChannel("ActivePowerL3", this).unit("W").multiplier(// 
    2)), new SignedWordElement(0x111, reactivePower = new ModbusReadLongChannel("ReactivePower", this).unit("Var").multiplier(// 
    2)), new SignedWordElement(0x112, reactivePowerL1 = new ModbusReadLongChannel("ReactivePowerL1", this).unit("Var").multiplier(// 
    2)), new SignedWordElement(0x113, reactivePowerL2 = new ModbusReadLongChannel("ReactivePowerL2", this).unit("Var").multiplier(// 
    2)), new SignedWordElement(0x114, reactivePowerL3 = new ModbusReadLongChannel("ReactivePowerL3", this).unit("Var").multiplier(// 
    2)), // 
    new SignedWordElement(0x115, cosPhi3p = new ModbusReadLongChannel("CosPhi3p", this).unit("")), // 
    new SignedWordElement(0x116, cosPhiL1 = new ModbusReadLongChannel("CosPhiL1", this).unit("")), // 
    new SignedWordElement(0x117, cosPhiL2 = new ModbusReadLongChannel("CosPhiL2", this).unit("")), // 
    new SignedWordElement(0x118, cosPhiL3 = new ModbusReadLongChannel("CosPhiL3", this).unit(""))), new // 
    ModbusInputRegisterRange(// 
    0x11A, new SignedWordElement(0x11A, pcsAllowedCharge = new ModbusReadLongChannel("PcsAllowedCharge", this).unit("kW").multiplier(2)), new SignedWordElement(0x11B, pcsAllowedDischarge = new ModbusReadLongChannel("PcsAllowedDischarge", this).unit("kW").multiplier(2)), new // 
    UnsignedWordElement(// 
    0x11C, batteryState = // 
    new ModbusReadLongChannel("BatteryState", this).label(0, // 
    "Initial").label(1, // 
    STOP).label(2, // 
    "Starting").label(3, // 
    START).label(4, // 
    "Stopping").label(5, // 
    "Fault")), new // 
    UnsignedWordElement(// 
    0x11D, batteryMode = new ModbusReadLongChannel("BatteryMode", this).label(0, "Normal Mode")), new SignedWordElement(0x11E, batteryVoltage = new ModbusReadLongChannel("BatteryVoltage", this).unit("mV").multiplier(2)), new SignedWordElement(0x11F, batteryCurrent = new ModbusReadLongChannel("BatteryCurrent", this).unit("mA").multiplier(2)), new // 
    SignedWordElement(// 
    0x120, batteryPower = // 
    new ModbusReadLongChannel("BatteryPower", this).unit("W").multiplier(2)), new // 
    UnsignedWordElement(// 
    0x121, soc = new ModbusReadLongChannel("Soc", this).unit("%")), new // 
    UnsignedWordElement(// 
    0x122, allowedChargeCurrent = new ModbusReadLongChannel("AllowedChargeCurrent", this).unit(// 
    "mA").multiplier(// 
    2).negate()), new // 
    UnsignedWordElement(// 
    0x123, allowedDischargeCurrent = new ModbusReadLongChannel("AllowedDischargeCurrent", this).unit("mA").multiplier(2)), new // 
    UnsignedWordElement(// 
    0x124, allowedCharge = new ModbusReadLongChannel("AllowedCharge", this).unit("W").multiplier(2).negate()), new // 
    UnsignedWordElement(// 
    0x125, allowedDischarge = new ModbusReadLongChannel("AllowedDischarge", this).unit("W").multiplier(2)), new // 
    SignedDoublewordElement(// 
    0x126, batteryChargeEnergy = new ModbusReadLongChannel("BatteryChargeEnergy", this).unit("kWh")).wordorder(WordOrder.LSWMSW), new // 
    SignedDoublewordElement(// 
    0x128, batteryDischargeEnergy = new ModbusReadLongChannel("BatteryDischargeEnergy", this).unit("kWh")).wordorder(WordOrder.LSWMSW), new // 
    UnsignedWordElement(// 
    0x12A, batteryOperationStatus = new StatusBitChannel("BatteryOperationStatus", this).label(1, // 
    "Battery group 1 operating").label(2, // 
    "Battery group 2 operating").label(4, // 
    "Battery group 3 operating").label(8, "Battery group 4 operating")), new // 
    UnsignedWordElement(// 
    0x12B, batteryHighestVoltage = new ModbusReadLongChannel("BatteryHighestVoltage", this).unit("mV")), new // 
    UnsignedWordElement(// 
    0x12C, batteryLowestVoltage = new ModbusReadLongChannel("BatteryLowestVoltage", this).unit("mV")), new // 
    SignedWordElement(// 
    0x12D, batteryHighestTemperature = new ModbusReadLongChannel("BatteryHighestTemperature", this).unit("�C")), new // 
    SignedWordElement(// 
    0x12E, batteryLowestTemperature = new ModbusReadLongChannel("BatteryLowestTemperature", this).unit("�C")), new // 
    UnsignedWordElement(// 
    0x12F, batteryStopRequest = new ModbusReadLongChannel("BatteryStopRequest", this)), new // 
    UnsignedWordElement(// 
    0x130, // 
    new ModbusBitWrappingChannel("BatteryAlarm1", this, this.thingState).warningBit(0, // 
    WarningEss.NormalChargingOverCurrent).warningBit(1, // 
    WarningEss.CharginigCurrentOverLimit).warningBit(2, // 
    WarningEss.DischargingCurrentOverLimit).warningBit(3, // 
    WarningEss.NormalHighVoltage).warningBit(4, // 
    WarningEss.NormalLowVoltage).warningBit(5, // 
    WarningEss.AbnormalVoltageVariation).warningBit(6, // 
    WarningEss.NormalHighTemperature).warningBit(7, // 
    WarningEss.NormalLowTemperature).warningBit(8, // 
    WarningEss.AbnormalTemperatureVariation).warningBit(9, // 
    WarningEss.SeriousHighVoltage).warningBit(10, // 
    WarningEss.SeriousLowVoltage).warningBit(11, // 
    WarningEss.SeriousLowTemperature).warningBit(12, // 
    WarningEss.ChargingSeriousOverCurrent).warningBit(13, // 
    WarningEss.DischargingSeriousOverCurrent).warningBit(14, // 
    WarningEss.AbnormalCapacityAlarm)), new // 
    UnsignedWordElement(// 
    0x131, // 
    new ModbusBitWrappingChannel("BatteryAlarm2", this, this.thingState).warningBit(0, // 
    WarningEss.EEPROMParameterFailure).warningBit(1, WarningEss.SwitchOfInsideCombinedCabinet).warningBit(5, WarningEss.ShouldNotBeConnectedToGridDueToTheDCSideCondition).warningBit(7, // 
    WarningEss.EmergencyStopRequireFromSystemController)), new // 
    UnsignedWordElement(// 
    0x132, // 
    new ModbusBitWrappingChannel("BatteryAlarm3", this, this.thingState).warningBit(0, // 
    WarningEss.BatteryGroup1EnableAndNotConnectedToGrid).warningBit(1, // 
    WarningEss.BatteryGroup2EnableAndNotConnectedToGrid).warningBit(2, // 
    WarningEss.BatteryGroup3EnableAndNotConnectedToGrid).warningBit(3, // 
    WarningEss.BatteryGroup4EnableAndNotConnectedToGrid)), new // 
    UnsignedWordElement(// 
    0x133, // 
    new ModbusBitWrappingChannel("BatteryAlarm4", this, this.thingState).warningBit(0, WarningEss.TheIsolationSwitchOfBatteryGroup1Open).warningBit(1, WarningEss.TheIsolationSwitchOfBatteryGroup2Open).warningBit(2, WarningEss.TheIsolationSwitchOfBatteryGroup3Open).warningBit(3, // 
    WarningEss.TheIsolationSwitchOfBatteryGroup4Open)), // 
    new DummyElement(0x134), new UnsignedWordElement(0x135, // 
    new ModbusBitWrappingChannel("BatteryAlarm6", this, this.thingState).warningBit(0, // 
    WarningEss.BalancingSamplingFailureOfBatteryGroup1).warningBit(1, // 
    WarningEss.BalancingSamplingFailureOfBatteryGroup2).warningBit(2, // 
    WarningEss.BalancingSamplingFailureOfBatteryGroup3).warningBit(3, // 
    WarningEss.BalancingSamplingFailureOfBatteryGroup4)), new // 
    UnsignedWordElement(// 
    0x136, // 
    new ModbusBitWrappingChannel("BatteryAlarm7", this, this.thingState).warningBit(0, // 
    WarningEss.BalancingControlFailureOfBatteryGroup1).warningBit(1, // 
    WarningEss.BalancingControlFailureOfBatteryGroup2).warningBit(2, // 
    WarningEss.BalancingControlFailureOfBatteryGroup3).warningBit(3, // 
    WarningEss.BalancingControlFailureOfBatteryGroup4)), new // 
    UnsignedWordElement(// 
    0x137, // 
    new ModbusBitWrappingChannel("BatteryFault1", this, this.thingState).faultBit(0, // 
    FaultEss.NoEnableBateryGroupOrUsableBatteryGroup).faultBit(1, // 
    FaultEss.NormalLeakageOfBatteryGroup).faultBit(2, // 
    FaultEss.SeriousLeakageOfBatteryGroup).faultBit(3, // 
    FaultEss.BatteryStartFailure).faultBit(4, // 
    FaultEss.BatteryStopFailure).faultBit(5, // 
    FaultEss.InterruptionOfCANCommunicationBetweenBatteryGroupAndController).faultBit(10, // 
    FaultEss.EmergencyStopAbnormalOfAuxiliaryCollector).faultBit(11, // 
    FaultEss.LeakageSelfDetectionOnNegative).faultBit(12, // 
    FaultEss.LeakageSelfDetectionOnPositive).faultBit(13, // 
    FaultEss.SelfDetectionFailureOnBattery)), new // 
    UnsignedWordElement(// 
    0x138, // 
    new ModbusBitWrappingChannel("BatteryFault2", this, this.thingState).faultBit(0, // 
    FaultEss.CANCommunicationInterruptionBetweenBatteryGroupAndGroup1).faultBit(1, // 
    FaultEss.CANCommunicationInterruptionBetweenBatteryGroupAndGroup2).faultBit(2, // 
    FaultEss.CANCommunicationInterruptionBetweenBatteryGroupAndGroup3).faultBit(3, // 
    FaultEss.CANCommunicationInterruptionBetweenBatteryGroupAndGroup4)), new // 
    UnsignedWordElement(// 
    0x139, // 
    new ModbusBitWrappingChannel("BatteryFault3", this, this.thingState).faultBit(0, // 
    FaultEss.MainContractorAbnormalInBatterySelfDetectGroup1).faultBit(1, // 
    FaultEss.MainContractorAbnormalInBatterySelfDetectGroup2).faultBit(2, // 
    FaultEss.MainContractorAbnormalInBatterySelfDetectGroup3).faultBit(3, // 
    FaultEss.MainContractorAbnormalInBatterySelfDetectGroup4)), new // 
    UnsignedWordElement(// 
    0x13A, // 
    new ModbusBitWrappingChannel("BatteryFault4", this, this.thingState).faultBit(0, // 
    FaultEss.PreChargeContractorAbnormalOnBatterySelfDetectGroup1).faultBit(1, // 
    FaultEss.PreChargeContractorAbnormalOnBatterySelfDetectGroup2).faultBit(2, // 
    FaultEss.PreChargeContractorAbnormalOnBatterySelfDetectGroup3).faultBit(3, // 
    FaultEss.PreChargeContractorAbnormalOnBatterySelfDetectGroup4)), new // 
    UnsignedWordElement(// 
    0x13B, // 
    new ModbusBitWrappingChannel("BatteryFault5", this, this.thingState).faultBit(0, // 
    FaultEss.MainContactFailureOnBatteryControlGroup1).faultBit(1, // 
    FaultEss.MainContactFailureOnBatteryControlGroup2).faultBit(2, // 
    FaultEss.MainContactFailureOnBatteryControlGroup3).faultBit(3, // 
    FaultEss.MainContactFailureOnBatteryControlGroup4)), new // 
    UnsignedWordElement(// 
    0x13C, // 
    new ModbusBitWrappingChannel("BatteryFault6", this, this.thingState).faultBit(0, // 
    FaultEss.PreChargeFailureOnBatteryControlGroup1).faultBit(1, // 
    FaultEss.PreChargeFailureOnBatteryControlGroup2).faultBit(2, // 
    FaultEss.PreChargeFailureOnBatteryControlGroup3).faultBit(3, // 
    FaultEss.PreChargeFailureOnBatteryControlGroup4)), new // 
    UnsignedWordElement(// 
    0x13D, // 
    new ModbusBitWrappingChannel("BatteryFault7", this, this.thingState)), new // 
    UnsignedWordElement(// 
    0x13E, // 
    new ModbusBitWrappingChannel("BatteryFault8", this, this.thingState)), // 
    new // 
    UnsignedWordElement(// 
    0x13F, // 
    new ModbusBitWrappingChannel("BatteryFault9", this, this.thingState).faultBit(2, // 
    FaultEss.SamplingCircuitAbnormalForBMU).faultBit(3, // 
    FaultEss.PowerCableDisconnectFailure).faultBit(4, // 
    FaultEss.SamplingCircuitDisconnectFailure).faultBit(6, // 
    FaultEss.CANDisconnectForMasterAndSlave).faultBit(9, // 
    FaultEss.SammplingCircuitFailure).faultBit(10, // 
    FaultEss.SingleBatteryFailure).faultBit(11, // 
    FaultEss.CircuitDetectionAbnormalForMainContactor).faultBit(12, // 
    FaultEss.CircuitDetectionAbnormalForMainContactorSecond).faultBit(13, // 
    FaultEss.CircuitDetectionAbnormalForFancontactor).faultBit(14, // 
    FaultEss.BMUPowerContactorCircuitDetectionAbnormal).faultBit(15, // 
    FaultEss.CentralContactorCircuitDetectionAbnormal)), new // 
    UnsignedWordElement(// 
    0x140, // 
    new ModbusBitWrappingChannel("BatteryFault10", this, this.thingState).faultBit(2, // 
    FaultEss.SeriousTemperatureFault).faultBit(3, // 
    FaultEss.CommunicationFaultForSystemController).faultBit(7, // 
    FaultEss.FrogAlarm).faultBit(8, // 
    FaultEss.FuseFault).faultBit(10, // 
    FaultEss.NormalLeakage).faultBit(11, // 
    FaultEss.SeriousLeakage).faultBit(12, // 
    FaultEss.CANDisconnectionBetweenBatteryGroupAndBatteryStack).faultBit(13, // 
    FaultEss.CentralContactorCircuitOpen).faultBit(14, // 
    FaultEss.BMUPowerContactorOpen)), new // 
    UnsignedWordElement(// 
    0x141, // 
    new ModbusBitWrappingChannel("BatteryFault11", this, this.thingState)), new // 
    UnsignedWordElement(// 
    0x142, // 
    new ModbusBitWrappingChannel("BatteryFault12", this, this.thingState)), new UnsignedWordElement(0x143, // 
    batteryFault13 = new StatusBitChannel("BatteryFault13", this)), new UnsignedWordElement(0x144, // 
    batteryFault14 = new StatusBitChannel("BatteryFault14", this)), new // 
    UnsignedWordElement(// 
    0x145, // 
    batteryGroupControlStatus = new StatusBitChannel("BatteryGroupControlStatus", this)), new UnsignedWordElement(0x146, // 
    errorLog1 = new StatusBitChannel("ErrorLog1", this)), new UnsignedWordElement(0x147, // 
    errorLog2 = new StatusBitChannel("ErrorLog2", this)), new UnsignedWordElement(0x148, // 
    errorLog3 = new StatusBitChannel("ErrorLog3", this)), new UnsignedWordElement(0x149, // 
    errorLog4 = new StatusBitChannel("ErrorLog4", this)), new UnsignedWordElement(0x14a, // 
    errorLog5 = new StatusBitChannel("ErrorLog5", this)), new UnsignedWordElement(0x14b, // 
    errorLog6 = new StatusBitChannel("ErrorLog6", this)), new UnsignedWordElement(0x14c, // 
    errorLog7 = new StatusBitChannel("ErrorLog7", this)), new UnsignedWordElement(0x14d, // 
    errorLog8 = new StatusBitChannel("ErrorLog8", this)), new UnsignedWordElement(0x14e, // 
    errorLog9 = new StatusBitChannel("ErrorLog9", this)), new UnsignedWordElement(0x14f, // 
    errorLog10 = new StatusBitChannel("ErrorLog10", this)), new UnsignedWordElement(0x150, // 
    errorLog11 = new StatusBitChannel("ErrorLog11", this)), new UnsignedWordElement(0x151, // 
    errorLog12 = new StatusBitChannel("ErrorLog12", this)), new UnsignedWordElement(0x152, // 
    errorLog13 = new StatusBitChannel("ErrorLog13", this)), new UnsignedWordElement(0x153, // 
    errorLog14 = new StatusBitChannel("ErrorLog14", this)), new UnsignedWordElement(0x154, // 
    errorLog15 = new StatusBitChannel("ErrorLog15", this)), new UnsignedWordElement(0x155, // 
    errorLog16 = new StatusBitChannel("ErrorLog16", this))), new // 
    WriteableModbusRegisterRange(// 
    0x200, new // 
    UnsignedWordElement(// 
    0x200, setWorkState = // 
    new ModbusWriteLongChannel("SetWorkState", this).label(0, // 
    STOP).label(1, START)), new // 
    UnsignedWordElement(// 
    0x201, setSystemErrorReset = new ModbusWriteLongChannel("SetSystemErrorReset", // 
    this).label(0, // 
    OFF).label(1, ON)), new // 
    UnsignedWordElement(// 
    0x202, setOperationMode = // 
    new ModbusWriteLongChannel("SetOperationMode", this).label(0, // 
    "P/Q Set point").label(1, "IAC / cosphi set point"))), new WriteableModbusRegisterRange(0x203, new // 
    SignedWordElement(// 
    0x203, setActivePower = // 
    new ModbusWriteLongChannel("SetActivePower", this).unit("W").multiplier(2))), new WriteableModbusRegisterRange(0x204, new // 
    SignedWordElement(// 
    0x204, setActivePowerL1 = // 
    new ModbusWriteLongChannel("SetActivePowerL1", this).unit("W").multiplier(2)), new // 
    SignedWordElement(// 
    0x205, setActivePowerL2 = // 
    new ModbusWriteLongChannel("SetActivePowerL2", this).unit("W").multiplier(2)), new // 
    SignedWordElement(// 
    0x206, setActivePowerL3 = // 
    new ModbusWriteLongChannel("SetActivePowerL3", this).unit("W").multiplier(2))), new WriteableModbusRegisterRange(0x207, new // 
    SignedWordElement(// 
    0x207, setReactivePower = // 
    new ModbusWriteLongChannel("SetReactivePower", this).unit("W").multiplier(2))), new WriteableModbusRegisterRange(0x208, new // 
    SignedWordElement(// 
    0x208, setReactivePowerL1 = // 
    new ModbusWriteLongChannel("SetReactivePowerL1", this).unit("W").multiplier(2)), new // 
    SignedWordElement(// 
    0x209, setReactivePowerL2 = // 
    new ModbusWriteLongChannel("SetReactivePowerL2", this).unit("W").multiplier(2)), new // 
    SignedWordElement(// 
    0x20A, setReactivePowerL3 = // 
    new ModbusWriteLongChannel("SetReactivePowerL3", this).unit("W").multiplier(2))));
    this.power = new SymmetricPowerImpl(100000, setActivePower, setReactivePower, getParent().getBridge());
    this.allowedChargeLimit = new PGreaterEqualLimitation(power);
    this.allowedChargeLimit.setP(this.allowedCharge.valueOptional().orElse(0L));
    this.batFullLimit = new NoPBetweenLimitation(power);
    this.power.addStaticLimitation(batFullLimit);
    this.allowedCharge.addChangeListener(new ChannelChangeListener() {

        @Override
        public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) {
            allowedChargeLimit.setP(allowedCharge.valueOptional().orElse(0L));
            if (allowedCharge.isValuePresent()) {
                if (allowedCharge.getValue() > -100) {
                    batFullLimit.setP(0L, 5000L);
                } else {
                    batFullLimit.setP(null, null);
                }
            }
        }
    });
    this.power.addStaticLimitation(this.allowedChargeLimit);
    this.allowedDischargeLimit = new PSmallerEqualLimitation(power);
    this.allowedDischargeLimit.setP(this.allowedDischarge.valueOptional().orElse(0L));
    this.batEmptyLimit = new NoPBetweenLimitation(power);
    this.power.addStaticLimitation(batEmptyLimit);
    this.allowedDischarge.addChangeListener(new ChannelChangeListener() {

        @Override
        public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) {
            allowedDischargeLimit.setP(allowedDischarge.valueOptional().orElse(0L));
            if (allowedDischarge.isValuePresent()) {
                if (allowedDischarge.getValue() < 100) {
                    batEmptyLimit.setP(-5000L, 0L);
                } else {
                    batEmptyLimit.setP(null, null);
                }
            }
        }
    });
    return protocol;
}
Also used : ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) WriteableModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.WriteableModbusRegisterRange) ReadChannel(io.openems.api.channel.ReadChannel) WriteChannel(io.openems.api.channel.WriteChannel) ConfigChannel(io.openems.api.channel.ConfigChannel) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) StatusBitChannel(io.openems.api.channel.StatusBitChannel) StaticValueChannel(io.openems.api.channel.StaticValueChannel) Channel(io.openems.api.channel.Channel) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) NoPBetweenLimitation(io.openems.core.utilities.power.symmetric.NoPBetweenLimitation) PGreaterEqualLimitation(io.openems.core.utilities.power.symmetric.PGreaterEqualLimitation) StatusBitChannel(io.openems.api.channel.StatusBitChannel) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) DummyElement(io.openems.impl.protocol.modbus.internal.DummyElement) SymmetricPowerImpl(io.openems.core.utilities.power.symmetric.SymmetricPowerImpl) UnsignedWordElement(io.openems.impl.protocol.modbus.internal.UnsignedWordElement) ChannelChangeListener(io.openems.api.channel.ChannelChangeListener) SignedWordElement(io.openems.impl.protocol.modbus.internal.SignedWordElement) ModbusProtocol(io.openems.impl.protocol.modbus.internal.ModbusProtocol) PSmallerEqualLimitation(io.openems.core.utilities.power.symmetric.PSmallerEqualLimitation)

Example 3 with SymmetricPowerImpl

use of io.openems.core.utilities.power.symmetric.SymmetricPowerImpl in project openems by OpenEMS.

the class FeneconCommercialEss method defineModbusProtocol.

/*
	 * Methods
	 */
@Override
protected ModbusProtocol defineModbusProtocol() throws ConfigException {
    ModbusProtocol protocol = new // 
    ModbusProtocol(new // 
    ModbusRegisterRange(// 
    0x0101, new // 
    UnsignedWordElement(// 
    0x0101, systemState = // 
    new ModbusReadLongChannel("SystemState", this).label(2, // 
    STOP).label(4, // 
    "PV-Charge").label(8, // 
    "Standby").label(16, // 
    START).label(32, // 
    FAULT).label(64, // 
    "Debug")), new // 
    UnsignedWordElement(// 
    0x0102, controlMode = // 
    new ModbusReadLongChannel("ControlMode", this).label(1, // 
    "Remote").label(2, // 
    "Local")), // WorkMode: RemoteDispatch
    new DummyElement(0x0103), new // 
    UnsignedWordElement(// 
    0x0104, batteryMaintenanceState = // 
    new ModbusReadLongChannel("BatteryMaintenanceState", this).label(0, // 
    OFF).label(1, // 
    ON)), new // 
    UnsignedWordElement(// 
    0x0105, inverterState = // 
    new ModbusReadLongChannel("InverterState", this).label(0, // 
    "Init").label(2, // 
    "Fault").label(4, // 
    STOP).label(8, // 
    STANDBY).label(16, // ,
    "Grid-Monitor").label(32, // 
    "Ready").label(64, // 
    START).label(128, // 
    "Debug")), new // 
    UnsignedWordElement(// 
    0x0106, gridMode = // 
    new ModbusReadLongChannel("GridMode", this).label(1, // 
    OFF_GRID).label(2, // 
    ON_GRID)), // 
    new DummyElement(0x0107), new // 
    UnsignedWordElement(// 
    0x0108, // 
    protocolVersion = new ModbusReadLongChannel("ProtocolVersion", this)), new // 
    UnsignedWordElement(// 
    0x0109, systemManufacturer = // 
    new ModbusReadLongChannel("SystemManufacturer", this).label(1, // 
    "BYD")), new // 
    UnsignedWordElement(// 
    0x010A, systemType = // 
    new ModbusReadLongChannel("SystemType", this).label(1, // 
    "CESS")), // 
    new DummyElement(0x010B, 0x010F), new // 
    UnsignedWordElement(// 
    0x0110, // 
    new ModbusBitWrappingChannel("SuggestiveInformation1", this, this.thingState).warningBit(2, // EmergencyStop
    WarningEss.EmergencyStop).warningBit(6, // KeyManualStop
    WarningEss.KeyManualStop)), new // 
    UnsignedWordElement(// 
    0x0111, // 
    new ModbusBitWrappingChannel("SuggestiveInformation2", this, this.thingState).warningBit(3, // Transformer
    WarningEss.TransformerPhaseBTemperatureSensorInvalidation).warningBit(12, // SD memory card
    WarningEss.SDMemoryCardInvalidation)), // 
    new DummyElement(0x0112, 0x0124), new // 
    UnsignedWordElement(// 
    0x0125, // 
    new ModbusBitWrappingChannel("SuggestiveInformation3", this, this.thingState).warningBit(0, // 
    WarningEss.InverterCommunicationAbnormity).warningBit(1, // 
    WarningEss.BatteryStackCommunicationAbnormity).warningBit(2, // 
    WarningEss.MultifunctionalAmmeterCommunicationAbnormity).warningBit(4, // 
    WarningEss.RemoteCommunicationAbnormity).warningBit(8, // 
    WarningEss.PVDC1CommunicationAbnormity).warningBit(9, // 
    WarningEss.PVDC2CommunicationAbnormity)), new // 
    UnsignedWordElement(// 
    0x0126, // 
    new ModbusBitWrappingChannel("SuggestiveInformation4", this, this.thingState).warningBit(3, // 
    WarningEss.TransformerSevereOvertemperature)), // 
    new DummyElement(0x0127, 0x014F), new // 
    UnsignedWordElement(// 
    0x0150, switchState = // 
    new StatusBitChannel("BatteryStringSwitchState", this).label(1, // 
    "Main contactor").label(2, // 
    "Precharge contactor").label(4, // 
    "FAN contactor").label(8, // 
    "BMU power supply relay").label(16, // 
    "Middle relay"))), // 
    new // 
    ModbusRegisterRange(// 
    0x0180, new // 
    UnsignedWordElement(// 
    0x0180, // 
    new ModbusBitWrappingChannel("Abnormity1", this, this.thingState).faultBit(0, // 
    FaultEss.DCPrechargeContactorCloseUnsuccessfully).faultBit(1, // 
    FaultEss.ACPrechargeContactorCloseUnsuccessfully).faultBit(2, // 
    FaultEss.ACMainContactorCloseUnsuccessfully).faultBit(3, // 
    FaultEss.DCElectricalBreaker1CloseUnsuccessfully).faultBit(4, // 
    FaultEss.DCMainContactorCloseUnsuccessfully).faultBit(5, // 
    FaultEss.ACBreakerTrip).faultBit(6, // 
    FaultEss.ACMainContactorOpenWhenRunning).faultBit(7, // 
    FaultEss.DCMainContactorOpenWhenRunning).faultBit(8, // 
    FaultEss.ACMainContactorOpenUnsuccessfully).faultBit(9, // 
    FaultEss.DCElectricalBreaker1OpenUnsuccessfully).faultBit(10, // 
    FaultEss.DCMainContactorOpenUnsuccessfully).faultBit(11, // 
    FaultEss.HardwarePDPFault).faultBit(12, // 
    FaultEss.MasterStopSuddenly)), new DummyElement(0x0181), new // 
    UnsignedWordElement(// 
    0x0182, // 
    new ModbusBitWrappingChannel("Abnormity2", this, this.thingState).faultBit(0, // 
    FaultEss.DCShortCircuitProtection).faultBit(1, // 
    FaultEss.DCOvervoltageProtection).faultBit(2, // 
    FaultEss.DCUndervoltageProtection).faultBit(3, // 
    FaultEss.DCInverseNoConnectionProtection).faultBit(4, // 
    FaultEss.DCDisconnectionProtection).faultBit(5, // 
    FaultEss.CommutingVoltageAbnormityProtection).faultBit(6, // 
    FaultEss.DCOvercurrentProtection).faultBit(7, // 
    FaultEss.Phase1PeakCurrentOverLimitProtection).faultBit(8, // 
    FaultEss.Phase2PeakCurrentOverLimitProtection).faultBit(9, // 
    FaultEss.Phase3PeakCurrentOverLimitProtection).faultBit(10, // 
    FaultEss.Phase1GridVoltageSamplingInvalidation).faultBit(11, // 
    FaultEss.Phase2VirtualCurrentOverLimitProtection).faultBit(12, // 
    FaultEss.Phase3VirtualCurrentOverLimitProtection).faultBit(13, // 
    FaultEss.Phase1GridVoltageSamplingInvalidation2).faultBit(14, // 
    FaultEss.Phase2ridVoltageSamplingInvalidation).faultBit(15, // 
    FaultEss.Phase3GridVoltageSamplingInvalidation)), new // 
    UnsignedWordElement(// 
    0x0183, // 
    new ModbusBitWrappingChannel("Abnormity3", this, this.thingState).faultBit(0, // 
    FaultEss.Phase1InvertVoltageSamplingInvalidation).faultBit(1, // 
    FaultEss.Phase2InvertVoltageSamplingInvalidation).faultBit(2, // 
    FaultEss.Phase3InvertVoltageSamplingInvalidation).faultBit(3, // 
    FaultEss.ACCurrentSamplingInvalidation).faultBit(4, // 
    FaultEss.DCCurrentSamplingInvalidation).faultBit(5, // 
    FaultEss.Phase1OvertemperatureProtection).faultBit(6, // 
    FaultEss.Phase2OvertemperatureProtection).faultBit(7, // 
    FaultEss.Phase3OvertemperatureProtection).faultBit(8, // 
    FaultEss.Phase1TemperatureSamplingInvalidation).faultBit(9, // 
    FaultEss.Phase2TemperatureSamplingInvalidation).faultBit(10, // 
    FaultEss.Phase3TemperatureSamplingInvalidation).faultBit(11, // 
    FaultEss.Phase1PrechargeUnmetProtection).faultBit(12, // 
    FaultEss.Phase2PrechargeUnmetProtection).faultBit(13, // 
    FaultEss.Phase3PrechargeUnmetProtection).faultBit(14, // 
    FaultEss.UnadaptablePhaseSequenceErrorProtection).faultBit(15, // 
    FaultEss.DSPProtection)), new // 
    UnsignedWordElement(// 
    0x0184, // 
    new ModbusBitWrappingChannel("Abnormity4", this, this.thingState).faultBit(0, // 
    FaultEss.Phase1GridVoltageSevereOvervoltageProtection).faultBit(1, // 
    FaultEss.Phase1GridVoltageGeneralOvervoltageProtection).faultBit(2, // 
    FaultEss.Phase2GridVoltageSevereOvervoltageProtection).faultBit(3, // 
    FaultEss.Phase2GridVoltageGeneralOvervoltageProtection).faultBit(4, // 
    FaultEss.Phase3GridVoltageSevereOvervoltageProtection).faultBit(5, // 
    FaultEss.Phase3GridVoltageGeneralOvervoltageProtection).faultBit(6, // 
    FaultEss.Phase1GridVoltageSevereUndervoltageProtection).faultBit(7, // 
    FaultEss.Phase1GridVoltageGeneralUndervoltageProtection).faultBit(8, // 
    FaultEss.Phase2GridVoltageSevereUndervoltageProtection).faultBit(9, // 
    FaultEss.Phase2GridVoltageGeneralUndervoltageProtection).faultBit(10, // 
    FaultEss.Phase3GridVoltageSevereUndervoltageProtection).faultBit(11, // 
    FaultEss.Phase3GridVoltageGeneralUndervoltageProtection).faultBit(12, // 
    FaultEss.SevereOverfrequncyProtection).faultBit(13, // 
    FaultEss.GeneralOverfrequncyProtection).faultBit(14, // 
    FaultEss.SevereUnderfrequncyProtection).faultBit(15, // 
    FaultEss.GeneralsUnderfrequncyProtection)), new // 
    UnsignedWordElement(// 
    0x0185, // 
    new ModbusBitWrappingChannel("Abnormity5", this, this.thingState).faultBit(0, // 
    FaultEss.Phase1Gridloss).faultBit(1, // 
    FaultEss.Phase2Gridloss).faultBit(2, // 
    FaultEss.Phase3Gridloss).faultBit(3, // 
    FaultEss.IslandingProtection).faultBit(4, // 
    FaultEss.Phase1UnderVoltageRideThrough).faultBit(5, // 
    FaultEss.Phase2UnderVoltageRideThrough).faultBit(6, // 
    FaultEss.Phase3UnderVoltageRideThrough).faultBit(7, // 
    FaultEss.Phase1InverterVoltageSevereOvervoltageProtection).faultBit(8, // 
    FaultEss.Phase1InverterVoltageGeneralOvervoltageProtection).faultBit(9, // 
    FaultEss.Phase2InverterVoltageSevereOvervoltageProtection).faultBit(10, // 
    FaultEss.Phase2InverterVoltageGeneralOvervoltageProtection).faultBit(11, // 
    FaultEss.Phase3InverterVoltageSevereOvervoltageProtection).faultBit(12, // 
    FaultEss.Phase3InverterVoltageGeneralOvervoltageProtection).faultBit(13, // 
    FaultEss.InverterPeakVoltageHighProtectionCauseByACDisconnect)), new // 
    UnsignedWordElement(// 
    0x0186, // 
    new ModbusBitWrappingChannel("SuggestiveInformation5", this, this.thingState).warningBit(0, // 
    WarningEss.DCPrechargeContactorInspectionAbnormity).warningBit(1, // 
    WarningEss.DCBreaker1InspectionAbnormity).warningBit(2, // 
    WarningEss.DCBreaker2InspectionAbnormity).warningBit(3, // 
    WarningEss.ACPrechargeContactorInspectionAbnormity).warningBit(4, // 
    WarningEss.ACMainontactorInspectionAbnormity).warningBit(5, // 
    WarningEss.ACBreakerInspectionAbnormity).warningBit(6, // 
    WarningEss.DCBreaker1CloseUnsuccessfully).warningBit(7, // 
    WarningEss.DCBreaker2CloseUnsuccessfully).warningBit(8, // 
    WarningEss.ControlSignalCloseAbnormallyInspectedBySystem).warningBit(9, // 
    WarningEss.ControlSignalOpenAbnormallyInspectedBySystem).warningBit(10, // 
    WarningEss.NeutralWireContactorCloseUnsuccessfully).warningBit(11, // 
    WarningEss.NeutralWireContactorOpenUnsuccessfully).warningBit(12, // 
    WarningEss.WorkDoorOpen).warningBit(13, // 
    WarningEss.Emergency1Stop).warningBit(14, // 
    WarningEss.ACBreakerCloseUnsuccessfully).warningBit(15, // 
    WarningEss.ControlSwitchStop)), new // 
    UnsignedWordElement(// 
    0x0187, // 
    new ModbusBitWrappingChannel("SuggestiveInformation6", this, this.thingState).warningBit(0, // 
    WarningEss.GeneralOverload).warningBit(1, // 
    WarningEss.SevereOverload).warningBit(2, // 
    WarningEss.BatteryCurrentOverLimit).warningBit(3, // 
    WarningEss.PowerDecreaseCausedByOvertemperature).warningBit(4, // 
    WarningEss.InverterGeneralOvertemperature).warningBit(5, // 
    WarningEss.ACThreePhaseCurrentUnbalance).warningBit(6, // 
    WarningEss.RestoreFactorySettingUnsuccessfully).warningBit(7, // 
    WarningEss.PoleBoardInvalidation).warningBit(8, // 
    WarningEss.SelfInspectionFailed).warningBit(9, // 
    WarningEss.ReceiveBMSFaultAndStop).warningBit(10, // 
    WarningEss.RefrigerationEquipmentinvalidation).warningBit(11, // 
    WarningEss.LargeTemperatureDifferenceAmongIGBTThreePhases).warningBit(12, // 
    WarningEss.EEPROMParametersOverRange).warningBit(13, // 
    WarningEss.EEPROMParametersBackupFailed).warningBit(14, // 
    WarningEss.DCBreakerCloseunsuccessfully)), // 
    new // 
    UnsignedWordElement(// 
    0x0188, // 
    new ModbusBitWrappingChannel("SuggestiveInformation7", this, this.thingState).warningBit(0, // 
    WarningEss.CommunicationBetweenInverterAndBSMUDisconnected).warningBit(1, // 
    WarningEss.CommunicationBetweenInverterAndMasterDisconnected).warningBit(2, // 
    WarningEss.CommunicationBetweenInverterAndUCDisconnected).warningBit(3, // 
    WarningEss.BMSStartOvertimeControlledByPCS).warningBit(4, // 
    WarningEss.BMSStopOvertimeControlledByPCS).warningBit(5, // 
    WarningEss.SyncSignalInvalidation).warningBit(6, // 
    WarningEss.SyncSignalContinuousCaputureFault).warningBit(7, WarningEss.SyncSignalSeveralTimesCaputureFault))), new // 
    ModbusRegisterRange(// 
    0x0200, new // 
    SignedWordElement(// 
    0x0200, batteryVoltage = new ModbusReadLongChannel("BatteryVoltage", this).unit("mV").multiplier(2)), new // 
    SignedWordElement(// 
    0x0201, batteryCurrent = new ModbusReadLongChannel("BatteryCurrent", this).unit("mA").multiplier(2)), new // 
    SignedWordElement(// 
    0x0202, batteryPower = new ModbusReadLongChannel("BatteryPower", this).unit("W").multiplier(2)), // 
    new DummyElement(0x0203, 0x0207), new // 
    UnsignedDoublewordElement(// 
    0x0208, acChargeEnergy = new ModbusReadLongChannel("AcChargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new // 
    UnsignedDoublewordElement(// 
    0x020A, acDischargeEnergy = new ModbusReadLongChannel("AcDischargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new DummyElement(0x020C, 0x020F), new // 
    SignedWordElement(// 
    0x0210, gridActivePower = new ModbusReadLongChannel("GridActivePower", this).unit("W").multiplier(2)), new // 
    SignedWordElement(// 
    0x0211, reactivePower = new ModbusReadLongChannel("ReactivePower", this).unit("var").multiplier(2)), new // 
    UnsignedWordElement(// 
    0x0212, apparentPower = new ModbusReadLongChannel("ApparentPower", this).unit("VA").multiplier(2)), new // 
    SignedWordElement(// 
    0x0213, currentL1 = new ModbusReadLongChannel("CurrentL1", this).unit("mA").multiplier(2)), new // 
    SignedWordElement(// 
    0x0214, currentL2 = new ModbusReadLongChannel("CurrentL2", this).unit("mA").multiplier(2)), new // 
    SignedWordElement(// 
    0x0215, currentL3 = new ModbusReadLongChannel("CurrentL3", this).unit("mA").multiplier(2)), // 
    new DummyElement(0x0216, 0x218), new // 
    UnsignedWordElement(// 
    0x0219, voltageL1 = new ModbusReadLongChannel("VoltageL1", this).unit("mV").multiplier(2)), new // 
    UnsignedWordElement(// 
    0x021A, voltageL2 = new ModbusReadLongChannel("VoltageL2", this).unit("mV").multiplier(2)), new // 
    UnsignedWordElement(// 
    0x021B, voltageL3 = new ModbusReadLongChannel("VoltageL3", this).unit("mV").multiplier(2)), new // 
    UnsignedWordElement(// 
    0x021C, frequency = new ModbusReadLongChannel("Frequency", this).unit("mHZ").multiplier(1))), new // 
    ModbusRegisterRange(// 
    0x0222, new // 
    UnsignedWordElement(// 
    0x0222, inverterVoltageL1 = new ModbusReadLongChannel("InverterVoltageL1", this).unit("mV").multiplier(// 
    2)), new // 
    UnsignedWordElement(// 
    0x0223, inverterVoltageL2 = new ModbusReadLongChannel("InverterVoltageL2", this).unit("mV").multiplier(// 
    2)), new // 
    UnsignedWordElement(// 
    0x0224, inverterVoltageL3 = new ModbusReadLongChannel("InverterVoltageL3", this).unit("mV").multiplier(// 
    2)), new // 
    UnsignedWordElement(// 
    0x0225, inverterCurrentL1 = new ModbusReadLongChannel("InverterCurrentL1", this).unit("mA").multiplier(// 
    2)), new // 
    UnsignedWordElement(// 
    0x0226, inverterCurrentL2 = new ModbusReadLongChannel("InverterCurrentL2", this).unit("mA").multiplier(// 
    2)), new // 
    UnsignedWordElement(// 
    0x0227, inverterCurrentL3 = new ModbusReadLongChannel("InverterCurrentL3", this).unit("mA").multiplier(// 
    2)), new // 
    SignedWordElement(// 
    0x0228, // 
    activePower = new ModbusReadLongChannel("ActivePower", this).unit("W").multiplier(2)), new DummyElement(0x0229, 0x022F), new // 
    SignedWordElement(// 
    0x0230, allowedCharge = new ModbusReadLongChannel("AllowedCharge", this).unit("W").multiplier(// 
    2)), new // 
    UnsignedWordElement(// 
    0x0231, allowedDischarge = new ModbusReadLongChannel("AllowedDischarge", this).unit("W").multiplier(// 
    2)), new // 
    UnsignedWordElement(// 
    0x0232, allowedApparent = new ModbusReadLongChannel("AllowedApparent", this).unit("VA").multiplier(// 
    2)), new DummyElement(0x0233, 0x23F), new // 
    SignedWordElement(// 
    0x0240, // 
    ipmTemperatureL1 = new ModbusReadLongChannel("IpmTemperatureL1", this).unit("�C")), new // 
    SignedWordElement(// 
    0x0241, // 
    ipmTemperatureL2 = new ModbusReadLongChannel("IpmTemperatureL2", this).unit("�C")), new // 
    SignedWordElement(// 
    0x0242, // 
    ipmTemperatureL3 = new ModbusReadLongChannel("IpmTemperatureL3", this).unit("�C")), new DummyElement(0x0243, 0x0248), new // 
    SignedWordElement(// 
    0x0249, transformerTemperatureL2 = new ModbusReadLongChannel("TransformerTemperatureL2", this).unit("�C"))), new // 
    WriteableModbusRegisterRange(// 
    0x0500, new // 
    UnsignedWordElement(// 
    0x0500, setWorkState = // 
    new ModbusWriteLongChannel("SetWorkState", this).label(4, // 
    STOP).label(32, // 
    STANDBY).label(64, START))), new // 
    WriteableModbusRegisterRange(// 
    0x0501, new // 
    SignedWordElement(// 
    0x0501, setActivePower = new ModbusWriteLongChannel("SetActivePower", this).unit("W").multiplier(2).minWriteChannel(allowedCharge).maxWriteChannel(allowedDischarge)), new // 
    SignedWordElement(// 
    0x0502, setReactivePower = new ModbusWriteLongChannel("SetReactivePower", this).unit("var").multiplier(2).minWriteChannel(allowedCharge).maxWriteChannel(allowedDischarge))), new // 
    ModbusRegisterRange(// 
    0x1402, new UnsignedWordElement(0x1402, soc = new ModbusReadLongChannel("Soc", this).unit("%").interval(0, 100)), new UnsignedWordElement(0x1403, soh = new ModbusReadLongChannel("Soh", this).unit("%").interval(0, 100)), new UnsignedWordElement(0x1404, batteryCellAverageTemperature = new ModbusReadLongChannel("BatteryCellAverageTemperature", this).unit("°C"))), new // 
    ModbusRegisterRange(// 
    0x1500, new UnsignedWordElement(0x1500, batteryCell1Voltage = new ModbusReadLongChannel("Cell1Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1501, batteryCell2Voltage = new ModbusReadLongChannel("Cell2Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1502, batteryCell3Voltage = new ModbusReadLongChannel("Cell3Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1503, batteryCell4Voltage = new ModbusReadLongChannel("Cell4Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1504, batteryCell5Voltage = new ModbusReadLongChannel("Cell5Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1505, batteryCell6Voltage = new ModbusReadLongChannel("Cell6Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1506, batteryCell7Voltage = new ModbusReadLongChannel("Cell7Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1507, batteryCell8Voltage = new ModbusReadLongChannel("Cell8Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1508, batteryCell9Voltage = new ModbusReadLongChannel("Cell9Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1509, batteryCell10Voltage = new ModbusReadLongChannel("Cell10Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x150A, batteryCell11Voltage = new ModbusReadLongChannel("Cell11Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x150B, batteryCell12Voltage = new ModbusReadLongChannel("Cell12Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x150C, batteryCell13Voltage = new ModbusReadLongChannel("Cell13Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x150D, batteryCell14Voltage = new ModbusReadLongChannel("Cell14Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x150E, batteryCell15Voltage = new ModbusReadLongChannel("Cell15Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x150F, batteryCell16Voltage = new ModbusReadLongChannel("Cell16Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1510, batteryCell17Voltage = new ModbusReadLongChannel("Cell17Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1511, batteryCell18Voltage = new ModbusReadLongChannel("Cell18Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1512, batteryCell19Voltage = new ModbusReadLongChannel("Cell19Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1513, batteryCell20Voltage = new ModbusReadLongChannel("Cell20Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1514, batteryCell21Voltage = new ModbusReadLongChannel("Cell21Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1515, batteryCell22Voltage = new ModbusReadLongChannel("Cell22Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1516, batteryCell23Voltage = new ModbusReadLongChannel("Cell23Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1517, batteryCell24Voltage = new ModbusReadLongChannel("Cell24Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1518, batteryCell25Voltage = new ModbusReadLongChannel("Cell25Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1519, batteryCell26Voltage = new ModbusReadLongChannel("Cell26Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x151A, batteryCell27Voltage = new ModbusReadLongChannel("Cell27Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x151B, batteryCell28Voltage = new ModbusReadLongChannel("Cell28Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x151C, batteryCell29Voltage = new ModbusReadLongChannel("Cell29Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x151D, batteryCell30Voltage = new ModbusReadLongChannel("Cell30Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x151E, batteryCell31Voltage = new ModbusReadLongChannel("Cell31Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x151F, batteryCell32Voltage = new ModbusReadLongChannel("Cell32Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1520, batteryCell33Voltage = new ModbusReadLongChannel("Cell33Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1521, batteryCell34Voltage = new ModbusReadLongChannel("Cell34Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1522, batteryCell35Voltage = new ModbusReadLongChannel("Cell35Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1523, batteryCell36Voltage = new ModbusReadLongChannel("Cell36Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1524, batteryCell37Voltage = new ModbusReadLongChannel("Cell37Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1525, batteryCell38Voltage = new ModbusReadLongChannel("Cell38Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1526, batteryCell39Voltage = new ModbusReadLongChannel("Cell39Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1527, batteryCell40Voltage = new ModbusReadLongChannel("Cell40Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1528, batteryCell41Voltage = new ModbusReadLongChannel("Cell41Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1529, batteryCell42Voltage = new ModbusReadLongChannel("Cell42Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x152A, batteryCell43Voltage = new ModbusReadLongChannel("Cell43Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x152B, batteryCell44Voltage = new ModbusReadLongChannel("Cell44Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x152C, batteryCell45Voltage = new ModbusReadLongChannel("Cell45Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x152D, batteryCell46Voltage = new ModbusReadLongChannel("Cell46Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x152E, batteryCell47Voltage = new ModbusReadLongChannel("Cell47Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x152F, batteryCell48Voltage = new ModbusReadLongChannel("Cell48Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1530, batteryCell49Voltage = new ModbusReadLongChannel("Cell49Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1531, batteryCell50Voltage = new ModbusReadLongChannel("Cell50Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1532, batteryCell51Voltage = new ModbusReadLongChannel("Cell51Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1533, batteryCell52Voltage = new ModbusReadLongChannel("Cell52Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1534, batteryCell53Voltage = new ModbusReadLongChannel("Cell53Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1535, batteryCell54Voltage = new ModbusReadLongChannel("Cell54Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1536, batteryCell55Voltage = new ModbusReadLongChannel("Cell55Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1537, batteryCell56Voltage = new ModbusReadLongChannel("Cell56Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1538, batteryCell57Voltage = new ModbusReadLongChannel("Cell57Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1539, batteryCell58Voltage = new ModbusReadLongChannel("Cell58Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x153A, batteryCell59Voltage = new ModbusReadLongChannel("Cell59Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x153B, batteryCell60Voltage = new ModbusReadLongChannel("Cell60Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x153C, batteryCell61Voltage = new ModbusReadLongChannel("Cell61Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x153D, batteryCell62Voltage = new ModbusReadLongChannel("Cell62Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x153E, batteryCell63Voltage = new ModbusReadLongChannel("Cell63Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x153F, batteryCell64Voltage = new ModbusReadLongChannel("Cell64Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1540, batteryCell65Voltage = new ModbusReadLongChannel("Cell65Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1541, batteryCell66Voltage = new ModbusReadLongChannel("Cell66Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1542, batteryCell67Voltage = new ModbusReadLongChannel("Cell67Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1543, batteryCell68Voltage = new ModbusReadLongChannel("Cell68Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1544, batteryCell69Voltage = new ModbusReadLongChannel("Cell69Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1545, batteryCell70Voltage = new ModbusReadLongChannel("Cell70Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1546, batteryCell71Voltage = new ModbusReadLongChannel("Cell71Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1547, batteryCell72Voltage = new ModbusReadLongChannel("Cell72Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1548, batteryCell73Voltage = new ModbusReadLongChannel("Cell73Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1549, batteryCell74Voltage = new ModbusReadLongChannel("Cell74Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x154A, batteryCell75Voltage = new ModbusReadLongChannel("Cell75Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x154B, batteryCell76Voltage = new ModbusReadLongChannel("Cell76Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x154C, batteryCell77Voltage = new ModbusReadLongChannel("Cell77Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x154D, batteryCell78Voltage = new ModbusReadLongChannel("Cell78Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x154E, batteryCell79Voltage = new ModbusReadLongChannel("Cell79Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x154F, batteryCell80Voltage = new ModbusReadLongChannel("Cell80Voltage", this).unit("mV"))), new // 
    ModbusRegisterRange(// 
    0x1550, new UnsignedWordElement(0x1550, batteryCell81Voltage = new ModbusReadLongChannel("Cell81Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1551, batteryCell82Voltage = new ModbusReadLongChannel("Cell82Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1552, batteryCell83Voltage = new ModbusReadLongChannel("Cell83Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1553, batteryCell84Voltage = new ModbusReadLongChannel("Cell84Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1554, batteryCell85Voltage = new ModbusReadLongChannel("Cell85Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1555, batteryCell86Voltage = new ModbusReadLongChannel("Cell86Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1556, batteryCell87Voltage = new ModbusReadLongChannel("Cell87Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1557, batteryCell88Voltage = new ModbusReadLongChannel("Cell88Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1558, batteryCell89Voltage = new ModbusReadLongChannel("Cell89Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1559, batteryCell90Voltage = new ModbusReadLongChannel("Cell90Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x155A, batteryCell91Voltage = new ModbusReadLongChannel("Cell91Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x155B, batteryCell92Voltage = new ModbusReadLongChannel("Cell92Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x155C, batteryCell93Voltage = new ModbusReadLongChannel("Cell93Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x155D, batteryCell94Voltage = new ModbusReadLongChannel("Cell94Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x155E, batteryCell95Voltage = new ModbusReadLongChannel("Cell95Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x155F, batteryCell96Voltage = new ModbusReadLongChannel("Cell96Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1560, batteryCell97Voltage = new ModbusReadLongChannel("Cell97Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1561, batteryCell98Voltage = new ModbusReadLongChannel("Cell98Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1562, batteryCell99Voltage = new ModbusReadLongChannel("Cell99Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1563, batteryCell100Voltage = new ModbusReadLongChannel("Cell100Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1564, batteryCell101Voltage = new ModbusReadLongChannel("Cell101Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1565, batteryCell102Voltage = new ModbusReadLongChannel("Cell102Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1566, batteryCell103Voltage = new ModbusReadLongChannel("Cell103Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1567, batteryCell104Voltage = new ModbusReadLongChannel("Cell104Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1568, batteryCell105Voltage = new ModbusReadLongChannel("Cell105Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1569, batteryCell106Voltage = new ModbusReadLongChannel("Cell106Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x156A, batteryCell107Voltage = new ModbusReadLongChannel("Cell107Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x156B, batteryCell108Voltage = new ModbusReadLongChannel("Cell108Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x156C, batteryCell109Voltage = new ModbusReadLongChannel("Cell109Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x156D, batteryCell110Voltage = new ModbusReadLongChannel("Cell110Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x156E, batteryCell111Voltage = new ModbusReadLongChannel("Cell111Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x156F, batteryCell112Voltage = new ModbusReadLongChannel("Cell112Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1570, batteryCell113Voltage = new ModbusReadLongChannel("Cell113Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1571, batteryCell114Voltage = new ModbusReadLongChannel("Cell114Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1572, batteryCell115Voltage = new ModbusReadLongChannel("Cell115Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1573, batteryCell116Voltage = new ModbusReadLongChannel("Cell116Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1574, batteryCell117Voltage = new ModbusReadLongChannel("Cell117Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1575, batteryCell118Voltage = new ModbusReadLongChannel("Cell18Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1576, batteryCell119Voltage = new ModbusReadLongChannel("Cell119Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1577, batteryCell120Voltage = new ModbusReadLongChannel("Cell120Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1578, batteryCell121Voltage = new ModbusReadLongChannel("Cell121Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1579, batteryCell122Voltage = new ModbusReadLongChannel("Cell122Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x157A, batteryCell123Voltage = new ModbusReadLongChannel("Cell123Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x157B, batteryCell124Voltage = new ModbusReadLongChannel("Cell124Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x157C, batteryCell125Voltage = new ModbusReadLongChannel("Cell125Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x157D, batteryCell126Voltage = new ModbusReadLongChannel("Cell126Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x157E, batteryCell127Voltage = new ModbusReadLongChannel("Cell127Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x157F, batteryCell128Voltage = new ModbusReadLongChannel("Cell128Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1580, batteryCell129Voltage = new ModbusReadLongChannel("Cell129Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1581, batteryCell130Voltage = new ModbusReadLongChannel("Cell130Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1582, batteryCell131Voltage = new ModbusReadLongChannel("Cell131Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1583, batteryCell132Voltage = new ModbusReadLongChannel("Cell132Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1584, batteryCell133Voltage = new ModbusReadLongChannel("Cell133Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1585, batteryCell134Voltage = new ModbusReadLongChannel("Cell134Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1586, batteryCell135Voltage = new ModbusReadLongChannel("Cell135Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1587, batteryCell136Voltage = new ModbusReadLongChannel("Cell136Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1588, batteryCell137Voltage = new ModbusReadLongChannel("Cell137Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1589, batteryCell138Voltage = new ModbusReadLongChannel("Cell138Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x158A, batteryCell139Voltage = new ModbusReadLongChannel("Cell139Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x158B, batteryCell140Voltage = new ModbusReadLongChannel("Cell140Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x158C, batteryCell141Voltage = new ModbusReadLongChannel("Cell141Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x158D, batteryCell142Voltage = new ModbusReadLongChannel("Cell142Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x158E, batteryCell143Voltage = new ModbusReadLongChannel("Cell143Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x158F, batteryCell144Voltage = new ModbusReadLongChannel("Cell144Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1590, batteryCell145Voltage = new ModbusReadLongChannel("Cell145Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1591, batteryCell146Voltage = new ModbusReadLongChannel("Cell146Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1592, batteryCell147Voltage = new ModbusReadLongChannel("Cell147Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1593, batteryCell148Voltage = new ModbusReadLongChannel("Cell148Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1594, batteryCell149Voltage = new ModbusReadLongChannel("Cell149Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1595, batteryCell150Voltage = new ModbusReadLongChannel("Cell150Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1596, batteryCell151Voltage = new ModbusReadLongChannel("Cell151Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1597, batteryCell152Voltage = new ModbusReadLongChannel("Cell152Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1598, batteryCell153Voltage = new ModbusReadLongChannel("Cell153Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x1599, batteryCell154Voltage = new ModbusReadLongChannel("Cell154Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x159A, batteryCell155Voltage = new ModbusReadLongChannel("Cell155Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x159B, batteryCell156Voltage = new ModbusReadLongChannel("Cell156Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x159C, batteryCell157Voltage = new ModbusReadLongChannel("Cell157Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x159D, batteryCell158Voltage = new ModbusReadLongChannel("Cell158Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x159E, batteryCell159Voltage = new ModbusReadLongChannel("Cell159Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x159F, batteryCell160Voltage = new ModbusReadLongChannel("Cell160Voltage", this).unit("mV"))), // 
    new // 
    ModbusRegisterRange(// 
    0x15A0, new UnsignedWordElement(0x15A0, batteryCell161Voltage = new ModbusReadLongChannel("Cell161Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15A1, batteryCell162Voltage = new ModbusReadLongChannel("Cell162Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15A2, batteryCell163Voltage = new ModbusReadLongChannel("Cell163Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15A3, batteryCell164Voltage = new ModbusReadLongChannel("Cell164Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15A4, batteryCell165Voltage = new ModbusReadLongChannel("Cell165Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15A5, batteryCell166Voltage = new ModbusReadLongChannel("Cell166Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15A6, batteryCell167Voltage = new ModbusReadLongChannel("Cell167Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15A7, batteryCell168Voltage = new ModbusReadLongChannel("Cell168Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15A8, batteryCell169Voltage = new ModbusReadLongChannel("Cell169Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15A9, batteryCell170Voltage = new ModbusReadLongChannel("Cell170Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15AA, batteryCell171Voltage = new ModbusReadLongChannel("Cell171Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15AB, batteryCell172Voltage = new ModbusReadLongChannel("Cell172Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15AC, batteryCell173Voltage = new ModbusReadLongChannel("Cell173Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15AD, batteryCell174Voltage = new ModbusReadLongChannel("Cell174Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15AE, batteryCell175Voltage = new ModbusReadLongChannel("Cell175Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15AF, batteryCell176Voltage = new ModbusReadLongChannel("Cell176Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15B0, batteryCell177Voltage = new ModbusReadLongChannel("Cell177Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15B1, batteryCell178Voltage = new ModbusReadLongChannel("Cell178Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15B2, batteryCell179Voltage = new ModbusReadLongChannel("Cell179Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15B3, batteryCell180Voltage = new ModbusReadLongChannel("Cell180Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15B4, batteryCell181Voltage = new ModbusReadLongChannel("Cell181Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15B5, batteryCell182Voltage = new ModbusReadLongChannel("Cell182Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15B6, batteryCell183Voltage = new ModbusReadLongChannel("Cell183Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15B7, batteryCell184Voltage = new ModbusReadLongChannel("Cell184Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15B8, batteryCell185Voltage = new ModbusReadLongChannel("Cell185Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15B9, batteryCell186Voltage = new ModbusReadLongChannel("Cell186Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15BA, batteryCell187Voltage = new ModbusReadLongChannel("Cell187Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15BB, batteryCell188Voltage = new ModbusReadLongChannel("Cell188Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15BC, batteryCell189Voltage = new ModbusReadLongChannel("Cell189Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15BD, batteryCell190Voltage = new ModbusReadLongChannel("Cell190Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15BE, batteryCell191Voltage = new ModbusReadLongChannel("Cell191Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15BF, batteryCell192Voltage = new ModbusReadLongChannel("Cell192Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15C0, batteryCell193Voltage = new ModbusReadLongChannel("Cell193Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15C1, batteryCell194Voltage = new ModbusReadLongChannel("Cell194Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15C2, batteryCell195Voltage = new ModbusReadLongChannel("Cell195Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15C3, batteryCell196Voltage = new ModbusReadLongChannel("Cell196Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15C4, batteryCell197Voltage = new ModbusReadLongChannel("Cell197Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15C5, batteryCell198Voltage = new ModbusReadLongChannel("Cell198Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15C6, batteryCell199Voltage = new ModbusReadLongChannel("Cell199Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15C7, batteryCell200Voltage = new ModbusReadLongChannel("Cell200Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15C8, batteryCell201Voltage = new ModbusReadLongChannel("Cell201Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15C9, batteryCell202Voltage = new ModbusReadLongChannel("Cell202Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15CA, batteryCell203Voltage = new ModbusReadLongChannel("Cell203Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15CB, batteryCell204Voltage = new ModbusReadLongChannel("Cell204Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15CC, batteryCell205Voltage = new ModbusReadLongChannel("Cell205Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15CD, batteryCell206Voltage = new ModbusReadLongChannel("Cell206Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15CE, batteryCell207Voltage = new ModbusReadLongChannel("Cell207Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15CF, batteryCell208Voltage = new ModbusReadLongChannel("Cell208Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15D0, batteryCell209Voltage = new ModbusReadLongChannel("Cell209Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15D1, batteryCell210Voltage = new ModbusReadLongChannel("Cell210Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15D2, batteryCell211Voltage = new ModbusReadLongChannel("Cell211Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15D3, batteryCell212Voltage = new ModbusReadLongChannel("Cell212Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15D4, batteryCell213Voltage = new ModbusReadLongChannel("Cell213Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15D5, batteryCell214Voltage = new ModbusReadLongChannel("Cell214Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15D6, batteryCell215Voltage = new ModbusReadLongChannel("Cell215Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15D7, batteryCell216Voltage = new ModbusReadLongChannel("Cell216Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15D8, batteryCell217Voltage = new ModbusReadLongChannel("Cell217Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15D9, batteryCell218Voltage = new ModbusReadLongChannel("Cell218Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15DA, batteryCell219Voltage = new ModbusReadLongChannel("Cell219Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15DB, batteryCell220Voltage = new ModbusReadLongChannel("Cell220Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15DC, batteryCell221Voltage = new ModbusReadLongChannel("Cell221Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15DD, batteryCell222Voltage = new ModbusReadLongChannel("Cell222Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15DE, batteryCell223Voltage = new ModbusReadLongChannel("Cell223Voltage", this).unit("mV")), // 
    new UnsignedWordElement(0x15DF, batteryCell224Voltage = new ModbusReadLongChannel("Cell224Voltage", this).unit("mV"))));
    this.power = new SymmetricPowerImpl(40000, setActivePower, setReactivePower, getParent().getBridge());
    this.qMinLimit = new QGreaterEqualLimitation(power);
    this.qMinLimit.setQ(-10000L);
    this.power.addStaticLimitation(qMinLimit);
    this.qMaxLimit = new QSmallerEqualLimitation(power);
    this.qMaxLimit.setQ(10000L);
    this.power.addStaticLimitation(qMaxLimit);
    this.allowedApparentLimit = new SMaxLimitation(power);
    this.allowedApparentLimit.setSMax(allowedApparent.valueOptional().orElse(0L), 0L, 0L);
    this.allowedApparent.addChangeListener(new ChannelChangeListener() {

        @Override
        public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) {
            allowedApparentLimit.setSMax(allowedApparent.valueOptional().orElse(0L), 0L, 0L);
        }
    });
    this.power.addStaticLimitation(this.allowedApparentLimit);
    this.allowedChargeLimit = new PGreaterEqualLimitation(power);
    this.allowedChargeLimit.setP(this.allowedCharge.valueOptional().orElse(0L));
    this.allowedCharge.addChangeListener(new ChannelChangeListener() {

        @Override
        public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) {
            allowedChargeLimit.setP(allowedCharge.valueOptional().orElse(0L));
        }
    });
    this.power.addStaticLimitation(this.allowedChargeLimit);
    this.allowedDischargeLimit = new PSmallerEqualLimitation(power);
    this.allowedDischargeLimit.setP(this.allowedDischarge.valueOptional().orElse(0L));
    this.allowedDischarge.addChangeListener(new ChannelChangeListener() {

        @Override
        public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) {
            allowedDischargeLimit.setP(allowedDischarge.valueOptional().orElse(0L));
        }
    });
    return protocol;
}
Also used : QGreaterEqualLimitation(io.openems.core.utilities.power.symmetric.QGreaterEqualLimitation) ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) QSmallerEqualLimitation(io.openems.core.utilities.power.symmetric.QSmallerEqualLimitation) ReadChannel(io.openems.api.channel.ReadChannel) ConfigChannel(io.openems.api.channel.ConfigChannel) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) StatusBitChannel(io.openems.api.channel.StatusBitChannel) StaticValueChannel(io.openems.api.channel.StaticValueChannel) Channel(io.openems.api.channel.Channel) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) SMaxLimitation(io.openems.core.utilities.power.symmetric.SMaxLimitation) PGreaterEqualLimitation(io.openems.core.utilities.power.symmetric.PGreaterEqualLimitation) StatusBitChannel(io.openems.api.channel.StatusBitChannel) DummyElement(io.openems.impl.protocol.modbus.internal.DummyElement) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) SymmetricPowerImpl(io.openems.core.utilities.power.symmetric.SymmetricPowerImpl) UnsignedWordElement(io.openems.impl.protocol.modbus.internal.UnsignedWordElement) ChannelChangeListener(io.openems.api.channel.ChannelChangeListener) SignedWordElement(io.openems.impl.protocol.modbus.internal.SignedWordElement) ModbusProtocol(io.openems.impl.protocol.modbus.internal.ModbusProtocol) PSmallerEqualLimitation(io.openems.core.utilities.power.symmetric.PSmallerEqualLimitation)

Example 4 with SymmetricPowerImpl

use of io.openems.core.utilities.power.symmetric.SymmetricPowerImpl in project openems by OpenEMS.

the class FeneconMiniEss method defineModbusProtocol.

/*
	 * Methods
	 */
@Override
protected ModbusProtocol defineModbusProtocol() throws ConfigException {
    ModbusProtocol protokol = new ModbusProtocol(new // 
    ModbusRegisterRange(// 
    100, new // 
    UnsignedWordElement(// 
    100, systemState = // 
    new ModbusReadLongChannel("SystemState", this).label(0, // 
    STANDBY).label(1, // 
    "Start Off-Grid").label(2, // 
    START).label(3, // 
    FAULT).label(4, "Off-grid PV")), new // 
    UnsignedWordElement(// 
    101, controlMode = // 
    new ModbusReadLongChannel("ControlMode", this).label(1, // 
    "Remote").label(2, // 
    "Local")), // 
    new DummyElement(102, 103), new // 
    UnsignedDoublewordElement(// 
    104, totalBatteryChargeEnergy = new ModbusReadLongChannel("TotalBatteryChargeEnergy", this).unit(// 
    "Wh")), new // 
    UnsignedDoublewordElement(// 
    106, totalBatteryDischargeEnergy = new ModbusReadLongChannel("TotalBatteryDischargeEnergy", this).unit(// 
    "Wh")), new // 
    UnsignedWordElement(// 
    108, batteryGroupState = // 
    new ModbusReadLongChannel("BatteryGroupState", this).label(0, // 
    "Initial").label(1, // 
    "Stop").label(2, // 
    "Starting").label(3, // 
    "Running").label(4, // 
    "Stopping").label(5, "Fail")), new // 
    UnsignedWordElement(// 
    109, soc = new ModbusReadLongChannel("Soc", this).unit("%").interval(0, 100)), new // 
    UnsignedWordElement(// 
    110, batteryVoltage = new ModbusReadLongChannel("BatteryVoltage", this).unit("mV").multiplier(2)), new // 
    SignedWordElement(// 
    111, batteryCurrent = new ModbusReadLongChannel("BatteryCurrent", this).unit("mA").multiplier(2)), new // 
    SignedWordElement(// 
    112, batteryPower = new ModbusReadLongChannel("BatteryPower", this).unit("W")), new // 
    UnsignedWordElement(// 
    113, // 
    new ModbusBitWrappingChannel("BatteryGroupAlarm", this, this.thingState).warningBit(0, // 
    WarningEss.FailTheSystemShouldBeStopped).warningBit(1, // 
    WarningEss.CommonLowVoltageAlarm).warningBit(2, // 
    WarningEss.CommonHighVoltageAlarm).warningBit(3, // 
    WarningEss.ChargingOverCurrentAlarm).warningBit(4, // 
    WarningEss.DischargingOverCurrentAlarm).warningBit(5, // 
    WarningEss.OverTemperatureAlarm).warningBit(6, // 
    WarningEss.InteralCommunicationAbnormal)), new // 
    UnsignedWordElement(// 
    114, pcsOperationState = new ModbusReadLongChannel("PcsOperationState", this).label(0, // 
    "Self-checking").label(1, // 
    "Standby").label(2, // 
    "Off grid PV").label(3, // 
    "Off grid").label(4, // 
    ON_GRID).label(5, // 
    "Fail").label(6, // 
    "bypass 1").label(7, "bypass 2")), // 
    new DummyElement(115, 117), new // 
    SignedWordElement(// 
    118, current = new ModbusReadLongChannel("Current", this).unit("mA").multiplier(2)), new DummyElement(119, 120), new // 
    UnsignedWordElement(// 
    121, voltage = new ModbusReadLongChannel("Voltage", this).unit("mV").multiplier(2)), new DummyElement(122, 123), new // 
    SignedWordElement(// 
    124, activePower = new ModbusReadLongChannel("ActivePower", this).unit("W")), new DummyElement(125, 126), new // 
    SignedWordElement(// 
    127, reactivePower = new ModbusReadLongChannel("ReactivePower", this).unit("var")), new DummyElement(128, 130), new // 
    UnsignedWordElement(// 
    131, frequency = new ModbusReadLongChannel("Frequency", this).unit("mHz").multiplier(1)), new DummyElement(132, 133), new // 
    UnsignedWordElement(// 
    134, phaseAllowedApparent = new ModbusReadLongChannel("PhaseAllowedApparentPower", this).unit("VA")), new DummyElement(135, 140), new // 
    UnsignedWordElement(// 
    141, allowedCharge = new ModbusReadLongChannel("AllowedCharge", this).unit("W").negate()), new // 
    UnsignedWordElement(// 
    142, allowedDischarge = new ModbusReadLongChannel("AllowedDischarge", this).unit("W")), new DummyElement(143, 149), new // 
    UnsignedWordElement(// 
    150, // 
    new ModbusBitWrappingChannel("PcsAlarm1", this, this.thingState).warningBit(0, // 
    WarningEss.GridUndervoltage).warningBit(1, // 
    WarningEss.GridOvervoltage).warningBit(2, // 
    WarningEss.GridUnderFrequency).warningBit(3, // 
    WarningEss.GridOverFrequency).warningBit(4, // 
    WarningEss.GridPowerSupplyOff).warningBit(5, // 
    WarningEss.GridConditionUnmeet).warningBit(6, // 
    WarningEss.DCUnderVoltage).warningBit(7, // 
    WarningEss.InputOverResistance).warningBit(8, // 
    WarningEss.CombinationError).warningBit(9, // 
    WarningEss.CommWithInverterError).warningBit(10, // 
    WarningEss.TmeError)), new UnsignedWordElement(151, // 
    new ModbusBitWrappingChannel("PcsAlarm2", this, this.thingState)), new UnsignedWordElement(152, // 
    new ModbusBitWrappingChannel("PcsFault1", this, this.thingState).faultBit(0, // 
    FaultEss.ControlCurrentOverload100Percent).faultBit(1, // 
    FaultEss.ControlCurrentOverload110Percent).faultBit(2, // 
    FaultEss.ControlCurrentOverload150Percent).faultBit(3, // 
    FaultEss.ControlCurrentOverload200Percent).faultBit(4, // 
    FaultEss.ControlCurrentOverload120Percent).faultBit(5, // 
    FaultEss.ControlCurrentOverload300Percent).faultBit(6, // 
    FaultEss.ControlTransientLoad300Percent).faultBit(7, // 
    FaultEss.GridOverCurrent).faultBit(8, // 
    FaultEss.LockingWaveformTooManyTimes).faultBit(9, // 
    FaultEss.InverterVoltageZeroDriftError).faultBit(10, // 
    FaultEss.GridVoltageZeroDriftError).faultBit(11, // 
    FaultEss.ControlCurrentZeroDriftError).faultBit(12, // 
    FaultEss.InverterCurrentZeroDriftError).faultBit(13, // 
    FaultEss.GridCurrentZeroDriftError).faultBit(14, // 
    FaultEss.PDPProtection).faultBit(15, // 
    FaultEss.HardwareControlCurrentProtection)), new // 
    UnsignedWordElement(// 
    153, // 
    new ModbusBitWrappingChannel("PcsFault2", this, this.thingState).faultBit(0, // 
    FaultEss.HardwareACVoltProtection).faultBit(1, // 
    FaultEss.HardwareDCCurrentProtection).faultBit(2, // 
    FaultEss.HardwareTemperatureProtection).faultBit(3, // 
    FaultEss.NoCapturingSignal).faultBit(4, // 
    FaultEss.DCOvervoltage).faultBit(5, // 
    FaultEss.DCDisconnected).faultBit(6, // 
    FaultEss.InverterUndervoltage).faultBit(7, // 
    FaultEss.InverterOvervoltage).faultBit(8, // 
    FaultEss.CurrentSensorFail).faultBit(9, // 
    FaultEss.VoltageSensorFail).faultBit(10, // 
    FaultEss.PowerUncontrollable).faultBit(11, // 
    FaultEss.CurrentUncontrollable).faultBit(12, // 
    FaultEss.FanError).faultBit(13, // 
    FaultEss.PhaseLack).faultBit(14, // 
    FaultEss.InverterRelayFault).faultBit(15, // 
    FaultEss.GridRelayFault)), new // 
    UnsignedWordElement(// 
    154, // 
    new ModbusBitWrappingChannel("PcsFault3", this, this.thingState).faultBit(0, // 
    FaultEss.ControlPanelOvertemp).faultBit(1, // 
    FaultEss.PowerPanelOvertemp).faultBit(2, // 
    FaultEss.DCInputOvercurrent).faultBit(3, // 
    FaultEss.CapacitorOvertemp).faultBit(4, // 
    FaultEss.RadiatorOvertemp).faultBit(5, // 
    FaultEss.TransformerOvertemp).faultBit(6, // 
    FaultEss.CombinationCommError).faultBit(7, // 
    FaultEss.EEPROMError).faultBit(8, // 
    FaultEss.LoadCurrentZeroDriftError).faultBit(9, // 
    FaultEss.CurrentLimitRError).faultBit(10, // 
    FaultEss.PhaseSyncError).faultBit(11, // 
    FaultEss.ExternalPVCurrentZeroDriftError).faultBit(12, // 
    FaultEss.ExternalGridCurrentZeroDriftError))), new // 
    WriteableModbusRegisterRange(// 
    200, new UnsignedWordElement(200, setWorkState = // 
    new ModbusWriteLongChannel("SetWorkState", this).label(0, // 
    "Local control").label(1, // "Remote control on grid starting"
    START).label(2, // 
    "Remote control off grid starting").label(3, // 
    STOP).label(4, "Emergency Stop"))), new // 
    WriteableModbusRegisterRange(// 
    201, new SignedWordElement(201, // 
    setActivePower = new ModbusWriteLongChannel("SetActivePower", this).unit("W")), new SignedWordElement(202, // 
    setReactivePower = new ModbusWriteLongChannel("SetReactivePower", this).unit("Var"))), new // 
    WriteableModbusRegisterRange(// 
    9014, new UnsignedWordElement(9014, rtcYear = new ModbusWriteLongChannel("Year", this)), new UnsignedWordElement(9015, rtcMonth = new ModbusWriteLongChannel("Month", this)), new UnsignedWordElement(9016, rtcDay = new ModbusWriteLongChannel("Day", this)), new UnsignedWordElement(9017, rtcHour = new ModbusWriteLongChannel("Hour", this)), new UnsignedWordElement(9018, rtcMinute = new ModbusWriteLongChannel("Minute", this)), new UnsignedWordElement(9019, rtcSecond = new ModbusWriteLongChannel("Second", this))), new WriteableModbusRegisterRange(30558, new UnsignedWordElement(30558, setSetupMode = new ModbusWriteLongChannel("SetSetupMode", this).label(0, EssNature.OFF).label(1, EssNature.ON))), new WriteableModbusRegisterRange(30559, new UnsignedWordElement(30559, setPcsMode = // 
    new ModbusWriteLongChannel("SetPcsMode", this).label(0, // 
    "Emergency").label(1, // 
    "ConsumersPeakPattern").label(2, // 
    "Economic").label(3, // 
    "Eco").label(4, // 
    "Debug").label(5, // 
    "SmoothPv").label(6, "Remote"))), new ModbusRegisterRange(30157, new UnsignedWordElement(30157, setupMode = // 
    new ModbusReadLongChannel("SetupMode", this).label(0, // 
    EssNature.OFF).label(1, EssNature.ON)), new UnsignedWordElement(30158, pcsMode = // 
    new ModbusReadLongChannel("PcsMode", this).label(0, // 
    "Emergency").label(1, // 
    "ConsumersPeakPattern").label(2, // 
    "Economic").label(3, // 
    "Eco").label(4, // 
    "Debug").label(5, // 
    "SmoothPv").label(6, "Remote"))));
    gridMode = new FunctionalReadChannel<Long>("GridMode", this, (channels) -> {
        ReadChannel<Long> state = channels[0];
        try {
            if (state.value() == 1L) {
                return 0L;
            } else {
                return 1L;
            }
        } catch (InvalidValueException e) {
            return null;
        }
    }, systemState).label(0L, OFF_GRID).label(1L, ON_GRID);
    apparentPower = new FunctionalReadChannel<Long>("ApparentPower", this, (channels) -> {
        ReadChannel<Long> activePower = channels[0];
        ReadChannel<Long> reactivePower = channels[1];
        try {
            return ControllerUtils.calculateApparentPower(activePower.value(), reactivePower.value());
        } catch (InvalidValueException e) {
            log.error("failed to calculate apparentPower. some value is missing.", e);
        }
        return 0l;
    }, activePower, reactivePower);
    this.power = new SymmetricPowerImpl(3000, setActivePower, setReactivePower, getParent().getBridge());
    this.allowedApparentLimit = new SMaxLimitation(power);
    this.allowedApparentLimit.setSMax(phaseAllowedApparent.valueOptional().orElse(0L) * 3, 0L, 0L);
    this.phaseAllowedApparent.addChangeListener(new ChannelChangeListener() {

        @Override
        public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) {
            allowedApparentLimit.setSMax(phaseAllowedApparent.valueOptional().orElse(0L) * 3, 0L, 0L);
        }
    });
    this.power.addStaticLimitation(this.allowedApparentLimit);
    this.allowedChargeLimit = new PGreaterEqualLimitation(power);
    this.allowedChargeLimit.setP(this.allowedCharge.valueOptional().orElse(0L));
    this.allowedCharge.addChangeListener(new ChannelChangeListener() {

        @Override
        public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) {
            allowedChargeLimit.setP(allowedCharge.valueOptional().orElse(0L));
        }
    });
    this.power.addStaticLimitation(this.allowedChargeLimit);
    this.allowedDischargeLimit = new PSmallerEqualLimitation(power);
    this.allowedDischargeLimit.setP(this.allowedDischarge.valueOptional().orElse(0L));
    this.allowedDischarge.addChangeListener(new ChannelChangeListener() {

        @Override
        public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) {
            allowedDischargeLimit.setP(allowedDischarge.valueOptional().orElse(0L));
        }
    });
    return protokol;
}
Also used : ReadChannel(io.openems.api.channel.ReadChannel) ModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.ModbusRegisterRange) ThingInfo(io.openems.api.doc.ThingInfo) PGreaterEqualLimitation(io.openems.core.utilities.power.symmetric.PGreaterEqualLimitation) LoggerFactory(org.slf4j.LoggerFactory) WriteChannel(io.openems.api.channel.WriteChannel) PSmallerEqualLimitation(io.openems.core.utilities.power.symmetric.PSmallerEqualLimitation) ConfigChannel(io.openems.api.channel.ConfigChannel) EssNature(io.openems.api.device.nature.ess.EssNature) ChannelChangeListener(io.openems.api.channel.ChannelChangeListener) ModbusProtocol(io.openems.impl.protocol.modbus.internal.ModbusProtocol) SMaxLimitation(io.openems.core.utilities.power.symmetric.SMaxLimitation) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) UnsignedWordElement(io.openems.impl.protocol.modbus.internal.UnsignedWordElement) WriteableModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.WriteableModbusRegisterRange) RealTimeClockNature(io.openems.api.device.nature.realtimeclock.RealTimeClockNature) SymmetricPowerImpl(io.openems.core.utilities.power.symmetric.SymmetricPowerImpl) Logger(org.slf4j.Logger) SymmetricEssNature(io.openems.api.device.nature.ess.SymmetricEssNature) StatusBitChannel(io.openems.api.channel.StatusBitChannel) ConfigException(io.openems.api.exception.ConfigException) FunctionalReadChannel(io.openems.api.channel.FunctionalReadChannel) UnsignedDoublewordElement(io.openems.impl.protocol.modbus.internal.UnsignedDoublewordElement) ControllerUtils(io.openems.core.utilities.ControllerUtils) Device(io.openems.api.device.Device) ThingStateChannels(io.openems.api.channel.thingstate.ThingStateChannels) InvalidValueException(io.openems.api.exception.InvalidValueException) SignedWordElement(io.openems.impl.protocol.modbus.internal.SignedWordElement) ModbusDeviceNature(io.openems.impl.protocol.modbus.ModbusDeviceNature) Optional(java.util.Optional) StaticValueChannel(io.openems.api.channel.StaticValueChannel) DummyElement(io.openems.impl.protocol.modbus.internal.DummyElement) Channel(io.openems.api.channel.Channel) SMaxLimitation(io.openems.core.utilities.power.symmetric.SMaxLimitation) ReadChannel(io.openems.api.channel.ReadChannel) FunctionalReadChannel(io.openems.api.channel.FunctionalReadChannel) InvalidValueException(io.openems.api.exception.InvalidValueException) PGreaterEqualLimitation(io.openems.core.utilities.power.symmetric.PGreaterEqualLimitation) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) UnsignedWordElement(io.openems.impl.protocol.modbus.internal.UnsignedWordElement) ChannelChangeListener(io.openems.api.channel.ChannelChangeListener) SignedWordElement(io.openems.impl.protocol.modbus.internal.SignedWordElement) PSmallerEqualLimitation(io.openems.core.utilities.power.symmetric.PSmallerEqualLimitation) ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) WriteableModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.WriteableModbusRegisterRange) ReadChannel(io.openems.api.channel.ReadChannel) WriteChannel(io.openems.api.channel.WriteChannel) ConfigChannel(io.openems.api.channel.ConfigChannel) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) StatusBitChannel(io.openems.api.channel.StatusBitChannel) FunctionalReadChannel(io.openems.api.channel.FunctionalReadChannel) StaticValueChannel(io.openems.api.channel.StaticValueChannel) Channel(io.openems.api.channel.Channel) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) DummyElement(io.openems.impl.protocol.modbus.internal.DummyElement) SymmetricPowerImpl(io.openems.core.utilities.power.symmetric.SymmetricPowerImpl) UnsignedDoublewordElement(io.openems.impl.protocol.modbus.internal.UnsignedDoublewordElement) ModbusProtocol(io.openems.impl.protocol.modbus.internal.ModbusProtocol) ModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.ModbusRegisterRange) WriteableModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.WriteableModbusRegisterRange)

Example 5 with SymmetricPowerImpl

use of io.openems.core.utilities.power.symmetric.SymmetricPowerImpl in project openems by OpenEMS.

the class SunnyIsland6Ess method defineModbusProtocol.

@Override
protected ModbusProtocol defineModbusProtocol() throws ConfigException {
    ModbusProtocol protokol = new ModbusProtocol(new ModbusRegisterRange(30201, new UnsignedDoublewordElement(30201, systemState = new ModbusReadLongChannel("SystemState", this).label(35, "Fehler").label(303, "Aus").label(307, "OK").label(455, "Warnung")), new UnsignedDoublewordElement(30203, maxPower = new ModbusReadLongChannel("MaxPower", this).unit("W"))), new // 
    ModbusRegisterRange(// 
    30775, new // 
    SignedDoublewordElement(// 
    30775, activePower = new ModbusReadLongChannel("ActivePower", this).unit("W")), new DummyElement(30777, 30802), new // 
    UnsignedDoublewordElement(// 
    30803, frequency = new ModbusReadLongChannel("Frequency", this).unit("mHz").multiplier(1)), new // 
    SignedDoublewordElement(// 
    30805, reactivePower = new ModbusReadLongChannel("ReactivePower", this).unit("var").negate())), new // 
    ModbusRegisterRange(// 
    30843, new // 
    SignedDoublewordElement(// 
    30843, batteryCurrent = new ModbusReadLongChannel("BatteryCurrent", this).unit("mA")), new // 
    UnsignedDoublewordElement(// 
    30845, soc = new ModbusReadLongChannel("Soc", this).unit("%").interval(0, 100)), new DummyElement(30847, 30848), new // 
    SignedDoublewordElement(// 
    30849, batteryTemperature = new ModbusReadLongChannel("BatteryTemperature", this).unit("°C").multiplier(-1)), new // 
    UnsignedDoublewordElement(// 
    30851, batteryVoltage = new ModbusReadLongChannel("BatteryVoltage", this).unit("mV").multiplier(1))), new ModbusRegisterRange(40189, new // 
    UnsignedDoublewordElement(// 
    40189, allowedCharge = new ModbusReadLongChannel("AllowedCharge", this).unit("W").negate()), new // 
    UnsignedDoublewordElement(// 
    40191, allowedDischarge = new ModbusReadLongChannel("AllowedDischarge", this).unit("W"))), new // 
    WriteableModbusRegisterRange(// 
    40149, new SignedDoublewordElement(40149, // 
    setActivePower = new ModbusWriteLongChannel("SetActivePower", this).unit("W")), new UnsignedDoublewordElement(40151, setControlMode = new ModbusWriteLongChannel("SetControlMode", this).label(802, START).label(803, // 
    STOP)), new SignedDoublewordElement(40153, setReactivePower = new ModbusWriteLongChannel("SetReactivePower", this).unit("Var"))), new WriteableModbusRegisterRange(40705, new UnsignedDoublewordElement(40705, // 
    minSocPowerOn = new ModbusWriteLongChannel("MinSocPowerOn", this)), new UnsignedDoublewordElement(40707, // 
    minSocPowerOff = new ModbusWriteLongChannel("MinSocPowerOff", this))), new WriteableModbusRegisterRange(41187, new UnsignedDoublewordElement(41187, meterSetting = new ModbusWriteLongChannel("MeterSetting", this).label(3053, "SMA Energy Meter").label(3547, "Wechselrichter"))));
    this.power = new SymmetricPowerImpl(40000, setActivePower, setReactivePower, getParent().getBridge());
    this.allowedChargeLimit = new PGreaterEqualLimitation(power);
    this.allowedChargeLimit.setP(this.allowedCharge.valueOptional().orElse(0L));
    this.allowedCharge.addChangeListener(new ChannelChangeListener() {

        @Override
        public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) {
            allowedChargeLimit.setP(allowedCharge.valueOptional().orElse(0L));
        }
    });
    this.power.addStaticLimitation(this.allowedChargeLimit);
    this.allowedDischargeLimit = new PSmallerEqualLimitation(power);
    this.allowedDischargeLimit.setP(this.allowedDischarge.valueOptional().orElse(0L));
    this.allowedDischarge.addChangeListener(new ChannelChangeListener() {

        @Override
        public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) {
            allowedDischargeLimit.setP(allowedDischarge.valueOptional().orElse(0L));
        }
    });
    return protokol;
}
Also used : ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) WriteableModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.WriteableModbusRegisterRange) ReadChannel(io.openems.api.channel.ReadChannel) WriteChannel(io.openems.api.channel.WriteChannel) ConfigChannel(io.openems.api.channel.ConfigChannel) ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) StaticValueChannel(io.openems.api.channel.StaticValueChannel) Channel(io.openems.api.channel.Channel) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) PGreaterEqualLimitation(io.openems.core.utilities.power.symmetric.PGreaterEqualLimitation) DummyElement(io.openems.impl.protocol.modbus.internal.DummyElement) SymmetricPowerImpl(io.openems.core.utilities.power.symmetric.SymmetricPowerImpl) SignedDoublewordElement(io.openems.impl.protocol.modbus.internal.SignedDoublewordElement) UnsignedDoublewordElement(io.openems.impl.protocol.modbus.internal.UnsignedDoublewordElement) ChannelChangeListener(io.openems.api.channel.ChannelChangeListener) ModbusProtocol(io.openems.impl.protocol.modbus.internal.ModbusProtocol) PSmallerEqualLimitation(io.openems.core.utilities.power.symmetric.PSmallerEqualLimitation) ModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.ModbusRegisterRange) WriteableModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.WriteableModbusRegisterRange)

Aggregations

SymmetricPowerImpl (io.openems.core.utilities.power.symmetric.SymmetricPowerImpl)5 ModbusReadLongChannel (io.openems.impl.protocol.modbus.ModbusReadLongChannel)5 DummyElement (io.openems.impl.protocol.modbus.internal.DummyElement)5 ModbusProtocol (io.openems.impl.protocol.modbus.internal.ModbusProtocol)5 Channel (io.openems.api.channel.Channel)4 ChannelChangeListener (io.openems.api.channel.ChannelChangeListener)4 ConfigChannel (io.openems.api.channel.ConfigChannel)4 ReadChannel (io.openems.api.channel.ReadChannel)4 StaticValueChannel (io.openems.api.channel.StaticValueChannel)4 PGreaterEqualLimitation (io.openems.core.utilities.power.symmetric.PGreaterEqualLimitation)4 PSmallerEqualLimitation (io.openems.core.utilities.power.symmetric.PSmallerEqualLimitation)4 ModbusBitWrappingChannel (io.openems.impl.protocol.modbus.ModbusBitWrappingChannel)4 ModbusWriteLongChannel (io.openems.impl.protocol.modbus.ModbusWriteLongChannel)4 UnsignedWordElement (io.openems.impl.protocol.modbus.internal.UnsignedWordElement)4 StatusBitChannel (io.openems.api.channel.StatusBitChannel)3 WriteChannel (io.openems.api.channel.WriteChannel)3 SignedWordElement (io.openems.impl.protocol.modbus.internal.SignedWordElement)3 UnsignedDoublewordElement (io.openems.impl.protocol.modbus.internal.UnsignedDoublewordElement)3 ModbusRegisterRange (io.openems.impl.protocol.modbus.internal.range.ModbusRegisterRange)3 WriteableModbusRegisterRange (io.openems.impl.protocol.modbus.internal.range.WriteableModbusRegisterRange)3