Modbus Handler

HaMo

Re: Modbus Handler

Post by HaMo » Wed Oct 01, 2014 9:21 am

Hello Mr. Grawunder,
let me latch in this thread.
Found that the processInOpen method of the ModbusTCPTransportHandler class, uses the
ReadInputDiscretesRequest method of the j2mod library.
Instead of this, we need com.ghgande.j2mod.modbus.msg.ReadInputRegistersRequest method.
This uses function code 4 (Modbus.READ_INPUT_REGISTERS) instead of function code 2 (Modbus.READ_INPUT_DISCRETES).
Is it possible to provide this method for us?
Thanks before

User avatar
Marco Grawunder
Posts: 272
Joined: Tue Jul 29, 2014 10:29 am
Location: Oldenburg, Germany
Contact:

Re: Modbus Handler

Post by Marco Grawunder » Wed Oct 01, 2014 12:53 pm

No Problem :-)

I have added a new option: FUNCTION_CODE where 2 is the current behaviour and 4 can be set for READ_INPUT_REGISTERS (more are not available at the moment, but its easy to do).

Update should be available via the update site.

HaMo

Re: Modbus Handler

Post by HaMo » Wed Oct 01, 2014 2:55 pm

Marco Grawunder wrote:No Problem :-)

I have added a new option: FUNCTION_CODE where 2 is the current behaviour and 4 can be set for READ_INPUT_REGISTERS (more are not available at the moment, but its easy to do).

Update should be available via the update site.
Thanks al lot, I will test it as soon as possible.

HaMo

Re: Modbus Handler

Post by HaMo » Thu Oct 02, 2014 11:29 am

Marco Grawunder wrote:No Problem :-)

I have added a new option: FUNCTION_CODE where 2 is the current behaviour and 4 can be set for READ_INPUT_REGISTERS (more are not available at the moment, but its easy to do).

Update should be available via the update site.
I testet the new option

Code: Select all

#DROPALLSOURCES
#PARSER PQL
#RUNQUERY
modbussource := RETRIEVE({
            transport = 'modbustcp',
            source = 'modbussource',
            datahandler = 'tuple',
            protocol = 'none',
            schema = [['value', 'BitVector']],
            options = [
              ['slave','x.x.x.x'],
              ['port','502'],
              ['ref','0'],
              ['count','4'],
              ['function_code','4'],
              ['scheduler.delay','1000']
            ]         
          }       
        )
 
This is my console output (after show data):

Code: Select all

73068775 DEBUG StandardQueryOptimizer  - Start rewriting of query... - de.uniol.inf.is.odysseus.planmanagement.optimization.query.standardqueryoptimizer.StandardQueryOptimizer.optimizeQuery(StandardQueryOptimizer.java:134) 
73068777 DEBUG StandardQueryOptimizer  - Rewriting of query done. - de.uniol.inf.is.odysseus.planmanagement.optimization.query.standardqueryoptimizer.StandardQueryOptimizer.optimizeQuery(StandardQueryOptimizer.java:138) 
73068778 DEBUG StandardQueryOptimizer  - Starting transformation for the logical query... - de.uniol.inf.is.odysseus.planmanagement.optimization.query.standardqueryoptimizer.StandardQueryOptimizer.optimizeQuery(StandardQueryOptimizer.java:157) 
73068787 DEBUG StandardQueryOptimizer  - Transformation into a physical query done. - de.uniol.inf.is.odysseus.planmanagement.optimization.query.standardqueryoptimizer.StandardQueryOptimizer.optimizeQuery(StandardQueryOptimizer.java:161) 
73068795 DEBUG ModbusTCPTransportHandler  - Opening connection to slave /10.1.183.3 - de.uniol.inf.is.odysseus.modbus.ModbusTCPTransportHandler.processInOpen(ModbusTCPTransportHandler.java:96) 
73068798 DEBUG ModbusTCPTransportHandler  - Creating new read request - de.uniol.inf.is.odysseus.modbus.ModbusTCPTransportHandler.processInOpen(ModbusTCPTransportHandler.java:106) 
73068800 ERROR SelectAllFromSource  - Could not start query for viewing source data - de.uniol.inf.is.odysseus.rcp.viewer.stream.table.commands.SelectAllFromSource.startQueries(SelectAllFromSource.java:78) 
java.lang.RuntimeException: Query not started. An Error during optimizing occurd (ID: 1). java.lang.IllegalArgumentException: FUNCTION_CODE 0 not know
	at de.uniol.inf.is.odysseus.planmanagement.executor.standardexecutor.StandardExecutor.startQuery(StandardExecutor.java:1040)
	at de.uniol.inf.is.odysseus.rcp.viewer.stream.table.commands.SelectAllFromSource.startQueries(SelectAllFromSource.java:76)
	at de.uniol.inf.is.odysseus.rcp.viewer.stream.table.commands.SelectAllFromSource.execute(SelectAllFromSource.java:54)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
	at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
	at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at de.uniol.inf.is.odysseus.product.studio.starter.OdysseusStudioApplication.start(OdysseusStudioApplication.java:68)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: de.uniol.inf.is.odysseus.core.physicaloperator.OpenFailedException: java.lang.IllegalArgumentException: FUNCTION_CODE 0 not know
	at de.uniol.inf.is.odysseus.core.server.physicaloperator.access.pull.AccessPO.process_open(AccessPO.java:134)
	at de.uniol.inf.is.odysseus.core.server.physicaloperator.AbstractSource.open(AbstractSource.java:329)
	at de.uniol.inf.is.odysseus.core.server.physicaloperator.AbstractSink.open(AbstractSink.java:252)
	at de.uniol.inf.is.odysseus.core.server.physicaloperator.AbstractPipe.open(AbstractPipe.java:177)
	at de.uniol.inf.is.odysseus.core.server.physicaloperator.AbstractSink.open(AbstractSink.java:252)
	at de.uniol.inf.is.odysseus.core.server.physicaloperator.AbstractSink.open(AbstractSink.java:211)
	at de.uniol.inf.is.odysseus.core.server.physicaloperator.AbstractPipe.open(AbstractPipe.java:165)
	at de.uniol.inf.is.odysseus.core.server.planmanagement.query.PhysicalQuery.start(PhysicalQuery.java:515)
	at de.uniol.inf.is.odysseus.planmanagement.executor.standardexecutor.StandardExecutor.startQuery(StandardExecutor.java:1032)
	... 36 more
Caused by: java.lang.IllegalArgumentException: FUNCTION_CODE 0 not know
	at de.uniol.inf.is.odysseus.modbus.ModbusTCPTransportHandler.processInOpen(ModbusTCPTransportHandler.java:119)
	at de.uniol.inf.is.odysseus.core.physicaloperator.access.transport.AbstractTransportHandlerDelegate.open(AbstractTransportHandlerDelegate.java:96)
	at de.uniol.inf.is.odysseus.core.physicaloperator.access.transport.AbstractTransportHandler.open(AbstractTransportHandler.java:82)
	at de.uniol.inf.is.odysseus.core.physicaloperator.access.protocol.AbstractProtocolHandler.open(AbstractProtocolHandler.java:93)
	at de.uniol.inf.is.odysseus.core.server.physicaloperator.access.pull.AccessPO.process_open(AccessPO.java:131)
	... 44 more
seems that the functioncode 4, I tried to use has been lost :-)
.
.

User avatar
Marco Grawunder
Posts: 272
Joined: Tue Jul 29, 2014 10:29 am
Location: Oldenburg, Germany
Contact:

Re: Modbus Handler

Post by Marco Grawunder » Thu Oct 02, 2014 1:07 pm

Oooohh my fault .... copy/paste error :-/

In the next update the error will be fixed.

HaMo

Re: Modbus Handler

Post by HaMo » Thu Oct 02, 2014 4:12 pm

Marco Grawunder wrote:Oooohh my fault .... copy/paste error :-/

In the next update the error will be fixed.
Now its running, going ahead trying to extract values :-)
.
.

User avatar
Marco Grawunder
Posts: 272
Joined: Tue Jul 29, 2014 10:29 am
Location: Oldenburg, Germany
Contact:

Re: Modbus Handler

Post by Marco Grawunder » Mon Oct 06, 2014 8:10 am

Fine, please report :-)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest