LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communicate with Modbus device using OPCLabVIEW.

Hi,
I think still our application is not clear to u.
Let start from the scratch.

We want to communicate with Flow controller locate in the field from a control room. (like SCADA). These controllers are follow Modbus protocols. At present we r trying to communicate with only Dainel Spectra 100 type controller(through modem). this controller should be connected once in a day for getting data. If the communication fails or some data loss happen than it should reconnect and get complete data. (All these has to be done automatically)
At present we r using LookOutOPC server and LV. (& started solving problem using only two controllers located at two different places)
For this I made
two objects of two cotrollers in Lookout. with 2 different phone nos. I am able to communicate with each of them separately (by making one of the object's communication port other than the com2(port used for the modem). In this if I want to get data from the controller using Labview I do as shown in the attach file.(but in this also i have to wait for the connection to be established [Is there any automatic way to detect the communication status and then try to get data]. & not getting the reading of the "CommFail" instance [how to get this so we can try to reconnect this controller for reading]). Let me know the better way if any is there.
If I make both the objects of the Controller active (Set comm port 2 for both cotrller) it try to communicate with both the controller in turn. But what I should do to get data of the specific Controller by selecting the phone no(or controller).
Plz let me know if u have any doubt. ( so I could get the best solution)

Thanks & regards,
Vishal

0 Kudos
Message 11 of 15
(1,636 Views)
______




I understand your app pretty well. I have helped couple of my clients build similar SCADA apps.

I took a look at your example VI. First of all, you're not using LabVIEW-DSC but just LabVIEW. This will make things difficult. Though you can use DataSocket connections to talk OPC, the best approach would be to use LabVIEW-DSC and Tags.

Please study the Tag architecture in detail. There's lot of info' in the LabVIEW-DSC manuals and Online Help.

If you have LabVIEW-DSC installed, go to Tools>>Datalogging & Supervisory Control>>Tag Configuration Editor. Once the Tag Configuration Editor (TCE) is launched, you can invoke the Wizard and browse all OPC
Servers on your machine.

Browse to your LookoutOPCServer and select the Items you need, including the Poll and CommFail. You'll later toggle the Poll Tag whenever you have to dial-out to a PLC. CommFail, like I said earlier, will give you the status of communication.

Once you have these Tags generated (and the SCF file created), you start writing your VI(s). First step would be to toggle the Poll member of the PLC you want to call. Next, you wait and check for the CommFail Tag. If all is well, you start reading and writing to the rest of the Tags. Use the HMI-Wizards to generate the code.

When you're done reading/writing, toggle the Poll Tag for the next PLC and repeat the same process.

Hope this helps..

Regards,

Khalid 🙂




______
0 Kudos
Message 12 of 15
(1,636 Views)
Hi,
Plz see the attached file. Here I use the LVDSC. I made two “.scf” files with tags of individual controllers. I made two objects of two controllers named ModbusDaniel1 & ModbusDaniel2 with two different phone nos.

While using this vi below mentioned problems r occurring.

1. I configured the serial port with dialing prefix as “AT&D2X4M1VEDT ”, as shown in help to hang up the phone after getting the data. This was working fine while using with LV only. But it is not working with LVDSC. (Once the connection is established it never hangs up automatically. (using FastTalkII modem from Motorola)
2. As I highlighted in vi that “En
gine Shutdown vi” is not working properly. It never stop engine programmatically.
3. If I use the vi for getting data from the ModbusDaniel1 object it works fine as it is first object created. But as in vi, if I try to connect ModbusDaniel2 object (second in the object creation) it first try to connect the first object (ModbusDaniel1) and then phone line stays there. Lookout server shows error “Communication failed with com2”. But in the vi “CommFail” instance doesn’t give any indication. !!!!!!!!! Is there any way to dial the selected object directly?

I had also tried out with the datasocket but give the same kind of response (rather Error for me). I tried with different combinations of dialing prefix, object settings, etc. But not getting the exact response as I want.

In our application we want to get data from different controllers (located at different places) once in a day one by one. It should retry to communicate only those controlle
rs from which we didn’t get data.

If u have any other solution for this plz let me know.

Thanks & regards,
Vishal.
0 Kudos
Message 13 of 15
(1,636 Views)
_________

I didn't see any SCF files attached. Anyways, move the Case Structure containing the Engine Shutdown outside the While loop -- race condition is causing the error.

Create Tags for the OffHook datamembers of both the PLCs. Writing a False to these Tags will hang-up the phone line for that particular PLC.

Before you read a Tag from the Lookout Objects, please first write a TRUE to the Poll datamamber for the first PLC. This will dial the first PLC. This should be the first step. Then read the Tags and then write to the OffHook Tag to hangu the line.

Next, write a TRUE to the Poll Tag from the second PLC. And so on...


_________
0 Kudos
Message 14 of 15
(1,636 Views)
Hi,
I made changes as u told me. Though I made ?Poll? of the first Controller ?FALSE?, it tries to connect it first. ?OffHook? also not responding properly. Plz let me know how to get status of connection ? (CommFail not give specific response).


Thanks & regards,
Vishal

Plz find (as ni_mod.zip)
1. Modified vi. (LVDSC_Modbus1.vi)
2. SCF file (Lookout_modbus2.scf)
3. LPD, LPS, LST & lks files (ni_mod.lpd, ni_mod.lps, ni_mod.lst & quality.lks)
0 Kudos
Message 15 of 15
(1,636 Views)