Search in sources :

Example 6 with InvalidValueException

use of io.openems.api.exception.InvalidValueException in project openems by OpenEMS.

the class CosPhiController method run.

/*
	 * Methods
	 */
@Override
public void run() {
    try {
        Ess ess = this.ess.value();
        ess.limit.setCosPhi(cosPhi.valueOptional().orElse(null), capacitive.valueOptional().orElse(null), 0L, 0L);
        ess.power.applyLimitation(ess.limit);
    } catch (InvalidValueException e) {
        log.error("No ess found.", e);
    } catch (PowerException e) {
        log.error("Failed to set Power!", e);
    }
}
Also used : InvalidValueException(io.openems.api.exception.InvalidValueException) Ess(io.openems.impl.controller.symmetric.balancingcosphi.Ess) PowerException(io.openems.core.utilities.power.symmetric.PowerException)

Example 7 with InvalidValueException

use of io.openems.api.exception.InvalidValueException 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 8 with InvalidValueException

use of io.openems.api.exception.InvalidValueException in project openems by OpenEMS.

the class AsymmetricSymmetricCombinationEssNature method loadEss.

private void loadEss() {
    String essId;
    try {
        essId = ess.value();
        // remove old ess
        if (essNature != null) {
            gridMode.removeChannel(essNature.gridMode());
            soc.removeChannel(essNature.soc());
            allowedApparent.removeChannel(essNature.allowedApparent());
            allowedCharge.removeChannel(essNature.allowedCharge());
            allowedDischarge.removeChannel(essNature.allowedDischarge());
            systemState.removeChannel(essNature.systemState());
            capacity.removeChannel(essNature.capacity());
            maxNominalPower.removeChannel(essNature.maxNominalPower());
            activePowerL1.removeChannel(essNature.activePowerL1());
            activePowerL1.removeChannel(essNature.activePowerL2());
            activePowerL1.removeChannel(essNature.activePowerL3());
            activePowerL2.removeChannel(essNature.activePowerL1());
            activePowerL2.removeChannel(essNature.activePowerL2());
            activePowerL2.removeChannel(essNature.activePowerL3());
            activePowerL3.removeChannel(essNature.activePowerL1());
            activePowerL3.removeChannel(essNature.activePowerL2());
            activePowerL3.removeChannel(essNature.activePowerL3());
            activePower.removeChannel(essNature.activePowerL1());
            activePower.removeChannel(essNature.activePowerL2());
            activePower.removeChannel(essNature.activePowerL3());
            reactivePowerL1.removeChannel(essNature.reactivePowerL1());
            reactivePowerL1.removeChannel(essNature.reactivePowerL2());
            reactivePowerL1.removeChannel(essNature.reactivePowerL3());
            reactivePowerL2.removeChannel(essNature.reactivePowerL1());
            reactivePowerL2.removeChannel(essNature.reactivePowerL2());
            reactivePowerL2.removeChannel(essNature.reactivePowerL3());
            reactivePowerL3.removeChannel(essNature.reactivePowerL1());
            reactivePowerL3.removeChannel(essNature.reactivePowerL2());
            reactivePowerL3.removeChannel(essNature.reactivePowerL3());
            reactivePower.removeChannel(essNature.reactivePowerL1());
            reactivePower.removeChannel(essNature.reactivePowerL2());
            reactivePower.removeChannel(essNature.reactivePowerL3());
            setActivePowerL1.removeChannel(essNature.setActivePowerL1());
            setActivePowerL1.removeChannel(essNature.setActivePowerL2());
            setActivePowerL1.removeChannel(essNature.setActivePowerL3());
            setActivePowerL2.removeChannel(essNature.setActivePowerL1());
            setActivePowerL2.removeChannel(essNature.setActivePowerL2());
            setActivePowerL2.removeChannel(essNature.setActivePowerL3());
            setActivePowerL3.removeChannel(essNature.setActivePowerL1());
            setActivePowerL3.removeChannel(essNature.setActivePowerL2());
            setActivePowerL3.removeChannel(essNature.setActivePowerL3());
            setReactivePowerL1.removeChannel(essNature.setReactivePowerL1());
            setReactivePowerL1.removeChannel(essNature.setReactivePowerL2());
            setReactivePowerL1.removeChannel(essNature.setReactivePowerL3());
            setReactivePowerL2.removeChannel(essNature.setReactivePowerL1());
            setReactivePowerL2.removeChannel(essNature.setReactivePowerL2());
            setReactivePowerL2.removeChannel(essNature.setReactivePowerL3());
            setReactivePowerL3.removeChannel(essNature.setReactivePowerL1());
            setReactivePowerL3.removeChannel(essNature.setReactivePowerL2());
            setReactivePowerL3.removeChannel(essNature.setReactivePowerL3());
            setWorkState.removeChannel(essNature.setWorkState());
            power = null;
            nativeAsymmetricPower = null;
        }
        essNature = null;
        if (essId != null) {
            Optional<Thing> nature = repo.getThingById(essId);
            if (nature.isPresent()) {
                if (nature.get() instanceof AsymmetricEssNature) {
                    AsymmetricEssNature ess = (AsymmetricEssNature) nature.get();
                    essNature = ess;
                    // Add channels to functionalChannels
                    if (essNature != null) {
                        gridMode.setChannel(essNature.gridMode());
                        soc.setChannel(essNature.soc());
                        allowedApparent.setChannel(essNature.allowedApparent());
                        allowedDischarge.setChannel(essNature.allowedDischarge());
                        allowedCharge.setChannel(essNature.allowedCharge());
                        systemState.setChannel(essNature.systemState());
                        capacity.setChannel(essNature.capacity());
                        maxNominalPower.setChannel(essNature.maxNominalPower());
                        activePowerL1.addChannel(essNature.activePowerL1());
                        activePowerL1.addChannel(essNature.activePowerL2());
                        activePowerL1.addChannel(essNature.activePowerL3());
                        activePowerL2.addChannel(essNature.activePowerL1());
                        activePowerL2.addChannel(essNature.activePowerL2());
                        activePowerL2.addChannel(essNature.activePowerL3());
                        activePowerL3.addChannel(essNature.activePowerL1());
                        activePowerL3.addChannel(essNature.activePowerL2());
                        activePowerL3.addChannel(essNature.activePowerL3());
                        activePower.addChannel(essNature.activePowerL1());
                        activePower.addChannel(essNature.activePowerL2());
                        activePower.addChannel(essNature.activePowerL3());
                        reactivePowerL1.addChannel(essNature.reactivePowerL1());
                        reactivePowerL1.addChannel(essNature.reactivePowerL2());
                        reactivePowerL1.addChannel(essNature.reactivePowerL3());
                        reactivePowerL2.addChannel(essNature.reactivePowerL1());
                        reactivePowerL2.addChannel(essNature.reactivePowerL2());
                        reactivePowerL2.addChannel(essNature.reactivePowerL3());
                        reactivePowerL3.addChannel(essNature.reactivePowerL1());
                        reactivePowerL3.addChannel(essNature.reactivePowerL2());
                        reactivePowerL3.addChannel(essNature.reactivePowerL3());
                        reactivePower.addChannel(essNature.reactivePowerL1());
                        reactivePower.addChannel(essNature.reactivePowerL2());
                        reactivePower.addChannel(essNature.reactivePowerL3());
                        setActivePowerL1.addChannel(essNature.setActivePowerL1());
                        setActivePowerL1.addChannel(essNature.setActivePowerL2());
                        setActivePowerL1.addChannel(essNature.setActivePowerL3());
                        setActivePowerL2.addChannel(essNature.setActivePowerL1());
                        setActivePowerL2.addChannel(essNature.setActivePowerL2());
                        setActivePowerL2.addChannel(essNature.setActivePowerL3());
                        setActivePowerL3.addChannel(essNature.setActivePowerL1());
                        setActivePowerL3.addChannel(essNature.setActivePowerL2());
                        setActivePowerL3.addChannel(essNature.setActivePowerL3());
                        setReactivePowerL1.addChannel(essNature.setReactivePowerL1());
                        setReactivePowerL1.addChannel(essNature.setReactivePowerL2());
                        setReactivePowerL1.addChannel(essNature.setReactivePowerL3());
                        setReactivePowerL2.addChannel(essNature.setReactivePowerL1());
                        setReactivePowerL2.addChannel(essNature.setReactivePowerL2());
                        setReactivePowerL2.addChannel(essNature.setReactivePowerL3());
                        setReactivePowerL3.addChannel(essNature.setReactivePowerL1());
                        setReactivePowerL3.addChannel(essNature.setReactivePowerL2());
                        setReactivePowerL3.addChannel(essNature.setReactivePowerL3());
                        setWorkState.addChannel(essNature.setWorkState());
                        power = new SymmetricPowerProxy(essNature.maxNominalPower().value(), getParent().getBridge());
                        nativeAsymmetricPower = new AsymmetricPower(essNature.allowedDischarge().required(), essNature.allowedCharge().required(), essNature.allowedApparent().required(), essNature.setActivePowerL1().required(), essNature.setActivePowerL2().required(), essNature.setActivePowerL3().required(), essNature.setReactivePowerL1().required(), essNature.setReactivePowerL2().required(), essNature.setReactivePowerL3().required());
                    }
                } else {
                    log.error("ThingID: " + essId + " is no AsymmetricEss!");
                }
            } else {
                log.warn("meter: " + essId + " not found!");
            }
        }
    } catch (InvalidValueException e) {
        log.error("esss value is invalid!", e);
    }
}
Also used : InvalidValueException(io.openems.api.exception.InvalidValueException) AsymmetricPower(io.openems.core.utilities.AsymmetricPower) SymmetricPowerProxy(io.openems.core.utilities.power.symmetric.SymmetricPowerProxy) Thing(io.openems.api.thing.Thing) AsymmetricEssNature(io.openems.api.device.nature.ess.AsymmetricEssNature)

Example 9 with InvalidValueException

use of io.openems.api.exception.InvalidValueException in project openems by OpenEMS.

the class EssClusterNature method loadEss.

private void loadEss() {
    Set<DeviceNature> natures = repo.getDeviceNatures();
    JsonArray essIds;
    try {
        essIds = esss.value();
        // remove old ess
        for (SymmetricEssNature ess : this.essList) {
            soc.removeChannel(ess.soc());
            gridMode.removeChannel(ess.gridMode());
            systemState.removeChannel(ess.systemState());
            allowedCharge.removeChannel(ess.allowedCharge());
            allowedDischarge.removeChannel(ess.allowedDischarge());
            allowedApparent.removeChannel(ess.allowedApparent());
            activePower.removeChannel(ess.activePower());
            reactivePower.removeChannel(ess.reactivePower());
            apparentPower.removeChannel(ess.apparentPower());
            maxNominalPower.removeChannel(ess.maxNominalPower());
            capacity.removeChannel(ess.capacity());
            setWorkState.removeChannel(ess.setWorkState());
            power.removeEss(ess);
        }
        essList.clear();
        if (essIds != null && isInitialized) {
            for (DeviceNature nature : natures) {
                if (nature instanceof SymmetricEssNature) {
                    if (essIds.toString().contains(nature.id())) {
                        SymmetricEssNature ess = (SymmetricEssNature) nature;
                        essList.add(ess);
                        soc.addChannel(ess.soc());
                        gridMode.addChannel(ess.gridMode());
                        systemState.addChannel(ess.systemState());
                        allowedCharge.addChannel(ess.allowedCharge());
                        allowedDischarge.addChannel(ess.allowedDischarge());
                        allowedApparent.addChannel(ess.allowedApparent());
                        activePower.addChannel(ess.activePower());
                        reactivePower.addChannel(ess.reactivePower());
                        apparentPower.addChannel(ess.apparentPower());
                        maxNominalPower.addChannel(ess.maxNominalPower());
                        capacity.addChannel(ess.capacity());
                        setWorkState.addChannel(ess.setWorkState());
                        power.addEss(ess);
                    }
                }
            }
        // capacity.channelUpdated(null, null);
        }
    } catch (InvalidValueException e) {
        log.error("esss value is invalid!", e);
    }
}
Also used : JsonArray(com.google.gson.JsonArray) InvalidValueException(io.openems.api.exception.InvalidValueException) DeviceNature(io.openems.api.device.nature.DeviceNature) SystemDeviceNature(io.openems.impl.protocol.system.SystemDeviceNature) SymmetricEssNature(io.openems.api.device.nature.ess.SymmetricEssNature)

Example 10 with InvalidValueException

use of io.openems.api.exception.InvalidValueException in project openems by OpenEMS.

the class MeterClusterNature method loadMeter.

private void loadMeter() {
    JsonArray meterIds;
    try {
        meterIds = meter.value();
        // remove old ess
        synchronized (symmetricMeterList) {
            synchronized (asymmetricMeterList) {
                symmetricMeterList.clear();
                for (AsymmetricMeterNature meter : asymmetricMeterList) {
                    this.thingState.removeChangeListener(meter.getStateChannel());
                }
                asymmetricMeterList.clear();
                if (meterIds != null) {
                    for (JsonElement id : meterIds) {
                        Optional<Thing> nature = repo.getThingById(id.getAsString());
                        if (nature.isPresent()) {
                            if (nature.get() instanceof AsymmetricMeterNature) {
                                AsymmetricMeterNature meter = (AsymmetricMeterNature) nature.get();
                                asymmetricMeterList.add(meter);
                            } else if (nature.get() instanceof SymmetricMeterNature) {
                                SymmetricMeterNature meter = (SymmetricMeterNature) nature.get();
                                symmetricMeterList.add(meter);
                            } else {
                                log.error("ThingID: " + id.getAsString() + " is no Meter!");
                            }
                        } else {
                            log.warn("meter: " + id.getAsString() + " not found!");
                        }
                    }
                }
            }
        }
    } catch (InvalidValueException e) {
        log.error("meter value is invalid!", e);
    }
}
Also used : JsonArray(com.google.gson.JsonArray) InvalidValueException(io.openems.api.exception.InvalidValueException) SymmetricMeterNature(io.openems.api.device.nature.meter.SymmetricMeterNature) AsymmetricMeterNature(io.openems.api.device.nature.meter.AsymmetricMeterNature) JsonElement(com.google.gson.JsonElement) Thing(io.openems.api.thing.Thing)

Aggregations

InvalidValueException (io.openems.api.exception.InvalidValueException)18 ConfigException (io.openems.api.exception.ConfigException)7 JsonArray (com.google.gson.JsonArray)6 ModbusProtocol (io.openems.impl.protocol.modbus.internal.ModbusProtocol)6 ConfigChannel (io.openems.api.channel.ConfigChannel)5 FunctionalReadChannel (io.openems.api.channel.FunctionalReadChannel)4 ReadChannel (io.openems.api.channel.ReadChannel)4 WriteChannel (io.openems.api.channel.WriteChannel)4 ThingStateChannels (io.openems.api.channel.thingstate.ThingStateChannels)4 Device (io.openems.api.device.Device)4 ThingInfo (io.openems.api.doc.ThingInfo)4 ModbusDeviceNature (io.openems.impl.protocol.modbus.ModbusDeviceNature)4 ModbusReadLongChannel (io.openems.impl.protocol.modbus.ModbusReadLongChannel)4 DummyElement (io.openems.impl.protocol.modbus.internal.DummyElement)4 UnsignedDoublewordElement (io.openems.impl.protocol.modbus.internal.UnsignedDoublewordElement)4 UnsignedWordElement (io.openems.impl.protocol.modbus.internal.UnsignedWordElement)4 ModbusRegisterRange (io.openems.impl.protocol.modbus.internal.range.ModbusRegisterRange)4 JsonElement (com.google.gson.JsonElement)3 StaticValueChannel (io.openems.api.channel.StaticValueChannel)3 AsymmetricMeterNature (io.openems.api.device.nature.meter.AsymmetricMeterNature)3