openems icon indicating copy to clipboard operation
openems copied to clipboard

Outdated tutorial

Open stefansc1 opened this issue 3 years ago • 1 comments

Bug Report or Feature Request

- [x] bug report
- [ ] feature request

Bug descriptions

I followed the tutorial and wanted to give feedback.

1. Download the source code

No problems.

2. Setup Eclipse IDE for OpenEMS Edge and Backend

Apart from the outdated Java version, no problems. I am using the existing openjdk 11 instead.

3. Run OpenEMS Edge and start Simulator

Step 2b (configure a scheduler): the cycle time can not be set in the UI.

Step 2c (setup Controller Debug Log): there are more options (Condensed output, Additional Channels and Ignore Components) which are not shown in the example. Defaults apply. Debug Log info shortened to [ctrlDebugLog0] _sum[State:Ok] without any power output.

Step 2d (Simulator Datasource): Time-Delta text input and Realtime checkbox merged into one field. Using default of -1 (not realtime).

:exclamation:Step 2e (Simulator Grid Meter Acting): MinPower/MaxPower must be set at creation, otherwise exceptions are thrown: java.lang.IllegalArgumentException: Unable to set value [] for Channel [meter0/_PropertyMinActivePower]: For input string: "" I am using values of 0 for both. Output looks close to example, but without SoC: _sum[State:Ok Grid:502 W Consumption:502 W] meter0[502 W]

Step 2f (Simulator EssSymmetric Reacting): Datasource-ID and Datasource target filter can not be set anymore.

Step 2g (Controller Balancing Symmetric): Max power adjustment rate can not be set anymore.

4. Setup Visual Studio Code for OpenEMS UI

Instead of using Visual Studio Code, I use the command line directly. No problems.

5. Run OpenEMS UI / 6. Integrate OpenEMS Backend

Straightforward frontend stuff, no problems.

Implementing a device

1.1 (Create a new OSGi Bundle) Could also be done directly from the menu (without Other...) but okay. JRE: as shown, setting execution environment JRE to (outdated?) JavaSE-1.8. After setting project name and JRE, there is no next screen with settings, only Finish. After Finish, there are several errors in the new component, which go away in later steps.

1.2 (Define Bundle dependencies) slf4j.api is no longer part of the buildpath.

1.3 (Define configuration parameters), step 2c (add Meter attribute) Meter must be imported. Later on, it is explained how to resolve import errors, but this is probably the earliest a user might stumble across one.

1.4 (Implement the OpenEMS Component) Under src/ there is Config.java, MyModbusDevice.java (an interface defining the enum ChannelId) and MyModbusDeviceImpl.java (the actual class). For this to work, the class constructor must be changed (as hinted at by Eclipse). It's a good idea to fix this error before renaming. I renamed both files. In the class constructor, the last channel line then reads MeterSimulated.ChannelId.values(), using the enum from the interface. Step 7 (set debugLog output): getActivePower() already returns an integer and therefore has no value() method. In the notes regarding the file content, points 18 and 19 are inside the block of point 17.

1.5 (Start the device simulator) In the test subfolder of the new component there are two files, MyConfig.java and MyModbusDeviceTest.java. The first has an error (The type MyConfig must implement the inherited abstract method Config.type()). Resolved by adding unimplemented methods, which adds the type() method (per default just returns null). I have the impression this never gets used during the tutorial. Starting the ModbusSlaveSimulator is straightforward and poses no problems.

1.6 (Enable Component) :exclamation:Resolving fails because of unmet requirements. Removing all io.openems.edge.evcs entries from the run requirements fixes this. You need to save before resolving, otherwise the new component is not part of the runbundle.

:exclamation:1.7 (Run the implementation) Adding the new simulated meter throws an error: bundle io.openems.edge.meter.simulated:<version> (159)[Meter.Simulated(15)] : Invalid syntax in target property for dependency Modbus to According to an earlier answer this is normal and expected. However, the simulated meter fails to connect to the slave simulator. While debugging, I can see the ModbusSlaveSimulator is running. In the console, I get the warning [bridge.modbus.api.ModbusWorker] [modbus0] FC3ReadHoldingRegisters [meter0;unitid=1;ref=1000/0x3e8;length=1] execution failed: Connection to [127.0.0.1] failed: Verbindungsaufbau abgelehnt (Connection refused) and the debug log shows _sum[State:Fault] meter0[L:UNDEFINED] modbus0[State:FAULT: LAN Communication to external device failed] followed by _sum[State:Ok] meter0[L:UNDEFINED] after the bridge is invalidated after the error.

Software versions used

  • OS: Ubuntu 20.04
  • Java: openjdk 11.0.11
  • Eclipse: 2019-12 (4.14.0)
  • no Visual Studio Code
  • Angular CLI: 12.0.2
  • Node: 14.17.0
  • Package Manager: npm 6.14.13
  • OpenEMS: current master branch, latest release version 2021.10.0

stefansc1 avatar Jun 08 '21 09:06 stefansc1

I faced similar issue saying [bridge.modbus.api.ModbusWorker] [modbus0] FC3ReadHoldingRegisters [meter0;unitid=1;ref=1000/0x3e8;length=1] execution failed: Connection to [127.0.0.1] failed: Verbindungsaufbau abgelehnt (Connection refused)

I resolved it by using another port instead of 502. I used port 2502 and then it started working. My operating system is also Ubuntu 20.04 so it might be a problem with Ubuntu.

wickywaka avatar Feb 22 '22 13:02 wickywaka