1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 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 2016 2017 2018 2019 2020 <2021> 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | ODP: Failed connection using e3-s7plc to Siemens S7-1500 |
From: | Mateusz Nabywaniec via Tech-talk <tech-talk at aps.anl.gov> |
To: | Miklós Boros <Miklos.Boros at ess.eu>, Dominik Domagała <Dominik.Domagala at s2innovation.com>, "dirk.zimoch at psi.ch" <dirk.zimoch at psi.ch>, Timo Korhonen <timo.korhonen at ess.eu>, Mateusz Nabywaniec via Tech-talk <tech-talk at aps.anl.gov> |
Date: | Wed, 24 Nov 2021 12:28:56 +0000 |
Dear all,
Many thanks for your help, especially for
Miklós Boros. We succeded with connection to PLC using E3-S7PLC without using Modbus registers.
We made integration inthe easiest way by using TSEND and TRCV. We discovered that TCON and TDISCON were wrongly synchronised. Before we use parameters sent by E3, TCON overwrite register with 0's.
In TIA Portal we got status 0000 (received) so we thought that there was problem with offset. After we slow down the loop we saw that value was overwritten.
Thank you once again,
Dominik Domagała, Mateusz Nabywaniec
S2Innovation
Od: Miklós Boros <Miklos.Boros at ess.eu>
Wysłane: środa, 17 listopada 2021 10:40 Do: Mateusz Nabywaniec <mateusz.nabywaniec at s2innovation.com>; Dominik Domagała <Dominik.Domagala at s2innovation.com>; dirk.zimoch at psi.ch <dirk.zimoch at psi.ch>; Timo Korhonen <Timo.Korhonen at ess.eu> Temat: RE: Failed connection using e3-s7plc to Siemens S7-1500 Hi,
I made an example project including:
So this IOC talks with the PLC code I have attached.
I have some extra features in my IOC-PLC communication such as Hash checking and heartbeat check, communication diagnostics and several other, that won’t make it easy to you to understand the db file, but I hope it helps.
For the PLC part, import the scl files attached with External source option. First the PLCFactory_external_source_standard_TIAv15.1.scl and than the PLCFactory_external_source_TIAv15.1.scl.
Call these blocks from OB1.
Before you call Utilities make sure to have the clock memory and system memory byte enabled. Also be aware that the _UtilitiesFB instance already exists in the External source input, so when you call the Utilities FB as above, don’t generate a new instance, but select the _UtilitiesFB.
I hope it helps.
Feladó: Mateusz Nabywaniec <mateusz.nabywaniec at s2innovation.com>
Hi,
thanks for answer. Could you show how your modbus configuration exactly looks like?
Cheers, Mateusz Od: Miklós Boros <Miklos.Boros at ess.eu>
Hi,
It’s hard to tell. Here is what I usually have .iocsh for sending data from the PLC to the IOC.
#- S7 port : 2000 #- Input block size : 21482 bytes #- Output block size : 0 bytes #- Endianness : BigEndian s7plcConfigure("PLCName", $(IPADDR=192.168.0.1), $(S7_PORT=2000), 21482, 0, 1, $(RECVTIMEOUT=300), 0)
Beside this I have the modbus registers configured here to send data from the IOC to the PLC and of course the dbLoadRecords
In the DB I have records like this: record(ai, "CrS-CMS:Cryo-PLC-01:GIntlockMax") { field(SCAN, "I/O Intr") field(DTYP, "S7plc") field(INP, "@$(PLCNAME)/20 T=INT16") field(DISS, "INVALID") field(DISV, "0") field(SDIS, "CrS-CMS:Cryo-PLC-01:PLCHashCorrectR") field(DESC, "Total number of Global Interlocks") info("plc_datablock", "DEV_CrS-CMS:Cryo-PLC-01_iDB") info("plc_variable", "GIntlockMax") }
record(bi, "CrS-CMS:Cryo-PLC-01:SpareBOOL6") { field(SCAN, "I/O Intr") field(DTYP, "S7plc") field(INP, "@$(PLCNAME)/62 T=UINT16 B=5") field(DISS, "INVALID") field(DISV, "0") field(SDIS, "CrS-CMS:Cryo-PLC-01:PLCHashCorrectR") field(DESC, "SpareBOOL6") info("plc_datablock", "DEV_CrS-CMS:Cryo-PLC-01_iDB") info("plc_variable", "SpareBOOL6") }
In the INP we calculate the offsets in the WORD array with a script, so we can insert variables easily.
Cheers, Miklos
Feladó: Mateusz Nabywaniec <mateusz.nabywaniec at s2innovation.com>
Hi,
thanks for your help. Sorry for not answering soon. Here is update from our side.
We are able to connect to PLC using E3. We used TSEND_C and TRCV_C. Unfortunetely, we are not able to set the value of data block in PLC. Here is our record, the name of our station is cpu1. The variable is configured as a byte.
record (bi, "testrcv")
When we run caput command on 'testrcv' the change of the PV is only seen locally. The firewall is disabled and we can see communication between PLC and our VM (we are using CentOS 7) in Wireshark. Do you have any ideas what can be problem ?
Cheers, Mateusz Nabywaniec
Od: Miklós Boros <Miklos.Boros at ess.eu>
Hi,
The timeout is most likely because the PLC does not send anything. The s7plc module needs to get some data before the timeout. If the telnet connects, you should see some binary data in the terminal.
We are using the T_SEND_C block to cyclically send a word array to the IOC. (and modbus to get data MB_SERVER)
TSEND_C is a nice way to handle the connection (open/close) and send in one block.
#TSEND_C_DB(REQ := #SendTrigger, CONT := TRUE, LEN := INT_TO_UINT(IN := #BytesToSend), DONE => #SendDone, BUSY => #SendBusy, ERROR => #SendError, STATUS => #SendStatus, CONNECT := #SendConnData, DATA := #PLCToEPICSData);
#SendConnData.LocalPort := INT_TO_UINT(IN := #S7Port); (we use port 2000) #SendConnData.ConnectionType := 11; #SendConnData.InterfaceId := #InterfaceID; (64 for X1) #SendConnData.ID := INT_TO_WORD(IN := #S7ConnectionID); (we have 256) I have a 100ms SendTrigger for most application.
Cheers, Miklos
Feladó: Mateusz Nabywaniec <mateusz.nabywaniec at s2innovation.com>
Hi,
thanks for messages. Update from our side:
We changed port to 102 as we found it is port for S7 TCP/IP . (https://support.industry.siemens.com/cs/document/8970169/which-ports-are-used-by-the-various-services-for-data-transfer-via-tcp-and-udp-and-what-should-you-watch-out-for-when-using-routers-and-firewalls-?dti=0&lc=en-WW)
We can connect to 102 using telnet. Here is output after running st.cmd:
10/29/21 10:17:30.277 s7plcCloseConnection cpu1
Do you have any suggestions about that?
Regards, Mateusz Nabywaniec, S2Innovation, Cracow, Poland Od: Miklós Boros <Miklos.Boros at ess.eu>
Dear Mateusz,
Usually the issue is in the PLC. You can doublecheck it by telnet into the PLC IP on port 2000. for example: telnet 192.168.0.100 2000 You should get an active connection and if you send something you should see it too in a binary form.
If you can't telnet it means the PLC does not open the port 2000 properly.
Check if you use the proper HW_ID for T_CON. X1 is usually 64 and X2 is 72.
The send block also needs a constant trigger.
Tell me if you need an example.
Cheers, Miklós Boros
Feladó: Tech-talk <tech-talk-bounces at aps.anl.gov>, Mateusz Nabywaniec via Tech-talk <tech-talk at aps.anl.gov>
nevében
Hello,
Together with @Dominik Domagała we are trying to connect with Siemens S7-1500 using e3-s7plc module (https://gitlab.esss.lu.se/e3/wrappers/communication/e3-s7plc) created by ESS.
We have EPICS 7.0.5 installed on CentOS 7 VM as well as E3 modules. Here is our start cmd based on : http://epics.web.psi.ch/software/s7plc/YHLhtcPLCa.pdf
‘’’ require s7plc epicsEnvSet("TOP","$(E3_CMD_TOP)/..") s7plcConfigure cpu1,192.168.0.1,2000,240,240,1,2000,500 dbLoadRecords ("$(TOP)/db/records.db") iocInit ‘’’
Unfortunetely we have the error: `s7plcConnect cpu1: background connect to 192.168.0.1:2000 failed: Connection refused.`
The firewall on VM and host side are disabled.
PLC Program configuration:
-Full Access. -Enabled PUT/GET connections. -Data blocks ale with full access , not optimized -TCON in stand by with status BUSY
TCON configuration: -Active Est. ON -Unspecified partner with IP address (E3 address) -TCP connection type by port 2000.
When we are starting E3 server we are getting information as below 10/28/21 08:44:00.763 s7plcConnect cpu1: background connect to 192.168.0.1:2000 failed: Connection refused We can’t get why E3-s7plc does not work on our machine. Does anybody had similar issue or successfully connected using e3-s7plc with Siemens S7-1513-1?
Thanks in advance, Mateusz Nabywaniec
S2Innovation, Cracow, Poland
|