|
| 1 | +package io.openems.edge.battery.test; |
| 2 | + |
| 3 | +import io.openems.common.exceptions.OpenemsError.OpenemsNamedException; |
| 4 | +import io.openems.edge.battery.api.Battery; |
| 5 | +import io.openems.edge.common.startstop.StartStop; |
| 6 | +import io.openems.edge.common.startstop.StartStoppable; |
| 7 | +import io.openems.edge.common.test.AbstractDummyOpenemsComponent; |
| 8 | +import io.openems.edge.common.test.TestUtils; |
| 9 | + |
| 10 | +public abstract class AbstractDummyBattery<SELF extends AbstractDummyBattery<?>> |
| 11 | + extends AbstractDummyOpenemsComponent<SELF> implements Battery, StartStoppable { |
| 12 | + |
| 13 | + protected AbstractDummyBattery(String id, io.openems.edge.common.channel.ChannelId[] firstInitialChannelIds, |
| 14 | + io.openems.edge.common.channel.ChannelId[]... furtherInitialChannelIds) { |
| 15 | + super(id, firstInitialChannelIds, furtherInitialChannelIds); |
| 16 | + } |
| 17 | + |
| 18 | + @Override |
| 19 | + public final void setStartStop(StartStop value) throws OpenemsNamedException { |
| 20 | + this.withStartStop(value); |
| 21 | + } |
| 22 | + |
| 23 | + /** |
| 24 | + * Set {@link StartStoppable.ChannelId#START_STOP}. |
| 25 | + * |
| 26 | + * @param value the value |
| 27 | + * @return myself |
| 28 | + */ |
| 29 | + public final SELF withStartStop(StartStop value) { |
| 30 | + TestUtils.withValue(this, StartStoppable.ChannelId.START_STOP, value); |
| 31 | + return this.self(); |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * Set {@link Battery.ChannelId#SOC}. |
| 36 | + * |
| 37 | + * @param value the value |
| 38 | + * @return myself |
| 39 | + */ |
| 40 | + public final SELF withSoc(int value) { |
| 41 | + TestUtils.withValue(this, Battery.ChannelId.SOC, value); |
| 42 | + return this.self(); |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * Set {@link Battery.ChannelId#SOH}. |
| 47 | + * |
| 48 | + * @param value the value |
| 49 | + * @return myself |
| 50 | + */ |
| 51 | + public final SELF withSoh(int value) { |
| 52 | + TestUtils.withValue(this, Battery.ChannelId.SOH, value); |
| 53 | + return this.self(); |
| 54 | + } |
| 55 | + |
| 56 | + /** |
| 57 | + * Set {@link Battery.ChannelId#CAPACITY}. |
| 58 | + * |
| 59 | + * @param value the value |
| 60 | + * @return myself |
| 61 | + */ |
| 62 | + public final SELF withCapacity(int value) { |
| 63 | + TestUtils.withValue(this, Battery.ChannelId.CAPACITY, value); |
| 64 | + return this.self(); |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Set {@link Battery.ChannelId#VOLTAGE}. |
| 69 | + * |
| 70 | + * @param value the value |
| 71 | + * @return myself |
| 72 | + */ |
| 73 | + public final SELF withVoltage(int value) { |
| 74 | + TestUtils.withValue(this, Battery.ChannelId.VOLTAGE, value); |
| 75 | + return this.self(); |
| 76 | + } |
| 77 | + |
| 78 | + /** |
| 79 | + * Set {@link Battery.ChannelId#CURRENT}. |
| 80 | + * |
| 81 | + * @param value the value |
| 82 | + * @return myself |
| 83 | + */ |
| 84 | + public final SELF withCurrent(int value) { |
| 85 | + TestUtils.withValue(this, Battery.ChannelId.CURRENT, value); |
| 86 | + return this.self(); |
| 87 | + } |
| 88 | + |
| 89 | + /** |
| 90 | + * Set {@link Battery.ChannelId#DISCHARGE_MAX_CURRENT}. |
| 91 | + * |
| 92 | + * @param value the value |
| 93 | + * @return myself |
| 94 | + */ |
| 95 | + public final SELF withDischargeMaxCurrent(int value) { |
| 96 | + TestUtils.withValue(this, Battery.ChannelId.DISCHARGE_MAX_CURRENT, value); |
| 97 | + return this.self(); |
| 98 | + } |
| 99 | + |
| 100 | + /** |
| 101 | + * Set {@link Battery.ChannelId#CHARGE_MAX_CURRENT}. |
| 102 | + * |
| 103 | + * @param value the value |
| 104 | + * @return myself |
| 105 | + */ |
| 106 | + public final SELF withChargeMaxCurrent(int value) { |
| 107 | + TestUtils.withValue(this, Battery.ChannelId.CHARGE_MAX_CURRENT, value); |
| 108 | + return this.self(); |
| 109 | + } |
| 110 | + |
| 111 | + /** |
| 112 | + * Set {@link Battery.ChannelId#DISCHARGE_MIN_VOLTAGE}. |
| 113 | + * |
| 114 | + * @param value the value |
| 115 | + * @return myself |
| 116 | + */ |
| 117 | + public final SELF withDischargeMinVoltage(int value) { |
| 118 | + TestUtils.withValue(this, Battery.ChannelId.DISCHARGE_MIN_VOLTAGE, value); |
| 119 | + return this.self(); |
| 120 | + } |
| 121 | + |
| 122 | + /** |
| 123 | + * Set {@link Battery.ChannelId#CHARGE_MAX_VOLTAGE}. |
| 124 | + * |
| 125 | + * @param value the value |
| 126 | + * @return myself |
| 127 | + */ |
| 128 | + public final SELF withChargeMaxVoltage(int value) { |
| 129 | + TestUtils.withValue(this, Battery.ChannelId.CHARGE_MAX_VOLTAGE, value); |
| 130 | + return this.self(); |
| 131 | + } |
| 132 | + |
| 133 | + /** |
| 134 | + * Set {@link Battery.ChannelId#MIN_CELL_VOLTAGE}. |
| 135 | + * |
| 136 | + * @param value the value |
| 137 | + * @return myself |
| 138 | + */ |
| 139 | + public final SELF withMinCellVoltage(int value) { |
| 140 | + TestUtils.withValue(this, Battery.ChannelId.MIN_CELL_VOLTAGE, value); |
| 141 | + return this.self(); |
| 142 | + } |
| 143 | + |
| 144 | + /** |
| 145 | + * Set {@link Battery.ChannelId#MAX_CELL_VOLTAGE}. |
| 146 | + * |
| 147 | + * @param value the value |
| 148 | + * @return myself |
| 149 | + */ |
| 150 | + public final SELF withMaxCellVoltage(int value) { |
| 151 | + TestUtils.withValue(this, Battery.ChannelId.MAX_CELL_VOLTAGE, value); |
| 152 | + return this.self(); |
| 153 | + } |
| 154 | + |
| 155 | + /** |
| 156 | + * Set {@link Battery.ChannelId#MIN_CELL_TEMPERATURE}. |
| 157 | + * |
| 158 | + * @param value the value |
| 159 | + * @return myself |
| 160 | + */ |
| 161 | + public final SELF withMinCellTemperature(int value) { |
| 162 | + TestUtils.withValue(this, Battery.ChannelId.MIN_CELL_TEMPERATURE, value); |
| 163 | + return this.self(); |
| 164 | + } |
| 165 | + |
| 166 | + /** |
| 167 | + * Set {@link Battery.ChannelId#MAX_CELL_TEMPERATURE}. |
| 168 | + * |
| 169 | + * @param value the value |
| 170 | + * @return myself |
| 171 | + */ |
| 172 | + public final SELF withMaxCellTemperature(int value) { |
| 173 | + TestUtils.withValue(this, Battery.ChannelId.MAX_CELL_TEMPERATURE, value); |
| 174 | + return this.self(); |
| 175 | + } |
| 176 | + |
| 177 | +} |
0 commit comments