-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements openDTU (for Hoymiles Micro Inverter) #2566
Open
Sn0w3y
wants to merge
17
commits into
OpenEMS:develop
Choose a base branch
from
Sn0w3y:feature/openDTU_Impl
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2456d05
Implement openDTU
Sn0w3y 6c8793e
Tests added
Sn0w3y 20158b7
fixed Imports
Sn0w3y 085fb47
Update IoOpenDtuImplTest.java
Sn0w3y 7c7a1ec
Added to EdgeApp.bndrun
Sn0w3y 1281fbe
Updated Test, Refactored, Reverted advanced Changes
Sn0w3y d76fdab
test
Sn0w3y 15d1501
try test
Sn0w3y 451d217
fix test
Sn0w3y 7ff6689
test
Sn0w3y 38f3cdc
Update OpendtuImplTest.java
Sn0w3y 4655097
Merge branch 'OpenEMS:develop' into feature/openDTU_Impl
Sn0w3y 517e56b
Apply ./prepare_commit.sh
Sn0w3y 8986937
Merge branch 'feature/openDTU_Impl' of https://github.com/Sn0w3y/open…
Sn0w3y a90f639
Apply prepare-commit
Sn0w3y 15377f8
Prepare Commit & Fix Test
Sn0w3y 960b9da
Merge branch 'OpenEMS:develop' into feature/openDTU_Impl
Sn0w3y File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-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> |
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 @@ | ||
/bin_test/ | ||
/generated/ |
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.io.opendtu</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> |
2 changes: 2 additions & 0 deletions
2
io.openems.edge.io.opendtu/.settings/org.eclipse.core.resources.prefs
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 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
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,16 @@ | ||
Bundle-Name: OpenEMS Edge IO OpenDTU | ||
Bundle-Vendor: Haller Johannes & Thomas Klinkenberg | ||
Bundle-License: https://opensource.org/licenses/EPL-2.0 | ||
Bundle-Version: 1.0.0.${tstamp} | ||
|
||
-buildpath: \ | ||
${buildpath},\ | ||
io.openems.common,\ | ||
io.openems.edge.bridge.http,\ | ||
io.openems.edge.common,\ | ||
io.openems.edge.io.api,\ | ||
io.openems.edge.meter.api,\ | ||
io.openems.edge.pvinverter.api,\ | ||
io.openems.edge.timedata.api | ||
-testpath: \ | ||
${testpath} |
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,8 @@ | ||
= openDTU Hoymiles | ||
|
||
This bundle implements openDTU for Hoymiles Inverters. | ||
|
||
Compatible with | ||
-https://github.com/tbnobody/OpenDTU | ||
|
||
https://github.com/OpenEMS/openems/tree/develop/io.openems.edge.io.opendtu[Source Code icon:github[]] |
46 changes: 46 additions & 0 deletions
46
io.openems.edge.io.opendtu/src/io/openems/edge/io/opendtu/inverter/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,46 @@ | ||
package io.openems.edge.io.opendtu.inverter; | ||
|
||
import org.osgi.service.metatype.annotations.AttributeDefinition; | ||
import org.osgi.service.metatype.annotations.AttributeType; | ||
import org.osgi.service.metatype.annotations.ObjectClassDefinition; | ||
|
||
import io.openems.edge.meter.api.MeterType; | ||
import io.openems.edge.meter.api.SinglePhase; | ||
|
||
@ObjectClassDefinition(// | ||
name = "openDTU Hoymiles Inverter", // | ||
description = "Implements the openDTU for Hoymiles Inverter.") | ||
@interface Config { | ||
|
||
@AttributeDefinition(name = "Component-ID", description = "Unique ID of this Component") | ||
String id() default "io0"; | ||
|
||
@AttributeDefinition(name = "Alias", description = "Human-readable name of this Component; defaults to Component-ID") | ||
String alias() default ""; | ||
|
||
@AttributeDefinition(name = "Username", description = "Username for openDTU to make settings possible") | ||
String username() default ""; | ||
|
||
@AttributeDefinition(name = "Password", description = "Password for oprnDTU to make settings possible", type = AttributeType.PASSWORD) | ||
String password() default ""; | ||
|
||
@AttributeDefinition(name = "Is enabled?", description = "Is this Component enabled?") | ||
boolean enabled() default true; | ||
|
||
@AttributeDefinition(name = "Phase", description = "Which Phase is this Inverter connected to?") | ||
SinglePhase phase() default SinglePhase.L1; | ||
|
||
@AttributeDefinition(name = "IP-Address", description = "The IP address of the openDTU.") | ||
String ip(); | ||
|
||
@AttributeDefinition(name = "Inverter Serial Number", description = "The serial number of the inverter connected to the DTU") | ||
String serialNumber() default ""; | ||
|
||
@AttributeDefinition(name = "Meter-Type", description = "What is measured by this DTU?") | ||
MeterType type() default MeterType.PRODUCTION; | ||
|
||
@AttributeDefinition(name = "Initial Power Limit", description = "The initial power limit setting") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the "power limit" used for? |
||
int initialPowerLimit() default 100; | ||
|
||
String webconsole_configurationFactory_nameHint() default "IO openDTU [{id}]"; | ||
} |
133 changes: 133 additions & 0 deletions
133
io.openems.edge.io.opendtu/src/io/openems/edge/io/opendtu/inverter/Opendtu.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,133 @@ | ||
package io.openems.edge.io.opendtu.inverter; | ||
|
||
import org.osgi.service.event.EventHandler; | ||
|
||
import io.openems.common.channel.AccessMode; | ||
import io.openems.common.channel.Level; | ||
import io.openems.common.channel.PersistencePriority; | ||
import io.openems.common.channel.Unit; | ||
import io.openems.common.types.OpenemsType; | ||
import io.openems.edge.common.channel.Doc; | ||
import io.openems.edge.common.channel.StateChannel; | ||
import io.openems.edge.common.channel.WriteChannel; | ||
import io.openems.edge.common.channel.value.Value; | ||
import io.openems.edge.common.component.OpenemsComponent; | ||
import io.openems.edge.meter.api.ElectricityMeter; | ||
import io.openems.edge.meter.api.SinglePhaseMeter; | ||
|
||
public interface Opendtu extends SinglePhaseMeter, ElectricityMeter, OpenemsComponent, EventHandler { | ||
|
||
/** | ||
* Channel for setting the Power Limit. | ||
* | ||
* @return bla ToDo change return | ||
*/ | ||
public default WriteChannel<Integer> setPowerLimit() { | ||
return this.channel(ChannelId.POWER_LIMIT); | ||
} | ||
|
||
public static enum ChannelId implements io.openems.edge.common.channel.ChannelId { | ||
/** | ||
* Slave Communication Failed Fault. | ||
* | ||
* <ul> | ||
* <li>Interface: Opendtu | ||
* <li>Type: State | ||
* </ul> | ||
*/ | ||
SLAVE_COMMUNICATION_FAILED(Doc.of(Level.FAULT)), // | ||
|
||
/** | ||
* Maximum Ever Actual Power. | ||
* | ||
* <ul> | ||
* <li>Interface: Ess DC Charger | ||
* <li>Type: Integer | ||
* <li>Unit: W | ||
* <li>Range: positive or '0' | ||
* <li>Implementation Note: value is automatically derived from ACTUAL_POWER | ||
* </ul> | ||
*/ | ||
MAX_ACTUAL_POWER(Doc.of(OpenemsType.INTEGER)// | ||
.unit(Unit.WATT) // | ||
.persistencePriority(PersistencePriority.HIGH)), // | ||
|
||
/** | ||
* Limit Status. | ||
* | ||
* <ul> | ||
* <li>Type: String | ||
* <li>Unit: Not applicable | ||
* <li>Range: "Ok", "Pending" or "Failure" | ||
* </ul> | ||
*/ | ||
LIMIT_STATUS(Doc.of(OpenemsType.STRING)// | ||
.text("Limit Status")), | ||
|
||
/** | ||
* The Relative Limit of the max. Power. | ||
* | ||
* <ul> | ||
* <li>Type: Integer | ||
* <li>Unit: Percent | ||
* <li>Range: 0 to 100 | ||
* <li>Access Mode: Read/Write | ||
* <li>Implementation Note: Adjusts the maximum allowable power output relative | ||
* to the inverters max. Power. | ||
* </ul> | ||
*/ | ||
POWER_LIMIT(Doc.of(OpenemsType.INTEGER)// | ||
.unit(Unit.PERCENT) // | ||
.text("The Relative Limit of the max. Power.").accessMode(AccessMode.READ_WRITE)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. // |
||
|
||
/** | ||
* Power Limit Fault. | ||
* | ||
* <ul> | ||
* <li>Interface: Opendtu | ||
* <li>Type: State | ||
* </ul> | ||
*/ | ||
POWER_LIMIT_FAULT(Doc.of(Level.FAULT)); // | ||
|
||
private final Doc doc; | ||
|
||
private ChannelId(Doc doc) { | ||
this.doc = doc; | ||
} | ||
|
||
@Override | ||
public Doc doc() { | ||
return this.doc; | ||
} | ||
} | ||
|
||
/** | ||
* Gets the Channel for {@link ChannelId#SLAVE_COMMUNICATION_FAILED}. | ||
* | ||
* @return the Channel | ||
*/ | ||
public default StateChannel getSlaveCommunicationFailedChannel() { | ||
return this.channel(ChannelId.SLAVE_COMMUNICATION_FAILED); | ||
} | ||
|
||
/** | ||
* Gets the Slave Communication Failed State. See | ||
* {@link ChannelId#SLAVE_COMMUNICATION_FAILED}. | ||
* | ||
* @return the Channel {@link Value} | ||
*/ | ||
public default Value<Boolean> getSlaveCommunicationFailed() { | ||
return this.getSlaveCommunicationFailedChannel().value(); | ||
} | ||
|
||
/** | ||
* Internal method to set the 'nextValue' on | ||
* {@link ChannelId#SLAVE_COMMUNICATION_FAILED} Channel. | ||
* | ||
* @param value the next value | ||
*/ | ||
public default void _setSlaveCommunicationFailed(boolean value) { | ||
this.getSlaveCommunicationFailedChannel().setNextValue(value); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is really only a pv inverter, like i would expect - you do not have to add the meter type in the config as it is always PRODUCTION.
Just set a fixed configuration property like this:
https://github.com/Sn0w3y/openems/blob/26cebce21d45f8f78edc93ed93e2084eb27c2750/io.openems.edge.pvinverter.fronius/src/io/openems/edge/pvinverter/fronius/PvInverterFroniusImpl.java#L44
Maybe you have to take care in the UI separately - i remember a method in the UI Part "isProduction".
Im not completely sure if there is still the need to do something in there.