LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView Modbus TCP IP

Hello i have a problem with my connection between LabView and the Solar SMA Converter. The conection is Over Modbus TCP IP. It works very well but every Sunnday i become an error.

If i try to  close the port and open the port again i become the next error " Port still in use" I can only reset this problem with stop the Labview Runtime and start again. 

I try with a wait time between close and open but it will be not resolve the error.

Have everyone an idea what i can do or test ?

 

LabView 2019 SP1 32 Bit  / SMA Enverter STP 6 

0 Kudos
Message 1 of 7
(1,102 Views)

Hi Michael,

 


@MichaelMoerix wrote:

Hello i have a problem with my connection between LabView and the Solar SMA Converter. The conection is Over Modbus TCP IP. It works very well but every Sunnday i become an error.


Which error do you receive?

Why does this happen always (?) on Sunday?

 


@MichaelMoerix wrote:

If i try to  close the port and open the port again i become the next error " Port still in use" I can only reset this problem with stop the Labview Runtime and start again. 

I try with a wait time between close and open but it will be not resolve the error.


The OS might need some time to properly close a TCP connection - not just milliseconds, but upto minutes. How long did you wait?

 

Your device might also reject new connections when the provious session wasn't closed properly…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(1,091 Views)

Error 1 occurred at SubVI in TCP Master.lvclass:Protocol Write.vi:6190001->IP Data Unit.lvclass:Write ADU Packet.vi:1820001->Modbus Master.lvclass:Read Holding Registers.vi:2420001->_MAIN_Haus.vi
LabVIEW: (Hex 0x1) An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
=========================
Command requires GPIB Controller to be Controller-In-Charge.

 

 

This is the Error Code. I Try to wait 5 minutes and manual i try with stop button more than 10 min.

0 Kudos
Message 3 of 7
(1,066 Views)

Yes the Error comes every Sunnday. I think the SMA Inverter make internal a reset or something. I dont know why !

0 Kudos
Message 4 of 7
(1,044 Views)

Now the errors from Sunnday:

Error 1 occurred at SubVI in TCP Master.lvclass:Protocol Write.vi:6190001->IP Data Unit.lvclass:Write ADU Packet.vi:1820001->Modbus Master.lvclass:Read Holding Registers.vi:2420001->_MAIN_Haus.vi

Possible reason(s):

LabVIEW: (Hex 0x1) An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
=========================
Command requires GPIB Controller to be Controller-In-Charge.

 

After this i try to close:

Error 1 occurred at TCP Close Connection in TCP Master.lvclass:Shutdown Master.vi->Modbus Master.lvclass:Shutdown.vi->_MAIN_Haus.vi

Possible reason(s):

LabVIEW: (Hex 0x1) An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
=========================
Command requires GPIB Controller to be Controller-In-Charge.

 

And after i like to open an new Connection:

Error 1 occurred at SubVI in TCP Master.lvclass:Protocol Write.vi:6190001->IP Data Unit.lvclass:Write ADU Packet.vi:1820001->Modbus Master.lvclass:Read Holding Registers.vi:2420001->_MAIN_Haus.vi

Possible reason(s):

LabVIEW: (Hex 0x1) An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
=========================
Command requires GPIB Controller to be Controller-In-Charge.

0 Kudos
Message 5 of 7
(960 Views)

@MichaelMoerix wrote:

Yes the Error comes every Sunnday. I think the SMA Inverter make internal a reset or something. I dont know why !


That's likely a very safe bet. The reason is likely that their firmware has memory leaks that slowly accumulate and after a while the OS either runs out of memory and restarts or they are aware of that problem and simply preemptively restart the system every week to avoid the out of memory crash.

 

<ironic>Why bother to fix such a bug and spend days and weeks to find it, when you can put in such a simple fix?</ironic>

 

Something in the used Modbus TCP library doesn't quite like the way this terminates the TCP/IP session and your use of it probably doesn't properly handle that condition and keeps the now invalid TCP/IP refnum in a shift register to try and communicate again with the device. When you receive any error but a timout error from the read or write function you should go through the stutdown and reconnect states of your state machine and make sure to clean out any stale shift registers and if you encounter any error during either shutdown and connect you should go back to do another shutdown and reconnect until the connect succeeds, before trying to communicate with the device again.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 7
(945 Views)

Thanks for your tipps. I try it more times. What you can see is only a small part of my program. At first as i head this problem i try to init my complete Program. All Ports closed all variable cleared and start again. But this error is still coming. I can only clear this error when is stop the complete Program and start ist new. 

The different between Init and Restart is in my case : during init is a while loop over my code running and my programm do it self if a hardware error created. If is stop the runtime will be closed.

0 Kudos
Message 7 of 7
(934 Views)