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  <20122013  2014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: Re: Fwd: request for config. steps
From: Claude Saunders <saunders@aps.anl.gov>
To: tech-talk@aps.anl.gov, Jiri.Jerabek@eli-beams.eu
Date: Mon, 05 Mar 2012 11:48:42 -0600
Hi Jiri,
Good timing, as just over the weekend I completed a simple EPICS IOC on Win7 using modbus support to talk to a real PLC over serial RTU. This is a home-project so I can control/monitor my aquaponics system. Doing the same for modbus-TCP and a simulated PLC is a minor change. I can give you some pointers, however as Andrew noted, it does take some learning. First of all, you could do all of this on one notebook running Win7 (assuming your modbus simulator is a Win7 exe). No need for multiple systems. The most difficult part will be some of the build behavior due to the differences between Windows and Unix paths.

In general, what you need is EPICS base and something called synApps (a packaging of EPICS with LOTS of add-ons targeted for beamline instrument control). SynApps will provide asyn and modbus modules which will allow you to hook EPICS base up to any modbus device. Alternately, you can get the pieces separately, but I just get the whole synApps release as it is already tested for particular combinations of modules.

You have a choice of compilers from cygwin, Microsoft Visual Studio for C++, or MinGW tools. I wound up settling on the MS Visual Studio for C++ 2008 Express Edition. The newer 2010 edition will have problems compiling some parts in synApps. My steps below also assume a 32-bit Windows build.

Rough steps are:
0. Install Visual Studio for C++ 2008 Express Edition free from Microsoft
1. get EPICS base (latest is R3.14.12.2) from www.aps.anl.gov/epics
2. Unzip/Untar it, set environment variables in DOS shell using epics/base/startup/win32.bat as an example (you'll have to customize it). For me, I used EPICS_HOST_ARCH=win32-x86. 3. Edit epics/base/configure/CONFIG_SITE so that it specifies SHARED_LIBRARIES=NO and STATIC_BUILD=YES (evidently you can do a shared library build, but I wasn't able to get it to work).
4. Get ActiveState perl or Strawberry perl and install
5. Get MinGW make tool (I just got whole MinGW for C++ setup)
6. Do a mingw32-make in epics/base directory and hope it builds
7. get synApps 5.6 from http://www.aps.anl.gov/bcda/synApps/index.php ( you'll need html doc too)
8. Untar that so you have a synApps/support directory
9. Edit synApps/support/configure/RELEASE file. For RELEASE, I think you will just need the following modules uncommented:
       ASYN, MODBUS, STD
10. Edit synApps/support/configure/EPICS_BASE.win32-x86 so it knows where your epics/base is 11. Edit synApps/support/configure/SUPPORT.win32-x86 so it knows where synApps/support is
12. Do a mingw32-make release
13. Do a mingw32-make and hope it builds
14. On the web page from step 7, scroll down and click to modbus module and read the modbusDoc.html 15. You will find a Koyo PLC example in synApps/support/modbus-2-3/iocBoot/iocTest The st.cmd is what bootstraps the IOC, and it points to Koyo1.cmd which has the setup to talk to a Koyo PLC. This combined with the modbusDoc.html is pretty self-documenting. 16. Assuming you have figured out how to create a "Koyo1.cmd" for your needs, you start the IOC with
         cd synApps/support/modbus-2-3/iocBoot/iocTest
         ../../bin/win32-x86/modbusApp.exe st.cmd

It will take some reading/learning to know how to set up the st.cmd/Koyo1.cmd. The first part basically sets up the connection to the PLC and then the "asyn ports" that point to coils/contacts/registers in the PLC. You then have to dbLoadTemplate (or similar) to define an EPICS record for each of those asyn ports. That EPICS record is what gives you the ability to use any EPICS Channel Access client to read/write values from anywhere on the network. Once you can do a caget.exe and caput.exe to your EPICS record, then you can go learn about the vast landscape of really cool EPICS client programs.

The above are general steps. You will have problems and want to tear your hair out. It takes a while to build up the necessary knowledge, and having a fellow EPICS person around helps a lot. It's hard to do over email, but hopefully I've got you started.

    regards, Claude


On 03/05/2012 10:49 AM, Andrew Johnson wrote:
Hi Jiří,

I am forwarding this email to our tech-talk mailing list as there are many
other people on the list with more experience than I have in building and
using EPICS on Win7 and with Modbus.

On your general points yes you can think of an EPICS IOC as a SCADA engine,
although being open we are a lot more extensible (and less standardized) than
most PLCs.  It is important to be aware that we do not make any promises as
far as network security goes, EPICS traffic should be contained within a
strongly-firewalled network since DoS attacks are trivial to create and it is
easy to impersonate other users over the Channel Access protocol.

As you are already aware, the learning curve for EPICS is unfortunately rather
hard; there are a number of training presentations and even videos of past
courses available, but I'm not aware of any that would quickly address your
particular setup.

You can run the IOC code on Windows, you won't need RTEMS at all for what
you're wanting to do.  There are a number of sites running EPICS inside VMs.
In both cases you will probably need to adjust your firewall settings to get
the network connections working properly though.

Tech-talk:

Can someone with more Windows 7 experience point Jiří in the right direction
for what he's wanting to do please.

- Andrew

----------  Forwarded Message  ----------

Subject: request for config. steps
Date: Friday 02 March 2012
From: Jeřábek Jiří<Jiri.Jerabek@eli-beams.eu>
To: "anj@aps.anl.gov"<anj@aps.anl.gov>

Hi Andrew,



Sorry for inconvenience.

I am a novice with EPICS.  I have extended SCADA, DCS,  OPC, Modbus, PLCs
experience besides other.
I am not a comp.sci. specialist by my profession and have no practical
experience with Linux, C++, Perl and so on.
I have experience with physical instrumentation and  industrial  field
instrumentation.

If  I am correct, I understand  EPICS as  a generalized, scalable, open  SCADA
engine (without particular  HMI)

As it is very diffcult, if not impossible, for me to acquire  within a short
period  necessary  knowledge by self-study  only,  I decided to address you
for a basic navigation help  with  setting  an EPICS client and building an
IOC.  Maybe  a hand drawn  flow diagram  would be  initially sufficient.
I do not request  detailed cookbook at all even asking for some details
anyway.

I would like to build a small setup having:

   * Two notebooks  with Win7
   * A small „Modbus.exe“  simulator  with Modbus TCP protocol.

The  aim is to access for simplicity only one holding register  in the Modbus
simulator and say only for “Read” operation.

As I understand  by now,  the   IOC should be  created/built  in my situation
on  one notebook (including a local EPICS Client), the second one   would
support only the Modbus simulator  application.

Could you  please to give me  a rough itemized  set up skeleton for sequence
of implementation steps?


   * What to do first, second , etc?
   * What to study  to  go across  particular steps?
   * How to build/install  an EPICS client (I want  to have only one field
shown, exactly with the Modbus register).
   * How to  build  an  appropriate IOC  and  a its  database?

Am I able to build the EPICS stuff  under Win7 or it would be necessary  to
boot the notebook with other OS, to use RTEMS or so…?
I have no idea…
Btw. are  anywhere  instructions  for using  virtual machines? My experience
is that  there could be a problem with  network card  incompatibility for
particular combination of virtual machine vs PC NIC .


With best regards,

Jiri



Jiri Jerabek
SCADA specialist
www.fzu.cz<http://www.fzu.cz>
www.eli-beams.eu<http://www.eli-beams.eu>

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


--
----------------------------------------------------------
 Claude Saunders<saunders@aps.anl.gov>
 Software Services Group Leader
 Advanced Photon Source,   Argonne National Laboratory
 Argonne, IL  60439                   630 - 252 - 6619
----------------------------------------------------------
    We write suggestions, suggesting fading to silence
    And that must please you
    My mirror's tarnished with 'no help'
                      - Gary Numan
----------------------------------------------------------


Replies:
RE: Fwd: request for config. steps Mark Rivers
References:
Fwd: request for config. steps Andrew Johnson

Navigate by Date:
Prev: Fwd: request for config. steps Andrew Johnson
Next: RE: Fwd: request for config. steps Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: Fwd: request for config. steps Andrew Johnson
Next: RE: Fwd: request for config. steps Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·