use of io.openems.core.utilities.power.symmetric.SymmetricPowerProxy 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);
}
}
Aggregations