Search in sources :

Example 1 with ReadChannel

use of io.openems.api.channel.ReadChannel in project openems by OpenEMS.

the class FeneconCommercialCharger method defineModbusProtocol.

/*
	 * Methods
	 */
@Override
protected ModbusProtocol defineModbusProtocol() throws ConfigException {
    ModbusProtocol protocol = new // 
    ModbusProtocol(new WriteableModbusRegisterRange(0x0503, new UnsignedWordElement(0x0503, pvPowerLimitCommand = new ModbusWriteLongChannel("PvPowerLimitCommand", this).multiplier(2).unit("W"))), new // 
    ModbusRegisterRange(// 
    0xA000, new UnsignedWordElement(0xA000, bmsDCDCWorkState = // 
    new ModbusReadLongChannel("BmsDCDCWorkState", this).label(2, // 
    "Initial").label(4, // 
    "Stop").label(8, // 
    "Ready").label(16, // 
    "Running").label(32, // 
    "Fault").label(64, // 
    "Debug").label(128, "Locked")), new UnsignedWordElement(0xA001, bmsDCDCWorkMode = // 
    new ModbusReadLongChannel("BmsDCDCWorkMode", this).label(128, // 
    "Constant Current").label(256, // 
    "Constant Voltage").label(512, "Boost MPPT"))), new // 
    ModbusRegisterRange(// 
    0xA100, new // 
    UnsignedWordElement(// 
    0xA100, // 
    new ModbusBitWrappingChannel("BmsDCDCSuggestiveInformation1", this, this.thingState).warningBit(0, // 
    WarningCharger.CurrentSamplingChannelAbnormityOnHighVoltageSide).warningBit(1, // 
    WarningCharger.CurrentSamplingChannelAbnormityOnLowVoltageSide).warningBit(6, // 
    WarningCharger.EEPROMParametersOverRange).warningBit(7, // 
    WarningCharger.UpdateEEPROMFailed).warningBit(8, // 
    WarningCharger.ReadEEPROMFailed).warningBit(9, // 
    WarningCharger.CurrentSamplingChannelAbnormityBeforeInductance)), new // 
    UnsignedWordElement(// 
    0xA101, // 
    new ModbusBitWrappingChannel("BmsDCDCSuggestiveInformation2", this, this.thingState).warningBit(0, // 
    WarningCharger.ReactorPowerDecreaseCausedByOvertemperature).warningBit(1, // 
    WarningCharger.IGBTPowerDecreaseCausedByOvertemperature).warningBit(2, // 
    WarningCharger.TemperatureChanel3PowerDecreaseCausedByOvertemperature).warningBit(3, // 
    WarningCharger.TemperatureChanel4PowerDecreaseCausedByOvertemperature).warningBit(4, // 
    WarningCharger.TemperatureChanel5PowerDecreaseCausedByOvertemperature).warningBit(5, // 
    WarningCharger.TemperatureChanel6PowerDecreaseCausedByOvertemperature).warningBit(6, // 
    WarningCharger.TemperatureChanel7PowerDecreaseCausedByOvertemperature).warningBit(7, // 
    WarningCharger.TemperatureChanel8PowerDecreaseCausedByOvertemperature).warningBit(8, // 
    WarningCharger.Fan1StopFailed).warningBit(9, // 
    WarningCharger.Fan2StopFailed).warningBit(10, // 
    WarningCharger.Fan3StopFailed).warningBit(11, // 
    WarningCharger.Fan4StopFailed).warningBit(12, // 
    WarningCharger.Fan1StartupFailed).warningBit(13, // 
    WarningCharger.Fan2StartupFailed).warningBit(14, // 
    WarningCharger.Fan3StartupFailed).warningBit(15, // 
    WarningCharger.Fan4StartupFailed)), new // 
    UnsignedWordElement(// 
    0xA102, // 
    new ModbusBitWrappingChannel("BmsDCDCSuggestiveInformation3", this, this.thingState).warningBit(0, // 
    WarningCharger.HighVoltageSideOvervoltage).warningBit(1, // 
    WarningCharger.HighVoltageSideUndervoltage).warningBit(2, // 
    WarningCharger.HighVoltageSideVoltageChangeUnconventionally)), new // 
    UnsignedWordElement(// 
    0xA103, // 
    new ModbusBitWrappingChannel("BmsDCDCSuggestiveInformation4", this, this.thingState).warningBit(0, WarningCharger.CurrentAbnormityBeforeDCConverterWorkOnHighVoltageSide).warningBit(1, WarningCharger.CurrentAbnormityBeforeDCConverterWorkOnLowVoltageSXide).warningBit(2, WarningCharger.InitialDutyRatioAbnormityBeforeDCConverterWork).warningBit(3, WarningCharger.VoltageAbnormityBeforeDCConverterWorkOnHighVoltageSide).warningBit(4, WarningCharger.VoltageAbnormityBeforeDCConverterWorkOnLowVoltageSide)), new UnsignedWordElement(0xA104, // 
    new ModbusBitWrappingChannel("BmsDCDCSuggestiveInformation5", this, this.thingState).warningBit(0, // 
    WarningCharger.HighVoltageBreakerInspectionAbnormity).warningBit(1, // 
    WarningCharger.LowVoltageBreakerInspectionAbnormity).warningBit(2, // 
    WarningCharger.BsmDCDC5DCPrechargeContactorInspectionAbnormity).warningBit(3, // 
    WarningCharger.DCPrechargeContactorOpenUnsuccessfully).warningBit(4, // 
    WarningCharger.DCMainContactorInspectionAbnormity).warningBit(5, // 
    WarningCharger.DCMainContactorOpenUnsuccessfully).warningBit(6, // 
    WarningCharger.OutputContactorCloseUnsuccessfully).warningBit(7, // 
    WarningCharger.OutputContactorOpenUnsuccessfully).warningBit(8, // 
    WarningCharger.ACMainContactorCloseUnsuccessfully).warningBit(9, // 
    WarningCharger.ACMainContactorOpenUnsuccessfully).warningBit(10, // 
    WarningCharger.NegContactorOpenUnsuccessfully).warningBit(11, // 
    WarningCharger.NegContactorCloseUnsuccessfully).warningBit(12, // 
    WarningCharger.NegContactorStateAbnormal)), new DummyElement(0xA105, 0xA10F), new // 
    UnsignedWordElement(// 
    0xA110, // 
    new ModbusBitWrappingChannel("BmsDCDCAbnormity1", this, this.thingState).faultBit(0, // 
    FaultCharger.HighVoltageSideOfDCConverterUndervoltage).faultBit(1, // 
    FaultCharger.HighVoltageSideOfDCConverterOvervoltage).faultBit(2, // 
    FaultCharger.LowVoltageSideOfDCConverterUndervoltage).faultBit(3, // 
    FaultCharger.LowVoltageSideOfDCConverterOvervoltage).faultBit(4, // 
    FaultCharger.HighVoltageSideOfDCConverterOvercurrentFault).faultBit(5, // 
    FaultCharger.LowVoltageSideOfDCConverterOvercurrentFault).faultBit(6, // 
    FaultCharger.DCConverterIGBTFault).faultBit(7, // 
    FaultCharger.DCConverterPrechargeUnmet)), new UnsignedWordElement(0xA111, // 
    new ModbusBitWrappingChannel("BmsDCDCAbnormity2", this, this.thingState).faultBit(0, // 
    FaultCharger.BECUCommunicationDisconnected).faultBit(1, // 
    FaultCharger.DCConverterCommunicationDisconnected).faultBit(2, // 
    FaultCharger.CurrentConfigurationOverRange).faultBit(3, // 
    FaultCharger.TheBatteryRequestStop).faultBit(5, // 
    FaultCharger.OvercurrentRelayFault).faultBit(6, // 
    FaultCharger.LightningProtectionDeviceFault).faultBit(7, // 
    FaultCharger.DCConverterPriamaryContactorDisconnectedAbnormally).faultBit(9, // 
    FaultCharger.DCDisconnectedAbnormallyOnLowVoltageSideOfDCConvetor).faultBit(12, // 
    FaultCharger.DCConvetorEEPROMAbnormity1).faultBit(13, // 
    FaultCharger.DCConvetorEEPROMAbnormity1Second).faultBit(14, // 
    FaultCharger.EDCConvetorEEPROMAbnormity1)), new // 
    UnsignedWordElement(// 
    0xA112, // 
    new ModbusBitWrappingChannel("BmsDCDCAbnormity3", this, this.thingState).faultBit(0, // 
    FaultCharger.DCConvertorGeneralOverload).faultBit(1, // 
    FaultCharger.DCShortCircuit).faultBit(2, // 
    FaultCharger.PeakPulseCurrentProtection).faultBit(3, // 
    FaultCharger.DCDisconnectAbnormallyOnHighVoltageSideOfDCConvetor).faultBit(4, // 
    FaultCharger.EffectivePulseValueOverhigh).faultBit(5, // 
    FaultCharger.DCConverteSevereOverload).faultBit(6, // 
    FaultCharger.DCBreakerDisconnectAbnormallyOnHighVoltageSideOfDCConvetor).faultBit(7, // 
    FaultCharger.DCBreakerDisconnectAbnormallyOnLowVoltageSideOfDCConvetor).faultBit(8, // 
    FaultCharger.DCConvetorPrechargeContactorCloseFailed).faultBit(9, // 
    FaultCharger.DCConvetorMainContactorCloseFailed).faultBit(10, // 
    FaultCharger.ACContactorStateAbnormityOfDCConvetor).faultBit(11, // 
    FaultCharger.DCConvetorEmergencyStop).faultBit(12, // 
    FaultCharger.DCConverterChargingGunDisconnected).faultBit(13, // 
    FaultCharger.DCCurrentAbnormityBeforeDCConvetorWork).faultBit(14, // 
    FaultCharger.FuSeDisconnected).faultBit(15, // 
    FaultCharger.DCConverterHardwareCurrentOrVoltageFault)), new // 
    UnsignedWordElement(// 
    0xA113, // 
    new ModbusBitWrappingChannel("BmsDCDCAbnormity4", this, this.thingState).faultBit(0, // 
    FaultCharger.DCConverterCrystalOscillatorCircuitInvalidation).faultBit(1, // 
    FaultCharger.DCConverterResetCircuitInvalidation).faultBit(2, // 
    FaultCharger.DCConverterSamplingCircuitInvalidation).faultBit(3, // 
    FaultCharger.DCConverterDigitalIOCircuitInvalidation).faultBit(4, // 
    FaultCharger.DCConverterPWMCircuitInvalidation).faultBit(5, // 
    FaultCharger.DCConverterX5045CircuitInvalidation).faultBit(6, // 
    FaultCharger.DCConverterCANCircuitInvalidation).faultBit(7, // 
    FaultCharger.DCConverterSoftwareANDHardwareProtectionCircuitInvalidation).faultBit(8, // 
    FaultCharger.DCConverterPowerCircuitInvalidation).faultBit(9, // 
    FaultCharger.DCConverterCPUInvalidation).faultBit(10, // 
    FaultCharger.DCConverterTINT0InterruptInvalidation).faultBit(11, // 
    FaultCharger.DCConverterADCInterruptInvalidation).faultBit(12, // 
    FaultCharger.DCConverterCAPITN4InterruptInvalidation).faultBit(13, // 
    FaultCharger.DCConverterCAPINT6InterruptInvalidation).faultBit(14, // 
    FaultCharger.DCConverterT3PINTinterruptInvalidation).faultBit(15, // 
    FaultCharger.DCConverterT4PINTinterruptInvalidation)), new // 
    UnsignedWordElement(// 
    0xA114, // 
    new ModbusBitWrappingChannel("BmsDCDCAbnormity5", this, this.thingState).faultBit(0, // 
    FaultCharger.DCConverterPDPINTAInterruptInvalidation).faultBit(1, // 
    FaultCharger.DCConverterT1PINTInterruptInvalidation).faultBit(2, // 
    FaultCharger.DCConverterRESVInterruptInvalidation).faultBit(3, // 
    FaultCharger.DCConverter100usTaskInvalidation).faultBit(4, // 
    FaultCharger.DCConverterClockInvalidation).faultBit(5, // 
    FaultCharger.DCConverterEMSMemoryInvalidation).faultBit(6, // 
    FaultCharger.DCConverterExteriorCommunicationInvalidation).faultBit(7, // 
    FaultCharger.DCConverterIOInterfaceInvalidation).faultBit(8, // 
    FaultCharger.DCConverterInputVoltageBoundFault).faultBit(9, // 
    FaultCharger.DCConverterOutterVoltageBoundFault).faultBit(10, // 
    FaultCharger.DCConverterOutputVoltageBoundFault).faultBit(11, // 
    FaultCharger.DCConverterInductCurrentBoundFault).faultBit(12, // 
    FaultCharger.DCConverterInputCurrentBoundFault).faultBit(13, // 
    FaultCharger.DCConverterOutputCurrentBoundFault)), new // 
    UnsignedWordElement(// 
    0xA115, // 
    new ModbusBitWrappingChannel("BmsDCDCAbnormity6", this, this.thingState).faultBit(0, // 
    FaultCharger.DCReactorOverTemperature).faultBit(1, // 
    FaultCharger.DCIGBTOverTemperature).faultBit(2, // 
    FaultCharger.DCConverterChanel3OverTemperature).faultBit(3, // 
    FaultCharger.DCConverterChanel4OverTemperature).faultBit(4, // 
    FaultCharger.DCConverterChanel5OverTemperature).faultBit(5, // 
    FaultCharger.DCConverterChanel6OverTemperature).faultBit(6, // 
    FaultCharger.DCConverterChanel7OverTemperature).faultBit(7, // 
    FaultCharger.DCConverterChanel8OverTemperature).faultBit(8, // 
    FaultCharger.DCReactorTemperatureSamplingInvalidation).faultBit(9, // 
    FaultCharger.DCIGBTTemperatureSamplingInvalidation).faultBit(10, // 
    FaultCharger.DCConverterChanel3TemperatureSamplingInvalidation).faultBit(11, // 
    FaultCharger.DCConverterChanel4TemperatureSamplingInvalidation).faultBit(12, // 
    FaultCharger.DCConverterChanel5TemperatureSamplingInvalidation).faultBit(13, // 
    FaultCharger.DCConverterChanel6TemperatureSamplingInvalidation).faultBit(14, // 
    FaultCharger.DCConverterChanel7TemperatureSamplingInvalidation).faultBit(15, // 
    FaultCharger.DCConverterChanel8TemperatureSamplingInvalidation)), new UnsignedWordElement(0xA116, // 
    new ModbusBitWrappingChannel("BmsDCDCAbnormity7", this, this.thingState).faultBit(4, // 
    FaultCharger.DCConverterInductanceCurrentSamplingInvalidation).faultBit(5, // 
    FaultCharger.CurrentSamplingInvalidationOnTheLowVoltageSideOfDCConverter).faultBit(6, // 
    FaultCharger.VoltageSamplingInvalidationOnTheLowVoltageSideOfDCConverter).faultBit(7, // 
    FaultCharger.InsulationInspectionFault).faultBit(8, // 
    FaultCharger.NegContactorCloseUnsuccessly).faultBit(9, // 
    FaultCharger.NegContactorCutWhenRunning)), new DummyElement(0xA117, 0xA11F), new UnsignedWordElement(0xA120, bmsDCDCSwitchState = // 
    new StatusBitChannel("BmsDCDCSwitchState", this).label(1, // 
    "DC precharge contactor").label(2, // 
    "DC main contactor").label(4, // 
    "Output contactor").label(8, // 
    "Output breaker").label(16, // 
    "Input breaker").label(32, // 
    "AC contactor").label(64, // 
    "Emergency stop button").label(128, "NegContactor"))), new // 
    ModbusRegisterRange(// 
    0xA130, new SignedWordElement(0xA130, bmsDCDCOutputVoltage = new ModbusReadLongChannel("BmsDCDCOutputVoltage", this).unit("mV").multiplier(2)), new SignedWordElement(0xA131, bmsDCDCOutputCurrent = new ModbusReadLongChannel("BmsDCDCOutputCurrent", this).unit("mA").multiplier(2)), new SignedWordElement(0xA132, bmsDCDCOutputPower = new ModbusReadLongChannel("BmsDCDCOutputPower", this).unit("W").multiplier(2)), new SignedWordElement(0xA133, bmsDCDCInputVoltage = new ModbusReadLongChannel("BmsDCDCInputVoltage", this).unit("mV").multiplier(2)), new SignedWordElement(0xA134, bmsDCDCInputCurrent = new ModbusReadLongChannel("BmsDCDCInputCurrent", this).unit("mA").multiplier(2)), new SignedWordElement(0xA135, bmsDCDCInputPower = new ModbusReadLongChannel("BmsDCDCInputPower", this).unit("W").multiplier(2)), new SignedWordElement(0xA136, bmsDCDCInputEnergy = new ModbusReadLongChannel("BmsDCDCInputEnergy", this).unit("Wh").multiplier(2)), new SignedWordElement(0xA137, bmsDCDCOutputEnergy = new ModbusReadLongChannel("BmsDCDCOutputEnergy", this).unit("Wh").multiplier(2)), new DummyElement(0xA138, 0xA13F), new SignedWordElement(0xA140, bmsDCDCReactorTemperature = new ModbusReadLongChannel("BmsDCDCReactorTemperature", this).unit("°C")), new SignedWordElement(0xA141, bmsDCDCIgbtTemperature = new ModbusReadLongChannel("BmsDCDCIgbtTemperature", this).unit("°C")), new DummyElement(0xA142, 0xA14F), new UnsignedDoublewordElement(0xA150, bmsDCDCInputTotalChargeEnergy = new ModbusReadLongChannel("BmsDCDCInputTotalChargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xA152, bmsDCDCInputTotalDischargeEnergy = new ModbusReadLongChannel("BmsDCDCInputTotalDischargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xA154, bmsDCDCOutputTotalChargeEnergy = new ModbusReadLongChannel("BmsDCDCOutputTotalChargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xA156, bmsDCDCOutputTotalDischargeEnergy = new ModbusReadLongChannel("BmsDCDCOutputTotalDischargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW)), new // 
    ModbusRegisterRange(// 
    0xA300, new UnsignedWordElement(0xA300, bmsDCDC1WorkState = // 
    new ModbusReadLongChannel("BmsDCDC1WorkState", this).label(2, // 
    "Initial").label(4, // 
    "Stop").label(8, // 
    "Ready").label(16, // 
    "Running").label(32, // 
    "Fault").label(64, // 
    "Debug").label(128, "Locked")), new UnsignedWordElement(0xA301, bmsDCDC1WorkMode = // 
    new ModbusReadLongChannel("BmsDCDC1WorkMode", this).label(128, // 
    "Constant Current").label(256, // 
    "Constant Voltage").label(512, "Boost MPPT"))), new // 
    ModbusRegisterRange(// 
    0xA400, new // 
    UnsignedWordElement(// 
    0xA400, // used BsmDCDC1 as prefix on each one if it is used before
    // 
    new ModbusBitWrappingChannel("BmsDCDC1SuggestiveInformation1", this, this.thingState).warningBit(0, // 
    WarningCharger.BsmDCDC1CurrentSamplingChannelAbnormityOnHighVoltageSide).warningBit(1, // 
    WarningCharger.BsmDCDC1CurrentSamplingChannelAbnormityOnLowVoltageSide).warningBit(6, // 
    WarningCharger.BmsDCDC1EEPROMParametersOverRange).warningBit(7, // 
    WarningCharger.BsmDCDC1UpdateEEPROMFailed).warningBit(8, // 
    WarningCharger.BsmDCDC1ReadEEPROMFailed).warningBit(9, // 
    WarningCharger.BsmDCDC1CurrentSamplingChannelAbnormityBeforeInductance)), new // 
    UnsignedWordElement(// 
    0xA401, // Prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1SuggestiveInformation2", this, this.thingState).warningBit(0, // 
    WarningCharger.BsmDCDC1ReactorPowerDecreaseCausedByOvertemperature).warningBit(1, // 
    WarningCharger.BsmDCDC1IGBTPowerDecreaseCausedByOvertemperature).warningBit(2, // 
    WarningCharger.BsmDCDC1TemperatureChanel3PowerDecreaseCausedByOvertemperature).warningBit(3, // 
    WarningCharger.BsmDCDC1TemperatureChanel4PowerDecreaseCausedByOvertemperature).warningBit(4, // 
    WarningCharger.BsmDCDC1TemperatureChanel5PowerDecreaseCausedByOvertemperature).warningBit(5, // 
    WarningCharger.BsmDCDC1TemperatureChanel6PowerDecreaseCausedByOvertemperature).warningBit(6, // 
    WarningCharger.BsmDCDC1TemperatureChanel7PowerDecreaseCausedByOvertemperature).warningBit(7, // 
    WarningCharger.BsmDCDC1TemperatureChanel8PowerDecreaseCausedByOvertemperature).warningBit(8, // 
    WarningCharger.BsmDCDC1Fan1StopFailed).warningBit(9, // 
    WarningCharger.BsmDCDC1Fan2StopFailed).warningBit(10, // 
    WarningCharger.BsmDCDC1Fan3StopFailed).warningBit(11, // 
    WarningCharger.BsmDCDC1Fan4StopFailed).warningBit(12, // 
    WarningCharger.BsmDCDC1Fan1StartupFailed).warningBit(13, // 
    WarningCharger.BsmDCDC1Fan2StartupFailed).warningBit(14, // 
    WarningCharger.BsmDCDC1Fan3StartupFailed).warningBit(15, // 
    WarningCharger.BsmDCDC1Fan4StartupFailed)), // 
    new // 
    UnsignedWordElement(// 
    0xA402, // prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1SuggestiveInformation3", this, this.thingState).warningBit(0, // 
    WarningCharger.BsmDCDC1HighVoltageSideOvervoltage).warningBit(1, // 
    WarningCharger.BsmDCDC1HighVoltageSideUndervoltage).warningBit(2, // 
    WarningCharger.BsmDCDC1HighVoltageSideVoltageChangeUnconventionally)), new // 
    UnsignedWordElement(// 
    0xA403, // prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1SuggestiveInformation4", this, this.thingState).warningBit(0, WarningCharger.BmsDCDC1CurrentAbnormityBeforeDCConverterWorkOnHighVoltageSide).warningBit(1, WarningCharger.BmsDCDC1CurrentAbnormityBeforeDCConverterWorkOnLowVoltageSXide).warningBit(2, WarningCharger.BmsDCDC1InitialDutyRatioAbnormityBeforeDCConverterWork).warningBit(3, WarningCharger.BmsDCDC1VoltageAbnormityBeforeDCConverterWorkOnHighVoltageSide).warningBit(4, WarningCharger.BmsDCDC1VoltageAbnormityBeforeDCConverterWorkOnLowVoltageSide)), new // 
    UnsignedWordElement(// 
    0xA404, // prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1SuggestiveInformation5", this, this.thingState).warningBit(0, // 
    WarningCharger.BmsDCDC1HighVoltageBreakerInspectionAbnormity).warningBit(1, // 
    WarningCharger.BmsDCDC1LowVoltageBreakerInspectionAbnormity).warningBit(2, // 
    WarningCharger.BmsDCDC1BsmDCDC5DCPrechargeContactorInspectionAbnormity).warningBit(3, // 
    WarningCharger.BmsDCDC1DCPrechargeContactorOpenUnsuccessfully).warningBit(4, // 
    WarningCharger.BmsDCDC1DCMainContactorInspectionAbnormity).warningBit(5, // 
    WarningCharger.BmsDCDC1DCMainContactorOpenUnsuccessfully).warningBit(6, // 
    WarningCharger.BmsDCDC1OutputContactorCloseUnsuccessfully).warningBit(7, // 
    WarningCharger.BmsDCDC1OutputContactorOpenUnsuccessfully).warningBit(8, // 
    WarningCharger.BmsDCDC1ACMainContactorCloseUnsuccessfully).warningBit(9, // 
    WarningCharger.BmsDCDC1ACMainContactorOpenUnsuccessfully).warningBit(10, // 
    WarningCharger.BmsDCDC1NegContactorOpenUnsuccessfully).warningBit(11, // 
    WarningCharger.BmsDCDC1NegContactorCloseUnsuccessfully).warningBit(12, // 
    WarningCharger.BmsDCDC1NegContactorStateAbnormal)), new DummyElement(0xA405, 0xA40F), new UnsignedWordElement(0xA410, // prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1Abnormity1", this, this.thingState).faultBit(0, // 
    FaultCharger.BmsDCDC1HighVoltageSideOfDCConverterUndervoltage).faultBit(1, // 
    FaultCharger.BmsDCDC1HighVoltageSideOfDCConverterOvervoltage).faultBit(2, // 
    FaultCharger.BmsDCDC1LowVoltageSideOfDCConverterUndervoltage).faultBit(3, // 
    FaultCharger.BmsDCDC1LowVoltageSideOfDCConverterOvervoltage).faultBit(4, // 
    FaultCharger.BmsDCDC1HighVoltageSideOfDCConverterOvercurrentFault).faultBit(5, // 
    FaultCharger.BmsDCDC1LowVoltageSideOfDCConverterOvercurrentFault).faultBit(6, // 
    FaultCharger.BmsDCDC1DCConverterIGBTFault).faultBit(7, // 
    FaultCharger.BmsDCDC1DCConverterPrechargeUnmet)), new UnsignedWordElement(0xA411, // prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1Abnormity2", this, this.thingState).faultBit(0, // 
    FaultCharger.BmsDCDC1BECUCommunicationDisconnected).faultBit(1, // 
    FaultCharger.BmsDCDC1DCConverterCommunicationDisconnected).faultBit(2, // 
    FaultCharger.BmsDCDC1CurrentConfigurationOverRange).faultBit(3, // 
    FaultCharger.BmsDCDC1TheBatteryRequestStop).faultBit(5, // 
    FaultCharger.BmsDCDC1OvercurrentRelayFault).faultBit(6, // 
    FaultCharger.BmsDCDC1LightningProtectionDeviceFault).faultBit(7, // 
    FaultCharger.BmsDCDC1DCConverterPriamaryContactorDisconnectedAbnormally).faultBit(9, // 
    FaultCharger.BmsDCDC1DCDisconnectedAbnormallyOnLowVoltageSideOfDCConvetor).faultBit(12, // 
    FaultCharger.BmsDCDC1DCConvetorEEPROMAbnormity1).faultBit(13, // 
    FaultCharger.BmsDCDC1DCConvetorEEPROMAbnormity1Second).faultBit(14, // 
    FaultCharger.BmsDCDC1EDCConvetorEEPROMAbnormity1)), new // 
    UnsignedWordElement(// 
    0xA412, // prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1Abnormity3", this, this.thingState).faultBit(0, // 
    FaultCharger.BsmDCDC1DCConvertorGeneralOverload).faultBit(1, // 
    FaultCharger.BsmDCDC1DCShortCircuit).faultBit(2, // 
    FaultCharger.BsmDCDC1PeakPulseCurrentProtection).faultBit(3, // 
    FaultCharger.BsmDCDC1DCDisconnectAbnormallyOnHighVoltageSideOfDCConvetor).faultBit(4, // 
    FaultCharger.BsmDCDC1EffectivePulseValueOverhigh).faultBit(5, // 
    FaultCharger.BsmDCDC1DCConverteSevereOverload).faultBit(6, // 
    FaultCharger.BsmDCDC1DCBreakerDisconnectAbnormallyOnHighVoltageSideOfDCConvetor).faultBit(7, // 
    FaultCharger.BsmDCDC1DCBreakerDisconnectAbnormallyOnLowVoltageSideOfDCConvetor).faultBit(8, // 
    FaultCharger.BsmDCDC1DCConvetorPrechargeContactorCloseFailed).faultBit(9, // 
    FaultCharger.BsmDCDC1DCConvetorMainContactorCloseFailed).faultBit(10, // 
    FaultCharger.BsmDCDC1ACContactorStateAbnormityOfDCConvetor).faultBit(11, // 
    FaultCharger.BsmDCDC1DCConvetorEmergencyStop).faultBit(12, // 
    FaultCharger.BsmDCDC1DCConverterChargingGunDisconnected).faultBit(13, // 
    FaultCharger.BsmDCDC1DCCurrentAbnormityBeforeDCConvetorWork).faultBit(14, // 
    FaultCharger.BsmDCDC1FuSeDisconnected).faultBit(15, // 
    FaultCharger.BsmDCDC1DCConverterHardwareCurrentOrVoltageFault)), new UnsignedWordElement(0xA413, // prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1Abnormity4", this, this.thingState).faultBit(0, // 
    FaultCharger.BmsDCDC1DCConverterCrystalOscillatorCircuitInvalidation).faultBit(1, // 
    FaultCharger.BmsDCDC1DCConverterResetCircuitInvalidation).faultBit(2, // 
    FaultCharger.BmsDCDC1DCConverterSamplingCircuitInvalidation).faultBit(3, // 
    FaultCharger.BmsDCDC1DCConverterDigitalIOCircuitInvalidation).faultBit(4, // 
    FaultCharger.BmsDCDC1DCConverterPWMCircuitInvalidation).faultBit(5, // 
    FaultCharger.BmsDCDC1DCConverterX5045CircuitInvalidation).faultBit(6, // 
    FaultCharger.BmsDCDC1DCConverterCANCircuitInvalidation).faultBit(7, // 
    FaultCharger.BmsDCDC1DCConverterSoftwareANDHardwareProtectionCircuitInvalidation).faultBit(8, // 
    FaultCharger.BmsDCDC1DCConverterPowerCircuitInvalidation).faultBit(9, // 
    FaultCharger.BmsDCDC1DCConverterCPUInvalidation).faultBit(10, // 
    FaultCharger.BmsDCDC1DCConverterTINT0InterruptInvalidation).faultBit(11, // 
    FaultCharger.BmsDCDC1DCConverterADCInterruptInvalidation).faultBit(12, // 
    FaultCharger.BmsDCDC1DCConverterCAPITN4InterruptInvalidation).faultBit(13, // 
    FaultCharger.BmsDCDC1DCConverterCAPINT6InterruptInvalidation).faultBit(14, // 
    FaultCharger.BmsDCDC1DCConverterT3PINTinterruptInvalidation).faultBit(15, // 
    FaultCharger.BmsDCDC1DCConverterT4PINTinterruptInvalidation)), // 
    new UnsignedWordElement(0xA414, // prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1Abnormity5", this, this.thingState).faultBit(0, // 
    FaultCharger.BmsDCDC1DCConverterPDPINTAInterruptInvalidation).faultBit(1, // 
    FaultCharger.BmsDCDC1DCConverterT1PINTInterruptInvalidationSecond).faultBit(2, // 
    FaultCharger.BmsDCDC1DCConverterRESVInterruptInvalidation).faultBit(3, // 
    FaultCharger.BmsDCDC1DCConverter100usTaskInvalidation).faultBit(4, // 
    FaultCharger.BmsDCDC1DCConverterClockInvalidation).faultBit(5, // 
    FaultCharger.BmsDCDC1DCConverterEMSMemoryInvalidation).faultBit(6, // 
    FaultCharger.BmsDCDC1DCConverterExteriorCommunicationInvalidation).faultBit(7, // 
    FaultCharger.BmsDCDC1DCConverterIOInterfaceInvalidation).faultBit(8, // 
    FaultCharger.BmsDCDC1DCConverterInputVoltageBoundFault).faultBit(9, // 
    FaultCharger.BmsDCDC1DCConverterOutterVoltageBoundFault).faultBit(10, // 
    FaultCharger.BmsDCDC1DCConverterOutputVoltageBoundFault).faultBit(11, // 
    FaultCharger.BmsDCDC1DCConverterInductCurrentBoundFault).faultBit(12, // 
    FaultCharger.BmsDCDC1DCConverterInputCurrentBoundFault).faultBit(13, // 
    FaultCharger.BmsDCDC1DCConverterOutputCurrentBoundFault)), // 
    new UnsignedWordElement(0xA415, // prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1Abnormity6", this, this.thingState).faultBit(0, // 
    FaultCharger.BmsDCDC1DCReactorOverTemperature).faultBit(1, // 
    FaultCharger.BmsDCDC1DCIGBTOverTemperature).faultBit(2, // 
    FaultCharger.BmsDCDC1DCConverterChanel3OverTemperature).faultBit(3, // 
    FaultCharger.BmsDCDC1DCConverterChanel4OverTemperature).faultBit(4, // 
    FaultCharger.BmsDCDC1DCConverterChanel5OverTemperature).faultBit(5, // 
    FaultCharger.BmsDCDC1DCConverterChanel6OverTemperature).faultBit(6, // 
    FaultCharger.BmsDCDC1DCConverterChanel7OverTemperature).faultBit(7, // 
    FaultCharger.BmsDCDC1DCConverterChanel8OverTemperature).faultBit(8, // 
    FaultCharger.BmsDCDC1DCReactorTemperatureSamplingInvalidation).faultBit(9, // 
    FaultCharger.BmsDCDC1DCIGBTTemperatureSamplingInvalidation).faultBit(10, // 
    FaultCharger.BmsDCDC1DCConverterChanel3TemperatureSamplingInvalidation).faultBit(11, // 
    FaultCharger.BmsDCDC1DCConverterChanel4TemperatureSamplingInvalidation).faultBit(12, // 
    FaultCharger.BmsDCDC1DCConverterChanel5TemperatureSamplingInvalidation).faultBit(13, // 
    FaultCharger.BmsDCDC1DCConverterChanel6TemperatureSamplingInvalidation).faultBit(14, // 
    FaultCharger.BmsDCDC1DCConverterChanel7TemperatureSamplingInvalidation).faultBit(15, // 
    FaultCharger.BmsDCDC1DCConverterChanel8TemperatureSamplingInvalidation)), // 
    new UnsignedWordElement(0xA416, // prefix = "BsmDCDC1"
    // 
    new ModbusBitWrappingChannel("BmsDCDC1Abnormity7", this, this.thingState).faultBit(4, // 
    FaultCharger.BmsDCDC1DCConverterInductanceCurrentSamplingInvalidation).faultBit(5, // 
    FaultCharger.BmsDCDC1CurrentSamplingInvalidationOnTheLowVoltageSideOfDCConverter).faultBit(6, // 
    FaultCharger.BmsDCDC1VoltageSamplingInvalidationOnTheLowVoltageSideOfDCConverter).faultBit(7, // 
    FaultCharger.BmsDCDC1InsulationInspectionFault).faultBit(8, // 
    FaultCharger.BmsDCDC1NegContactorCloseUnsuccessly).faultBit(9, // 
    FaultCharger.BmsDCDC1NegContactorCutWhenRunning)), // 
    new DummyElement(0xA417, 0xA41F), new UnsignedWordElement(0xA420, bmsDCDC1SwitchState = // 
    new StatusBitChannel("BmsDCDC1SwitchState", this).label(1, // 
    "DC precharge contactor").label(2, // 
    "DC main contactor").label(4, // 
    "Output contactor").label(8, // 
    "Output breaker").label(16, // 
    "Input breaker").label(32, // 
    "AC contactor").label(64, // 
    "Emergency stop button").label(128, "NegContactor"))), new // 
    ModbusRegisterRange(// 
    0xA430, new SignedWordElement(0xA430, bmsDCDC1OutputVoltage = new ModbusReadLongChannel("BmsDCDC1OutputVoltage", this).unit("mV").multiplier(2)), new SignedWordElement(0xA431, bmsDCDC1OutputCurrent = new ModbusReadLongChannel("BmsDCDC1OutputCurrent", this).unit("mA").multiplier(2)), new SignedWordElement(0xA432, bmsDCDC1OutputPower = new ModbusReadLongChannel("BmsDCDC1OutputPower", this).unit("W").multiplier(2)), new SignedWordElement(0xA433, bmsDCDC1InputVoltage = new ModbusReadLongChannel("BmsDCDC1InputVoltage", this).unit("mV").multiplier(2)), new SignedWordElement(0xA434, bmsDCDC1InputCurrent = new ModbusReadLongChannel("BmsDCDC1InputCurrent", this).unit("mA").multiplier(2)), new SignedWordElement(0xA435, bmsDCDC1InputPower = new ModbusReadLongChannel("BmsDCDC1InputPower", this).unit("W").multiplier(2)), new SignedWordElement(0xA436, bmsDCDC1InputEnergy = new ModbusReadLongChannel("BmsDCDC1InputEnergy", this).unit("Wh").multiplier(2)), new SignedWordElement(0xA437, bmsDCDC1OutputEnergy = new ModbusReadLongChannel("BmsDCDC1OutputEnergy", this).unit("Wh").multiplier(2)), new DummyElement(0xA438, 0xA43F), new SignedWordElement(0xA440, bmsDCDC1ReactorTemperature = new ModbusReadLongChannel("BmsDCDC1ReactorTemperature", this).unit("°C")), new SignedWordElement(0xA441, bmsDCDC1IgbtTemperature = new ModbusReadLongChannel("BmsDCDC1IgbtTemperature", this).unit("°C")), new DummyElement(0xA442, 0xA44F), new UnsignedDoublewordElement(0xA450, bmsDCDC1InputTotalChargeEnergy = new ModbusReadLongChannel("BmsDCDC1InputTotalChargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xA452, bmsDCDC1InputTotalDischargeEnergy = new ModbusReadLongChannel("BmsDCDC1InputTotalDischargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xA454, bmsDCDC1OutputTotalChargeEnergy = new ModbusReadLongChannel("BmsDCDC1OutputTotalChargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xA456, bmsDCDC1OutputTotalDischargeEnergy = new ModbusReadLongChannel("BmsDCDC1OutputTotalDischargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW)), new // 
    ModbusRegisterRange(// 
    0xA600, new UnsignedWordElement(0xA600, pvDCDCWorkState = // 
    new ModbusReadLongChannel("PvDCDCWorkState", this).label(2, // 
    "Initial").label(4, // 
    "Stop").label(8, // 
    "Ready").label(16, // 
    "Running").label(32, // 
    "Fault").label(64, // 
    "Debug").label(128, "Locked")), new UnsignedWordElement(0xA601, pvDCDCWorkMode = // 
    new ModbusReadLongChannel("PvDCDCWorkMode", this).label(128, // 
    "Constant Current").label(256, // 
    "Constant Voltage").label(512, "Boost MPPT"))), new // 
    ModbusRegisterRange(// 
    0xA700, new // 
    UnsignedWordElement(// 
    0xA700, // prefix  = "PvDCDC "
    // 
    new ModbusBitWrappingChannel("PvDCDCSuggestiveInformation1", this, this.thingState).warningBit(0, // 
    WarningCharger.PvDCDCCurrentSamplingChannelAbnormityOnHighVoltageSide).warningBit(1, // 
    WarningCharger.PvDCDCCurrentSamplingChannelAbnormityOnLowVoltageSide).warningBit(6, // 
    WarningCharger.PvDCDCEEPROMParametersOverRange).warningBit(7, // 
    WarningCharger.PvDCDCUpdateEEPROMFailed).warningBit(8, // 
    WarningCharger.PvDCDCReadEEPROMFailed).warningBit(9, // 
    WarningCharger.PvDCDCCurrentSamplingChannelAbnormityBeforeInductance)), new // 
    UnsignedWordElement(// 
    0xA701, // prefix  = "PvDCDC "
    // 
    new ModbusBitWrappingChannel("PvDCDCSuggestiveInformation2", this, this.thingState).warningBit(0, // 
    WarningCharger.PvDCDCReactorPowerDecreaseCausedByOvertemperature).warningBit(1, // 
    WarningCharger.PvDCDCIGBTPowerDecreaseCausedByOvertemperature).warningBit(2, // 
    WarningCharger.PvDCDCTemperatureChanel3PowerDecreaseCausedByOvertemperature).warningBit(3, // 
    WarningCharger.PvDCDCTemperatureChanel4PowerDecreaseCausedByOvertemperature).warningBit(4, // 
    WarningCharger.PvDCDCTemperatureChanel5PowerDecreaseCausedByOvertemperature).warningBit(5, // 
    WarningCharger.PvDCDCTemperatureChanel6PowerDecreaseCausedByOvertemperature).warningBit(6, // 
    WarningCharger.PvDCDCTemperatureChanel7PowerDecreaseCausedByOvertemperature).warningBit(7, // 
    WarningCharger.PvDCDCTemperatureChanel8PowerDecreaseCausedByOvertemperature).warningBit(8, // 
    WarningCharger.PvDCDCFan1StopFailed).warningBit(9, // 
    WarningCharger.PvDCDCFan2StopFailed).warningBit(10, // 
    WarningCharger.PvDCDCFan3StopFailed).warningBit(11, // 
    WarningCharger.PvDCDCFan4StopFailed).warningBit(12, // 
    WarningCharger.PvDCDCFan1StartupFailed).warningBit(13, // 
    WarningCharger.PvDCDCFan2StartupFailed).warningBit(14, // 
    WarningCharger.PvDCDCFan3StartupFailed).warningBit(15, // 
    WarningCharger.PvDCDCFan4StartupFailed)), new // 
    UnsignedWordElement(// 
    0xA702, // prefix  = "PvDCDC"
    // 
    new ModbusBitWrappingChannel("PvDCDCSuggestiveInformation3", this, this.thingState).warningBit(0, // 
    WarningCharger.PvDCDCHighVoltageSideOvervoltage).warningBit(1, // 
    WarningCharger.PvDCDCHighVoltageSideUndervoltage).warningBit(2, // 
    WarningCharger.PvDCDCHighVoltageSideVoltageChangeUnconventionally)), new UnsignedWordElement(0xA703, // prefix  = "PvDCDC"
    // 
    new ModbusBitWrappingChannel("PvDCDCSuggestiveInformation4", this, this.thingState).warningBit(0, WarningCharger.PvDCDCCurrentAbnormityBeforeDCConverterWorkOnHighVoltageSide).warningBit(1, WarningCharger.PvDCDCCurrentAbnormityBeforeDCConverterWorkOnLowVoltageSXide).warningBit(2, WarningCharger.PvDCDCInitialDutyRatioAbnormityBeforeDCConverterWork).warningBit(3, WarningCharger.PvDCDCVoltageAbnormityBeforeDCConverterWorkOnHighVoltageSide).warningBit(4, WarningCharger.PvDCDCVoltageAbnormityBeforeDCConverterWorkOnLowVoltageSide)), new // 
    UnsignedWordElement(// 
    0xA704, // prefix  = "PvDCDC"
    // 
    new ModbusBitWrappingChannel("PvDCDCSuggestiveInformation5", this, this.thingState).warningBit(0, // 
    WarningCharger.PvDCDCHighVoltageBreakerInspectionAbnormity).warningBit(1, // 
    WarningCharger.PvDCDCLowVoltageBreakerInspectionAbnormity).warningBit(2, // 
    WarningCharger.PvDCDCBsmDCDC5DCPrechargeContactorInspectionAbnormity).warningBit(3, // 
    WarningCharger.PvDCDCDCPrechargeContactorOpenUnsuccessfully).warningBit(4, // 
    WarningCharger.PvDCDCDCMainContactorInspectionAbnormity).warningBit(5, // 
    WarningCharger.PvDCDCDCMainContactorOpenUnsuccessfully).warningBit(6, // 
    WarningCharger.PvDCDCOutputContactorCloseUnsuccessfully).warningBit(7, // 
    WarningCharger.PvDCDCOutputContactorOpenUnsuccessfully).warningBit(8, // 
    WarningCharger.PvDCDCACMainContactorCloseUnsuccessfully).warningBit(9, // 
    WarningCharger.PvDCDCACMainContactorOpenUnsuccessfully).warningBit(10, // 
    WarningCharger.PvDCDCNegContactorOpenUnsuccessfully).warningBit(11, // 
    WarningCharger.PvDCDCNegContactorCloseUnsuccessfully).warningBit(12, // 
    WarningCharger.PvDCDCNegContactorStateAbnormal)), new DummyElement(0xA705, 0xA70F), new // 
    UnsignedWordElement(// 
    0xA710, // prefix = "PvDCDC"
    // 
    new ModbusBitWrappingChannel("PvDCDCAbnormity1", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDCHighVoltageSideOfDCConverterUndervoltage).faultBit(1, // 
    FaultCharger.PvDCDCHighVoltageSideOfDCConverterOvervoltage).faultBit(2, // 
    FaultCharger.PvDCDCLowVoltageSideOfDCConverterUndervoltage).faultBit(3, // 
    FaultCharger.PvDCDCLowVoltageSideOfDCConverterOvervoltage).faultBit(4, // 
    FaultCharger.PvDCDCHighVoltageSideOfDCConverterOvercurrentFault).faultBit(5, // 
    FaultCharger.PvDCDCLowVoltageSideOfDCConverterOvercurrentFault).faultBit(6, // 
    FaultCharger.PvDCDCDCConverterIGBTFault).faultBit(7, // 
    FaultCharger.PvDCDCDCConverterPrechargeUnmet)), new UnsignedWordElement(0xA711, // prefix = "PvDCDC"
    // 
    new ModbusBitWrappingChannel("PvDCDCAbnormity2", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDCBECUCommunicationDisconnected).faultBit(1, // 
    FaultCharger.PvDCDCDCConverterCommunicationDisconnected).faultBit(2, // 
    FaultCharger.PvDCDCCurrentConfigurationOverRange).faultBit(3, // 
    FaultCharger.PvDCDCTheBatteryRequestStop).faultBit(5, // 
    FaultCharger.PvDCDCOvercurrentRelayFault).faultBit(6, // 
    FaultCharger.PvDCDCLightningProtectionDeviceFault).faultBit(7, // 
    FaultCharger.PvDCDCDCConverterPriamaryContactorDisconnectedAbnormally).faultBit(9, // 
    FaultCharger.PvDCDCDCDisconnectedAbnormallyOnLowVoltageSideOfDCConvetor).faultBit(12, // 
    FaultCharger.PvDCDCDCConvetorEEPROMAbnormity1).faultBit(13, // 
    FaultCharger.PvDCDCDCConvetorEEPROMAbnormity1Second).faultBit(14, // 
    FaultCharger.PvDCDCEDCConvetorEEPROMAbnormity1)), new // 
    UnsignedWordElement(// 
    0xA712, // prefix = "PvDCDC"
    // 
    new ModbusBitWrappingChannel("PvDCDCAbnormity3", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDCDCConvertorGeneralOverload).faultBit(1, // 
    FaultCharger.PvDCDCDCShortCircuit).faultBit(2, // 
    FaultCharger.PvDCDCPeakPulseCurrentProtection).faultBit(3, // 
    FaultCharger.PvDCDCDCDisconnectAbnormallyOnHighVoltageSideOfDCConvetor).faultBit(4, // 
    FaultCharger.PvDCDCEffectivePulseValueOverhigh).faultBit(5, // 
    FaultCharger.PvDCDCDCConverteSevereOverload).faultBit(6, // 
    FaultCharger.PvDCDCDCBreakerDisconnectAbnormallyOnHighVoltageSideOfDCConvetor).faultBit(7, // 
    FaultCharger.PvDCDCDCBreakerDisconnectAbnormallyOnLowVoltageSideOfDCConvetor).faultBit(8, // 
    FaultCharger.PvDCDCDCConvetorPrechargeContactorCloseFailed).faultBit(9, // 
    FaultCharger.PvDCDCDCConvetorMainContactorCloseFailed).faultBit(10, // 
    FaultCharger.PvDCDCACContactorStateAbnormityOfDCConvetor).faultBit(11, // 
    FaultCharger.PvDCDCDCConvetorEmergencyStop).faultBit(12, // 
    FaultCharger.PvDCDCDCConverterChargingGunDisconnected).faultBit(13, // 
    FaultCharger.PvDCDCDCCurrentAbnormityBeforeDCConvetorWork).faultBit(14, // 
    FaultCharger.PvDCDCFuSeDisconnected).faultBit(15, // 
    FaultCharger.PvDCDCDCConverterHardwareCurrentOrVoltageFault)), new // 
    UnsignedWordElement(// 
    0xA713, // prefix = "PvDCDC"
    // 
    new ModbusBitWrappingChannel("PvDCDCAbnormity4", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDCDCConverterCrystalOscillatorCircuitInvalidation).faultBit(1, // 
    FaultCharger.PvDCDCDCConverterResetCircuitInvalidation).faultBit(2, // 
    FaultCharger.PvDCDCDCConverterSamplingCircuitInvalidation).faultBit(3, // 
    FaultCharger.PvDCDCDCConverterDigitalIOCircuitInvalidation).faultBit(4, // 
    FaultCharger.PvDCDCDCConverterPWMCircuitInvalidation).faultBit(5, // 
    FaultCharger.PvDCDCDCConverterX5045CircuitInvalidation).faultBit(6, // 
    FaultCharger.PvDCDCDCConverterCANCircuitInvalidation).faultBit(7, // 
    FaultCharger.PvDCDCDCConverterSoftwareANDHardwareProtectionCircuitInvalidation).faultBit(8, // 
    FaultCharger.PvDCDCDCConverterPowerCircuitInvalidation).faultBit(9, // 
    FaultCharger.PvDCDCDCConverterCPUInvalidation).faultBit(10, // 
    FaultCharger.PvDCDCDCConverterTINT0InterruptInvalidation).faultBit(11, // 
    FaultCharger.PvDCDCDCConverterADCInterruptInvalidation).faultBit(12, // 
    FaultCharger.PvDCDCDCConverterCAPITN4InterruptInvalidation).faultBit(13, // 
    FaultCharger.PvDCDCDCConverterCAPINT6InterruptInvalidation).faultBit(14, // 
    FaultCharger.PvDCDCDCConverterT3PINTinterruptInvalidation).faultBit(15, // 
    FaultCharger.PvDCDCDCConverterT4PINTinterruptInvalidation)), new UnsignedWordElement(0xA714, // prefix = "PvDCDC"
    // 
    new ModbusBitWrappingChannel("PvDCDCAbnormity5", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDCConverterPDPINTAInterruptInvalidation).faultBit(1, // 
    FaultCharger.PvDCDCConverterT1PINTInterruptInvalidationSecond).faultBit(2, // 
    FaultCharger.PvDCDCConverterRESVInterruptInvalidation).faultBit(3, // 
    FaultCharger.PvDCDCConverter100usTaskInvalidation).faultBit(4, // 
    FaultCharger.PvDCDCConverterClockInvalidation).faultBit(5, // 
    FaultCharger.PvDCDCConverterEMSMemoryInvalidation).faultBit(6, // 
    FaultCharger.PvDCDCConverterExteriorCommunicationInvalidation).faultBit(7, // 
    FaultCharger.PvDCDCConverterIOInterfaceInvalidation).faultBit(8, // 
    FaultCharger.PvDCDCConverterInputVoltageBoundFault).faultBit(9, // 
    FaultCharger.PvDCDCConverterOutterVoltageBoundFault).faultBit(10, // 
    FaultCharger.PvDCDCConverterOutputVoltageBoundFault).faultBit(11, // 
    FaultCharger.PvDCDCConverterInductCurrentBoundFault).faultBit(12, // 
    FaultCharger.PvDCDCConverterInputCurrentBoundFault).faultBit(13, // 
    FaultCharger.PvDCDCConverterOutputCurrentBoundFault)), new // 
    UnsignedWordElement(// 
    0xA715, // prefix = "PvDCDC"
    // 
    new ModbusBitWrappingChannel("PvDCDCAbnormity6", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDCDCReactorOverTemperature).faultBit(1, // 
    FaultCharger.PvDCDCDCIGBTOverTemperature).faultBit(2, // 
    FaultCharger.PvDCDCDCConverterChanel3OverTemperature).faultBit(3, // 
    FaultCharger.PvDCDCDCConverterChanel4OverTemperature).faultBit(4, // 
    FaultCharger.PvDCDCDCConverterChanel5OverTemperature).faultBit(5, // 
    FaultCharger.PvDCDCDCConverterChanel6OverTemperature).faultBit(6, // 
    FaultCharger.PvDCDCDCConverterChanel7OverTemperature).faultBit(7, // 
    FaultCharger.PvDCDCDCConverterChanel8OverTemperature).faultBit(8, // 
    FaultCharger.PvDCDCDCReactorTemperatureSamplingInvalidation).faultBit(9, // 
    FaultCharger.PvDCDCDCIGBTTemperatureSamplingInvalidation).faultBit(10, // 
    FaultCharger.PvDCDCDCConverterChanel3TemperatureSamplingInvalidation).faultBit(11, // 
    FaultCharger.PvDCDCDCConverterChanel4TemperatureSamplingInvalidation).faultBit(12, // 
    FaultCharger.PvDCDCDCConverterChanel5TemperatureSamplingInvalidation).faultBit(13, // 
    FaultCharger.PvDCDCDCConverterChanel6TemperatureSamplingInvalidation).faultBit(14, // 
    FaultCharger.PvDCDCDCConverterChanel7TemperatureSamplingInvalidation).faultBit(15, // 
    FaultCharger.PvDCDCDCConverterChanel8TemperatureSamplingInvalidation)), new // 
    UnsignedWordElement(// 
    0xA716, // prefix = "PvDCDC"
    // 
    new ModbusBitWrappingChannel("PvDCDCAbnormity7", this, this.thingState).faultBit(4, // 
    FaultCharger.PvDCDCDCConverterInductanceCurrentSamplingInvalidation).faultBit(5, // 
    FaultCharger.PvDCDCCurrentSamplingInvalidationOnTheLowVoltageSideOfDCConverter).faultBit(6, // 
    FaultCharger.PvDCDCVoltageSamplingInvalidationOnTheLowVoltageSideOfDCConverter).faultBit(7, // 
    FaultCharger.PvDCDCInsulationInspectionFault).faultBit(8, // 
    FaultCharger.PvDCDCNegContactorCloseUnsuccessly).faultBit(9, // 
    FaultCharger.PvDCDCNegContactorCutWhenRunning)), new DummyElement(0xA717, 0xA71F), new UnsignedWordElement(0xA720, pvDCDCSwitchState = // 
    new StatusBitChannel("PvDCDCSwitchState", this).label(1, // 
    "DC precharge contactor").label(2, // 
    "DC main contactor").label(4, // 
    "Output contactor").label(8, // 
    "Output breaker").label(16, // 
    "Input breaker").label(32, // 
    "AC contactor").label(64, // 
    "Emergency stop button").label(128, "NegContactor"))), new // 
    ModbusRegisterRange(// 
    0xA730, new SignedWordElement(0xA730, pvDCDCOutputVoltage = new ModbusReadLongChannel("PvDCDCOutputVoltage", this).unit("mV").multiplier(2)), new SignedWordElement(0xA731, pvDCDCOutputCurrent = new ModbusReadLongChannel("PvDCDCOutputCurrent", this).unit("mA").multiplier(2)), new SignedWordElement(0xA732, pvDCDCOutputPower = new ModbusReadLongChannel("PvDCDCOutputPower", this).unit("W").multiplier(2)), new SignedWordElement(0xA733, pvDCDCInputVoltage = new ModbusReadLongChannel("PvDCDCInputVoltage", this).unit("mV").multiplier(2)), new SignedWordElement(0xA734, pvDCDCInputCurrent = new ModbusReadLongChannel("PvDCDCInputCurrent", this).unit("mA").multiplier(2)), new SignedWordElement(0xA735, pvDCDCInputPower = new ModbusReadLongChannel("PvDCDCInputPower", this).unit("W").multiplier(2)), new SignedWordElement(0xA736, pvDCDCInputEnergy = new ModbusReadLongChannel("PvDCDCInputEnergy", this).unit("Wh").multiplier(2)), new SignedWordElement(0xA737, pvDCDCOutputEnergy = new ModbusReadLongChannel("PvDCDCOutputEnergy", this).unit("Wh").multiplier(2)), new DummyElement(0xA738, 0xA73F), new SignedWordElement(0xA740, pvDCDCReactorTemperature = new ModbusReadLongChannel("PvDCDCReactorTemperature", this).unit("°C")), new SignedWordElement(0xA741, pvDCDCIgbtTemperature = new ModbusReadLongChannel("PvDCDCIgbtTemperature", this).unit("°C")), new DummyElement(0xA742, 0xA74F), new UnsignedDoublewordElement(0xA750, pvDCDCInputTotalChargeEnergy = new ModbusReadLongChannel("PvDCDCInputTotalChargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xA752, pvDCDCInputTotalDischargeEnergy = new ModbusReadLongChannel("PvDCDCInputTotalDischargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xA754, pvDCDCOutputTotalChargeEnergy = new ModbusReadLongChannel("PvDCDCOutputTotalChargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xA756, pvDCDCOutputTotalDischargeEnergy = new ModbusReadLongChannel("PvDCDCOutputTotalDischargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW)), new // 
    ModbusRegisterRange(// 
    0xA900, new UnsignedWordElement(0xA900, pvDCDC1WorkState = // 
    new ModbusReadLongChannel("PvDCDC1WorkState", this).label(2, // 
    "Initial").label(4, // 
    "Stop").label(8, // 
    "Ready").label(16, // 
    "Running").label(32, // 
    "Fault").label(64, // 
    "Debug").label(128, "Locked")), new UnsignedWordElement(0xA901, pvDCDC1WorkMode = // 
    new ModbusReadLongChannel("PvDCDC1WorkMode", this).label(128, // 
    "Constant Current").label(256, // 
    "Constant Voltage").label(512, "Boost MPPT"))), new // 
    ModbusRegisterRange(// 
    0xAA00, new // 
    UnsignedWordElement(// 
    0xAA00, // Prefix = "PvDCDC1 "
    // 
    new ModbusBitWrappingChannel("PvDCDC1SuggestiveInformation1", this, this.thingState).warningBit(0, // 
    WarningCharger.PvDCDC1CurrentSamplingChannelAbnormityOnHighVoltageSide).warningBit(1, // 
    WarningCharger.PvDCDC1CurrentSamplingChannelAbnormityOnLowVoltageSide).warningBit(6, // 
    WarningCharger.PvDCDC1EEPROMParametersOverRange).warningBit(7, // 
    WarningCharger.PvDCDC1UpdateEEPROMFailed).warningBit(8, // 
    WarningCharger.PvDCDC1ReadEEPROMFailed).warningBit(9, // 
    WarningCharger.PvDCDC1CurrentSamplingChannelAbnormityBeforeInductance)), new // 
    UnsignedWordElement(// 
    0xAA01, // Prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1SuggestiveInformation2", this, this.thingState).warningBit(0, // 
    WarningCharger.PvDCDC1ReactorPowerDecreaseCausedByOvertemperature).warningBit(1, // 
    WarningCharger.PvDCDC1IGBTPowerDecreaseCausedByOvertemperature).warningBit(2, // 
    WarningCharger.PvDCDC1TemperatureChanel3PowerDecreaseCausedByOvertemperature).warningBit(3, // 
    WarningCharger.PvDCDC1TemperatureChanel4PowerDecreaseCausedByOvertemperature).warningBit(4, // 
    WarningCharger.PvDCDC1TemperatureChanel5PowerDecreaseCausedByOvertemperature).warningBit(5, // 
    WarningCharger.PvDCDC1TemperatureChanel6PowerDecreaseCausedByOvertemperature).warningBit(6, // 
    WarningCharger.PvDCDC1TemperatureChanel7PowerDecreaseCausedByOvertemperature).warningBit(7, // 
    WarningCharger.PvDCDC1TemperatureChanel8PowerDecreaseCausedByOvertemperature).warningBit(8, // 
    WarningCharger.PvDCDC1Fan1StopFailed).warningBit(9, // 
    WarningCharger.PvDCDC1Fan2StopFailed).warningBit(10, // 
    WarningCharger.PvDCDC1Fan3StopFailed).warningBit(11, // 
    WarningCharger.PvDCDC1Fan4StopFailed).warningBit(12, // 
    WarningCharger.PvDCDC1Fan1StartupFailed).warningBit(13, // 
    WarningCharger.PvDCDC1Fan2StartupFailed).warningBit(14, // 
    WarningCharger.PvDCDC1Fan3StartupFailed).warningBit(15, // 
    WarningCharger.PvDCDC1Fan4StartupFailed)), new // 
    UnsignedWordElement(// 
    0xAA02, // prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1SuggestiveInformation3", this, this.thingState).warningBit(0, // 
    WarningCharger.PvDCDC1HighVoltageSideOvervoltage).warningBit(1, // 
    WarningCharger.PvDCDC1HighVoltageSideUndervoltage).warningBit(2, // 
    WarningCharger.PvDCDC1HighVoltageSideVoltageChangeUnconventionally)), new // 
    UnsignedWordElement(// 
    0xAA03, // prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1SuggestiveInformation4", this, this.thingState).warningBit(0, WarningCharger.PvDCDC1CurrentAbnormityBeforeDCConverterWorkOnHighVoltageSide).warningBit(1, WarningCharger.PvDCDC1CurrentAbnormityBeforeDCConverterWorkOnLowVoltageSXide).warningBit(2, WarningCharger.PvDCDC1InitialDutyRatioAbnormityBeforeDCConverterWork).warningBit(3, WarningCharger.PvDCDC1VoltageAbnormityBeforeDCConverterWorkOnHighVoltageSide).warningBit(4, WarningCharger.PvDCDC1VoltageAbnormityBeforeDCConverterWorkOnLowVoltageSide)), new UnsignedWordElement(0xAA04, // prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1SuggestiveInformation5", this, this.thingState).warningBit(0, // 
    WarningCharger.PvDCDC1HighVoltageBreakerInspectionAbnormity).warningBit(1, // 
    WarningCharger.PvDCDC1LowVoltageBreakerInspectionAbnormity).warningBit(2, // 
    WarningCharger.PvDCDC1BsmDCDC5DCPrechargeContactorInspectionAbnormity).warningBit(3, // 
    WarningCharger.PvDCDC1DCPrechargeContactorOpenUnsuccessfully).warningBit(4, // 
    WarningCharger.PvDCDC1DCMainContactorInspectionAbnormity).warningBit(5, // 
    WarningCharger.PvDCDC1DCMainContactorOpenUnsuccessfully).warningBit(6, // 
    WarningCharger.PvDCDC1OutputContactorCloseUnsuccessfully).warningBit(7, // 
    WarningCharger.PvDCDC1OutputContactorOpenUnsuccessfully).warningBit(8, // 
    WarningCharger.PvDCDC1ACMainContactorCloseUnsuccessfully).warningBit(9, // 
    WarningCharger.PvDCDC1ACMainContactorOpenUnsuccessfully).warningBit(10, // 
    WarningCharger.PvDCDC1NegContactorOpenUnsuccessfully).warningBit(11, // 
    WarningCharger.PvDCDC1NegContactorCloseUnsuccessfully).warningBit(12, // 
    WarningCharger.PvDCDC1NegContactorStateAbnormal)), new DummyElement(0xAA05, 0xAA0F), new // 
    UnsignedWordElement(// 
    0xAA10, // prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1Abnormity1", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDC1HighVoltageSideOfDCConverterUndervoltage).faultBit(1, // 
    FaultCharger.PvDCDC1HighVoltageSideOfDCConverterOvervoltage).faultBit(2, // 
    FaultCharger.PvDCDC1LowVoltageSideOfDCConverterUndervoltage).faultBit(3, // 
    FaultCharger.PvDCDC1LowVoltageSideOfDCConverterOvervoltage).faultBit(4, // 
    FaultCharger.PvDCDC1HighVoltageSideOfDCConverterOvercurrentFault).faultBit(5, // 
    FaultCharger.PvDCDC1LowVoltageSideOfDCConverterOvercurrentFault).faultBit(6, // 
    FaultCharger.PvDCDC1DCConverterIGBTFault).faultBit(7, // 
    FaultCharger.PvDCDC1DCConverterPrechargeUnmet)), new // 
    UnsignedWordElement(// 
    0xAA11, // prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1Abnormity2", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDC1BECUCommunicationDisconnected).faultBit(1, // 
    FaultCharger.PvDCDC1DCConverterCommunicationDisconnected).faultBit(2, // 
    FaultCharger.PvDCDC1CurrentConfigurationOverRange).faultBit(3, // 
    FaultCharger.PvDCDC1TheBatteryRequestStop).faultBit(5, // 
    FaultCharger.PvDCDC1OvercurrentRelayFault).faultBit(6, // 
    FaultCharger.PvDCDC1LightningProtectionDeviceFault).faultBit(7, // 
    FaultCharger.PvDCDC1DCConverterPriamaryContactorDisconnectedAbnormally).faultBit(9, // 
    FaultCharger.PvDCDC1DCDisconnectedAbnormallyOnLowVoltageSideOfDCConvetor).faultBit(12, // 
    FaultCharger.PvDCDC1DCConvetorEEPROMAbnormity1).faultBit(13, // 
    FaultCharger.PvDCDC1DCConvetorEEPROMAbnormity1Second).faultBit(14, // 
    FaultCharger.PvDCDC1EDCConvetorEEPROMAbnormity1)), new UnsignedWordElement(0xAA12, // prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1Abnormity3", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDC1DCConvertorGeneralOverload).faultBit(1, // 
    FaultCharger.PvDCDC1DCShortCircuit).faultBit(2, // 
    FaultCharger.PvDCDC1PeakPulseCurrentProtection).faultBit(3, // 
    FaultCharger.PvDCDC1DCDisconnectAbnormallyOnHighVoltageSideOfDCConvetor).faultBit(4, // 
    FaultCharger.PvDCDC1EffectivePulseValueOverhigh).faultBit(5, // 
    FaultCharger.PvDCDC1DCConverteSevereOverload).faultBit(6, // 
    FaultCharger.PvDCDC1DCBreakerDisconnectAbnormallyOnHighVoltageSideOfDCConvetor).faultBit(7, // 
    FaultCharger.PvDCDC1DCBreakerDisconnectAbnormallyOnLowVoltageSideOfDCConvetor).faultBit(8, // 
    FaultCharger.PvDCDC1DCConvetorPrechargeContactorCloseFailed).faultBit(9, // 
    FaultCharger.PvDCDC1DCConvetorMainContactorCloseFailed).faultBit(10, // 
    FaultCharger.PvDCDC1ACContactorStateAbnormityOfDCConvetor).faultBit(11, // 
    FaultCharger.PvDCDC1DCConvetorEmergencyStop).faultBit(12, // 
    FaultCharger.PvDCDC1DCConverterChargingGunDisconnected).faultBit(13, // 
    FaultCharger.PvDCDC1DCCurrentAbnormityBeforeDCConvetorWork).faultBit(14, // 
    FaultCharger.PvDCDC1FuSeDisconnected).faultBit(15, // 
    FaultCharger.PvDCDC1DCConverterHardwareCurrentOrVoltageFault)), // 
    new UnsignedWordElement(0xAA13, // prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1Abnormity4", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDC1DCConverterCrystalOscillatorCircuitInvalidation).faultBit(1, // 
    FaultCharger.PvDCDC1DCConverterResetCircuitInvalidation).faultBit(2, // 
    FaultCharger.PvDCDC1DCConverterSamplingCircuitInvalidation).faultBit(3, // 
    FaultCharger.PvDCDC1DCConverterDigitalIOCircuitInvalidation).faultBit(4, // 
    FaultCharger.PvDCDC1DCConverterPWMCircuitInvalidation).faultBit(5, // 
    FaultCharger.PvDCDC1DCConverterX5045CircuitInvalidation).faultBit(6, // 
    FaultCharger.PvDCDC1DCConverterCANCircuitInvalidation).faultBit(7, // 
    FaultCharger.PvDCDC1DCConverterSoftwareANDHardwareProtectionCircuitInvalidation).faultBit(8, // 
    FaultCharger.PvDCDC1DCConverterPowerCircuitInvalidation).faultBit(9, // 
    FaultCharger.PvDCDC1DCConverterCPUInvalidation).faultBit(10, // 
    FaultCharger.PvDCDC1DCConverterTINT0InterruptInvalidation).faultBit(11, // 
    FaultCharger.PvDCDC1DCConverterADCInterruptInvalidation).faultBit(12, // 
    FaultCharger.PvDCDC1DCConverterCAPITN4InterruptInvalidation).faultBit(13, // 
    FaultCharger.PvDCDC1DCConverterCAPINT6InterruptInvalidation).faultBit(14, // 
    FaultCharger.PvDCDC1DCConverterT3PINTinterruptInvalidation).faultBit(15, // 
    FaultCharger.PvDCDC1DCConverterT4PINTinterruptInvalidation)), // 
    new UnsignedWordElement(0xAA14, // prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1Abnormity5", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDC1DCConverterPDPINTAInterruptInvalidation).faultBit(1, // 
    FaultCharger.PvDCDC1DCConverterT1PINTInterruptInvalidationSecond).faultBit(2, // 
    FaultCharger.PvDCDC1DCConverterRESVInterruptInvalidation).faultBit(3, // 
    FaultCharger.PvDCDC1DCConverter100usTaskInvalidation).faultBit(4, // 
    FaultCharger.PvDCDC1DCConverterClockInvalidation).faultBit(5, // 
    FaultCharger.PvDCDC1DCConverterEMSMemoryInvalidation).faultBit(6, // 
    FaultCharger.PvDCDC1DCConverterExteriorCommunicationInvalidation).faultBit(7, // 
    FaultCharger.PvDCDC1DCConverterIOInterfaceInvalidation).faultBit(8, // 
    FaultCharger.PvDCDC1DCConverterInputVoltageBoundFault).faultBit(9, // 
    FaultCharger.PvDCDC1DCConverterOutterVoltageBoundFault).faultBit(10, // 
    FaultCharger.PvDCDC1DCConverterOutputVoltageBoundFault).faultBit(11, // 
    FaultCharger.PvDCDC1DCConverterInductCurrentBoundFault).faultBit(12, // 
    FaultCharger.PvDCDC1DCConverterInputCurrentBoundFault).faultBit(13, // 
    FaultCharger.PvDCDC1DCConverterOutputCurrentBoundFault)), // 
    new UnsignedWordElement(0xAA15, // prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1Abnormity6", this, this.thingState).faultBit(0, // 
    FaultCharger.PvDCDC1DCReactorOverTemperature).faultBit(1, // 
    FaultCharger.PvDCDC1DCIGBTOverTemperature).faultBit(2, // 
    FaultCharger.PvDCDC1DCConverterChanel3OverTemperature).faultBit(3, // 
    FaultCharger.PvDCDC1DCConverterChanel4OverTemperature).faultBit(4, // 
    FaultCharger.PvDCDC1DCConverterChanel5OverTemperature).faultBit(5, // 
    FaultCharger.PvDCDC1DCConverterChanel6OverTemperature).faultBit(6, // 
    FaultCharger.PvDCDC1DCConverterChanel7OverTemperature).faultBit(7, // 
    FaultCharger.PvDCDC1DCConverterChanel8OverTemperature).faultBit(8, // 
    FaultCharger.PvDCDC1DCReactorTemperatureSamplingInvalidation).faultBit(9, // 
    FaultCharger.PvDCDC1DCIGBTTemperatureSamplingInvalidation).faultBit(10, // 
    FaultCharger.PvDCDC1DCConverterChanel3TemperatureSamplingInvalidation).faultBit(11, // 
    FaultCharger.PvDCDC1DCConverterChanel4TemperatureSamplingInvalidation).faultBit(12, // 
    FaultCharger.PvDCDC1DCConverterChanel5TemperatureSamplingInvalidation).faultBit(13, // 
    FaultCharger.PvDCDC1DCConverterChanel6TemperatureSamplingInvalidation).faultBit(14, // 
    FaultCharger.PvDCDC1DCConverterChanel7TemperatureSamplingInvalidation).faultBit(15, // 
    FaultCharger.PvDCDC1DCConverterChanel8TemperatureSamplingInvalidation)), // 
    new UnsignedWordElement(0xAA16, // prefix = "PvDCDC1"
    // 
    new ModbusBitWrappingChannel("PvDCDC1Abnormity7", this, this.thingState).faultBit(4, // 
    FaultCharger.PvDCDC1DCConverterInductanceCurrentSamplingInvalidation).faultBit(5, // 
    FaultCharger.PvDCDC1CurrentSamplingInvalidationOnTheLowVoltageSideOfDCConverter).faultBit(6, // 
    FaultCharger.PvDCDC1VoltageSamplingInvalidationOnTheLowVoltageSideOfDCConverter).faultBit(7, // 
    FaultCharger.PvDCDC1InsulationInspectionFault).faultBit(8, // 
    FaultCharger.PvDCDC1NegContactorCloseUnsuccessly).faultBit(9, // 
    FaultCharger.PvDCDC1NegContactorCutWhenRunning)), // 
    new DummyElement(0xAA17, 0xAA1F), new UnsignedWordElement(0xAA20, pvDCDC1SwitchState = // 
    new StatusBitChannel("PvDCDC1SwitchState", this).label(1, // 
    "DC precharge contactor").label(2, // 
    "DC main contactor").label(4, // 
    "Output contactor").label(8, // 
    "Output breaker").label(16, // 
    "Input breaker").label(32, // 
    "AC contactor").label(64, // 
    "Emergency stop button").label(128, "NegContactor"))), new // 
    ModbusRegisterRange(// 
    0xAA30, new SignedWordElement(0xAA30, pvDCDC1OutputVoltage = new ModbusReadLongChannel("PvDCDC1OutputVoltage", this).unit("mV").multiplier(2)), new SignedWordElement(0xAA31, pvDCDC1OutputCurrent = new ModbusReadLongChannel("PvDCDC1OutputCurrent", this).unit("mA").multiplier(2)), new SignedWordElement(0xAA32, pvDCDC1OutputPower = new ModbusReadLongChannel("PvDCDC1OutputPower", this).unit("W").multiplier(2)), new SignedWordElement(0xAA33, pvDCDC1InputVoltage = new ModbusReadLongChannel("PvDCDC1InputVoltage", this).unit("mV").multiplier(2)), new SignedWordElement(0xAA34, pvDCDC1InputCurrent = new ModbusReadLongChannel("PvDCDC1InputCurrent", this).unit("mA").multiplier(2)), new SignedWordElement(0xAA35, pvDCDC1InputPower = new ModbusReadLongChannel("PvDCDC1InputPower", this).unit("W").multiplier(2)), new SignedWordElement(0xAA36, pvDCDC1InputEnergy = new ModbusReadLongChannel("PvDCDC1InputEnergy", this).unit("Wh").multiplier(2)), new SignedWordElement(0xAA37, pvDCDC1OutputEnergy = new ModbusReadLongChannel("PvDCDC1OutputEnergy", this).unit("Wh").multiplier(2)), new DummyElement(0xAA38, 0xAA3F), new SignedWordElement(0xAA40, pvDCDC1ReactorTemperature = new ModbusReadLongChannel("PvDCDC1ReactorTemperature", this).unit("°C")), new SignedWordElement(0xAA41, pvDCDC1IgbtTemperature = new ModbusReadLongChannel("PvDCDC1IgbtTemperature", this).unit("°C")), new DummyElement(0xAA42, 0xAA4F), new UnsignedDoublewordElement(0xAA50, pvDCDC1InputTotalChargeEnergy = new ModbusReadLongChannel("PvDCDC1InputTotalChargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xAA52, pvDCDC1InputTotalDischargeEnergy = new ModbusReadLongChannel("PvDCDC1InputTotalDischargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xAA54, pvDCDC1OutputTotalChargeEnergy = new ModbusReadLongChannel("PvDCDC1OutputTotalChargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW), new UnsignedDoublewordElement(0xAA56, pvDCDC1OutputTotalDischargeEnergy = new ModbusReadLongChannel("PvDCDC1OutputTotalDischargeEnergy", this).unit("Wh").multiplier(2)).wordOrder(WordOrder.LSWMSW)));
    actualPower = new FunctionalReadChannel<Long>("ActualPower", this, (channels) -> {
        long erg = 0;
        try {
            for (ReadChannel<Long> ch : channels) {
                erg += ch.value();
            }
            return erg;
        } catch (InvalidValueException e) {
            return null;
        }
    }, pvDCDCInputPower, pvDCDC1InputPower);
    inputVoltage = new FunctionalReadChannel<Long>("InputVoltage", this, (channels) -> {
        long erg = 0;
        try {
            for (ReadChannel<Long> ch : channels) {
                if (erg < ch.value()) {
                    erg = ch.value();
                }
            }
            return erg;
        } catch (InvalidValueException e) {
            return null;
        }
    }, pvDCDCInputVoltage, pvDCDC1InputVoltage);
    return protocol;
}
Also used : ReadChannel(io.openems.api.channel.ReadChannel) ModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.ModbusRegisterRange) ThingInfo(io.openems.api.doc.ThingInfo) WriteChannel(io.openems.api.channel.WriteChannel) ConfigChannel(io.openems.api.channel.ConfigChannel) ChargerNature(io.openems.api.device.nature.charger.ChargerNature) ModbusProtocol(io.openems.impl.protocol.modbus.internal.ModbusProtocol) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) ModbusReadChannel(io.openems.impl.protocol.modbus.ModbusReadChannel) ModbusWriteChannel(io.openems.impl.protocol.modbus.ModbusWriteChannel) 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) 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) 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) StaticValueChannel(io.openems.api.channel.StaticValueChannel) WordOrder(io.openems.impl.protocol.modbus.internal.WordOrder) DummyElement(io.openems.impl.protocol.modbus.internal.DummyElement) ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) WriteableModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.WriteableModbusRegisterRange) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) ReadChannel(io.openems.api.channel.ReadChannel) ModbusReadChannel(io.openems.impl.protocol.modbus.ModbusReadChannel) FunctionalReadChannel(io.openems.api.channel.FunctionalReadChannel) InvalidValueException(io.openems.api.exception.InvalidValueException) StatusBitChannel(io.openems.api.channel.StatusBitChannel) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) DummyElement(io.openems.impl.protocol.modbus.internal.DummyElement) UnsignedWordElement(io.openems.impl.protocol.modbus.internal.UnsignedWordElement) UnsignedDoublewordElement(io.openems.impl.protocol.modbus.internal.UnsignedDoublewordElement) SignedWordElement(io.openems.impl.protocol.modbus.internal.SignedWordElement) ModbusProtocol(io.openems.impl.protocol.modbus.internal.ModbusProtocol)

Example 2 with ReadChannel

use of io.openems.api.channel.ReadChannel in project openems by OpenEMS.

the class FeneconProEss 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 // 
    UnsignedWordElement(// 
    102, workMode = // 
    new ModbusReadLongChannel("WorkMode", this).label(2, // 
    "Economy").label(6, // 
    "Remote").label(8, // 
    "Timing")), // 
    new DummyElement(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, state).warningBit(0, // Fail, The system should be stopped
    WarningEss.FailTheSystemShouldBeStopped).warningBit(1, // Common low voltage alarm
    WarningEss.CommonLowVoltageAlarm).warningBit(2, // Common high voltage alarm
    WarningEss.CommonHighVoltageAlarm).warningBit(3, // Charging over current alarm
    WarningEss.ChargingOverCurrentAlarm).warningBit(4, // Discharging over current alarm
    WarningEss.DischargingOverCurrentAlarm).warningBit(5, // Over temperature alarm
    WarningEss.OverTemperatureAlarm).warningBit(6, // Interal communication abnormal
    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, currentL1 = new ModbusReadLongChannel("CurrentL1", this).unit("mA").multiplier(2)), new // 
    SignedWordElement(// 
    119, currentL2 = new ModbusReadLongChannel("CurrentL2", this).unit("mA").multiplier(2)), new // 
    SignedWordElement(// 
    120, currentL3 = new ModbusReadLongChannel("CurrentL3", this).unit("mA").multiplier(2)), new // 
    UnsignedWordElement(// 
    121, voltageL1 = new ModbusReadLongChannel("VoltageL1", this).unit("mV").multiplier(2)), new // 
    UnsignedWordElement(// 
    122, voltageL2 = new ModbusReadLongChannel("VoltageL2", this).unit("mV").multiplier(2)), new // 
    UnsignedWordElement(// 
    123, voltageL3 = new ModbusReadLongChannel("VoltageL3", this).unit("mV").multiplier(2)), new // 
    SignedWordElement(// 
    124, activePowerL1 = new ModbusReadLongChannel("ActivePowerL1", this).unit("W")), new // 
    SignedWordElement(// 
    125, activePowerL2 = new ModbusReadLongChannel("ActivePowerL2", this).unit("W")), new // 
    SignedWordElement(// 
    126, activePowerL3 = new ModbusReadLongChannel("ActivePowerL3", this).unit("W")), new // 
    SignedWordElement(// 
    127, reactivePowerL1 = new ModbusReadLongChannel("ReactivePowerL1", this).unit("var")), new // 
    SignedWordElement(// 
    128, reactivePowerL2 = new ModbusReadLongChannel("ReactivePowerL2", this).unit("var")), new // 
    SignedWordElement(// 
    129, reactivePowerL3 = new ModbusReadLongChannel("ReactivePowerL3", this).unit("var")), new DummyElement(130), new // 
    UnsignedWordElement(// 
    131, frequencyL1 = new ModbusReadLongChannel("FrequencyL1", this).unit("mHz").multiplier(1)), new // 
    UnsignedWordElement(// 
    132, frequencyL2 = new ModbusReadLongChannel("FrequencyL2", this).unit("mHz").multiplier(1)), new // 
    UnsignedWordElement(// 
    133, frequencyL3 = new ModbusReadLongChannel("FrequencyL3", this).unit("mHz").multiplier(1)), new // 
    UnsignedWordElement(// 
    134, phaseAllowedApparent = new ModbusReadLongChannel("PhaseAllowedApparentPower", this).unit("VA")), new DummyElement(135, 140), new // 
    UnsignedWordElement(// 
    141, allowedCharge = new ModbusReadLongChannel("AllowedCharge", this).negate().unit("W")), new // 
    UnsignedWordElement(// 
    142, allowedDischarge = new ModbusReadLongChannel("AllowedDischarge", this).unit("W"))), new ModbusRegisterRange(150, new UnsignedWordElement(150, // 
    new ModbusBitWrappingChannel("PcsAlarm1L1", this, state).warningBit(0, // Grid undervoltage
    WarningEss.GridUndervoltageL1).warningBit(1, // Grid overvoltage
    WarningEss.GridOvervoltageL1).warningBit(2, // Grid under frequency
    WarningEss.GridUnderFrequencyL1).warningBit(3, // Grid over frequency
    WarningEss.GridOverFrequencyL1).warningBit(4, // Grid power supply off
    WarningEss.GridPowerSupplyOffL1).warningBit(5, // Grid condition unmeet
    WarningEss.GridConditionUnmeetL1).warningBit(6, // DC under voltage
    WarningEss.DCUnderVoltageL1).warningBit(7, // Input over resistance
    WarningEss.InputOverResistanceL1).warningBit(8, // Combination error
    WarningEss.CombinationErrorL1).warningBit(9, // Comm with inverter error
    WarningEss.CommWithInverterErrorL1).warningBit(10, // Tme error
    WarningEss.TmeErrorL1)), new UnsignedWordElement(151, new ModbusBitWrappingChannel("PcsAlarm2L1", this, state)), new UnsignedWordElement(152, // 
    new ModbusBitWrappingChannel("PcsFault1L1", this, state).faultBit(0, // Control current overload
    FaultEss.ControlCurrentOverload100PercentL1).faultBit(1, // Control current overload
    FaultEss.ControlCurrentOverload110PercentL1).faultBit(2, // Control current overload
    FaultEss.ControlCurrentOverload150PercentL1).faultBit(3, // Control current overload
    FaultEss.ControlCurrentOverload200PercentL1).faultBit(4, // Control current overload
    FaultEss.ControlCurrentOverload120PercentL1).faultBit(5, // Control current overload
    FaultEss.ControlCurrentOverload300PercentL1).faultBit(6, // Control transient load 300%
    FaultEss.ControlTransientLoad300PercentL1).faultBit(7, // Grid over current
    FaultEss.GridOverCurrentL1).faultBit(8, // Locking waveform too many times
    FaultEss.LockingWaveformTooManyTimesL1).faultBit(9, // Inverter voltage zero drift
    FaultEss.InverterVoltageZeroDriftErrorL1).faultBit(10, // Grid voltage zero drift error
    FaultEss.GridVoltageZeroDriftErrorL1).faultBit(11, // Control current zero drift
    FaultEss.ControlCurrentZeroDriftErrorL1).faultBit(12, // Inverter current zero drift
    FaultEss.InverterCurrentZeroDriftErrorL1).faultBit(13, // Grid current zero drift error
    FaultEss.GridCurrentZeroDriftErrorL1).faultBit(14, // PDP protection
    FaultEss.PDPProtectionL1).faultBit(15, // Hardware control current
    FaultEss.HardwareControlCurrentProtectionL1)), // protection
    new UnsignedWordElement(153, // 
    new ModbusBitWrappingChannel("PcsFault2L1", this, state).faultBit(0, // Hardware AC volt. protection
    FaultEss.HardwareACVoltageProtectionL1).faultBit(1, // Hardware DC curr. protection
    FaultEss.HardwareDCCurrentProtectionL1).faultBit(2, // Hardware temperature
    FaultEss.HardwareTemperatureProtectionL1).faultBit(3, // No capturing signal
    FaultEss.NoCapturingSignalL1).faultBit(4, // DC overvoltage
    FaultEss.DCOvervoltageL1).faultBit(5, // DC disconnected
    FaultEss.DCDisconnectedL1).faultBit(6, // Inverter undervoltage
    FaultEss.InverterUndervoltageL1).faultBit(7, // Inverter overvoltage
    FaultEss.InverterOvervoltageL1).faultBit(8, // Current sensor fail
    FaultEss.CurrentSensorFailL1).faultBit(9, // Voltage sensor fail
    FaultEss.VoltageSensorFailL1).faultBit(10, // Power uncontrollable
    FaultEss.PowerUncontrollableL1).faultBit(11, // Current uncontrollable
    FaultEss.CurrentUncontrollableL1).faultBit(12, // Fan error
    FaultEss.FanErrorL1).faultBit(13, // Phase lack
    FaultEss.PhaseLackL1).faultBit(14, // Inverter relay fault
    FaultEss.InverterRelayFaultL1).faultBit(15, // Grid relay fault
    FaultEss.GridRealyFaultL1)), new UnsignedWordElement(154, // 
    new ModbusBitWrappingChannel("PcsFault3L1", this, state).faultBit(0, // Control panel overtemp
    FaultEss.ControlPanelOvertempL1).faultBit(1, // Power panel overtemp
    FaultEss.PowerPanelOvertempL1).faultBit(2, // DC input overcurrent
    FaultEss.DCInputOvercurrentL1).faultBit(3, // Capacitor overtemp
    FaultEss.CapacitorOvertempL1).faultBit(4, // Radiator overtemp
    FaultEss.RadiatorOvertempL1).faultBit(5, // Transformer overtemp
    FaultEss.TransformerOvertempL1).faultBit(6, // Combination comm error
    FaultEss.CombinationCommErrorL1).faultBit(7, // EEPROM error
    FaultEss.EEPROMErrorL1).faultBit(8, // Load current zero drift error
    FaultEss.LoadCurrentZeroDriftErrorL1).faultBit(9, // Current limit-R error
    FaultEss.CurrentLimitRErrorL1).faultBit(10, // Phase sync error
    FaultEss.PhaseSyncErrorL1).faultBit(11, // External PV current zero
    FaultEss.ExternalPVCurrentZeroDriftErrorL1).faultBit(12, // External grid current
    FaultEss.ExternalGridCurrentZeroDriftErrorL1)), // zero drift error
    new UnsignedWordElement(155, // 
    new ModbusBitWrappingChannel("PcsAlarm1L2", this, state).warningBit(0, // Grid undervoltage
    WarningEss.GridUndervoltageL2).warningBit(1, // Grid overvoltage
    WarningEss.GridOvervoltageL2).warningBit(2, // Grid under frequency
    WarningEss.GridUnderFrequencyL2).warningBit(3, // Grid over frequency
    WarningEss.GridOverFrequencyL2).warningBit(4, // Grid power supply off
    WarningEss.GridPowerSupplyOffL2).warningBit(5, // Grid condition unmeet
    WarningEss.GridConditionUnmeetL2).warningBit(6, // DC under voltage
    WarningEss.DCUnderVoltageL2).warningBit(7, // Input over resistance
    WarningEss.InputOverResistanceL2).warningBit(8, // Combination error
    WarningEss.CombinationErrorL2).warningBit(9, // Comm with inverter error
    WarningEss.CommWithInverterErrorL2).warningBit(10, // Tme error
    WarningEss.TmeErrorL2)), new UnsignedWordElement(156, new ModbusBitWrappingChannel("PcsAlarm2L2", this, state)), new UnsignedWordElement(157, // 
    new ModbusBitWrappingChannel("PcsFault1L2", this, state).faultBit(0, // Control current overload
    FaultEss.ControlCurrentOverload100PercentL2).faultBit(1, // Control current overload
    FaultEss.ControlCurrentOverload110PercentL2).faultBit(2, // Control current overload
    FaultEss.ControlCurrentOverload150PercentL2).faultBit(3, // Control current overload
    FaultEss.ControlCurrentOverload200PercentL2).faultBit(4, // Control current overload
    FaultEss.ControlCurrentOverload120PercentL2).faultBit(5, // Control current overload
    FaultEss.ControlCurrentOverload300PercentL2).faultBit(6, // Control transient load 300%
    FaultEss.ControlTransientLoad300PercentL2).faultBit(7, // Grid over current
    FaultEss.GridOverCurrentL2).faultBit(8, // Locking waveform too many times
    FaultEss.LockingWaveformTooManyTimesL2).faultBit(9, // Inverter voltage zero drift
    FaultEss.InverterVoltageZeroDriftErrorL2).faultBit(10, // Grid voltage zero drift error
    FaultEss.GridVoltageZeroDriftErrorL2).faultBit(11, // Control current zero drift
    FaultEss.ControlCurrentZeroDriftErrorL2).faultBit(12, // Inverter current zero drift
    FaultEss.InverterCurrentZeroDriftErrorL2).faultBit(13, // Grid current zero drift error
    FaultEss.GridCurrentZeroDriftErrorL2).faultBit(14, // PDP protection
    FaultEss.PDPProtectionL2).faultBit(15, // Hardware control current
    FaultEss.HardwareControlCurrentProtectionL2)), // protection
    new UnsignedWordElement(158, // 
    new ModbusBitWrappingChannel("PcsFault2L2", this, state).faultBit(0, // Hardware AC volt. protection
    FaultEss.HardwareACVoltageProtectionL2).faultBit(1, // Hardware DC curr. protection
    FaultEss.HardwareDCCurrentProtectionL2).faultBit(2, // Hardware temperature
    FaultEss.HardwareTemperatureProtectionL2).faultBit(3, // No capturing signal
    FaultEss.NoCapturingSignalL2).faultBit(4, // DC overvoltage
    FaultEss.DCOvervoltageL2).faultBit(5, // DC disconnected
    FaultEss.DCDisconnectedL2).faultBit(6, // Inverter undervoltage
    FaultEss.InverterUndervoltageL2).faultBit(7, // Inverter overvoltage
    FaultEss.InverterOvervoltageL2).faultBit(8, // Current sensor fail
    FaultEss.CurrentSensorFailL2).faultBit(9, // Voltage sensor fail
    FaultEss.VoltageSensorFailL2).faultBit(10, // Power uncontrollable
    FaultEss.PowerUncontrollableL2).faultBit(11, // Current uncontrollable
    FaultEss.CurrentUncontrollableL2).faultBit(12, // Fan error
    FaultEss.FanErrorL2).faultBit(13, // Phase lack
    FaultEss.PhaseLackL2).faultBit(14, // Inverter relay fault
    FaultEss.InverterRelayFaultL2).faultBit(15, // Grid relay fault
    FaultEss.GridRealyFaultL2)), new UnsignedWordElement(159, // 
    new ModbusBitWrappingChannel("PcsFault3L2", this, state).faultBit(0, // Control panel overtemp
    FaultEss.ControlPanelOvertempL2).faultBit(1, // Power panel overtemp
    FaultEss.PowerPanelOvertempL2).faultBit(2, // DC input overcurrent
    FaultEss.DCInputOvercurrentL2).faultBit(3, // Capacitor overtemp
    FaultEss.CapacitorOvertempL2).faultBit(4, // Radiator overtemp
    FaultEss.RadiatorOvertempL2).faultBit(5, // Transformer overtemp
    FaultEss.TransformerOvertempL2).faultBit(6, // Combination comm error
    FaultEss.CombinationCommErrorL2).faultBit(7, // EEPROM error
    FaultEss.EEPROMErrorL2).faultBit(8, // Load current zero drift error
    FaultEss.LoadCurrentZeroDriftErrorL2).faultBit(9, // Current limit-R error
    FaultEss.CurrentLimitRErrorL2).faultBit(10, // Phase sync error
    FaultEss.PhaseSyncErrorL2).faultBit(11, // External PV current zero
    FaultEss.ExternalPVCurrentZeroDriftErrorL2).faultBit(12, // External grid current
    FaultEss.ExternalGridCurrentZeroDriftErrorL2)), // zero drift error
    new UnsignedWordElement(160, // 
    new ModbusBitWrappingChannel("PcsAlarm1L3", this, state).warningBit(0, // Grid undervoltage
    WarningEss.GridUndervoltageL3).warningBit(1, // Grid overvoltage
    WarningEss.GridOvervoltageL3).warningBit(2, // Grid under frequency
    WarningEss.GridUnderFrequencyL3).warningBit(3, // Grid over frequency
    WarningEss.GridOverFrequencyL3).warningBit(4, // Grid power supply off
    WarningEss.GridPowerSupplyOffL3).warningBit(5, // Grid condition unmeet
    WarningEss.GridConditionUnmeetL3).warningBit(6, // DC under voltage
    WarningEss.DCUnderVoltageL3).warningBit(7, // Input over resistance
    WarningEss.InputOverResistanceL3).warningBit(8, // Combination error
    WarningEss.CombinationErrorL3).warningBit(9, // Comm with inverter error
    WarningEss.CommWithInverterErrorL3).warningBit(10, // Tme error
    WarningEss.TmeErrorL3)), new UnsignedWordElement(161, new ModbusBitWrappingChannel("PcsAlarm2L3", this, state)), new UnsignedWordElement(162, // 
    new ModbusBitWrappingChannel("PcsFault1L3", this, state).faultBit(0, // Control current overload
    FaultEss.ControlCurrentOverload100PercentL3).faultBit(1, // Control current overload
    FaultEss.ControlCurrentOverload110PercentL3).faultBit(2, // Control current overload
    FaultEss.ControlCurrentOverload150PercentL3).faultBit(3, // Control current overload
    FaultEss.ControlCurrentOverload200PercentL3).faultBit(4, // Control current overload
    FaultEss.ControlCurrentOverload120PercentL3).faultBit(5, // Control current overload
    FaultEss.ControlCurrentOverload300PercentL3).faultBit(6, // Control transient load 300%
    FaultEss.ControlTransientLoad300PercentL3).faultBit(7, // Grid over current
    FaultEss.GridOverCurrentL3).faultBit(8, // Locking waveform too many times
    FaultEss.LockingWaveformTooManyTimesL3).faultBit(9, // Inverter voltage zero drift
    FaultEss.InverterVoltageZeroDriftErrorL3).faultBit(10, // Grid voltage zero drift error
    FaultEss.GridVoltageZeroDriftErrorL3).faultBit(11, // Control current zero drift
    FaultEss.ControlCurrentZeroDriftErrorL3).faultBit(12, // Inverter current zero drift
    FaultEss.InverterCurrentZeroDriftErrorL3).faultBit(13, // Grid current zero drift error
    FaultEss.GridCurrentZeroDriftErrorL3).faultBit(14, // PDP protection
    FaultEss.PDPProtectionL3).faultBit(15, // Hardware control current
    FaultEss.HardwareControlCurrentProtectionL3)), // protection
    new UnsignedWordElement(163, // 
    new ModbusBitWrappingChannel("PcsFault2L3", this, state).faultBit(0, // Hardware AC volt. protection
    FaultEss.HardwareACVoltageProtectionL3).faultBit(1, // Hardware DC curr. protection
    FaultEss.HardwareDCCurrentProtectionL3).faultBit(2, // Hardware temperature
    FaultEss.HardwareTemperatureProtectionL3).faultBit(3, // No capturing signal
    FaultEss.NoCapturingSignalL3).faultBit(4, // DC overvoltage
    FaultEss.DCOvervoltageL3).faultBit(5, // DC disconnected
    FaultEss.DCDisconnectedL3).faultBit(6, // Inverter undervoltage
    FaultEss.InverterUndervoltageL3).faultBit(7, // Inverter overvoltage
    FaultEss.InverterOvervoltageL3).faultBit(8, // Current sensor fail
    FaultEss.CurrentSensorFailL3).faultBit(9, // Voltage sensor fail
    FaultEss.VoltageSensorFailL3).faultBit(10, // Power uncontrollable
    FaultEss.PowerUncontrollableL3).faultBit(11, // Current uncontrollable
    FaultEss.CurrentUncontrollableL3).faultBit(12, // Fan error
    FaultEss.FanErrorL3).faultBit(13, // Phase lack
    FaultEss.PhaseLackL3).faultBit(14, // Inverter relay fault
    FaultEss.InverterRelayFaultL3).faultBit(15, // Grid relay fault
    FaultEss.GridRealyFaultL3)), new UnsignedWordElement(164, // 
    new ModbusBitWrappingChannel("PcsFault3L3", this, state).faultBit(0, // Control panel overtemp
    FaultEss.ControlPanelOvertempL3).faultBit(1, // Power panel overtemp
    FaultEss.PowerPanelOvertempL3).faultBit(2, // DC input overcurrent
    FaultEss.DCInputOvercurrentL3).faultBit(3, // Capacitor overtemp
    FaultEss.CapacitorOvertempL3).faultBit(4, // Radiator overtemp
    FaultEss.RadiatorOvertempL3).faultBit(5, // Transformer overtemp
    FaultEss.TransformerOvertempL3).faultBit(6, // Combination comm error
    FaultEss.CombinationCommErrorL3).faultBit(7, // EEPROM error
    FaultEss.EEPROMErrorL3).faultBit(8, // Load current zero drift error
    FaultEss.LoadCurrentZeroDriftErrorL3).faultBit(9, // Current limit-R error
    FaultEss.CurrentLimitRErrorL3).faultBit(10, // Phase sync error
    FaultEss.PhaseSyncErrorL3).faultBit(11, // External PV current zero
    FaultEss.ExternalPVCurrentZeroDriftErrorL3).faultBit(12, // External grid current
    FaultEss.ExternalGridCurrentZeroDriftErrorL3))), // zero drift error
    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, // 
    STANDBY).label(4, STOP))), new // 
    WriteableModbusRegisterRange(// 
    206, new SignedWordElement(206, // 
    setActivePowerL1 = new ModbusWriteLongChannel("SetActivePowerL1", this).unit("W")), new SignedWordElement(207, setReactivePowerL1 = new ModbusWriteLongChannel("SetReactivePowerL1", this).unit(// 
    "Var")), new SignedWordElement(208, // 
    setActivePowerL2 = new ModbusWriteLongChannel("SetActivePowerL2", this).unit("W")), new SignedWordElement(209, setReactivePowerL2 = new ModbusWriteLongChannel("SetReactivePowerL2", this).unit(// 
    "Var")), new SignedWordElement(210, // 
    setActivePowerL3 = new ModbusWriteLongChannel("SetActivePowerL3", this).unit("W")), new SignedWordElement(211, // 
    setReactivePowerL3 = new ModbusWriteLongChannel("SetReactivePowerL3", this).unit("Var"))), // 
    new ModbusRegisterRange(3020, new UnsignedWordElement(3020, batteryVoltageSection1 = new ModbusReadLongChannel("BatteryVoltageSection1", this).unit("mV")), new UnsignedWordElement(3021, batteryVoltageSection2 = new ModbusReadLongChannel("BatteryVoltageSection2", this).unit("mV")), new UnsignedWordElement(3022, batteryVoltageSection3 = new ModbusReadLongChannel("BatteryVoltageSection3", this).unit("mV")), new UnsignedWordElement(3023, batteryVoltageSection4 = new ModbusReadLongChannel("BatteryVoltageSection4", this).unit("mV")), new UnsignedWordElement(3024, batteryVoltageSection5 = new ModbusReadLongChannel("BatteryVoltageSection5", this).unit("mV")), new UnsignedWordElement(3025, batteryVoltageSection6 = new ModbusReadLongChannel("BatteryVoltageSection6", this).unit("mV")), new UnsignedWordElement(3026, batteryVoltageSection7 = new ModbusReadLongChannel("BatteryVoltageSection7", this).unit("mV")), new UnsignedWordElement(3027, batteryVoltageSection8 = new ModbusReadLongChannel("BatteryVoltageSection8", this).unit("mV")), new UnsignedWordElement(3028, batteryVoltageSection9 = new ModbusReadLongChannel("BatteryVoltageSection9", this).unit("mV")), new UnsignedWordElement(3029, batteryVoltageSection10 = new ModbusReadLongChannel("BatteryVoltageSection10", this).unit("mV")), new UnsignedWordElement(3030, batteryVoltageSection11 = new ModbusReadLongChannel("BatteryVoltageSection11", this).unit("mV")), new UnsignedWordElement(3031, batteryVoltageSection12 = new ModbusReadLongChannel("BatteryVoltageSection12", this).unit("mV")), new UnsignedWordElement(3032, batteryVoltageSection13 = new ModbusReadLongChannel("BatteryVoltageSection13", this).unit("mV")), new UnsignedWordElement(3033, batteryVoltageSection14 = new ModbusReadLongChannel("BatteryVoltageSection14", this).unit("mV")), new UnsignedWordElement(3034, batteryVoltageSection15 = new ModbusReadLongChannel("BatteryVoltageSection15", this).unit("mV")), new UnsignedWordElement(3035, batteryVoltageSection16 = new ModbusReadLongChannel("BatteryVoltageSection16", this).unit("mV")), new UnsignedWordElement(3036, batteryTemperatureSection1 = new ModbusReadLongChannel("BatteryTemperatureSection1", this).unit("°C").delta(-40L)), new UnsignedWordElement(3037, batteryTemperatureSection2 = new ModbusReadLongChannel("BatteryTemperatureSection2", this).unit("°C").delta(-40L)), new UnsignedWordElement(3038, batteryTemperatureSection3 = new ModbusReadLongChannel("BatteryTemperatureSection3", this).unit("°C").delta(-40L)), new UnsignedWordElement(3039, batteryTemperatureSection4 = new ModbusReadLongChannel("BatteryTemperatureSection4", this).unit("°C").delta(-40L)), new UnsignedWordElement(3040, batteryTemperatureSection5 = new ModbusReadLongChannel("BatteryTemperatureSection5", this).unit("°C").delta(-40L)), new UnsignedWordElement(3041, batteryTemperatureSection6 = new ModbusReadLongChannel("BatteryTemperatureSection6", this).unit("°C").delta(-40L)), new UnsignedWordElement(3042, batteryTemperatureSection7 = new ModbusReadLongChannel("BatteryTemperatureSection7", this).unit("°C").delta(-40L)), new UnsignedWordElement(3043, batteryTemperatureSection8 = new ModbusReadLongChannel("BatteryTemperatureSection8", this).unit("°C").delta(-40L)), new UnsignedWordElement(3044, batteryTemperatureSection9 = new ModbusReadLongChannel("BatteryTemperatureSection9", this).unit("°C").delta(-40L)), new UnsignedWordElement(3045, batteryTemperatureSection10 = new ModbusReadLongChannel("BatteryTemperatureSection10", this).unit("°C").delta(-40L)), new UnsignedWordElement(3046, batteryTemperatureSection11 = new ModbusReadLongChannel("BatteryTemperatureSection11", this).unit("°C").delta(-40L)), new UnsignedWordElement(3047, batteryTemperatureSection12 = new ModbusReadLongChannel("BatteryTemperatureSection12", this).unit("°C").delta(-40L)), new UnsignedWordElement(3048, batteryTemperatureSection13 = new ModbusReadLongChannel("BatteryTemperatureSection13", this).unit("°C").delta(-40L)), new UnsignedWordElement(3049, batteryTemperatureSection14 = new ModbusReadLongChannel("BatteryTemperatureSection14", this).unit("°C").delta(-40L)), new UnsignedWordElement(3050, batteryTemperatureSection15 = new ModbusReadLongChannel("BatteryTemperatureSection15", this).unit("°C").delta(-40L)), new UnsignedWordElement(3051, batteryTemperatureSection16 = new ModbusReadLongChannel("BatteryTemperatureSection16", this).unit("°C").delta(-40L))), 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);
    allowedApparent = new FunctionalReadChannel<Long>("AllowedApparent", this, (channels) -> {
        ReadChannel<Long> apparent = channels[0];
        try {
            return apparent.value() * 3;
        } catch (InvalidValueException e) {
            log.error(e.getMessage());
        }
        return 0l;
    }, phaseAllowedApparent);
    // FaultChannels
    state.addFaultChannel(new ValueToBooleanThingStateChannel(FaultEss.SystemFault, this, systemState, 3L));
    state.addFaultChannel(new ValueToBooleanThingStateChannel(FaultEss.BatteryFault, this, batteryGroupState, 5L));
    state.addFaultChannel(new ValueToBooleanThingStateChannel(FaultEss.PCSFault, this, pcsOperationState, 5L));
    // WarningChannels
    state.addWarningChannel(new ValueToBooleanThingStateChannel(WarningEss.OFFGrid, this, systemState, 1L));
    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) AsymmetricEssNature(io.openems.api.device.nature.ess.AsymmetricEssNature) LoggerFactory(org.slf4j.LoggerFactory) WriteChannel(io.openems.api.channel.WriteChannel) ConfigChannel(io.openems.api.channel.ConfigChannel) EssNature(io.openems.api.device.nature.ess.EssNature) ChannelInfo(io.openems.api.doc.ChannelInfo) ModbusProtocol(io.openems.impl.protocol.modbus.internal.ModbusProtocol) 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) ValueToBooleanThingStateChannel(io.openems.api.channel.ValueToBooleanThingStateChannel) Logger(org.slf4j.Logger) ConfigException(io.openems.api.exception.ConfigException) FunctionalReadChannel(io.openems.api.channel.FunctionalReadChannel) UnsignedDoublewordElement(io.openems.impl.protocol.modbus.internal.UnsignedDoublewordElement) 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) StaticValueChannel(io.openems.api.channel.StaticValueChannel) DummyElement(io.openems.impl.protocol.modbus.internal.DummyElement) ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) WriteableModbusRegisterRange(io.openems.impl.protocol.modbus.internal.range.WriteableModbusRegisterRange) ModbusWriteLongChannel(io.openems.impl.protocol.modbus.ModbusWriteLongChannel) ValueToBooleanThingStateChannel(io.openems.api.channel.ValueToBooleanThingStateChannel) ReadChannel(io.openems.api.channel.ReadChannel) FunctionalReadChannel(io.openems.api.channel.FunctionalReadChannel) InvalidValueException(io.openems.api.exception.InvalidValueException) DummyElement(io.openems.impl.protocol.modbus.internal.DummyElement) ModbusBitWrappingChannel(io.openems.impl.protocol.modbus.ModbusBitWrappingChannel) UnsignedWordElement(io.openems.impl.protocol.modbus.internal.UnsignedWordElement) UnsignedDoublewordElement(io.openems.impl.protocol.modbus.internal.UnsignedDoublewordElement) SignedWordElement(io.openems.impl.protocol.modbus.internal.SignedWordElement) 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 3 with ReadChannel

use of io.openems.api.channel.ReadChannel in project openems by OpenEMS.

the class FeneconPersistence method addChannelValueToQueue.

/**
 * Add a channel value to the send queue
 *
 * @param channel
 * @param valueOpt
 */
private void addChannelValueToQueue(Channel channel, Optional<?> valueOpt) {
    // Ignore anything that is not a ReadChannel
    if (!(channel instanceof ReadChannel<?>)) {
        return;
    }
    ReadChannel<?> readChannel = (ReadChannel<?>) channel;
    // Ignore channels that shall not be persisted
    if (readChannel.isDoNotPersist()) {
        return;
    }
    // Read and format value from channel
    FieldValue<?> fieldValue;
    if (!valueOpt.isPresent()) {
        fieldValue = new NullFieldValue();
    } else {
        Object value = valueOpt.get();
        if (value instanceof Number) {
            fieldValue = new NumberFieldValue((Number) value);
        } else if (value instanceof String) {
            fieldValue = new StringFieldValue((String) value);
        } else if (value instanceof Inet4Address) {
            fieldValue = new StringFieldValue(((Inet4Address) value).getHostAddress());
        } else if (value instanceof Boolean) {
            fieldValue = new NumberFieldValue(((Boolean) value) ? 1 : 0);
        } else if (value instanceof ChannelEnum) {
            fieldValue = new NumberFieldValue(((ChannelEnum) value).getValue());
        } else if (value instanceof DeviceNature || value instanceof JsonElement || value instanceof Map || value instanceof Set || value instanceof List || value instanceof ThingMap) {
            // ignore
            return;
        } else {
            log.warn("FENECON Persistence for value type [" + value.getClass().getName() + "] of channel [" + channel.address() + "] is not implemented.");
            return;
        }
    }
    // Add timestamp + value to queue
    synchronized (queue) {
        queue.put(readChannel.address(), fieldValue);
    }
}
Also used : Inet4Address(java.net.Inet4Address) Set(java.util.Set) NumberFieldValue(io.openems.common.types.NumberFieldValue) ReadChannel(io.openems.api.channel.ReadChannel) NullFieldValue(io.openems.common.types.NullFieldValue) StringFieldValue(io.openems.common.types.StringFieldValue) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject) DeviceNature(io.openems.api.device.nature.DeviceNature) List(java.util.List) ThingMap(io.openems.api.controller.ThingMap) ChannelEnum(io.openems.common.types.ChannelEnum) HashMap(java.util.HashMap) Map(java.util.Map) ThingMap(io.openems.api.controller.ThingMap)

Example 4 with ReadChannel

use of io.openems.api.channel.ReadChannel in project openems by OpenEMS.

the class BHKWMeter method defineModbusProtocol.

/*
	 * Methods
	 */
@Override
protected ModbusProtocol defineModbusProtocol() throws ConfigException {
    ModbusProtocol protocol = new // 
    ModbusProtocol(new ModbusRegisterRange(370, new // 
    UnsignedDoublewordElement(// 
    370, voltageL1 = new ModbusReadLongChannel("VoltageL1", this).unit("mV").multiplier(2))), new ModbusRegisterRange(371, new // 
    UnsignedDoublewordElement(// 
    371, voltageL2 = new ModbusReadLongChannel("VoltageL2", this).unit("mV").multiplier(2))), new ModbusRegisterRange(372, new // 
    UnsignedDoublewordElement(// 
    372, voltageL3 = new ModbusReadLongChannel("VoltageL3", this).unit("mV").multiplier(2))), new ModbusRegisterRange(373, new // 
    UnsignedDoublewordElement(// 
    373, frequencyL1 = new ModbusReadLongChannel("FrequencyL1", this).unit("mHZ").multiplier(1))), new ModbusRegisterRange(374, new // 
    UnsignedDoublewordElement(// 
    374, frequencyL1 = new ModbusReadLongChannel("FrequencyL2", this).unit("mHZ").multiplier(1))), new ModbusRegisterRange(375, new // 
    UnsignedDoublewordElement(// 
    375, frequencyL1 = new ModbusReadLongChannel("FrequencyL3", this).unit("mHZ").multiplier(1))), new ModbusRegisterRange(376, new // 
    UnsignedDoublewordElement(// 
    376, currentL1 = new ModbusReadLongChannel("CurrentL1", this).unit("mA").multiplier(2))), new ModbusRegisterRange(377, new // 
    UnsignedDoublewordElement(// 
    377, currentL2 = new ModbusReadLongChannel("CurrentL2", this).unit("mA").multiplier(2))), new ModbusRegisterRange(378, new // 
    UnsignedDoublewordElement(// 
    378, currentL3 = new ModbusReadLongChannel("CurrentL3", this).unit("mA").multiplier(2))), new ModbusRegisterRange(379, new // 
    SignedDoublewordElement(// 
    379, cosPhiL1 = new ModbusReadLongChannel("CosPhiL1", this))), new ModbusRegisterRange(380, new // 
    SignedDoublewordElement(// 
    380, cosPhiL2 = new ModbusReadLongChannel("CosPhiL2", this))), new ModbusRegisterRange(381, new // 
    SignedDoublewordElement(// 
    381, cosPhiL3 = new ModbusReadLongChannel("SocPhiL3", this))), new ModbusRegisterRange(382, new // 
    SignedDoublewordElement(// 
    382, activePowerL1 = new ModbusReadLongChannel("ActivePowerL1", this).unit("W").multiplier(-2))), new ModbusRegisterRange(383, new // 
    SignedDoublewordElement(// 
    383, activePowerL2 = new ModbusReadLongChannel("ActivePowerL2", this).unit("W").multiplier(-2))), new ModbusRegisterRange(384, new // 
    SignedDoublewordElement(// 
    384, activePowerL3 = new ModbusReadLongChannel("ActivePowerL3", this).unit("W").multiplier(-2))));
    activePower = new FunctionalReadChannel<Long>("ActivePower", this, new FunctionalReadChannelFunction<Long>() {

        @Override
        public Long handle(@SuppressWarnings("unchecked") ReadChannel<Long>... channels) throws InvalidValueException {
            Long value = 0L;
            for (ReadChannel<Long> channel : channels) {
                if (channel.valueOptional().isPresent()) {
                    value += channel.valueOptional().get();
                } else {
                    return null;
                }
            }
            return value;
        }
    }, activePowerL1, activePowerL2, activePowerL3);
    reactivePowerL1 = new FunctionalReadChannel<Long>("ReactivePowerL1", this, new FunctionalReadChannelFunction<Long>() {

        @Override
        public Long handle(@SuppressWarnings("unchecked") ReadChannel<Long>... channels) throws InvalidValueException {
            if (channels.length == 2 && channels[0].valueOptional().isPresent() && channels[1].valueOptional().isPresent()) {
                return ControllerUtils.calculateReactivePower(channels[0].valueOptional().get(), ((double) channels[1].valueOptional().get()) / 100.0, false);
            }
            return null;
        }
    }, activePowerL1, cosPhiL1);
    reactivePowerL2 = new FunctionalReadChannel<Long>("ReactivePowerL2", this, new FunctionalReadChannelFunction<Long>() {

        @Override
        public Long handle(@SuppressWarnings("unchecked") ReadChannel<Long>... channels) throws InvalidValueException {
            if (channels.length == 2 && channels[0].valueOptional().isPresent() && channels[1].valueOptional().isPresent()) {
                return ControllerUtils.calculateReactivePower(channels[0].valueOptional().get(), ((double) channels[1].valueOptional().get()) / 100.0, false);
            }
            return null;
        }
    }, activePowerL2, cosPhiL2);
    reactivePowerL3 = new FunctionalReadChannel<Long>("ReactivePowerL3", this, new FunctionalReadChannelFunction<Long>() {

        @Override
        public Long handle(@SuppressWarnings("unchecked") ReadChannel<Long>... channels) throws InvalidValueException {
            if (channels.length == 2 && channels[0].valueOptional().isPresent() && channels[1].valueOptional().isPresent()) {
                return ControllerUtils.calculateReactivePower(channels[0].valueOptional().get(), ((double) channels[1].valueOptional().get()) / 100.0, false);
            }
            return null;
        }
    }, activePowerL3, cosPhiL3);
    reactivePower = new FunctionalReadChannel<Long>("ReactivePower", this, new FunctionalReadChannelFunction<Long>() {

        @Override
        public Long handle(@SuppressWarnings("unchecked") ReadChannel<Long>... channels) throws InvalidValueException {
            Long value = 0L;
            for (ReadChannel<Long> channel : channels) {
                if (channel.valueOptional().isPresent()) {
                    value += channel.valueOptional().get();
                } else {
                    return null;
                }
            }
            return value;
        }
    }, reactivePowerL1, reactivePowerL2, reactivePowerL3);
    apparentPower = new FunctionalReadChannel<Long>("ApparentPower", this, new FunctionalReadChannelFunction<Long>() {

        @Override
        public Long handle(@SuppressWarnings("unchecked") ReadChannel<Long>... channels) throws InvalidValueException {
            if (channels.length == 2 && channels[0].valueOptional().isPresent() && channels[1].valueOptional().isPresent()) {
                return ControllerUtils.calculateApparentPower(channels[0].valueOptional().get(), channels[1].valueOptional().get());
            }
            return null;
        }
    }, activePower, reactivePower);
    return protocol;
}
Also used : ModbusReadLongChannel(io.openems.impl.protocol.modbus.ModbusReadLongChannel) SignedDoublewordElement(io.openems.impl.protocol.modbus.internal.SignedDoublewordElement) 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) FunctionalReadChannelFunction(io.openems.api.channel.FunctionalReadChannelFunction) ReadChannel(io.openems.api.channel.ReadChannel) FunctionalReadChannel(io.openems.api.channel.FunctionalReadChannel)

Example 5 with ReadChannel

use of io.openems.api.channel.ReadChannel in project openems by OpenEMS.

the class ChannelExport method main.

public static void main(String[] args) throws OpenemsException {
    String openemsPath = "C:\\Users\\matthias.rossmann\\Dev\\git\\openems-neu\\edge\\src";
    Collection<ThingDoc> deviceNatures;
    HashMap<Path, FileWriter> files = new HashMap<>();
    try {
        deviceNatures = ClassRepository.getInstance().getAvailableDeviceNatures();
        FileWriter devices = new FileWriter(Paths.get(openemsPath, "\\io\\openems\\impl\\device\\Readme.md").toFile());
        devices.write("# List of implemented Devices.\r\n\r\n");
        for (ThingDoc thingDoc : deviceNatures) {
            try {
                System.out.println(thingDoc.getClazz().getName());
                if (thingDoc.getClazz().equals(AsymmetricSymmetricCombinationEssNature.class) || thingDoc.getClazz().equals(EssClusterNature.class) || thingDoc.getClazz().isInterface() || Modifier.isAbstract(thingDoc.getClazz().getModifiers())) {
                    continue;
                }
                Path p = Paths.get(openemsPath, thingDoc.getClazz().getName().replaceAll("[^\\.]*$", "").replace(".", "/"), "Readme.md");
                FileWriter fw;
                if (files.containsKey(p)) {
                    fw = files.get(p);
                } else {
                    fw = new FileWriter(p.toFile());
                    files.put(p, fw);
                    fw.write("");
                }
                fw.append("# " + thingDoc.getTitle() + "\r\n" + thingDoc.getText() + "\r\n\r\nFollowing Values are implemented:\r\n\r\n" + "|ChannelName|Unit|\r\n" + "|---|---|\r\n");
                devices.append("* [" + thingDoc.getTitle() + "](" + Paths.get(thingDoc.getClazz().getName().replaceAll("io.openems.impl.device.", "").replaceAll("[^\\.]*$", "").replace(".", "/"), "Readme.md").toString().replace("\\", "/") + ")\r\n");
                Thing thing = thingDoc.getClazz().getConstructor(String.class, Device.class).newInstance("", null);
                if (thing instanceof ModbusDeviceNature) {
                    ((ModbusDeviceNature) thing).init();
                }
                List<ChannelDoc> channelDocs = new LinkedList<>(thingDoc.getChannelDocs());
                Collections.sort(channelDocs, new Comparator<ChannelDoc>() {

                    @Override
                    public int compare(ChannelDoc arg0, ChannelDoc arg1) {
                        return arg0.getName().compareTo(arg1.getName());
                    }
                });
                for (ChannelDoc channelDoc : channelDocs) {
                    Member member = channelDoc.getMember();
                    try {
                        List<Channel> channels = new ArrayList<>();
                        if (member instanceof Method) {
                            if (((Method) member).getReturnType().isArray()) {
                                Channel[] ch = (Channel[]) ((Method) member).invoke(thing);
                                for (Channel c : ch) {
                                    channels.add(c);
                                }
                            } else {
                                // It's a Method with ReturnType Channel
                                channels.add((Channel) ((Method) member).invoke(thing));
                            }
                        } else if (member instanceof Field) {
                            // It's a Field with Type Channel
                            channels.add((Channel) ((Field) member).get(thing));
                        } else {
                            continue;
                        }
                        if (channels.isEmpty()) {
                            System.out.println("Channel is returning null! Thing [" + thing.id() + "], Member [" + member.getName() + "]");
                            continue;
                        }
                        for (Channel channel : channels) {
                            if (channel != null) {
                                StringBuilder unit = new StringBuilder();
                                if (channel instanceof ReadChannel) {
                                    ReadChannel rchannel = ((ReadChannel) channel);
                                    unit.append(rchannel.unitOptional());
                                    rchannel.getLabels().forEach((key, value) -> {
                                        unit.append(key + ": " + value + "<br/>");
                                    });
                                }
                                fw.append("|" + channel.id() + "|" + unit + "|\r\n");
                            }
                        }
                    } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
                        System.out.println("Unable to add Channel. Member [" + member.getName() + "]");
                    }
                }
            } catch (NoSuchMethodException e) {
            }
        }
        for (FileWriter fw : files.values()) {
            fw.close();
        }
        devices.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : HashMap(java.util.HashMap) FileWriter(java.io.FileWriter) ArrayList(java.util.ArrayList) ReadChannel(io.openems.api.channel.ReadChannel) Field(java.lang.reflect.Field) EssClusterNature(io.openems.impl.device.system.esscluster.EssClusterNature) Member(java.lang.reflect.Member) Thing(io.openems.api.thing.Thing) ThingDoc(io.openems.api.doc.ThingDoc) Path(java.nio.file.Path) Device(io.openems.api.device.Device) ReadChannel(io.openems.api.channel.ReadChannel) Channel(io.openems.api.channel.Channel) Method(java.lang.reflect.Method) ChannelDoc(io.openems.api.doc.ChannelDoc) LinkedList(java.util.LinkedList) InvocationTargetException(java.lang.reflect.InvocationTargetException) OpenemsException(io.openems.common.exceptions.OpenemsException) InvocationTargetException(java.lang.reflect.InvocationTargetException) AsymmetricSymmetricCombinationEssNature(io.openems.impl.device.system.asymmetricsymmetriccombinationess.AsymmetricSymmetricCombinationEssNature) ModbusDeviceNature(io.openems.impl.protocol.modbus.ModbusDeviceNature)

Aggregations

ReadChannel (io.openems.api.channel.ReadChannel)10 ConfigChannel (io.openems.api.channel.ConfigChannel)5 FunctionalReadChannel (io.openems.api.channel.FunctionalReadChannel)5 Device (io.openems.api.device.Device)5 ModbusDeviceNature (io.openems.impl.protocol.modbus.ModbusDeviceNature)5 ModbusReadLongChannel (io.openems.impl.protocol.modbus.ModbusReadLongChannel)5 ModbusProtocol (io.openems.impl.protocol.modbus.internal.ModbusProtocol)5 UnsignedDoublewordElement (io.openems.impl.protocol.modbus.internal.UnsignedDoublewordElement)5 ModbusRegisterRange (io.openems.impl.protocol.modbus.internal.range.ModbusRegisterRange)5 WriteChannel (io.openems.api.channel.WriteChannel)4 ThingStateChannels (io.openems.api.channel.thingstate.ThingStateChannels)4 ThingInfo (io.openems.api.doc.ThingInfo)4 ConfigException (io.openems.api.exception.ConfigException)4 InvalidValueException (io.openems.api.exception.InvalidValueException)4 DummyElement (io.openems.impl.protocol.modbus.internal.DummyElement)4 UnsignedWordElement (io.openems.impl.protocol.modbus.internal.UnsignedWordElement)4 Channel (io.openems.api.channel.Channel)3 StaticValueChannel (io.openems.api.channel.StaticValueChannel)3 ModbusBitWrappingChannel (io.openems.impl.protocol.modbus.ModbusBitWrappingChannel)3 ModbusWriteLongChannel (io.openems.impl.protocol.modbus.ModbusWriteLongChannel)3