EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Question about the connection refused
From: Mark Rivers <[email protected]>
To: lzfneu <[email protected]>, "[email protected]" <[email protected]>
Date: Fri, 25 Mar 2016 13:01:51 +0000
Hi Zhefu,

Please send the complete output when you start the IOC and get the errors.

One possibility is that is does initially connect OK, but then it is timing out.  Are you only creating drvAsymModbus ports for output bits, or do you also create some for inputs?  If you only create outputs then that can be a problem.  The reason is that many PLCs will close the socket connection after a few seconds of inactivity.  If you only have output ports connected to the PLC that can happen, because the outputs are not processed very frequently.  If you create an input port that will normally be rapidly pollled, and will prevent the socket from timing out.  This is discussed in my EPICS Modbus documentation here:

http://cars.uchicago.edu/software/epics/modbusDoc.html

It says:

***********

It is important to note, however, that many PLCs will time out sockets after a few seconds of inactivity. This is not a problem with modbus drivers that use read function codes, because they are polling frequently. But modbus drivers that use write function codes may only do occasional I/O, and hence may time out if they are the only ones communicating through a drvAsynIPPort driver. Thus, it is usually necessary for modbus drivers with write function codes to use the same drvAsynIPPort driver (socket) as at least one modbus driver with a read function code to avoid timeouts.

***********

Mark

________________________________
From: Mark Rivers
Sent: Friday, March 25, 2016 7:07 AM
To: lzfneu; [email protected]
Subject: RE: Question about the connection refused

Hi Zhefu,

You said:
> I performed the ping 192.168.1.125:502 command and found that the computer and radiation monitor counter connected well.

That does not make sense to me.  Are you sure you had the :502 at the end? That should not work.  It should work if you omit the :502.

This works for me:
ping 164.54.160.158
PING 164.54.160.158 (164.54.160.158) 56(84) bytes of data.
64 bytes from 164.54.160.158: icmp_req=1 ttl=64 time=1.46 ms
64 bytes from 164.54.160.158: icmp_req=2 ttl=64 time=0.891 ms

This does not work:
corvette:CARS/iocBoot/ioc13GasLoading>ping 164.54.160.158:502
ping: unknown host 164.54.160.158:502

Here is a way to see if your device is responding on the Modbus port 502

telnet 192.168.1.125 502

This is what I get when I try to telnet into a Modbus PLC

>telnet 164.54.160.158 502
Trying 164.54.160.158...
Connected to 164.54.160.158.
Escape character is '^]'.

This is what I get when I try to telnet into a Linux computer that does not support Modbus

>telnet 164.54.160.82 502
Trying 164.54.160.82...
telnet: connect to address 164.54.160.82: Connection refused

Does your radiation monitor actually support Modbus?  If so, how many simultaneous socket connections does it allow?  Perhaps you already have some other software connected to it on port 502?

Mark




________________________________
From: lzfneu [[email protected]]
Sent: Thursday, March 24, 2016 11:22 PM
To: Mark Rivers; [email protected]
Subject: RE: Question about the connection refused

Hi Mark,

Actually,  I need to read the dose rate from a radiation monitor counter by using epics.

I installed the asyn4-29 and modbusR2-8 packages.

As a new user in epics, I edited the modbus ioc example in iocTest folder and the file named Koyo1.cmd:
I changed the IPaddress to the actual IPaddress of radiation monitor counter.

drvAsynIPPortConfigure ("Koyo1","192.168.1.125:502",0,0,1)

after starting the ioc:
> $ modbusApp Koyo1.cmd

the first error occurs in command:
# write 32 bits (Y0-Y37). Function code = 5
drvModbusAsynConfigure("K1_Yn_Out_Bit", "Koyo1", 0, 5, 04000, 040, 0, 1, "Koyo")

2016/03/25 11:33:29.067 drvModbusAsyn::doModbusIO port K1_Yn_Out_Bit error calling writeRead, error =192.168.1.235:502 timeout: Resource temporarily unavailable, nwrite=6/6, nread=0

and the sequenct errors were:
# Write 8 words (128 bits).  Function code=6.
drvModbusAsynConfigure("K1_Yn_Out_Word", "Koyo1", 0, 6, 040500, 010, 0, 100, "koyo")
drvModbusAsyn

2016/03/25 11:33:34.073 drvModbusAsyn::doModbusIO port K1_Xn_Bit error calling writeRead, error=192.168.1.125:502 timeout: Resource temporarily unavailable, nwrite=6/6, nread=0
2016/03/25 11:33:39.078 drvModbusAsyn::doModbusIO port K1_Xn_Word error calling writeRead, error=192.168.1.125:502 timeout: Resource temporarily unavailable, nwrite=6/6, nread=0
2016/03/25 11:33:44.084 drvModbusAsyn::doModbusIO port K1_Yn_In_Bit error calling writeRead, error=192.168.1.125:502 timeout: Resource temporarily unavailable, nwrite=6/6, nread=0

I have to stop the output in the terminal window.

I performed the ping 192.168.1.125:502 command and found that the computer and radiation monitor counter connected well.

It seems the read and write error occurs when they communicate with each other.

I am confused and really don't know how to do next. Could you plesase help me and thanks in advance.

Best regards,

Zhefu


> From: [email protected]
> To: [email protected]; [email protected]
> Subject: RE: Question about the softioc connection refused ?
> Date: Sat, 19 Mar 2016 12:55:02 +0000
>
> Hi Zhefu
>
> > I edited the Koyo1.cmd file to change the ip address in function with two conditions:
> > 1) drvAsynIPPortConfigure("Koyo1","127.0.0.1:5065",0,0,1)
> > where 127.0.0.1:5065 is my localhost ip address.
>
> This is not correct. You have specified port 5065 for the drvAsynIPPort driver that is supposed to connect to a Modbus server. Port 5065 is not used for Modbus, it is used for EPICS channel access.
>
> You cannot run the test application in the Modbus directory unless you actually have a Modbus server that you can connect to. Do you actually have a Modbus server? If so, then you specify its IP address and port 502 in the drvAsynIPPortConfigure command.
>
> Mark
>
>
> ________________________________
> From: [email protected] [[email protected]] on behalf of lzfneu [[email protected]]
> Sent: Saturday, March 19, 2016 7:26 AM
> To: [email protected]
> Subject: Question about the softioc connection refused ?
>
> hi,
>
> I have encountered another softioc connection problem:
>
> I have insatlled modbus-R2-8, and want to run test example (file named Koyo1.cmd) in the iocTest folder.
>
> I edited the Koyo1.cmd file to change the ip address in function with two conditions:
>
> 1) drvAsynIPPortConfigure("Koyo1","127.0.0.1:5065",0,0,1)
> where 127.0.0.1:5065 is my localhost ip address.
>
> 2) drvAsynIPPortConfigure("Koyo1","192.168.1.255:5065",0,0,1)
> where 192.168.1.255:5065 is my broadcast ip address that obtained by command ifconfig.
>
> after starting the ioc:
> $ modbusApp Koyo1.cmd
>
> the results are both two ip address cannot connect the Koyo1, the error messages are shown below:
>
> 1) drvAsynIPPortConfigure("Koyo1","127.0.0.1:5065",0,0,1)
> 2016/03/19 19:40:19.158 Can't connect to 127.0.0.1:5065: Connection refused Koyo1 -1 autoConnect could not connect
>
> 2) drvAsynIPPortConfigure("Koyo1","192.168.1.255:5065",0,0,1)
> 2016/03/19 20:19:49.083 Can't connect to 192.168.1.255:5065: Network is unreachable Koyo1 -1 autoConnect could not connect
>
> I am new in epics, could you plesase help me and thanks in advance.
>
> Best regards
>
> Zhefu
>


Replies:
RE: Question about the connection refused lzfneu
References:
Question about the softioc connection refused ? lzfneu
RE: Question about the softioc connection refused ? Mark Rivers
RE: Question about the connection refused lzfneu
RE: Question about the connection refused Mark Rivers

Navigate by Date:
Prev: RE: Question about the connection refused Mark Rivers
Next: Job Posting - Sr. Applications/Controls Engineer (I-8) / Applications/Controls Architect (I-9) - 24 month term - Brookhaven National Laboratory Esposito, Peter J
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Question about the connection refused Mark Rivers
Next: RE: Question about the connection refused lzfneu
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 15 Jul 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·