Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Wifi network GetdataRecord problem


Coralie May 21, 2015 08:37 AM

Hello,

I have a network of 2 dataloggers connected with NL240 wifi modules through a ad-hoc network.
The NL240 modules are connected with CSI/O plug to the dataloggers.

The 2 NL240 are configured as follow:
- bridge mode: disable
- DHCP: disable
- RS232 -> configuration disable
- CSI/O -> configuration TCP serial server

The NL240 which creates the Ad-hoc network has the IP address 192.168.1.1. It is the datalogger n°1 with pakbus address 100.

The other one has the IP address: 192.168.1.4. It is the datalogger n°2 with pakbus address 1.

I did not modify the pakbus address of each NL240 (default value is 678).

The Ad-hoc network is working. Configuring a computer on the ad-hoc network, i can access each dataloggers with PC400 configuring a IP port connection as follow: 192.168.1.4:6783 and it works fine.

Now, I would like the datalogger n°2 sends its data table to datalogger n°1.

I use the GetDataRecord function in the program of the datalogger 1 (192.168.1.1) as below:

DataTable(Datalog1,True,-1)
DataInterval(0,1,Min,10)
Sample(1,PTemp_C1,FP2)
Average(1,PTemp_C1,FP2,False)
Sample(1,Batt_Volt,FP2)
EndTable

DataTable(Datalog2,1,100)
DataInterval(0,1,Min,10)
Sample(1,PTemp_C4,FP2)
Average(1,PTemp_C4,FP2,False)
EndTable

BeginProg

Socket = TCPOpen ("192.168.1.4",6783,0)
Scan(10,Sec,1,0)

Battery(Batt_Volt)
PanelTemp(PTemp_C1,_50Hz)

GetDataRecord(Result,Socket,0,1,0000,0,2,1,Datalog2,-1)

CallTable(Datalog1)
CallTable(Datalog2)
NextScan
EndProg

In the program of the datalogger 2, I only open a TCPSocket as follow:
Socket = TCPOpen ("192.168.1.1",6783,0)

It doesn't work and the variable result of the GetDataRecord instruction is a number increasing each time there is a record.

Does anybody have an advise? Sorry for the long message...

Coralie


aps May 22, 2015 07:58 AM

Please try putting the TCPOpen within the scan loop so the socket is reopened if closed.


Coralie May 22, 2015 10:25 AM

Hi,

Thanks it is working now but I can only get 1 record at a time.

I would like to transfer all the table record at a time in the datalogger n°1.

Actually, i will plug the NL240 to the SW12 port of the datalogger and I will switch it on only once a day and transfer the dataTable to datalogger 1 in one time.

The datalogger 1 will be connected to the 3G network with a modem and transfer all the data (datalogger 1+2) to the loggernet server once a day.

My instruction is:
GetDataRecord(Result_col_PB4,Socket,-1,1,0000,0,2,1,Flux,-1)

If I change the MaxRecord field to -100 for example, I get the result code -7...

Do you have any suggestion?

Regards,

Coralie


aps May 22, 2015 11:29 AM

For the power control of the NL240 have a look at the IPNetPower instruction in the logger as it is a more controlled way of turning off the power to the NL240 (the logger then know not to try to use it).

Regarding the Getrecord instruction are you sure the two tables in the two loggers are an exact match?


Coralie May 22, 2015 12:17 PM

I think the 2 tables in the 2 loggers are matching.

The logger 1 program (the logger which receives data from logger 2) is the following:

----------------------------------
DataTable(Datalog1,True,-1)
DataInterval(0,1,Min,10)
Sample(1,PTemp_C1,FP2)
Average(1,PTemp_C1,FP2,False)
Sample(1,Batt_Volt,FP2)
EndTable

DataTable(Datalog2,1,10000)
DataInterval(0,1,Min,10)
Sample(1,PTemp_C4,FP2)
Average(1,PTemp_C4,FP2,False)
EndTable


BeginProg

Scan(10,Sec,1,0)

Battery(Batt_Volt)
PanelTemp(PTemp_C1,_50Hz)

CallTable(Datalog1)

NextScan

SlowSequence

Scan(1,min,1,0)
Socket = TCPOpen ("192.168.1.4",6785,0)
GetDataRecord(Result_col_PB4,Socket,-1,1,0000,0,2,1,Flux,-1)
NextScan
EndProg
--------------------------
The logger 2 program is the following:

DataTable(Datalog2,1,10000)
DataInterval(0,1,Min,10)
Sample(1,PTemp_C4,FP2)
Average(1,PTemp_C4,FP2,False)
EndTable


BeginProg

Scan(10,Sec,1,0)

Battery(Batt_Volt)
PanelTemp(PTemp_C4,_50Hz)
Socket = TCPOpen ("192.168.1.1",6785,0)
CallTable(Datalog2)


NextScan
EndProg
------------------------------
I do not understand why I get only one value at a time. I have then a gap between the record number sent to the logger 1 and the one which is recorded in the logger 2... and the gap is never filled...

Regarding the power control of the NL240, I wanted to swith it off all the day to save energy and to switch it on only 1 hour per day. That's why I wanted to use the SW12.

DOes the IPNetPower instruction allows to do the same?

Regards,
Coralie


Coralie May 22, 2015 12:27 PM

Sorry the getDataRecord is

GetDataRecord(Result_col_PB4,Socket,-1,1,0000,0,2,1,Datalog2,-1)


aps May 22, 2015 01:52 PM

You only need the TCPOpen in the logger collecting the data otherwise there will be two paths between the two loggers and the calling logger will get confused which to use.

I cannot see any other issue with the program, with the correct GetDataRecord, except you will need to enter a bigger negative number if you want to get multiple records.

Make sure both loggers are the same type and have the same recent operating systems otherwise you may have to use the option to ignore any differences in the table signatures (see the help).

IPNetPower will largely turn off the NL240 and takes its power use down a low quiescent level. Using this instruction is better as it tells the logger when the interface is on or not, so it will not try to talk to the interface when it does not have to, saving a little power in that way to.


Coralie May 26, 2015 09:18 AM

Hello aps,

I think I solved my problem using the GetDatarecord as follow:

GetDataRecord(Result_col_PB4,Socket,-1,1,0000,0,2,32769,Flux,-10000)

I used 32769 number in the Tableno field to ignore any differences between the data tables. Now it works!

Thanks for your help,
Coralie


Coralie May 27, 2015 11:53 AM

Hello aps,

I wanted to ask more questions about NL240.

The configuration we discussed here above is now working.
I remind you the configuration I did:
The 2 dataloggers are connected to NL240 through CSI/O port
- bridge mode: enable (in the NL240)
- Ip adresses entered in the dataloggers configuration CSI/O IP Interface #2
- Datalogger 1: 192.168.1.1
- Datalogger 2: 192.168.1.4

In the datalogger 1 program instruction:
Socket = TCPOpen ("192.168.1.4",6785,0)
GetDataRecord(Result_col_PB4,Socket,-1,1,0000,0,2,32769,Flux,-10000)

It is working fine.

Now, i connected the datalogger 2 to the NL240 using the RS232 port of the datalogger and the RS232 (DTE) port of the NL240 with the SC12 cable.

I did this because I will need to install the NL240 at about 2m distance from the datalogger on the field and I was told the CSI/O cable can be extended to maximum 1.8m whereas I will need a 2.5m cable.

I can't manage to make it work as before...

I tried several configuration (configurations of NL240 + datalogger 1 remain the same).

Configuration of the NL240 connected to datalogger 2:
- bridge mode: enable
- In the NL240 Settings editor, I changed the CSI/O interface identifier from 2 to 1
- On the datalogger 2, I switched the CSI/O IP Interface #2 to CSI/O IP Interface #1 and entered the IP addess 192.168.1.4

It is not working... Does the bridge mode enable work when connecting the NL240 using RS232 port?

Then, I disabled the bridge mode and entered the IP address in the NL240 configuration.

I configured the RS232 tab to TCP serial server. It is also not working. Impossible to ping the station and to receive data on the datalogger 1.

Finally, I configured the RS232 tab to Pakbus. I can ping the datalogger 2 and I can connect it using PC400 (IPPPORT) 192.168.1.4:6784

I receive data from datalogger 2 on datalogger 1 using the program instruction
Socket = TCPOpen ("192.168.1.4",6785,0)
GetDataRecord(Result_col_PB4,Socket,-1,1,0000,0,2,32769,Flux,-10000)

However, the number of data received is not the same at each connection. I receive sometimes 71 records, sometimes 4... I do not undersdant why...

I think i misunderstand something. Do you have any explanations? I get a bit lost...

Thanks for your help,
Coralie


aps May 27, 2015 04:11 PM

The bridge mode does not work over RS232.

I would advise going back and try the CS I/O port and if necessary slow down the SDC baud rate a little to allow for extra cable length. Start off at the default of 115 kbaud and reduce it if there seems to be communications issues.


Coralie Jun 4, 2015 10:15 AM

Hello aps,

I followed your advised and it works well by connecting the NL240 with the CSI/O port and usinf IPNetPower to turn off the NL240 power (sleep mode).

However, I stil have a problem I cannot solve after several days of tries.

I turn off the NL240 using IPNetPower all the day and I turn it on once a day to send data from datalogger to datalogger 1.

My program is the following

DATLOGGER 1:


'Definition des tables
DataTable(DATALOGGER1,True,-1)
DataInterval(0,30,Min,10)
Sample(1,PTemp_C1,FP2)
Average(1,PTemp_C1,FP2,False)
Sample(1,Batt_Volt,FP2)
EndTable

DataTable(DATALOGGER2,1,10000)
DataInterval(0,30,Min,10)
Sample(1,PTemp_C2,FP2)
Average(1,PTemp_C2,FP2,False)
EndTable

BeginProg

SequentialMode
IPNetPower (3,0) 'wifi module sleep mode

Scan(10,min,3,0)

Battery(Batt_Volt)
PanelTemp(PTemp_C1,_50Hz)
CallTable(DATALOGGER1)

NextScan

SlowSequence

Scan(30,min,3,0)

If IfTime (6,24,Hr) Then

IPNetPower (3,-1)
Delay(1,2,min)
Socket1 = TCPOpen ("192.168.1.2",6785,0)
GetDataRecord(Result_col_PB1,Socket1,-1,2,0000,0,2,32769,DATALOGGER2,-10000)
TCPClose(Socket1)
EndIf

If IfTime (8,24,Hr) Then
IPNetPower (3,0)
EndIf
NextScan

EndProg
-------------------------------

DATALOGGER 2

DataTable(DATALOGGER2,1,10000)
DataInterval(0,30,Min,10)
Sample(1,PTemp_C2,FP2)
Average(1,PTemp_C2,FP2,False)
EndTable


BeginProg
SequentialMode
IPNetPower (3,0) 'wifi module sleep mode

Scan(10,min,3,0)

Battery(Batt_Volt)

PanelTemp(PTemp_C2,_50Hz)

CallTable(DATALOGGER2)


NextScan

SlowSequence
Scan(30,min,3,0)

If IfTime (6,24,Hr) Then
Delay(1,2,min)
IPNetPower (3,-1)

EndIf
If IfTime (8,24,Hr) Then
IPNetPower (3,0)
EndIf
NextScan

EndProg

Sometimes, it works fine, DATALOGGER1 receives data from DATALOGGER2.
Sometimes, I get the result code -21 for the GetDataRecord instruction and no data received whereas the 2 NL240 are ON...

I can ping the 2 dataloggers at distance even when no data is sent...

The 2 NL240 are in bridge mode. I configured the IP adress of each dataloggers using deviceconfig in the CSI/O IP tab.

Can you help? I do not understand what is going on...
Regards,

Coralie


Coralie Jun 4, 2015 10:46 AM

Hello aps,

I followed your advised and it works well by connecting the NL240 with the CSI/O port and usinf IPNetPower to turn off the NL240 power (sleep mode).

However, I stil have a problem I cannot solve after several days of tries.

I turn off the NL240 using IPNetPower all the day and I turn it on once a day to send data from datalogger to datalogger 1.

My program is the following

DATLOGGER 1:


'Definition des tables
DataTable(DATALOGGER1,True,-1)
DataInterval(0,30,Min,10)
Sample(1,PTemp_C1,FP2)
Average(1,PTemp_C1,FP2,False)
Sample(1,Batt_Volt,FP2)
EndTable

DataTable(DATALOGGER2,1,10000)
DataInterval(0,30,Min,10)
Sample(1,PTemp_C2,FP2)
Average(1,PTemp_C2,FP2,False)
EndTable

BeginProg

SequentialMode
IPNetPower (3,0) 'wifi module sleep mode

Scan(10,min,3,0)

Battery(Batt_Volt)
PanelTemp(PTemp_C1,_50Hz)
CallTable(DATALOGGER1)

NextScan

SlowSequence

Scan(30,min,3,0)

If IfTime (6,24,Hr) Then

IPNetPower (3,-1)
Delay(1,2,min)
Socket1 = TCPOpen ("192.168.1.2",6785,0)
GetDataRecord(Result_col_PB1,Socket1,-1,2,0000,0,2,32769,DATALOGGER2,-10000)
TCPClose(Socket1)
EndIf

If IfTime (8,24,Hr) Then
IPNetPower (3,0)
EndIf
NextScan

EndProg
-------------------------------

DATALOGGER 2

DataTable(DATALOGGER2,1,10000)
DataInterval(0,30,Min,10)
Sample(1,PTemp_C2,FP2)
Average(1,PTemp_C2,FP2,False)
EndTable


BeginProg
SequentialMode
IPNetPower (3,0) 'wifi module sleep mode

Scan(10,min,3,0)

Battery(Batt_Volt)

PanelTemp(PTemp_C2,_50Hz)

CallTable(DATALOGGER2)


NextScan

SlowSequence
Scan(30,min,3,0)

If IfTime (6,24,Hr) Then
Delay(1,2,min)
IPNetPower (3,-1)

EndIf
If IfTime (8,24,Hr) Then
IPNetPower (3,0)
EndIf
NextScan

EndProg

Sometimes, it works fine, DATALOGGER1 receives data from DATALOGGER2.
Sometimes, I get the result code -21 for the GetDataRecord instruction and no data received whereas the 2 NL240 are ON...

I can ping the 2 dataloggers at distance even when no data is sent...

The 2 NL240 are in bridge mode. I configured the IP adress of each dataloggers using deviceconfig in the CSI/O IP tab.

Can you help? I do not understand what is going on...
Regards,

Coralie


aps Jun 4, 2015 02:02 PM

This might be the problem (or not) but in the second logger program the 2 min delay comes before you turn the Wifi power on, so it will only be turned on at the instant the first logger starts to try to communicate. This might prevent the two talking, at least within the timeout period of the GetRecord instruction.

There seems to be no reason to have that delay in the second logger at all?


Coralie Jun 5, 2015 06:26 AM

Hello aps,

Thanks for your reply.
I have already tested with a delay of 1 min in the DATALOGGER 2 and yesterday I removed the delay in the datalogger 2.

This morning, it still did not work. The result code of the GetDataRecord is -21.

I can ping the DATALOGGER 1 : 192.168.1.1 but I cannot ping the DATALOGGER 2: 192.168.1.2 I think it might be the problem...

However, when I check each of the NL240. They are blinking red and green alternately and when I connect to the NL240 connected to the DATALOGGER 2, it is written "connected to the ad-hoc wifi" and the MAC Address and the IP address is indicated.

I really do not understand and how to solve this problem...

Regards,

Coralie


aps Jun 5, 2015 10:39 AM

First I would go back and check the Wifi settings making sure only one NL240 is set to create the ad hoc network and the other is set to join it. I would also recommend that you set the one creating the network to either be in high power mode or you think carefully about the on/off time settings so as to make sure the two NL240s get talking to each other before the Getdatarecord runs.

Also check the network masks are appropriate and all devices are in the same sub-net (255.255.255.0)

You do not mention what the main communication method into the main logger. If it is IP based then then it may be worth including IPRoute commands in the program to force the connection to the remote logger to go via the NL240, otherwise the logger might just be routing the traffic another way.


Coralie Jun 15, 2015 08:10 AM

Hello aps,

I am still trying to fix the problems of transmission with NL240. I checked everything as you advised me in your previous email.
I thought I solved the problem removing the option "Low power mode" on the NL240. I use IPNetPower to put the module in sleep mode and I wake them up every hour.

It still does not work properly. I sometimes get the result code -21 in the GetDataRecord instruction and when i get this code and after the transfer works, I realized the data are sometimes transfered twice and upside down...

I really do not know what to do. Is there a way to export the configuration files of the NL240 + the dataloggers to send them to you to check if there is a mistake in my configuration?

May it be a problem of modules?

Regards,

Coralie


aps Jun 16, 2015 12:56 PM

You can use our Device Configuration program to save the settings to a file which you can email to me.


Coralie Jun 17, 2015 06:15 AM

Hello aps,

OK, I will send you my configuration files and my programs files by email.
Shall I use the generic address?

Thanks,
Coralie


aps Jun 18, 2015 09:04 AM

Send them to andrew dot sandford at campbellsci dot co dot uk
(converting to correct email address format).


Coralie Jun 18, 2015 09:18 AM

Hello,

Ok it is done,

Thanks,

Coralie

Log in or register to post/reply in the forum.