-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Fronius PV Inverter (via Modbus/SunSpec) (#207)
- Implement Fronius PV Inverter bundle - AbstractOpenemsSunSpecComponent readNextBlock() function change to complete when all expected blocks have already been read. - Add Factory ID in isProducer() method to be displayed in the UI. Co-authored-by: Sebastian Asen <[email protected]> Co-authored-by: Stefan Feilmeier <[email protected]> Reviewed-on: https://git.intranet.fenecon.de/FENECON/fems/pulls/207 Reviewed-by: Stefan Feilmeier <[email protected]> Co-authored-by: sebastian asen <[email protected]> Co-committed-by: sebastian asen <[email protected]>
- Loading branch information
1 parent
ef17b06
commit 77ca9f1
Showing
14 changed files
with
351 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-11"/> | ||
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/generated/ | ||
/bin_test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>io.openems.edge.pvinverter.fronius</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>bndtools.core.bndbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>bndtools.core.bndnature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Bundle-Name: OpenEMS Edge PV Inverter Fronius | ||
Bundle-Vendor: FENECON GmbH | ||
Bundle-License: https://opensource.org/licenses/EPL-2.0 | ||
Bundle-Version: 1.0.0.${tstamp} | ||
|
||
-buildpath: \ | ||
${buildpath},\ | ||
io.openems.common,\ | ||
io.openems.edge.bridge.modbus,\ | ||
io.openems.edge.common,\ | ||
io.openems.edge.meter.api,\ | ||
io.openems.edge.pvinverter.api,\ | ||
io.openems.edge.pvinverter.sunspec | ||
|
||
-testpath: \ | ||
${testpath},\ | ||
com.ghgande.j2mod |
Binary file added
BIN
+50.9 KB
...ge.pvinverter.fronius/doc/Inverter_Register_Map_Float_v1.0_with_SYMOHYBRID_MODEL_124.xlsx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
= Fronius PV inverter | ||
|
||
Implementation of the Fronius PV inverters. | ||
|
||
Tested on | ||
- [Fronius Symo] | ||
|
||
Implemented Natures: | ||
- SymmetricMeter | ||
- ManagedSymmetricPvInverter | ||
|
||
https://github.com/OpenEMS/openems/tree/develop/io.openems.edge.pvinverter.fronius[Source Code icon:github[]] |
30 changes: 30 additions & 0 deletions
30
io.openems.edge.pvinverter.fronius/src/io/openems/edge/pvinverter/fronius/Config.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.openems.edge.pvinverter.fronius; | ||
|
||
import org.osgi.service.metatype.annotations.AttributeDefinition; | ||
import org.osgi.service.metatype.annotations.ObjectClassDefinition; | ||
|
||
@ObjectClassDefinition(name = "PV-Inverter Fronius", // | ||
description = "Implements the Fronius PV inverter.") | ||
@interface Config { | ||
|
||
@AttributeDefinition(name = "Component-ID", description = "Unique ID of this Component") | ||
String id() default "pvInverter0"; | ||
|
||
@AttributeDefinition(name = "Alias", description = "Human-readable name of this Component; defaults to Component-ID") | ||
String alias() default ""; | ||
|
||
@AttributeDefinition(name = "Is enabled?", description = "Is this Component enabled?") | ||
boolean enabled() default true; | ||
|
||
@AttributeDefinition(name = "Modbus-ID", description = "ID of Modbus bridge.") | ||
String modbus_id() default "modbus0"; | ||
|
||
@AttributeDefinition(name = "Modbus Unit-ID", description = "The Unit-ID of the Modbus device.") | ||
int modbusUnitId() default 1; | ||
|
||
@AttributeDefinition(name = "Modbus target filter", description = "This is auto-generated by 'Modbus-ID'.") | ||
String Modbus_target() default "(enabled=true)"; | ||
|
||
String webconsole_configurationFactory_nameHint() default "PV-Inverter Fronius [{id}]"; | ||
|
||
} |
110 changes: 110 additions & 0 deletions
110
...ems.edge.pvinverter.fronius/src/io/openems/edge/pvinverter/fronius/FroniusPvInverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package io.openems.edge.pvinverter.fronius; | ||
|
||
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.Reference; | ||
import org.osgi.service.component.annotations.ReferenceCardinality; | ||
import org.osgi.service.component.annotations.ReferencePolicy; | ||
import org.osgi.service.component.annotations.ReferencePolicyOption; | ||
import org.osgi.service.event.Event; | ||
import org.osgi.service.event.EventConstants; | ||
import org.osgi.service.event.EventHandler; | ||
import org.osgi.service.metatype.annotations.Designate; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
|
||
import io.openems.common.channel.AccessMode; | ||
import io.openems.common.exceptions.OpenemsException; | ||
import io.openems.edge.bridge.modbus.api.BridgeModbus; | ||
import io.openems.edge.bridge.modbus.api.ModbusComponent; | ||
import io.openems.edge.bridge.modbus.sunspec.DefaultSunSpecModel; | ||
import io.openems.edge.bridge.modbus.sunspec.SunSpecModel; | ||
import io.openems.edge.common.component.OpenemsComponent; | ||
import io.openems.edge.common.event.EdgeEventConstants; | ||
import io.openems.edge.common.modbusslave.ModbusSlave; | ||
import io.openems.edge.common.modbusslave.ModbusSlaveNatureTable; | ||
import io.openems.edge.common.modbusslave.ModbusSlaveTable; | ||
import io.openems.edge.common.taskmanager.Priority; | ||
import io.openems.edge.meter.api.SymmetricMeter; | ||
import io.openems.edge.pvinverter.api.ManagedSymmetricPvInverter; | ||
import io.openems.edge.pvinverter.sunspec.AbstractSunSpecPvInverter; | ||
import io.openems.edge.pvinverter.sunspec.SunSpecPvInverter; | ||
|
||
@Designate(ocd = Config.class, factory = true) | ||
@Component(// | ||
name = "PV-Inverter.Fronius", // | ||
immediate = true, // | ||
configurationPolicy = ConfigurationPolicy.REQUIRE, // | ||
property = { // | ||
EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_EXECUTE_WRITE, // | ||
"type=PRODUCTION" // | ||
}) | ||
public class FroniusPvInverter extends AbstractSunSpecPvInverter implements SunSpecPvInverter, | ||
ManagedSymmetricPvInverter, SymmetricMeter, ModbusComponent, OpenemsComponent, EventHandler, ModbusSlave { | ||
|
||
private static final Map<SunSpecModel, Priority> ACTIVE_MODELS = ImmutableMap.<SunSpecModel, Priority>builder() | ||
.put(DefaultSunSpecModel.S_1, Priority.LOW) // from 40002 | ||
|
||
/* | ||
* This is depending on the specific inverter. | ||
*/ | ||
.put(DefaultSunSpecModel.S_111, Priority.LOW) // from 40070 | ||
.put(DefaultSunSpecModel.S_112, Priority.LOW) // from 40070 | ||
.put(DefaultSunSpecModel.S_113, Priority.HIGH) // from 40070 | ||
.build(); | ||
|
||
private static final int READ_FROM_MODBUS_BLOCK = 1; | ||
|
||
@Reference | ||
protected ConfigurationAdmin cm; | ||
|
||
public FroniusPvInverter() throws OpenemsException { | ||
super(// | ||
ACTIVE_MODELS, // | ||
OpenemsComponent.ChannelId.values(), // | ||
ModbusComponent.ChannelId.values(), // | ||
SymmetricMeter.ChannelId.values(), // | ||
ManagedSymmetricPvInverter.ChannelId.values(), // | ||
SunSpecPvInverter.ChannelId.values() // | ||
); | ||
} | ||
|
||
@Reference(policy = ReferencePolicy.STATIC, policyOption = ReferencePolicyOption.GREEDY, cardinality = ReferenceCardinality.MANDATORY) | ||
protected void setModbus(BridgeModbus modbus) { | ||
super.setModbus(modbus); | ||
} | ||
|
||
@Activate | ||
void activate(ComponentContext context, Config config) throws OpenemsException { | ||
if (super.activate(context, config.id(), config.alias(), config.enabled(), config.modbusUnitId(), this.cm, | ||
"Modbus", config.modbus_id(), READ_FROM_MODBUS_BLOCK)) { | ||
return; | ||
} | ||
} | ||
|
||
@Deactivate | ||
protected void deactivate() { | ||
super.deactivate(); | ||
} | ||
|
||
@Override | ||
public void handleEvent(Event event) { | ||
super.handleEvent(event); | ||
} | ||
|
||
@Override | ||
public ModbusSlaveTable getModbusSlaveTable(AccessMode accessMode) { | ||
return new ModbusSlaveTable(// | ||
OpenemsComponent.getModbusSlaveNatureTable(accessMode), // | ||
SymmetricMeter.getModbusSlaveNatureTable(accessMode), // | ||
ManagedSymmetricPvInverter.getModbusSlaveNatureTable(accessMode), // | ||
ModbusSlaveNatureTable.of(FroniusPvInverter.class, accessMode, 100) // | ||
.build()); | ||
} | ||
} |
Empty file.
26 changes: 26 additions & 0 deletions
26
...dge.pvinverter.fronius/test/io/openems/edge/pvinverter/fronius/FroniusPvInverterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.openems.edge.pvinverter.fronius; | ||
|
||
import org.junit.Test; | ||
|
||
import io.openems.edge.bridge.modbus.test.DummyModbusBridge; | ||
import io.openems.edge.common.test.ComponentTest; | ||
import io.openems.edge.common.test.DummyConfigurationAdmin; | ||
|
||
public class FroniusPvInverterTest { | ||
|
||
private static final String PV_INVERTER_ID = "pvInverter0"; | ||
private static final String MODBUS_ID = "modbus0"; | ||
|
||
@Test | ||
public void test() throws Exception { | ||
new ComponentTest(new FroniusPvInverter()) // | ||
.addReference("cm", new DummyConfigurationAdmin()) // | ||
.addReference("setModbus", new DummyModbusBridge(MODBUS_ID)) // | ||
.activate(MyConfig.create() // | ||
.setId(PV_INVERTER_ID) // | ||
.setModbusId(MODBUS_ID) // | ||
.setModbusUnitId(1) // | ||
.build()) // | ||
; | ||
} | ||
} |
Oops, something went wrong.