Skip to content

Commit

Permalink
Fix Build
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeilmeier committed Sep 9, 2021
1 parent ce020e9 commit e75f0a9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import org.junit.Before;
import org.junit.Test;

import io.openems.common.OpenemsConstants;
import io.openems.common.types.ChannelAddress;
import io.openems.edge.common.sum.DummySum;
import io.openems.edge.common.sum.GridMode;
import io.openems.edge.common.sum.Sum;
import io.openems.edge.common.test.AbstractComponentTest.TestCase;
import io.openems.edge.common.test.DummyComponentManager;
import io.openems.edge.common.test.TimeLeapClock;
Expand All @@ -26,7 +26,7 @@ public class StandbyControllerImplTest {
private static final String CTRL_ID = "ctrlEssStandby0";
private static final ChannelAddress STATE_MACHINE = new ChannelAddress(CTRL_ID, "StateMachine");

private static final String SUM_ID = OpenemsConstants.SUM_ID;
private static final String SUM_ID = Sum.SINGLETON_COMPONENT_ID;
private static final ChannelAddress SUM_GRID_ACTIVE_POWER = new ChannelAddress(SUM_ID, "GridActivePower");
private static final ChannelAddress SUM_PRODUCTION_ACTIVE_POWER = new ChannelAddress(SUM_ID,
"ProductionActivePower");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class CycleImpl extends AbstractOpenemsComponent implements OpenemsCompon
private final CycleWorker worker = new CycleWorker(this);

@Reference
ConfigurationAdmin cm;
private ConfigurationAdmin cm;

@Reference
protected EventAdmin eventAdmin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

public interface PowerComponent extends OpenemsComponent, EventHandler, Power {

public final static String SINGLETON_SERVICE_PID = "Ess.Power";
public final static String SINGLETON_COMPONENT_ID = "_power";

public static final boolean DEFAULT_SYMMETRIC_MODE = true;
public static final boolean DEFAULT_DEBUG_MODE = false;
public static final SolverStrategy DEFAULT_SOLVER_STRATEGY = SolverStrategy.OPTIMIZE_BY_MOVING_TOWARDS_TARGET;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;

import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
Expand Down Expand Up @@ -41,11 +42,10 @@

@Designate(ocd = Config.class, factory = false)
@Component(//
name = "Ess.Power", //
name = PowerComponent.SINGLETON_SERVICE_PID, //
immediate = true, //
configurationPolicy = ConfigurationPolicy.OPTIONAL, //
property = { //
"id=_power", //
"enabled=true", //
EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_BEFORE_WRITE, //
EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_AFTER_WRITE //
Expand All @@ -55,6 +55,9 @@ public class PowerComponentImpl extends AbstractOpenemsComponent

private final Logger log = LoggerFactory.getLogger(PowerComponentImpl.class);

@Reference
private ConfigurationAdmin cm;

private final Data data;
private final Solver solver;

Expand All @@ -81,7 +84,10 @@ public PowerComponentImpl() {

@Activate
void activate(ComponentContext context, Config config) {
super.activate(context, "_power", "Ess.Power", true);
super.activate(context, SINGLETON_COMPONENT_ID, SINGLETON_SERVICE_PID, true);
if (OpenemsComponent.validateSingleton(this.cm, SINGLETON_SERVICE_PID, SINGLETON_COMPONENT_ID)) {
return;
}
this.updateConfig(config);
}

Expand All @@ -92,7 +98,10 @@ protected void deactivate() {

@Modified
void modified(ComponentContext context, Config config) throws OpenemsNamedException {
super.modified(context, "_power", "Ess.Power", true);
super.modified(context, SINGLETON_COMPONENT_ID, SINGLETON_SERVICE_PID, true);
if (OpenemsComponent.validateSingleton(this.cm, SINGLETON_SERVICE_PID, SINGLETON_COMPONENT_ID)) {
return;
}
this.updateConfig(config);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import java.util.Map;

import org.osgi.service.cm.ConfigurationAdmin;
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.Modified;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.event.EventConstants;
import org.osgi.service.metatype.annotations.Designate;

Expand All @@ -21,17 +23,22 @@

@Designate(ocd = Config.class, factory = false)
@Component(//
name = "Evcs.SlowPowerIncreaseFilter", //
name = EvcsPowerComponent.SINGLETON_SERVICE_PID, //
immediate = true, //
configurationPolicy = ConfigurationPolicy.OPTIONAL, //
property = { //
"id=_evcsSlowPowerIncreaseFilter", //
"enabled=true", //
EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_BEFORE_WRITE, //
EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_AFTER_WRITE //
})
public class EvcsPowerComponent extends AbstractOpenemsComponent implements OpenemsComponent, EvcsPower {

public final static String SINGLETON_SERVICE_PID = "Evcs.SlowPowerIncreaseFilter";
public final static String SINGLETON_COMPONENT_ID = "_evcsSlowPowerIncreaseFilter";

@Reference
private ConfigurationAdmin cm;

private double increasingRate = RampFilter.DEFAULT_INCREASE_RATE;
private RampFilter rampFilter;

Expand All @@ -43,7 +50,10 @@ public EvcsPowerComponent() {

@Activate
void activate(ComponentContext context, Map<String, Object> properties, Config config) {
super.activate(context, "_evcsSlowPowerIncreaseFilter", "Evcs.SlowPowerIncreaseFilter", true);
super.activate(context, SINGLETON_COMPONENT_ID, SINGLETON_SERVICE_PID, true);
if (OpenemsComponent.validateSingleton(this.cm, SINGLETON_SERVICE_PID, SINGLETON_COMPONENT_ID)) {
return;
}
this.updateConfig(config);
}

Expand All @@ -54,7 +64,10 @@ protected void deactivate() {

@Modified
void modified(ComponentContext context, Config config) throws OpenemsNamedException {
super.activate(context, "_evcsSlowPowerIncreaseFilter", "Evcs.SlowPowerIncreaseFilter", true);
super.modified(context, SINGLETON_COMPONENT_ID, SINGLETON_SERVICE_PID, true);
if (OpenemsComponent.validateSingleton(this.cm, SINGLETON_SERVICE_PID, SINGLETON_COMPONENT_ID)) {
return;
}
this.updateConfig(config);
}

Expand Down

0 comments on commit e75f0a9

Please sign in to comment.