-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use JSON-RPC for communication between Edge, Backend and UI (#211)
* Migrate the complete (websocket-)communication to JSON-RPC. See the JSON-RPC specification on https://www.jsonrpc.org/specification. * The base classes for JSON-RPC are in the package io.openems.common/jsonrpc (https://github.com/OpenEMS/openems/blob/develop/io.openems.common/src/io/openems/common/jsonrpc) * Added some documentation on how the JSON-RPC communication works: https://openems.io/openems/latest/component-communication/index.adoc (https://github.com/OpenEMS/openems/blob/develop/doc/modules/ROOT/pages/component-communication) using antora + asciidoc + mermaid.js To implement a new JSON-RPC Request/Notification from UI via Backend to Edge, touch the following places - Add the Request in UI (https://github.com/OpenEMS/openems/blob/develop/ui/src/app/shared/jsonrpc/request) - Send the Request from UI (https://github.com/OpenEMS/openems/blob/develop/ui/src/app/shared/edge/edge.ts#L146) - Handle the Request in Backend (https://github.com/OpenEMS/openems/blob/develop/io.openems.backend.uiwebsocket.impl/src/io/openems/backend/uiwebsocket/impl/OnRequest.java#L101) - Handle the Request in Edge (https://github.com/OpenEMS/openems/blob/develop/io.openems.edge.controller.api.websocket/src/io/openems/edge/controller/api/websocket/OnRequest.java#L91) Plus many other changes: Common: * Reimplement AbstractWebsocketClient and -Server * Implement fully asynchronous handling with functional interfaces * Pin JSON dependency version for Apache Felix * Add OpenemsNamedException to get unique IDs for OpenEMS errors * Set EVCS Controller Charge-Mode from UI Widget * Add EVCS Widgets to Index & Historic view * Apply Checkstyle to many projects * Improve Javadoc Backend: * Improve Metadata api & services * Improve Timedata api & services * Add io.openems.backend.b2bwebsocket module (e.g. SetGridConnSchedule and GetStatusOfEdges) * Create Backend Timedata.Dummy service * Define a EdgeConfig format. Parsing XML meta information from Bundle. * Add AbstractOpenemsBackendComponent parent class; similar to AbstractOpenemsComponent in Edge * Change format for Metadata.File Edge: * Refactor AbstractOpenemsComponent.activate()-method. No need for properties, as they are available via ComponentContext - Get rid of mandatory 'service_pid' in every Component Config. - Make Factory-PID available * Create Symmetric Balancing Schedule Controller für "SetGridConnSchedule": takes a schedule with ActivePowerSetPoints for defined timestamps and periods * Modbus-TCP slave: add automatic retry for starting the server * Fix REST-Api: use ApiWorker to constantly write values till timeout * EVCS-Api: add ChargePower channel * Add EVCS simulator * ComponentManager is able to update a component configuration using UpdateComponentConfig JSON-RPC Request * Split 'Sum' in 'Sum' and 'SumImpl' * Trigger OsgiValidateWorker on every configuration change * Fix KEBA using value instead of writeValue * Add EVCS Controller * Add Equals/LessThan/GreaterThan Channels for ManagedSymmetricEss and ManagedAsymmetricEss * Add OneFullCycleController UI * Refactor Chart Sections * UI: Refactor UI language selection * Remove temporarily disabled parts of UI * Fix formatting of numbers using 'formatNumber' * avoid having 'Edge' and 'Config' as @input parameter; use Service instead * Remove obsolete 'intl' polyfill (angular/angular-cli#9920) * Update @ionic/angular
- Loading branch information
1 parent
ae20a8b
commit 7207fc4
Showing
705 changed files
with
16,437 additions
and
18,095 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,23 +52,23 @@ Indepth documentation is currently in progress. Please find the latest documents | |
|
||
OpenEMS development was started by [FENECON GmbH](https://www.fenecon.de), a German company specialized in manufacturing and project development of energy storage systems. It is the software stack behind [FEMS - FENECON Energy Management System](https://fenecon.de/page/fems) and widely used in private, commercial and industrial applications. | ||
|
||
We are inviting third parties - like universities, hardware manufacturers, software companies, commercial and private owners,... - to use OpenEMS for their own projects and are glad to support them with their first steps. In any case if you are interested in OpenEMS our development team would be glad to hear from you at [email protected]. | ||
In 2019 governance of the OpenEMS project was taken over by the newly founded "OpenEMS Association e.V. (i.Gr.)". We are inviting third parties - like universities, hardware manufacturers, software companies, commercial and private owners,... - to use OpenEMS for their own projects and are glad to support them with their first steps. In any case if you are interested in OpenEMS our development team would be glad to hear from you at [email protected]. | ||
|
||
OpenEMS is funded by several federal and EU funding projects. If you are a developer and you would like to get hired by one of the partner companies or universities for working on OpenEMS, please send your motivation letter to [email protected]. | ||
OpenEMS is funded by several federal and EU funding projects. If you are a developer and you would like to get hired by one of the partner companies or universities for working on OpenEMS, please send your motivation letter to [email protected]. | ||
|
||
## License | ||
|
||
* OpenEMS Edge | ||
* OpenEMS Backend | ||
|
||
Copyright (C) 2016-2018 FENECON GmbH. | ||
Copyright (C) 2016-2019 FENECON GmbH. | ||
|
||
This product includes software developed at FENECON GmbH: you can | ||
redistribute it and/or modify it under the terms of the [Eclipse Public License version 2.0](LICENSE-EPL-2.0). | ||
|
||
* OpenEMS UI | ||
|
||
Copyright (C) 2016-2018 FENECON GmbH. | ||
Copyright (C) 2016-2019 FENECON GmbH. | ||
|
||
This product includes software developed at FENECON GmbH: you can | ||
redistribute it and/or modify it under the terms of the [GNU Affero General Public License version 3](LICENSE-AGPL-3.0). |
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
110 changes: 110 additions & 0 deletions
110
com.ed.openems.centurio/src/com/ed/openems/centurio/ess/EssUtils.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 com.ed.openems.centurio.ess; | ||
|
||
import java.util.Arrays; | ||
import java.util.stream.Stream; | ||
|
||
import io.openems.edge.common.channel.AbstractReadChannel; | ||
import io.openems.edge.common.channel.FloatReadChannel; | ||
import io.openems.edge.common.channel.IntegerReadChannel; | ||
import io.openems.edge.common.channel.IntegerWriteChannel; | ||
import io.openems.edge.common.channel.StateCollectorChannel; | ||
import io.openems.edge.common.component.OpenemsComponent; | ||
import io.openems.edge.common.sum.GridMode; | ||
import io.openems.edge.ess.api.ManagedSymmetricEss; | ||
import io.openems.edge.ess.api.SymmetricEss; | ||
|
||
public class EssUtils { | ||
|
||
public static Stream<? extends AbstractReadChannel<?>> initializeChannels(CenturioEss c) { | ||
return Stream.of(Arrays.stream(OpenemsComponent.ChannelId.values()).map(channelId -> { | ||
switch (channelId) { | ||
case STATE: | ||
return new StateCollectorChannel(c, channelId); | ||
} | ||
return null; | ||
}), Arrays.stream(SymmetricEss.ChannelId.values()).map(channelId -> { | ||
switch (channelId) { | ||
case GRID_MODE: | ||
return new IntegerReadChannel(c, channelId, GridMode.UNDEFINED); | ||
case SOC: | ||
case ACTIVE_POWER: | ||
case REACTIVE_POWER: | ||
case ACTIVE_CHARGE_ENERGY: | ||
case ACTIVE_DISCHARGE_ENERGY: | ||
return new IntegerReadChannel(c, channelId); | ||
case MAX_APPARENT_POWER: | ||
return new IntegerReadChannel(c, channelId, CenturioEss.MAX_APPARENT_POWER); | ||
} | ||
return null; | ||
}), Arrays.stream(ManagedSymmetricEss.ChannelId.values()).map(channelId -> { | ||
switch (channelId) { | ||
case ALLOWED_CHARGE_POWER: | ||
case ALLOWED_DISCHARGE_POWER: | ||
return new IntegerReadChannel(c, channelId, 0); | ||
case DEBUG_SET_ACTIVE_POWER: | ||
case DEBUG_SET_REACTIVE_POWER: | ||
return new IntegerReadChannel(c, channelId); | ||
case SET_ACTIVE_POWER_EQUALS: | ||
case SET_REACTIVE_POWER_EQUALS: | ||
case SET_ACTIVE_POWER_LESS_OR_EQUALS: | ||
case SET_ACTIVE_POWER_GREATER_OR_EQUALS: | ||
case SET_REACTIVE_POWER_LESS_OR_EQUALS: | ||
case SET_REACTIVE_POWER_GREATER_OR_EQUALS: | ||
return new IntegerWriteChannel(c, channelId); | ||
} | ||
return null; | ||
}), Arrays.stream(CenturioEss.ChannelId.values()).map(channelId -> { | ||
switch (channelId) { | ||
case A001: | ||
case A002: | ||
case A003: | ||
case A004: | ||
case A005: | ||
case A010: | ||
case A021: | ||
case A022: | ||
case A030: | ||
case A032: | ||
case A040: | ||
case A050: | ||
case A060: | ||
case A071: | ||
case A072: | ||
case A100: | ||
case A110: | ||
case A200: | ||
case A210: | ||
case A220: | ||
case A230: | ||
case E001: | ||
case E002: | ||
case E010: | ||
case E021: | ||
case E022: | ||
case E030: | ||
case E041: | ||
case E042: | ||
case E050: | ||
case E060: | ||
case E070: | ||
case E080: | ||
case E101: | ||
case E102: | ||
case E103: | ||
case E104: | ||
case E110: | ||
case E120: | ||
case E140: | ||
case E150: | ||
case E160: | ||
case E170: | ||
case E180: | ||
return new CenturioErrorChannel(c, channelId); | ||
case BMS_VOLTAGE: | ||
return new FloatReadChannel(c, channelId); | ||
} | ||
return null; | ||
})).flatMap(channel -> channel); | ||
} | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
com.ed.openems.centurio/src/com/ed/openems/centurio/pv/MeterUtils.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,60 @@ | ||
package com.ed.openems.centurio.pv; | ||
|
||
import java.util.Arrays; | ||
import java.util.stream.Stream; | ||
|
||
import io.openems.edge.common.channel.AbstractReadChannel; | ||
import io.openems.edge.common.channel.IntegerReadChannel; | ||
import io.openems.edge.common.channel.StateCollectorChannel; | ||
import io.openems.edge.common.component.OpenemsComponent; | ||
import io.openems.edge.meter.api.AsymmetricMeter; | ||
import io.openems.edge.meter.api.SymmetricMeter; | ||
|
||
public class MeterUtils { | ||
|
||
public static Stream<? extends AbstractReadChannel<?>> initializeChannels(CenturioPVMeter c) { | ||
return Stream.of(Arrays.stream(OpenemsComponent.ChannelId.values()).map(channelId -> { | ||
switch (channelId) { | ||
case STATE: | ||
return new StateCollectorChannel(c, channelId); | ||
} | ||
return null; | ||
}), Arrays.stream(SymmetricMeter.ChannelId.values()).map(channelId -> { | ||
switch (channelId) { | ||
case ACTIVE_POWER: | ||
case MAX_ACTIVE_POWER: | ||
case MIN_ACTIVE_POWER: | ||
case REACTIVE_POWER: | ||
case CURRENT: | ||
case VOLTAGE: | ||
case FREQUENCY: | ||
case ACTIVE_PRODUCTION_ENERGY: | ||
case ACTIVE_CONSUMPTION_ENERGY: | ||
return new IntegerReadChannel(c, channelId); | ||
|
||
} | ||
return null; | ||
}), Arrays.stream(AsymmetricMeter.ChannelId.values()).map(channelId -> { | ||
switch (channelId) { | ||
case ACTIVE_POWER_L1: | ||
case ACTIVE_POWER_L2: | ||
case ACTIVE_POWER_L3: | ||
|
||
case CURRENT_L1: | ||
case CURRENT_L2: | ||
case CURRENT_L3: | ||
|
||
case REACTIVE_POWER_L1: | ||
case REACTIVE_POWER_L2: | ||
case REACTIVE_POWER_L3: | ||
case VOLTAGE_L1: | ||
case VOLTAGE_L2: | ||
case VOLTAGE_L3: | ||
return new IntegerReadChannel(c, channelId, 0); | ||
|
||
} | ||
return null; | ||
})).flatMap(channel -> channel); | ||
} | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
com.ed.openems.centurio/src/com/ed/openems/centurio/vectis/VectisUtils.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,60 @@ | ||
package com.ed.openems.centurio.vectis; | ||
|
||
import java.util.Arrays; | ||
import java.util.stream.Stream; | ||
|
||
import io.openems.edge.common.channel.AbstractReadChannel; | ||
import io.openems.edge.common.channel.IntegerReadChannel; | ||
import io.openems.edge.common.channel.StateCollectorChannel; | ||
import io.openems.edge.common.component.OpenemsComponent; | ||
import io.openems.edge.meter.api.AsymmetricMeter; | ||
import io.openems.edge.meter.api.SymmetricMeter; | ||
|
||
public class VectisUtils { | ||
|
||
public static Stream<? extends AbstractReadChannel<?>> initializeChannels(Vectis c) { | ||
return Stream.of(Arrays.stream(OpenemsComponent.ChannelId.values()).map(channelId -> { | ||
switch (channelId) { | ||
case STATE: | ||
return new StateCollectorChannel(c, channelId); | ||
} | ||
return null; | ||
}), Arrays.stream(SymmetricMeter.ChannelId.values()).map(channelId -> { | ||
switch (channelId) { | ||
case ACTIVE_POWER: | ||
case MAX_ACTIVE_POWER: | ||
case MIN_ACTIVE_POWER: | ||
case REACTIVE_POWER: | ||
case CURRENT: | ||
case VOLTAGE: | ||
case FREQUENCY: | ||
case ACTIVE_PRODUCTION_ENERGY: | ||
case ACTIVE_CONSUMPTION_ENERGY: | ||
return new IntegerReadChannel(c, channelId); | ||
|
||
} | ||
return null; | ||
}), Arrays.stream(AsymmetricMeter.ChannelId.values()).map(channelId -> { | ||
switch (channelId) { | ||
case ACTIVE_POWER_L1: | ||
case ACTIVE_POWER_L2: | ||
case ACTIVE_POWER_L3: | ||
|
||
case CURRENT_L1: | ||
case CURRENT_L2: | ||
case CURRENT_L3: | ||
|
||
case REACTIVE_POWER_L1: | ||
case REACTIVE_POWER_L2: | ||
case REACTIVE_POWER_L3: | ||
case VOLTAGE_L1: | ||
case VOLTAGE_L2: | ||
case VOLTAGE_L3: | ||
return new IntegerReadChannel(c, channelId, 0); | ||
|
||
} | ||
return null; | ||
})).flatMap(channel -> channel); | ||
} | ||
|
||
} |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.