Search in sources :

Example 1 with ChargerNature

use of io.openems.api.device.nature.charger.ChargerNature in project openems by OpenEMS.

the class SimulatorAsymmetricEss method getCharger.

private void getCharger() {
    if (chargerList != null) {
        for (ChargerNature charger : chargerList) {
            soc.removeChannel(charger.getActualPower());
        }
        chargerList.clear();
        if (charger.valueOptional().isPresent()) {
            JsonArray ids = charger.valueOptional().get();
            for (JsonElement e : ids) {
                Optional<Thing> t = repo.getThingById(e.getAsString());
                if (t.isPresent()) {
                    if (t.get() instanceof ChargerNature) {
                        ChargerNature charger = (ChargerNature) t.get();
                        chargerList.add(charger);
                        soc.addChannel(charger.getActualPower());
                    }
                }
            }
        }
    }
}
Also used : JsonArray(com.google.gson.JsonArray) JsonElement(com.google.gson.JsonElement) ChargerNature(io.openems.api.device.nature.charger.ChargerNature) Thing(io.openems.api.thing.Thing)

Example 2 with ChargerNature

use of io.openems.api.device.nature.charger.ChargerNature in project openems by OpenEMS.

the class SimulatorSymmetricEss method getCharger.

private void getCharger() {
    if (chargerList != null) {
        for (ChargerNature charger : chargerList) {
            soc.removeChannel(charger.getActualPower());
        }
        chargerList.clear();
        if (charger.valueOptional().isPresent()) {
            JsonArray ids = charger.valueOptional().get();
            for (JsonElement e : ids) {
                Optional<Thing> t = repo.getThingById(e.getAsString());
                if (t.isPresent()) {
                    if (t.get() instanceof ChargerNature) {
                        ChargerNature charger = (ChargerNature) t.get();
                        chargerList.add(charger);
                        soc.addChannel(charger.getActualPower());
                    }
                }
            }
        }
    }
}
Also used : JsonArray(com.google.gson.JsonArray) JsonElement(com.google.gson.JsonElement) ChargerNature(io.openems.api.device.nature.charger.ChargerNature) Thing(io.openems.api.thing.Thing)

Aggregations

JsonArray (com.google.gson.JsonArray)2 JsonElement (com.google.gson.JsonElement)2 ChargerNature (io.openems.api.device.nature.charger.ChargerNature)2 Thing (io.openems.api.thing.Thing)2