NI Labs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

NI LabVIEW Modbus API Discussion

Try using a property node on the TCP master instance reference of the create TCP Master VI.

Message 341 of 527
(3,093 Views)

Dear colleagues,

I make a simple application to test comunication betewen PC and PLC.

This application works very well but, after a time, this loses comunication and, the only form to restore comunication is reboot the PC.

The error 56 is shown.

What is happening? Anyone have an idea? This can be because PARITY or FLOW CONTROL?

Thanks.

modbus.png

0 Kudos
Message 342 of 527
(3,093 Views)

To explain better, my application works very well until first error ( -1073807194 ), that occours, for example, when I remove and put the cable from PC . After this error, the application doesn't communicate anymore if I do not close and open the application again. As the application will stay monitoring all the time, it can't happen. Did anybody have this problem? What can I do?

Sem título.png

Message was edited by: MarcosBelgo

0 Kudos
Message 343 of 527
(3,093 Views)

maybe a race condition in the code or something? In any case your problem will likely be resolved if you move the open and close functions outside of the while loop, or use a state machine (so if an error occurs you close the session then try to reopen). Doing what you're doing (opening and closing sessions constantly) is just asking for a problem.

0 Kudos
Message 344 of 527
(3,093 Views)

Feature request?

Add VISA Lock Unlock to Serial communication similar to the way Plasmionique Modbus code works.  I think its important to have this flexibility when using different coding styles that have parallel operations.  I don't think a DVR is sufficient in situations where the Modbus class wire can't be shared for whatever reason and users may want to talk to RTU's at different addresses on the same serial connection at the "same" time without stepping on eachothers toes.

Plasmionique Serial Query.png

0 Kudos
Message 345 of 527
(3,093 Views)

To be brief, no. The issue is that his code has flattened out some of the layers. There you see that the class passed in is a modbus serial class. In my version, the code doesn't know its serial vs tcp really until its actually performing the read or the write, which makes it a bit tougher. You could of course make a light wrapper for the library which does the visa lock and unlock, but if you just need master behavior I'd recommend his. It looks pretty good.

0 Kudos
Message 346 of 527
(3,093 Views)

Hey guys!

I have an architectural question for you. I'm trying to monitor and log values from a remote home using MODBUS. The sensors are located all over the home and are wired to the AcquiSuite 8812 Data Acquisition Server (Modbus Master). I have about 15 different slaves in this network.

In a centralized architecture, where there's one instance of the TCP Master, I can loop through each slave and get their value - however, that takes 15 seconds - start to finish. I also think I'm overloading the network because I get that error a lot. In short, most of the data is lost rather then picked up.

In a completely distributed architecture - Each slave has their own loop and I can vary the sampling rate on each device. This gives slightly better performance and more flexibility, but I still overload the network. The data recieved vs data lost (lost being an instance where the MODBUS VI errors out) is about 50% when I set all the sampling rates to 5 seconds.

Has anyone encountered this type of situation before? Maybe I can try staggering all the loops by 200 msec or so to make sure they don't all try to read the AcquiSuite at the same time...

PS: The distributed approach is quasi-distributed. In the real world, there's only one AcquiSuite. Just because I have 15 instances of of it in my code doesn't mean there's 15 of them in parallel responding to my request.

Shehezaada

0 Kudos
Message 347 of 527
(3,093 Views)

I'm confused where the library is in this. You say you have 15 slaves connected to a AcquiSuite master...are you saying the AcquiSuite is also a slave?

Assuming its a slave, are there 15, or 1? If 1, it doesn't really make sense to have 15 master instances unless the server has more than one core. If 15, I don't understand how having only 1 TCP master instance would work.

What is the error? Is it a timeout or something else.

-If a timeout, theres a reasonable chance the slave isn't great. Also, this is why it takes 15 seconds to talk to the slave because timeouts are a few seconds each.

-If something else..well there are too many options. But it likely means you are making an invalid request. Some devices are stupider than others about this, for example arranging registers such that 1,2,3,4,5,7,8 and 9 are valid but if you try to read 1-9 it errors because 6 wasn't valid.

0 Kudos
Message 348 of 527
(3,093 Views)

Hey smithd,

Sorry if I wasn't being clear earlier. I use the TCP Master to connect to the AcquiSuite Data Server, then I use the set Unit ID VI in order to talk to the specific device I want to talk to. There are 15 different devices with unique IDs.

I'm not making an invalid request. I can run each device in isolation and I get back proper values. When I run them all together, I get the following error:

Modbus Exception: Gateway Path Unavailable. The gateway may be misconfigured or overloaded.

Function 3

This leads me to believe that I'm overloading the AcquiSuite Master with requests.

0 Kudos
Message 349 of 527
(3,093 Views)

Oh I see, its just a gateway. Makes sense. I've personally never seen that error code pop up before. Unless anyone else has any input I'd suggest talking to the manufacturer. It really shouldn't be doing that if you are running as slow as you are. Maybe there are some settings you can tweak to make it perform better?

0 Kudos
Message 350 of 527
(3,093 Views)