Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » modbus multi-connection(modbus multi-connection)
modbus multi-connection [message #1857345] Wed, 01 February 2023 08:44 Go to next message
jack li is currently offline jack liFriend
Messages: 15
Registered: August 2022
Junior Member
Dear Alois
I have a problem when i use the modbusTCP client in runtime.if i have 100 CLIENT_1 FBs to connect the MODBUS tcpserver,so the runtime must make 100 connections,but sometimes the server is not allowed to make so many connections.How do I optimize it
best regards
Re: modbus multi-connection [message #1857414 is a reply to message #1857345] Mon, 06 February 2023 02:33 Go to previous messageGo to next message
jack li is currently offline jack liFriend
Messages: 15
Registered: August 2022
Junior Member
dear all ,who have a better solution to help me
Re: modbus multi-connection [message #1857699 is a reply to message #1857414] Tue, 21 February 2023 18:59 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Hi,

sorry for the late reply. Unfortunately I have no idea how the modbus module is implemented. So I'm of very little help. You could have a look on the modbus_ng module that is waiting to be merged into 4diac FORTE (https://git.eclipse.org/r/c/4diac/org.eclipse.4diac.forte/+/139743). There modbus is handled better and you can use the generic IO FBs for accessing modbus. This is most probably more in the direction of what you need.

Cheers,
Alois
Re: modbus multi-connection [message #1857752 is a reply to message #1857699] Fri, 24 February 2023 05:58 Go to previous messageGo to next message
jack li is currently offline jack liFriend
Messages: 15
Registered: August 2022
Junior Member
Dear Alois
Ok, thanks a lot, I'd like to try creating a separate thread dedicated to dealing with modbus communication.Only one connection is created when multiple functional blocks communicate with the same device.
best regards
Re: modbus multi-connection [message #1857758 is a reply to message #1857752] Fri, 24 February 2023 07:14 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

I think then the approach I sent you is the right one.
Re: modbus multi-connection [message #1863044 is a reply to message #1857345] Fri, 12 January 2024 10:54 Go to previous messageGo to next message
Ketut Kumajaya is currently offline Ketut KumajayaFriend
Messages: 24
Registered: January 2024
Junior Member
I just found we can modify client function block to have multiple outputs more than the default. Just copy it and then add more output for example 4, 8, 16 modbus registers. For now, I registered here to answer this question :D
Re: modbus multi-connection [message #1863064 is a reply to message #1863044] Sat, 13 January 2024 13:07 Go to previous messageGo to next message
Ketut Kumajaya is currently offline Ketut KumajayaFriend
Messages: 24
Registered: January 2024
Junior Member
The freeze branch shares a Modbus connection for multiple FBs. I built it last night and still can't get any data at all :(
Re: modbus multi-connection [message #1863068 is a reply to message #1863064] Sun, 14 January 2024 01:58 Go to previous messageGo to next message
Ketut Kumajaya is currently offline Ketut KumajayaFriend
Messages: 24
Registered: January 2024
Junior Member
I built forte for Linux, Raspberry 4B, and Windows target with the same problem. No problem in underlaying communication, I debug it using ModRsim2 and diagslave application, I confirm no problem in modbus request and response but somehow no data come out from FB. This frustrate me since forte freeze branch + milestone ide feel so smooth.

UPDATE:
Follow https://git.eclipse.org/c/4diac/org.eclipse.4diac.forte.git/commit/src/com/opc_ua?h=freeze&id=aa6c4e76c6af06e9adaa2fa5c4c61956c489b17a to fix the problem.

[Updated on: Sun, 14 January 2024 05:49]

Report message to a moderator

Re: modbus multi-connection [message #1863070 is a reply to message #1863068] Sun, 14 January 2024 09:12 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Unfortunately we currently have no one in the core team using Modbus. Based on your experience could you provide us a patch for fixing Modbus?

The way how to submit patches is explained here: https://eclipse.dev/4diac/en_help.php?helppage=html/development/contribute.html
Re: modbus multi-connection [message #1863074 is a reply to message #1863070] Mon, 15 January 2024 02:15 Go to previous messageGo to next message
Ketut Kumajaya is currently offline Ketut KumajayaFriend
Messages: 24
Registered: January 2024
Junior Member
Alois Zoitl wrote on Sun, 14 January 2024 09:12
Unfortunately we currently have no one in the core team using Modbus. Based on your experience could you provide us a patch for fixing Modbus?

The way how to submit patches is explained here: https://eclipse.dev/4diac/en_help.php?helppage=html/development/contribute.html

I can read modbus data but still can't write anything, slave always receive zero. Looks like there is something wrong with the pointer in the convertDataInput function: https://git.eclipse.org/c/4diac/org.eclipse.4diac.forte.git/tree/src/com/modbus/modbuslayer.cpp?h=develop

Can you give me a little hint?
Re: modbus multi-connection [message #1863075 is a reply to message #1863074] Mon, 15 January 2024 08:22 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Can you try changing line 65 to:
CIEC_ANY *anyVal = apoSDs[i]->unwrap();
Re: modbus multi-connection [message #1863077 is a reply to message #1863075] Mon, 15 January 2024 08:42 Go to previous messageGo to next message
Ketut Kumajaya is currently offline Ketut KumajayaFriend
Messages: 24
Registered: January 2024
Junior Member
Alois Zoitl wrote on Mon, 15 January 2024 08:22
Can you try changing line 65 to:
CIEC_ANY *anyVal = apoSDs[i]->unwrap();

I did it and convertDataInput enter to the case loop but convertedData content always null.

I tried reading the contents of anyVal using toString method and I can read for example 'WORD#1024', 'WORD#4096' following my force value from IDE but it wasn't actually read as a WORD by TForteWord out = (TForteWord) *(CIEC_WORD*) anyVal line.
Re: modbus multi-connection [message #1863078 is a reply to message #1863077] Mon, 15 January 2024 09:13 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

I noticed that I mixed up the return value of unwrap. Can you give that patch https://git.eclipse.org/r/c/4diac/org.eclipse.4diac.forte/+/206095 a try.

I'm not sure if it compiles as I can not test it on my machine for now. So please fix accordingly.
Re: modbus multi-connection [message #1863080 is a reply to message #1863078] Mon, 15 January 2024 10:17 Go to previous messageGo to next message
Ketut Kumajaya is currently offline Ketut KumajayaFriend
Messages: 24
Registered: January 2024
Junior Member
Alois Zoitl wrote on Mon, 15 January 2024 09:13
I noticed that I mixed up the return value of unwrap. Can you give that patch https://git.eclipse.org/r/c/4diac/org.eclipse.4diac.forte/+/206095 a try.

I'm not sure if it compiles as I can not test it on my machine for now. So please fix accordingly.

Great Professor, it's works! Don't forget processInterrupt() function also need a fix: "switch (apoRDs[i]->unwrap().getDataTypeID())".
Re: modbus multi-connection [message #1863086 is a reply to message #1863080] Mon, 15 January 2024 12:49 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

I just pushed and update that should improve receiving a bit more. Could you please test and give my a +1 if it is working for you.
Re: modbus multi-connection [message #1863088 is a reply to message #1863086] Mon, 15 January 2024 15:02 Go to previous messageGo to next message
Ketut Kumajaya is currently offline Ketut KumajayaFriend
Messages: 24
Registered: January 2024
Junior Member
Alois Zoitl wrote on Mon, 15 January 2024 12:49
I just pushed and update that should improve receiving a bit more. Could you please test and give my a +1 if it is working for you.

It looks like your patch is working correctly except for a typo at line 179. Thank you very much!

4diac very promising for use in industry. My team just have to learn industrial standard programming languages ​​to bring up my ideas related to IIoT but still under control. Node-RED have too much hidden script and harder to learn for a technician.
Re: modbus multi-connection [message #1863089 is a reply to message #1863088] Mon, 15 January 2024 15:23 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Ketut Kumajaya wrote on Mon, 15 January 2024 15:02
Alois Zoitl wrote on Mon, 15 January 2024 12:49
I just pushed and update that should improve receiving a bit more. Could you please test and give my a +1 if it is working for you.

It looks like your patch is working correctly except for a typo at line 179. Thank you very much!


Thx for pointing that out. Fixed it.


Ketut Kumajaya wrote on Mon, 15 January 2024 15:02

4diac very promising for use in industry. My team just have to learn industrial standard programming languages ​​to bring up my ideas related to IIoT but still under control. Node-RED have too much hidden script and harder to learn for a technician.

Very happy to hear that.
Previous Topic:Auxiliary variables
Next Topic:Documentation about SubApps
Goto Forum:
  


Current Time: Thu Apr 25 17:58:14 GMT 2024

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

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

Back to the top