Skip to content

Commit 52d38cc

Browse files
authored
Docs: Update Getting Started & Implementing a Device (OpenEMS#2331)
- Update text and images - Fix Bnd templates Fixes OpenEMS#1507
1 parent 5f207bd commit 52d38cc

28 files changed

+168
-56
lines changed
Binary file not shown.
Loading
Loading
Loading
Loading
Binary file not shown.
Loading
Loading
Loading
Loading
Loading
Loading
Binary file not shown.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
-1021 Bytes
Loading
-41.3 KB
Binary file not shown.

doc/modules/ROOT/pages/edge/implement.adoc

+108-35
Large diffs are not rendered by default.

doc/modules/ROOT/pages/gettingstarted.adoc

+56-20
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ NOTE: Eclipse IDE is the recommended development environment for newcomers to Op
4343

4444
. Prepare Eclipse IDE
4545
.. Download Java Development Kit (JDK) 17 and install it. We recommend the https://adoptium.net/de/temurin/releases/?version=17[OpenJDK Temurin builds by the Adoptium project]
46-
.. Download https://www.eclipse.org[Eclipse for Java icon:external-link[]], install and start it
46+
.. Download https://www.eclipse.org/downloads/[Eclipse for Java icon:external-link[]], install and start it
4747
.. On first start you will get asked to create a workspace.
4848
Select your source code directory (`C:\Users\your.user\git\openems` in our example) and press btn:[Launch].
4949
+
@@ -60,7 +60,7 @@ Menu: btn:[Help] → btn:[Eclipse Marketplace...] → btn:[Find:] → enter btn:
6060
- Select btn:[Java] - btn:[Installed JREs] in the navigation tree
6161
- Press the btn:[Add...] button
6262
- Keep btn:[Standard VM] selected and press btn:[Next >]
63-
- Press the btn:[Directory...] button and select the folder of the installed JDK (e.g. `C:\Program Files\Eclipse Adoptium\jdk-17.0.6.10-hotspot`)
63+
- Press the btn:[Directory...] button and select the folder of the installed JDK (e.g. `C:\Program Files\Eclipse Adoptium\jdk-17.0.7.7-hotspot`)
6464
- Press the btn:[Finish] button
6565
- Back in the Preferences window, tick the newly added JDK 17 and press btn:[Apply and Close]
6666
+
@@ -82,6 +82,14 @@ Menu: btn:[File] → btn:[Import...] → btn:[Bndtools] → btn:[Existing Bnd W
8282
+
8383
.io.openems.edge.application project in Eclipse IDE
8484
image::eclipse-io.openems.edge.application.png[io.openems.edge.application project in Eclipse IDE]
85+
+
86+
NOTE: Instead of navigating through the projects tree, you can simply use the keyboard shortcut btn:[Ctrl] + btn:[Shift] + btn:[R] to start the "Open Resource" dialog. Enter "EdgeApp.bndrun" there and press btn:[Enter] to open the file.
87+
+
88+
The `EdgeApp.bndrun` file declares all the bundles and runtime properties. For now it should not be necessary to edit it, but it hides some useful settings unter the btn:[Source] tab:
89+
+
90+
- `org.osgi.service.http.port=8080`: start the Apache Felix Web Console on port `8080`
91+
- `felix.cm.dir=c:/openems/config`: persist configurations in the folder `c:/openems/config`. Adjust this if you are working on Linux to keep your configurations after restart
92+
- `openems.data.dir=c:/openems/data`: this is where bundles are allowed to persist data. It is used e.g. by the RRD4j timedata storage
8593

8694
.. Click on btn:[Run OSGi] to run OpenEMS Edge. You should see log outputs in the **Console** tab inside Eclipse IDE.
8795
+
@@ -98,7 +106,7 @@ image::apache-felix-console-configuration.png[Apache Felix Web Console Configura
98106

99107
.. Configure a Scheduler
100108
+
101-
NOTE: The Scheduler is responsible for executing the control algorithms (Controllers) and defines the OpenEMS Edge application cycle
109+
NOTE: The Scheduler is responsible for executing the control algorithms (Controllers) in order and defines the OpenEMS Edge application cycle
102110

103111
... Click on _**Scheduler All Alphabetically**_
104112
+
@@ -113,7 +121,9 @@ image::config-scheduler-all-alphabetically.png[Configuration of All Alphabetical
113121
INFO [onent.AbstractOpenemsComponent] [scheduler0] Activate Scheduler.AllAlphabetically
114122
```
115123
+
116-
Add any other OpenEMS Components in the same way:
124+
Add any other OpenEMS Components in the same way.
125+
+
126+
NOTE: Once everything is setup you can configure Components more easily via OpenEMS UI using the "Install components" feature in the Settings.
117127

118128
.. Configure debug outputs on the console: _**Controller Debug Log**_. The default values can be accepted without changes.
119129
+
@@ -152,7 +162,7 @@ NOTE: The data source was configured with the OpenEMS Component ID `datasource0`
152162
.Configuration of Simulator GridMeter Acting
153163
image::config-simulator-grid-meter-acting.png[Configuration of Simulator GridMeter Acting]
154164
+
155-
This time some more logs will show up. Most importantly they show, that the Grid meter now shows a power value and the Consumption is derived directly from this value, because no PV system or energy storage system is configured yet.
165+
This time some more logs will appear. Most importantly they show, that the Grid meter now measures (simulates) a power value and the Consumption is derived directly from this value, because no PV system or energy storage system is configured yet.
156166
+
157167
```
158168
INFO [onent.AbstractOpenemsComponent] [meter0] Activate Simulator.GridMeter.Acting
@@ -165,7 +175,7 @@ NOTE: This setup causes the simulated grid-meter to take the standardized load-p
165175
+
166176
NOTE: 'Acting' in the name 'Simulator GridMeter Acting' refers to the fact, that this meter actively provides data - in opposite to a 'Reacting' simulated device that is reacting on other components: for example the 'Simulator.EssSymmetric.Reacting' configured below.
167177

168-
.. Configure a simulated reacting energy storage system: _**Simulator EssSymmetric Reacting**_. The default values can be accepted without changes. (If you choose an other setup as the one described here you may have to create a new Datasource-Component and provide its ID here. The actual data is ignored, but the Datasource's Time-Delta value is required to calculate values with time-dependant units.)
178+
.. Configure a simulated reacting energy storage system: _**Simulator EssSymmetric Reacting**_. The default values can be accepted without changes.
169179
+
170180
.Configuration of Simulator EssSymmetric Reacting
171181
image::config-simulator-esssymmetric-reacting.png[Configuration of Simulator EssSymmetric Reacting]
@@ -180,10 +190,10 @@ INFO [ntroller.debuglog.DebugLogImpl] [ctrlDebugLog0] _sum[State:Ok Ess SoC:50
180190
+
181191
NOTE: The debug log now shows data for the battery, but the charge/discharge power stays at "0 W" and the state of charge stays at "50 %" as configured. Next step is to configure a control algorithm that tells the battery to charge or discharge depending on the power measured by the simulated grid meter.
182192

183-
.. Configure the self-consumption optimization algorithm: _**Controller Balancing Symmetric**_. Configure the `Ess-ID` `'ess0'` and `Grid-Meter-ID` `'meter0'` to refer to the components configured above.
193+
.. Configure the self-consumption optimization algorithm: _**Controller Ess Balancing**_. Configure the `Ess-ID` `'ess0'` and `Grid-Meter-ID` `'meter0'` to refer to the components configured above.
184194
+
185-
.Configuration of Symmetric Balancing Controller
186-
image::config-controller-balancing-symmetric.png[Configuration of Symmetric Balancing Controller]
195+
.Configuration of Controller Ess Balancing
196+
image::config-controller-ess-balancing.png[Configuration of Controller Ess Balancing]
187197
+
188198
The log shows:
189199
+
@@ -227,6 +237,11 @@ image::openems-ui-login.png[OpenEMS UI Login screen]
227237
.OpenEMS UI Energymonitor screen
228238
image::openems-ui-edge-overview.png[OpenEMS UI Energymonitor screen]
229239

240+
_Unfortunately the hosted version of OpenEMS UI is currently slightly outdated and incompatble with latest OpenEMS Edge. Follow the xref:ui/setup-ide.adoc[OpenEMS UI guide] to produce the following visualization. The language can be changed in the "burger menu" on top left -> btn:[admin] -> btn:[Allgemeine Einstellungen]._
241+
242+
.OpenEMS UI Energymonitor screen
243+
image::openems-ui-edge-overview2.png[OpenEMS UI Energymonitor screen]
244+
230245
== Integrate OpenEMS Backend
231246

232247
Instead of having Edge and UI talk to each other directly, the communication can also be proxied via Backend.
@@ -251,15 +266,12 @@ NOTE: Disable the two icon buttons "Show Console When Standard Out changes" and
251266
NOTE: Apache Felix Web Console for OpenEMS Backend is started on port 8079 by default. This is configured using the `org.osgi.service.http.port` setting in BackendApp.bndrun.
252267
+
253268
Login with username *admin* and password *admin*.
254-
+
255-
.Apache Felix Web Console Configuration for OpenEMS Backend
256-
image::apache-felix-console-backend-configuration.png[Apache Felix Web Console Configuration for OpenEMS Backend]
257269

258270
.. Configure Edge.Websocket
259271
+
260272
NOTE: The _**Edge.Websocket**_ service is responsible for the communication between OpenEMS Backend and OpenEMS Edge.
261273
+
262-
In the example we are configuring the `Port '8081'`. This port needs to match with what we configure later in OpenEMS Edge.
274+
In the example we are configuring the `Port '8081'`. This port needs to match with what we configure later in OpenEMS Edge. The `Debug Mode 'DETAILED'` setting helps us to get some more details on the internal behaviour.
263275
+
264276
.Configuration of Backend Edge.Websocket
265277
image::config-backend-edge.websocket.png[Configuration of Backend Edge.Websocket]
@@ -268,7 +280,7 @@ image::config-backend-edge.websocket.png[Configuration of Backend Edge.Websocket
268280
+
269281
NOTE: The _**Ui.Websocket**_ service is responsible for the communication between OpenEMS Backend and OpenEMS UI.
270282
+
271-
In the example we are configuring the `Port '8082'`. This port needs to match with what we configure later in the OpenEMS UI environment file.
283+
In the example we are configuring the `Port '8082'`. This port needs to match with what we configure later in the OpenEMS UI environment file. We are again setting `Debug Mode 'DETAILED'`
272284
+
273285
.Configuration of Backend Ui.Websocket
274286
image::config-backend-ui.websocket.png[Configuration of Backend Ui.Websocket]
@@ -277,7 +289,7 @@ image::config-backend-ui.websocket.png[Configuration of Backend Ui.Websocket]
277289
+
278290
NOTE: The *Timedata* service provider is responsible for holding the current and historic data of each connected Edge device.
279291
+
280-
In the example we are configuring the _**Timedata.Dummy**_ service. It takes no configuration parameters, so just press btn:[Save]. In a production system you would want to use a real implementation like *Timedata.InfluxDB*.
292+
In the example we are configuring the _**Timedata.Dummy**_ service. The default value for _Component-ID` can be accepted without changes, so just press btn:[Save]. In a production system you would want to use a real implementation like *Timedata.InfluxDB*.
281293
+
282294
.Configuration of Backend Timedata.Dummy
283295
image::config-backend-timedata.dummy.png[Configuration of Backend Timedata.Dummy]
@@ -291,6 +303,16 @@ image::config-backend-metadata.dummy.png[Configuration of Backend Metadata.Dummy
291303
+
292304
NOTE: In the example we are configuring the _**Metadata.Dummy**_ service. It takes no configuration parameters, so just press btn:[Save]. In a production system you would want to use a real implementation like _**Metadata.File**_, which uses a static JSON file as input, or _**Metadata.Odoo**_, which uses the *Odoo* business software for authentication and IoT device management. This will require the https://github.com/OpenEMS/odoo-openems[Odoo-OpenEMS-Addon] to be installed on your Odoo instance. See the https://gitpod.io/#https://github.com/OpenEMS/openems/tree/main[OpenEMS Live-Demo Gitpod workspace] for a full, production ready example configuration. For more information see → xref:simulation/gitpod.adoc[Gitpod Workspace]
293305

306+
.. Backend is ready
307+
+
308+
You should have seen some important log messages by now, that indicate that the OpenEMS Backend is ready to accept connections:
309+
```
310+
INFO [d.timedata.dummy.TimedataDummy] [Timedata.Dummy] Activate
311+
INFO [d.metadata.dummy.MetadataDummy] [Metadata.Dummy] Activate
312+
INFO [socket.AbstractWebsocketServer] [Ui.Websocket] Starting websocket server [port=8082]
313+
INFO [socket.AbstractWebsocketServer] [Edge.Websocket] Starting websocket server [port=8081]
314+
```
315+
294316
=== Configure OpenEMS Edge
295317

296318
Next we will configure OpenEMS Edge to connect to the OpenEMS Backend _**Edge.Websocket**_ service.
@@ -311,18 +333,24 @@ Once you press btn:[save] you should see logs in OpenEMS Edge
311333
+
312334
```
313335
INFO [onent.AbstractOpenemsComponent] [ctrlBackend0] Activate Controller.Api.Backend
314-
INFO [socket.AbstractWebsocketClient] Opening connection [Controller.Api.Backend:ctrlBackend0] to websocket server [ws://localhost:8081]
336+
INFO [socket.AbstractWebsocketClient] [ctrlBackend0] Opening connection to websocket server [ws://localhost:8081]
337+
INFO [socket.ClientReconnectorWorker] [ctrlBackend0] Connecting WebSocket... [NOT_YET_CONNECTED]
338+
INFO [socket.ClientReconnectorWorker] [ctrlBackend0] Connected WebSocket successfully [0s]
315339
INFO [.controller.api.backend.OnOpen] [ctrlBackend0] Connected to OpenEMS Backend
316340
```
317341
+
318342
and OpenEMS Backend
319343
+
320344
```
321-
INFO [s.backend.edgewebsocket.OnOpen] [Edge.Websocket] Edge [edge0] connected
345+
INFO [s.backend.common.metadata.Edge] Edge [edge0]: Update version from [0.0.0] to [...]
346+
INFO [mon.metadata.SimpleEdgeHandler] Edge [edge0]. Update config: ...
347+
INFO [dgewebsocket.EdgeWebsocketImpl] [monitor] Edge-Connections: 1
322348
```
323349

324350
=== Connect OpenEMS UI with Backend
325351

352+
_(You need to have completed the xref:ui/setup-ide.adoc[OpenEMS UI guide] for the following steps)_
353+
326354
. In the Visual Studio Code terminal stop the running `ng serve...` by pressing btn:[ctrl] + btn:[c]
327355

328356
. Restart OpenEMS UI in 'local backend mode':
@@ -337,10 +365,18 @@ NOTE: OpenEMS UI can work both for local connections to OpenEMS Edge as well as
337365
+
338366
NOTE: _**Metadata.Dummy**_ accepts any user/password combination. For production use, switch to a different *Metadata* implementation as described above.
339367
+
340-
.UI via Backend
341-
image::ui-via-backend.png[UI via Backend]
368+
.OpenEMS UI Login screen
369+
image::openems-ui-backend-login.png[OpenEMS UI Login screen]
370+
371+
. You will be presented an overview list of all connected OpenEMS Edge devices you have permissions for:
372+
+
373+
.OpenEMS UI Overview screen
374+
image::openems-ui-backend-overview.png[OpenEMS UI Overview screen]
375+
376+
. Click on *OpenEMS Edge #0* to see the same live-view as before on the local connection.
342377
+
343-
Click on *OpenEMS Edge #0* to see the same live-view as before on the local connection.
378+
.OpenEMS UI Live screen
379+
image::openems-ui-backend-live.png[OpenEMS UI Live screen]
344380

345381
## Next steps
346382

io.openems.common/resources/templates/device-modbus/$testSrcDir$/$basePackageDir$/MyConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class MyConfig extends AbstractComponentConfig implements Config {
99
protected static class Builder {
1010
private String id;
1111
private String modbusId = null;
12-
public int modbusUnitId;
12+
private int modbusUnitId;
1313

1414
private Builder() {
1515
}

io.openems.common/resources/templates/device-modbus/$testSrcDir$/$basePackageDir$/MyModbusDeviceTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.openems.edge.common.test.AbstractComponentTest.TestCase;
66
import io.openems.edge.bridge.modbus.test.DummyModbusBridge;
77
import io.openems.edge.common.test.ComponentTest;
8+
import io.openems.edge.common.test.DummyConfigurationAdmin;
89

910
public class MyModbusDeviceTest {
1011

@@ -14,6 +15,7 @@ public class MyModbusDeviceTest {
1415
@Test
1516
public void test() throws Exception {
1617
new ComponentTest(new MyModbusDeviceImpl()) //
18+
.addReference("cm", new DummyConfigurationAdmin()) //
1719
.addReference("setModbus", new DummyModbusBridge(MODBUS_ID)) //
1820
.activate(MyConfig.create() //
1921
.setId(COMPONENT_ID) //

io.openems.common/resources/templates/device-modbus/bnd.bnd

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Bundle-Version: 1.0.0.\${tstamp}
55

66
-buildpath: \
77
\${buildpath},\
8+
com.ghgande.j2mod,\
89
io.openems.common,\
910
io.openems.edge.bridge.modbus,\
1011
io.openems.edge.common

0 commit comments

Comments
 (0)