Problems creating new component

Hello Everybody,

I am trying to implement a new device, just a simple meter, connected via Modbus TCP.
Because I basically only have to copy the code from another, already implemented meter and change the register from which the data gets pulled is should be relatively straight forward.

But my code, which is mostly just copied from other meters gets a lot of errors I can´t explain. Even if the exact code works in another component.
I have imported all the necessary components and created the Bnd OSGi project from the template provided in openEMS.

In addition I have a few interessting quirks in Eclipse right now.
For example I have 38 errors in my code, but the Problems tab shows 0 erros.
When crating a new project the templates from openEMS are only availabe sometimes (I could find a systemetic).

This makes me belive that the problem is somewhere deeper than just my code beeing false.
I reloaded the workspace and cleaned all projects a few times. I even reinstalled java and eclipse. But that didn´t help.

Sadly, I can´t give you acces to my code, but here are a few examples of the erros a get:
(my code next to the code I copied)
My constructor:


Here is my code ext to the code which I copied
The Error message I get in line 57:
The constructor AbstractOpenemsModbusComponent(OpenemsComponent.ChannelId[], SymmetricMeter.ChannelId[], AsymmetricMeter.ChannelId[], MeterSentronPac4200.ChannelId[]) is undefined

Another example when pulling the data via modbus


Error messages:
Line 94: Exception OpenemsException is not compatible with throws clause in AbstractOpenemsModbusComponent.defineModbusProtocol()
Line 96: The constructor ModbusProtocol(AbstractOpenemsModbusComponent, Task…) refers to the missing type OpenemsException
Line 100: The method m(T) in the type AbstractOpenemsModbusComponent is not applicable for the arguments (AsymmetricMeter.ChannelId, FloatDoublewordElement,
ElementToChannelConverter)

I would really appreciate any input.

Best Regards

Tobi

Hi Tobi,

it indeed sounds like there is something weird going on in your workspace. It’s difficult to help you without seeing the actual code.

It’s interesting though, that there is currently a very similar implementation by @simonfey waiting for review for a Siemens Sentron PAC 3200. Also the modbus registers look very similar to me. Can you check if the code in this Pull Request works for you?

Regards,
Stefan

Hi Stefan,

thanks for the answer.
The implementation you linked works but doesn’t read all the values I need, still good to know.

I fixed my problem now by simply trying over and over again, creating new components. I usually had the problem that the freshly with the template created component had a lot of errors (not just in the MyModbusDeviceImpl.java).
But at mybe the 6th time this problem didn’t occured anymore. I don’t know why, but at this point I don’t care anymore.

Regards,
Tobi

Hi Tobi,

Thank you anyway for the feedback. Of course this is not the kind of ‘Getting Started’ experience we want our users to have with OpenEMS. Since the release yesterday, OpenEMS is built on Java 11, which might improve things a little bit.

If the above linked implementation does not have all values/registers you need, you might still consider extending it. In the end Open Source software is all about collaboration. It’s what makes OpenEMS better and better in time.

Thanks,
Stefan