Skip to content

Commit

Permalink
Correction of pullrequest / github import
Browse files Browse the repository at this point in the history
  • Loading branch information
DerWahreKlinki committed Sep 26, 2024
1 parent c1dd6d7 commit b655f1f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
12 changes: 12 additions & 0 deletions io.openems.edge.controller.pvinverter.reversepowerrelay/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="src" output="bin" path="src"/>
<classpathentry kind="src" output="bin_test" path="test">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Bundle-Version: 1.0.0.${tstamp}
io.openems.edge.common,\
io.openems.edge.controller.api,\
io.openems.edge.meter.api,\
io.openems.edge.pvinverter.api
io.openems.edge.pvinverter.api,\
osgi.cmpn

-testpath: \
${testpath},\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

import java.util.Optional;

import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.ConfigurationPolicy;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.metatype.annotations.Designate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -21,6 +14,15 @@
import io.openems.edge.pvinverter.api.ManagedSymmetricPvInverter;
import io.openems.edge.common.channel.BooleanReadChannel;

import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.ConfigurationPolicy;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;

import org.osgi.service.metatype.annotations.Designate;

@Designate(ocd = Config.class, factory = true)
@Component(//
name = "Controller.PvInverter.ReversePowerRelay", //
Expand Down Expand Up @@ -129,7 +131,7 @@ private Optional<Boolean> getChannelValue(ChannelAddress address) {
BooleanReadChannel channel = this.componentManager.getChannel(address);
return channel.value().asOptional();
} catch (OpenemsNamedException e) {
this.log.error("Error reading channel value", e);
this.log.error("Error reading channel value for address: " + address, e);
return Optional.empty();

Check warning on line 135 in io.openems.edge.controller.pvinverter.reversepowerrelay/src/io/openems/edge/controller/pvinverter/reversepowerrelay/ReversePowerRelayImpl.java

View check run for this annotation

Codecov / codecov/patch

io.openems.edge.controller.pvinverter.reversepowerrelay/src/io/openems/edge/controller/pvinverter/reversepowerrelay/ReversePowerRelayImpl.java#L133-L135

Added lines #L133 - L135 were not covered by tests
}
}
Expand Down Expand Up @@ -172,6 +174,7 @@ public void run() throws OpenemsNamedException {

} catch (Exception e) {
this.log.error("No values from modbus channels yet", e);
this.setPvLimit(0);
return;

Check warning on line 178 in io.openems.edge.controller.pvinverter.reversepowerrelay/src/io/openems/edge/controller/pvinverter/reversepowerrelay/ReversePowerRelayImpl.java

View check run for this annotation

Codecov / codecov/patch

io.openems.edge.controller.pvinverter.reversepowerrelay/src/io/openems/edge/controller/pvinverter/reversepowerrelay/ReversePowerRelayImpl.java#L175-L178

Added lines #L175 - L178 were not covered by tests
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import io.openems.edge.io.test.DummyInputOutput;


public class ReversePowerRelayImplTest {

private static final String CTRL_ID = "ctrl0";
Expand All @@ -30,6 +31,8 @@ public class ReversePowerRelayImplTest {
private static final ChannelAddress IO_INPUT_OUTPUT1 = new ChannelAddress(IO_ID, "InputOutput1");
private static final ChannelAddress IO_INPUT_OUTPUT2 = new ChannelAddress(IO_ID, "InputOutput2");
private static final ChannelAddress IO_INPUT_OUTPUT3 = new ChannelAddress(IO_ID, "InputOutput3");

private static final int powerLimit100 = 1500;

@Test
public void testReversePowerRelay() throws Exception {
Expand All @@ -48,6 +51,7 @@ public void testReversePowerRelay() throws Exception {
.setInputChannelAddress30Percent(IO_INPUT_OUTPUT1.toString()) //
.setInputChannelAddress60Percent(IO_INPUT_OUTPUT2.toString()) //
.setInputChannelAddress100Percent(IO_INPUT_OUTPUT3.toString()) //
.setPowerLimit100(powerLimit100)
.build())
.next(new TestCase() //
.input(GRID_ACTIVE_POWER, -15000) //
Expand All @@ -61,15 +65,15 @@ public void testReversePowerRelay() throws Exception {
.input(IO_INPUT_OUTPUT1, true) //
.input(IO_INPUT_OUTPUT2, false) //
.input(IO_INPUT_OUTPUT3, false) //
.output(PV_INVERTER_SET_ACTIVE_POWER_EQUALS, 30)) //
.output(PV_INVERTER_SET_ACTIVE_POWER_EQUALS, 450)) //
.next(new TestCase() //
.input(GRID_ACTIVE_POWER, -15000) //
.input(PV_INVERTER_ACTIVE_POWER, 8000) //
.input(IO_INPUT_OUTPUT0, false) //
.input(IO_INPUT_OUTPUT1, false) //
.input(IO_INPUT_OUTPUT2, true) //
.input(IO_INPUT_OUTPUT3, false) //
.output(PV_INVERTER_SET_ACTIVE_POWER_EQUALS, 60)) //
.output(PV_INVERTER_SET_ACTIVE_POWER_EQUALS, 900)) //
.next(new TestCase() //
.input(GRID_ACTIVE_POWER, -13000) //
.input(PV_INVERTER_ACTIVE_POWER, 7000) //
Expand Down

0 comments on commit b655f1f

Please sign in to comment.