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  2016  2017  <20182019  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  <20182019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: 回复: asking for help on s7nodave
From: "成威黄瀛" <[email protected]>
To: "Ralph Lange" <[email protected]>, "tech-talk" <[email protected]>
Date: Fri, 7 Sep 2018 22:02:07 +0800
Hi, Lange,
I would raise my question again.
Here is the content of some related files.
-----------------------------------------------------
             st.cmd
#!../../bin/linux-x86_64/example

## You may have to change example to something else
## everywhere it appears in this file

< envPaths

cd "${TOP}"

## Register all support components
dbLoadDatabase "dbd/example.dbd"

example_registerRecordDeviceDriver pdbbase


#Configure PLC Connection
s7nodaveConfigureIsoTcpPort("myPLC", "192.168.0.2", 0, 0, 0)

# Configure Poll Group
#s7nodaveConfigurePollGroup("myPLC", "default", 1, 0)
#s7nodaveConfigurePollGroup("myPLC", "1s", 1, 0)


## Load record instances
dbLoadTemplate "db/user.substitutions"
dbLoadRecords "db/dbSubExample.db", "user=root"

#dbLoadRecords("db/dbExample1.db","S7_DEFAULT_SCAN_INTERVAL=I/O Intr")
dbLoadRecords("exampleApp/Db/hydb.db","S7_DEFAULT_SCAN_INTERVAL=I/O Intr")
#dbLoadRecords "exampleApp/Db/hydb.db"
## Set this to see messages from mySub
#var mySubDebug 1

## Run this to trace the stages of iocInit
#traceIocInit

cd "${TOP}/iocBoot/${IOC}"
iocInit

## Start any sequence programs
seq sncExample, "user=root"

------------------------------------------------
     hydb.db
#record(bi,"root:bil1_5poll")
#{
#       field(SCAN,"I/O Intr")
#       field(DTYP,"s7nodave")
#       field(INP,"@myPLC(PG=1s) I1.5")
#       field(INP,"@myPLC I1.5")
#       field(DESC,"S7 PLC I1.5 Binary Input POLLING")
#}


record(bo,"root:boQ0_4poll")
{
       # field(SCAN,"I/O Intr")
        field(DTYP,"s7nodave")
        field(OUT,"@myPLC Q0.4 bool")
#       field(SCAN,"Passive")
       # field(DESC,"S7 PLC I1.5 Binary Input POLLING")
}

-----------------------------------------------------------------------
sncExample.stt
program sncExample

double v;
short light;
assign v to "root:bil1_5poll";
monitor v;
assign light to "root:boQ0_4poll";
ss ss1 {
    state init {
        when (delay(1)) {
            printf("sncExample: Startup delay over\n");
            printf("sncExample:Going to low\n");
        } state low
    }
    state low {
        when (v >= 0.5) {
            printf("sncExample: Changing to high %f\n",v);
            light = TRUE;
            pvPut(light);
        } state high
    }
    state high {
        when (v <= 0.5) {
            printf("sncExample: Changing to low %f\n",v);
            light = FALSE;
            pvPut(light);
        } state low
    }
}
----------------------------------------------------------------------------
I just try to follow the guideline. http://metis.ipfn.ist.utl.pt/index.php?title=FUSION_Collaborations/ESTHER/Slow_Control/EPICS_%26_Siemens_PLC_Tutorial

My question is
1, when I run st.cmd, it tells "myPLC error while reading 1 bytes from PLC address QB0." I think that means I still cannot talk to PLC
############################################################################
## EPICS R3.15.5
## EPICS Base built Sep  2 2018
############################################################################
2018/09/07 21:51:25.221 myPLC error while reading 1 bytes from PLC address QB0.
iocRun: All initialization complete
## Start any sequence programs
seq sncExample, "user=root"
sevr=info Sequencer release 2.2.6, compiled Wed Sep  5 17:17:22 2018
sevr=info Spawning sequencer program "sncExample", thread 0x5646dc53b3a0: "sncExample"
epics> sevr=minor sncExample[0](after 0 sec): assigned=2, connected=1, monitored=1, got monitor=0
sevr=minor sncExample[0](after 0 sec): assigned=2, connected=1, monitored=1, got monitor=0
sevr=minor sncExample[0](after 0 sec): assigned=2, connected=1, monitored=1, got monitor=0
sevr=minor sncExample[0](after 0 sec): assigned=2, connected=1, monitored=1, got monitor=0
epics> sevr=minor sncExample[0](after 0 sec): assigned=2, connected=1, monitored=1, got monitor=0
sevr=minor sncExample[0](after 0 sec): assigned=2, connected=1, monitored=1, got monitor=0
sevr=minor sncExample[0](after 0 sec): assigned=2, connected=1, monitored=1, got monitor=0
^C
-----------------------------------------------------
2, All I want is to light up just one light of the PLC, for example Q0.4.
In my opinion, first is to create my own record, like hydb.db, which includes the PLC Q0.4, then change the value of this PV to be 1. Then the light of PLC can be ON status. Am I right?

Thanks. I got stuck here for almost a week...................
------------------
黄 瀛
 
*****开票信息*****
名称:绵阳成威实验室工程技术有限公司
税号:915107 0455 1000 912T
注册地址:四川省绵阳市游仙区仙人路一段32号
开户银行:中国银行绵阳游仙支行
账号:1279 5046 6834
*****送货信息*****
地址:四川省绵阳市游仙区游仙镇仙童街一号,电商谷
联系人:黄瀛
电话:18784065819
************************************************
Ying Huang
Chengwei Lab&Engineering Company
No1 Xiantong Street, Youxian Area, Mianyang City, Sichuan Province, China
86 0816 2967213
 


------------------ 原始邮件 ------------------
发件人: "Ralph Lange"<[email protected]>;
发送时间: 2018年9月7日(星期五) 晚上9:10
收件人: "EPICS Tech Talk"<[email protected]>;
抄送: "成威黄瀛"<[email protected]>;
主题: Re: asking for help on s7nodave

The s7nodave driver uses the asyn framework, but neither the generic asyn device support nor the asyn low level network drivers (libnodave is doing the network connections).

The s7nodave documentation looks very complete and comprehensive. I would suggest following it as close as possible, and contacting the s7nodave author (or posting here) if the documentation doesn't work as expected.

Cheers,
~Ralph



On Fri, 7 Sep 2018 at 14:58, Mark Rivers <[email protected]> wrote:

Ø  It does not include

Ø  example_DBD += asyn.dbd

Ø  example_DBD += asynRecord.dbd

Ø  example_DBD += drvAsynIPPort.dbd

 

Ø  Why are they necessary and what are they for

 

The example you sent previously had example_LIBS += asyn

 

In that case it is necessary to also include the asyn dbd files.  You should not include asynRecord.dbd, that was a mistake.  If your application uses the drvAsynIPPort driver then you must include drvAsynIPPort.dbd. 

 

I am not familiar with the s7nodave driver, so I don’t know if it uses asyn or drvAsynIPPort or not.  It looks from the documentation like it does not.

 

Mark

 

 

From: 成威黄瀛 <[email protected]>
Sent: Friday, September 7, 2018 3:05 AM
To: Mark Rivers <[email protected]>; tech-talk <[email protected]>
Subject: Re: asking for help on s7nodave

 

Hi, Rivers,

I read the turorial carefully and it says

---------------------------------------

Compilation

This section assumes a correct setup of the system as explained in the Getting Started. After changing these files, the whole IOC must be recompiled from the root directory.

 

In order to compile an IOC using the s7nodave library the following steps must be complete:

  • The S7NODAVE=[path_to_module] must be set in the configure/RELEASE file
  • The [testS7]/tests7App/src/Makefile must include the lines:
    • tests7_DBD += s7nodave.dbd
    • tests7_LIBS += s7nodave
  • The PLC connection must be configured in the startup script [testS7]/iocBoot/ioctests7/st.cmd
  • The poll groups must be configured in the startup script [testS7]/iocBoot/ioctests7/st.cmd

 

In order to compile an IOC with a sequencer program the following steps must be complete:

  • The SNCSEQ=[path_to_module] must be set in the configure/RELEASE file
  • The [testS7]/tests7App/src/Makefile must include the lines:
    • snctests7_SNCFLAGS += +r
    • tests7_DBD += snctests7.dbd
    • tests7_SRCS += snctests7.stt
    • tests7_LIBS += seq pv
    • PROD_HOST += sncProgram
    • sncProgram_SNCFLAGS += +m
    • sncProgram_SRCS += sncProgram.st
    • sncProgram_LIBS += seq pv
    • sncProgram_LIBS += $(EPICS_BASE_HOST_LIBS)
  • The [testS7]/tests7App/src/snctests7.dbd file must include the correct "registrar(snctests7Registrar)" command.
  • The startup script [testS7]/iocBoot/ioctests7/st.cmd must include the command "seq snctests7"

----------------------------------------------------------------------------------------

It does not include

example_DBD += asyn.dbd
example_DBD += asynRecord.dbd
example_DBD += drvAsynIPPort.dbd

 

Why are they necessary and what are they for

Thanks

------------------

 

*****开票信息*****
名称绵阳成威实验室工程技术有限公司
税号915107 0455 1000 912T
注册地址四川省绵阳市游仙区仙人路一段32
开户银行中国银行绵阳游仙支行
账号1279 5046 6834
*****
送货信息*****
地址四川省绵阳市游仙区游仙镇仙童街一号电商谷
联系人黄瀛
电话18784065819

************************************************

Ying Huang

Chengwei Lab&Engineering Company

No1 Xiantong Street, Youxian Area, Mianyang City, Sichuan Province, China

86 0816 2967213

 

 

 

------------------ Original ------------------

From:  "Mark Rivers"<[email protected]>;

Date:  Thu, Sep 6, 2018 08:16 PM

To:  "成威黄瀛"<[email protected]>;"tech-talk"<[email protected]>;

Subject:  Re: asking for help on s7nodave

 

I think your problems are these 2 lines:


my_DBD += s7nodave.dbd
my_LIB += s7nodave


Since your application is called "example" those should be


example_DBD += s7nodave.dbd
example_LIB += s7nodave

You also need to make sure that exampleApp/src/Makefile contains

example_DBD += asyn.dbd

example_DBD += asynRecord.dbd


It may also need

example_DBD += drvAsynIPPort.dbd

The above lines should be earlier in the Makefile, before this line:
example_LIBS += $(EPICS_BASE_IOC_LIBS)

Mark


________________________________
From: [email protected] <[email protected]> on behalf of 成威黄瀛 <[email protected]>
Sent: Thursday, September 6, 2018 3:56 AM
To: tech-talk
Subject: asking for help on s7nodave

Hi,
Currently I am trying to make connection with epics and PLC, using s7nodave. I am following this guideline http://oss.aquenos.com/epics/s7nodave/docs/2.1.3/manual.html#recordreference
Below is what I have done but I am stuck.

1, Install EPICS base. Version is 3.15.5
root@hy-VirtualBox:~/epics/base# ls
bin        db   documentation  include  LICENSE   README  startup
configure  dbd  html           lib      Makefile  src     templates

2, "makeBaseApp.pl -t example example"    " makeBaseApp.pl -i -t example example"      to build up mytest, the IOC application.
root@hy-VirtualBox:~/epics/mytest# ls
bin  configure  db  dbd  exampleApp  include  iocBoot  lib  Makefile

3, install asynDriver. Version is 4-33
Following this link, I add BPICS_BASE=/root/epics/base to asyn4-33/configure/RELEASE
https://epics.anl.gov/modules/soft/asyn/
root@hy-VirtualBox:~/epics/asyn4-33# ls
asyn           iocBoot      testApp                 testGpibApp
bin            lib          testArrayRingBufferApp  testGpibSerialApp
configure      LICENSE      testAsynPortClientApp   testIPServerApp
db             Makefile     testAsynPortDriverApp   testManagerApp
dbd            makeSupport  testBroadcastApp        testOutputCallbackApp
documentation  opi          testConnectApp          testOutputReadbackApp
html           README.md    testEpicsApp            testUsbtmcApp
include        templates    testErrorsApp

4,put boost_1_67_0 in a certain folder but not compile
root@hy-VirtualBox:~/epics/boost_1_67_0# ls
boost            boost.png      index.htm   libs             status
boost-build.jam  bootstrap.bat  index.html  LICENSE_1_0.txt  tools
boostcpp.jam     bootstrap.sh   INSTALL     more
boost.css        doc            Jamroot     rst.css

5, in s7nodave, configure/RELEASE file, add EPICS_BASE, ASYN, RELEASE_INCLUDES, and make s7nodabe
# If using the sequencer, point SNCSEQ at its top directory:
#SNCSEQ=$(EPICS_BASE)/../modules/soft/seq
SNCSEQ=/root/epics/seq
# The ASYN variable has to point to the asyn director.
#ASYN=/opt/epics/modules/synApps_5_5/support/asyn-4-13
ASYN=/root/epics/asyn4-33

# If the headers of the Boost library (http://www.boost.org/) are not installed
# in one of the default header locations (usually /usr/include and
# /usr/local/include) the includes path has to be added to RELEASE_INCLUDES.
# Only Boost headers are used, there is no need to compile the Boost library.
#RELEASE_INCLUDES+=-I/my/path/to/boost_1_47_0
RELEASE_INCLUDES+=-I/root/epics/boost_1_67_0
# EPICS_BASE usually appears last so other apps can override stuff:
#EPICS_BASE=/opt/epics/base-3.14.12
EPICS_BASE=/root/epics/base
# Set RULES here if you want to take build rules from somewhere
# other than EPICS_BASE:
#RULES=/path/to/epics/support/module/rules/x-y

# Allow the user to override settings locally.
-include $(TOP)/configure/RELEASE.local

6, in configure/RELEASE file of my own project, add "S/NODAVE=/opt/epics/modules/s7nodave"
# EPICS_BASE should appear last so earlier modules can override stuff:
EPICS_BASE=/root/epics/base

# Set RULES here if you want to use build rules from somewhere
# other than EPICS_BASE:
#RULES = $(MODULES)/build-rules

# These allow developers to override the RELEASE variable settings
# without having to modify the configure/RELEASE file itself.
-include $(TOP)/../RELEASE.local
-include $(TOP)/configure/RELEASE.local

ASYN=/root/epics/asyn4-33
S/NODAVE=/root/epics/s7nodave
S7NODAVE=/root/epics/s7nodave
SNCSEQ=/root/epics/seq

7, add "my_DBD += s7nodave.dbd"   "my_LIBS += s7nodave"  to /root/epics/mytest/exampleApp/src/Makefile
# Finally link IOC to the EPICS Base libraries
example_LIBS += $(EPICS_BASE_IOC_LIBS)

include $(TOP)/configure/RULES
#----------------------------------------
#  ADD EXTRA GNUMAKE RULES BELOW HERE
example_LIBS += asyn

#by hy
my_DBD += s7nodave.dbd
my_LIB += s7nodave

---------------------------------------------------------
After these configure, I run st.cmd, however, IOC shell still cannot recoginze the command s7nodaveConfigureIsoTcpPort
I notice the guideline mentioned that "However, you have to add asyn.dbd to the list of DBDs used by your project in order to enable these commands in the IOC shell. "
But how can I add asyn.dbd to IOC shell???? by dbLoadDatabase "/root/epics/asyn4-33/dbd/asyn.dbd" ????????????????
< envPaths
epicsEnvSet("IOC","iocexample")
epicsEnvSet("TOP","/root/epics/mytest")
epicsEnvSet("EPICS_BASE","/root/epics/base")
epicsEnvSet("ASYN","/root/epics/asyn4-33")
epicsEnvSet("S7NODAVE","/root/epics/s7nodave")
epicsEnvSet("SNCSEQ","/root/epics/seq")
cd "/root/epics/mytest"
## Register all support components
dbLoadDatabase "dbd/example.dbd"
## dbLoadDatabase "/root/epics/asyn4-33/dbd/asyn.dbd"
## dbLoadDatabase "/root/epics/asyn4-33/dbd/asynRecord.dbd"
## dbLoadDatabase "/root/epics/asyn4-33/dbd/devEpivd.dbd"
example_registerRecordDeviceDriver pdbbase
## Load record instances
dbLoadTemplate "db/user.substitutions"
dbLoadRecords "db/dbSubExample.db", "user=root"
## Set this to see messages from mySub
#var mySubDebug 1
## Run this to trace the stages of iocInit
#traceIocInit
cd "/root/epics/mytest/iocBoot/iocexample"
iocInit
Starting iocInit
############################################################################
## EPICS R3.15.5
## EPICS Base built Sep  2 2018
############################################################################
iocRun: All initialization complete
## Start any sequence programs
#seq sncExample, "user=root"
epics> s7nodaveConfigureIsoTcpPort
Command s7nodaveConfigureIsoTcpPort not found.
epics>

------------------


*****?票信息*****
名称:??成威??室工程技?有限公司
税号:915107 0455 1000 912T
注册地址:四川省??市游仙区仙人路一段32
???行:中国???游仙支行
?号:1279 5046 6834
*****?信息*****
地址:四川省??市游仙区游仙?仙童街一号,?商谷
?系人:黄瀛
??18784065819
************************************************
Ying Huang
Chengwei Lab&Engineering Company
No1 Xiantong Street, Youxian Area, Mianyang City, Sichuan Province, China
86 0816 2967213


References:
asking for help on s7nodave =?gb18030?b?s8nN/rvG5a0=?=
Re: asking for help on s7nodave Mark Rivers
Re: asking for help on s7nodave =?gb18030?b?s8nN/rvG5a0=?=
RE: asking for help on s7nodave Mark Rivers
Re: asking for help on s7nodave Ralph Lange

Navigate by Date:
Prev: 回复: asking for help on s7nodave 成威黄瀛
Next: Keithley 2001 Digital multimeter IOC [email protected]
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  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: 回复: asking for help on s7nodave 成威黄瀛
Next: 回复:RE: asking for help on s7nodave 成威黄瀛
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  <20182019  2020  2021  2022  2023  2024 
ANJ, 07 Sep 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·