Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » Kura Modbus(Modbus in kura)
Kura Modbus [message #1778838] Fri, 22 December 2017 11:26 Go to next message
Javier A. is currently offline Javier A.Friend
Messages: 10
Registered: November 2017
Junior Member
Good morning.

Is the first time that I use something as modbus. I need a app to desploy after in kura wich read and write in the registers of a plc, the comunication between app in kura and the plc in by ethernet.

I have read a lot of post about modbus but i haven´t a clear idea about how I should implement the app. I have read oficial docs of Kura (https://eclipse.github.io/kura/dev/kura-modbus-protocol.html), I have add configuration in the .xml file:
<reference bind="setModbusProtocolDeviceService" cardinality="1..1"
	interface="com.eurotech.framework.protocol.modbus.ModbusProtocolDeviceService"
	name="ModbusProtocolDeviceService"
	policy="static"
	unbind="unsetModbusProtocolDeviceService" />

But eclipse shows me warnings and some errors.

If someone could explain my step a step how should I do it.

Thank you.
Re: Kura Modbus [message #1778867 is a reply to message #1778838] Fri, 22 December 2017 15:03 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 264
Registered: July 2015
Location: Italy
Senior Member
Hello,
if you need only to read/write data from your modbus device, have you tried using Kura Wires?
Maybe you can get the same result without writing lines of code.

If, otherwise, you need to develop a more specific application, I would suggest first to start with the first examples. In this way you can understand how declarative services work and what you need to do to define dependencies between services.

Related to the errors you are having, could you please report them, in order to be able to provide support?

Thanks.

Best regards,
Matteo
Re: Kura Modbus [message #1779013 is a reply to message #1778867] Thu, 28 December 2017 13:15 Go to previous messageGo to next message
Javier A. is currently offline Javier A.Friend
Messages: 10
Registered: November 2017
Junior Member
Matteo Maiero wrote on Fri, 22 December 2017 15:03
Hello,
if you need only to read/write data from your modbus device, have you tried using Kura Wires?
Maybe you can get the same result without writing lines of code.

If, otherwise, you need to develop a more specific application, I would suggest first to start with the first examples. In this way you can understand how declarative services work and what you need to do to define dependencies between services.

Related to the errors you are having, could you please report them, in order to be able to provide support?

Thanks.

Best regards,
Matteo


Hi Matteo, reference Kura Wires, thank you for your suggest, I have been able to read a register, show it with log and send it a mqtt server but I couldn´t write. I use esf modbus driver.

Some idea why I can´t write a register?

[Updated on: Thu, 28 December 2017 13:16]

Report message to a moderator

Re: Kura Modbus [message #1779014 is a reply to message #1779013] Thu, 28 December 2017 13:49 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 264
Registered: July 2015
Location: Italy
Senior Member
Hi,
I believe you have two options if you are using Kura 3.1.0:
- if you only need to change a single time a value in an asset, go to the "Drivers and Assets" section, select your asset, then the "Data" tab and from there perform the write of the specific value you want to change;
- use the graph for that: you need to setup a graph, maybe using the subscriber component, the database and database filter that will determine a graph that is able to produce a value that matches, with its name and type, one of the channels of the Asset. This message is then received, using the data flow model, by the Asset that will write to the specific Modbus register.

Best regards,
Matteo
Re: Kura Modbus [message #1779085 is a reply to message #1779014] Tue, 02 January 2018 12:08 Go to previous messageGo to next message
Javier A. is currently offline Javier A.Friend
Messages: 10
Registered: November 2017
Junior Member
Matteo Maiero wrote on Thu, 28 December 2017 13:49
Hi,
I believe you have two options if you are using Kura 3.1.0:
- if you only need to change a single time a value in an asset, go to the "Drivers and Assets" section, select your asset, then the "Data" tab and from there perform the write of the specific value you want to change;
- use the graph for that: you need to setup a graph, maybe using the subscriber component, the database and database filter that will determine a graph that is able to produce a value that matches, with its name and type, one of the channels of the Asset. This message is then received, using the data flow model, by the Asset that will write to the specific Modbus register.

Best regards,
Matteo


Hi Matteo, happy new year.

I tried as you said it and all OK, now I can write to, but with this way, the write is very slow and for reduced number of changes.
I need something more complex, so, I have to develop an application in java to deploy it after in kura, here I have two problems:

  • The eclipse project "org.eclipse.kura.protocol.modbus" show me an error reference pom.xml (Project build error: Non-resolvable parent POM for org.eclipse.kura:org.eclipse.kura.protocol.modbus:2.0.200-SNAPSHOT: Could not find artifact org.eclipse.kura:kura:pom:3.2.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM).
  • Test project "org.eclipse.kura.protocol.modbus.test" isn´t a eclipse project, it is a maven project and when I try to clean, install etc allways I have some error.

Re: Kura Modbus [message #1779087 is a reply to message #1779085] Tue, 02 January 2018 12:34 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 264
Registered: July 2015
Location: Italy
Senior Member
Hi,
Quote:
I tried as you said it and all OK, now I can write to

Good!

Quote:
the write is very slow and for reduced number of changes

If you are using Wires you can develop many graphs with different triggering times and complex structures to achieve what you desire.

But I understand that a wire graph is not always a possible solution, so the development of a custom Java bundle can definitely solve your issue.

Regarding your errors, those projects are maven projects so them need, to work, a proper maven structure with a parent pom.
A structure like the one kura has https://github.com/eclipse/kura/blob/develop/kura/pom.xml is what you need in order to successfully build those bundles.

Best regards,
Matteo
Re: Kura Modbus [message #1779088 is a reply to message #1779087] Tue, 02 January 2018 13:19 Go to previous messageGo to next message
Javier A. is currently offline Javier A.Friend
Messages: 10
Registered: November 2017
Junior Member
Good afternoon Matteo.

When I run "mvn clean install" in these folder I have this error in maven log:

[INFO] Scanning for projects...
[WARNING] The POM for org.apache.commons:commons-compress:jar:1.9 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for junit:junit:jar:4.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] Computing target platform for MavenProject: org.eclipse.kura:org.eclipse.kura.api:1.4.0-SNAPSHOT @ C:\Users\javier \Downloads\kura-develop\kura\org.eclipse.kura.api\pom.xml
[INFO] Adding repository file:/C:/Users/javier/Downloads/kura-develop/kura/org.eclipse.kura.api/../target-definition/equinox_3.11.1/repository
[ERROR] Internal error: java.lang.RuntimeException: Failed to load p2 repository with ID 'p2-repo-equinox_3.11.1' from location file:/C:/Users/javier/Downloads/kura-develop/kura/org.eclipse.kura.api/../target-definition/equinox_3.11.1/repository/: No re
pository found at file:/C:/Users/javier/Downloads/kura-develop/kura/org.eclipse.kura.api/../target-definition/equinox_3.11.1/repository. -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: Failed to load p2 repository with ID 'p2-repo-equinox_3.11.1' from location file:/C:/Users/javier/Downloads/kura-develop/kura/org.eclipse.kura.api/../target-definition/equinox_3.11.1/repository/
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:122)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown Source)
    at java.lang.reflect.Method.invoke (Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.RuntimeException: Failed to load p2 repository with ID 'p2-repo-equinox_3.11.1' from location file:/C:/Users/ja
vier/Downloads/kura-develop/kura/org.eclipse.kura.api/../target-definition/equinox_3.11.1/repository/
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.loadMetadataRepository (TargetPlatformFactoryImpl.java:302)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.gatherExternalInstallableUnits (TargetPlatformFactoryImpl.java:270)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:176)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:128)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:1)
    at org.eclipse.tycho.p2.manager.ReactorRepositoryManagerImpl.computePreliminaryTargetPlatform (ReactorRepositoryManagerImpl.java
:84)
    at org.eclipse.tycho.p2.resolver.P2DependencyResolver.computePreliminaryTargetPlatform (P2DependencyResolver.java:223)
    at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject (DefaultTychoResolver.java:109)
    at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead (TychoMavenLifecycleParticipant.java:95)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:267)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown Source)
    at java.lang.reflect.Method.invoke (Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.eclipse.equinox.p2.core.ProvisionException: No repository found at file:/C:/Users/javier/Downloads/kura-de
velop/kura/org.eclipse.kura.api/../target-definition/equinox_3.11.1/repository.
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.fail (AbstractRepositoryManager.java:395)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:6
92)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository (MetadataRepositoryManager.java:
96)
    at org.eclipse.tycho.p2.remote.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:61)
    at org.eclipse.tycho.p2.remote.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:53)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.loadMetadataRepository (TargetPlatformFactoryImpl.java:298)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.gatherExternalInstallableUnits (TargetPlatformFactoryImpl.java:270)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:176)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:128)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:1)
    at org.eclipse.tycho.p2.manager.ReactorRepositoryManagerImpl.computePreliminaryTargetPlatform (ReactorRepositoryManagerImpl.java
:84)
    at org.eclipse.tycho.p2.resolver.P2DependencyResolver.computePreliminaryTargetPlatform (P2DependencyResolver.java:223)
    at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject (DefaultTychoResolver.java:109)
    at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead (TychoMavenLifecycleParticipant.java:95)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:267)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown Source)
    at java.lang.reflect.Method.invoke (Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException

Re: Kura Modbus [message #1779089 is a reply to message #1779088] Tue, 02 January 2018 14:04 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 264
Registered: July 2015
Location: Italy
Senior Member
Hi,
I believe you have taken the code of those two bundles extracting it from the develop of Kura. But, in this way, it will not work because it requires to have the whole Kura repository to satisfy its dependencies.
In this case I see two options:
1- download all the Kura codebase and build from that.
2- modify the pom in order to fetch the few needed artefacts from maven central. (I believe in this case you will not be able to use Tycho directly).

Best regards,
Matteo
Re: Kura Modbus [message #1779230 is a reply to message #1779089] Thu, 04 January 2018 08:27 Go to previous messageGo to next message
Javier A. is currently offline Javier A.Friend
Messages: 10
Registered: November 2017
Junior Member
Good morning Matteo.

I`m with kura code downloaded from https://github.com/eclipse/kura.
Re: Kura Modbus [message #1779257 is a reply to message #1779230] Thu, 04 January 2018 14:25 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 264
Registered: July 2015
Location: Italy
Senior Member
Great, so if you correctly cloned that repository, you should be able to build with maven without errors.

Best regards,
Matteo
Re: Kura Modbus [message #1779977 is a reply to message #1779257] Tue, 16 January 2018 09:47 Go to previous message
Javier A. is currently offline Javier A.Friend
Messages: 10
Registered: November 2017
Junior Member
At the end. I used eclipse installer following the steps in kura github page instead of mvn and all ok (0 errors).

Thank you Matteo for all.
Previous Topic:adc
Next Topic:Kura 3.1.0, Raspi3, Sensortag connectivity Problem
Goto Forum:
  


Current Time: Mon Sep 24 23:53:46 GMT 2018

Powered by FUDForum. Page generated in 0.05252 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top