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  <20102011  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  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Testing UIs against real databases using simulation mode
From: "J. Lewis Muir" <[email protected]>
To: [email protected]
Date: Mon, 29 Nov 2010 09:12:58 -0600
On 11/28/10 11:57 PM, Angus Gratton wrote:
> Does anyone have any tips on simulating hardware for easy/quick UI
> development?
> 
> My intention is to be able to test that a given UI and a database talk
> properly, before facing the problem of having the database talk to the
> hardware. I'm using wxPython w/ pyepics for the UIs.
> 
> I've read about the 'simulation mode' record fields in the Record
> Reference & App Developer's Guide, but I don't just want to switch a
> single record over to simulation mode. I want to control a soft IOC
> without any of my real target hardware, but with equivalent PV names.
> 
> Have I missed an available resource somewhere?
> 
> At the moment I'm thinking the easiest way may be to just run sed over
> my database file to change all the DTYPs to asyn soft records (all our
> hardware records are asyn), and then fix up the INP/OUT port names. Then
> I can just poke in the values I need for UI testing at runtime, using
> iocsh or caget/caput.
> 
> Thanks in advance for any tips.

Hi, Angus.

For serial or Ethernet devices that have an ASCII communication
protocol, I usually write a simulator for the device in Python using
Python's asyncore and asynchat modules.  Then, I just change how the
ASYN port is created in my EPICS soft IOC and I can test any GUIs, EPICS
databases, etc.

For devices that are not easily simulated, I typically write a simulated
database for any database that would communicate w/ the device.  I might
name it the same as the real database but prefixed with "sim" or
something.  This approach is not as good because I don't get to exercise
the real database, and I have to make changes to the database twice:
once in the real one and once in the simulated one.  But sometimes this
is the best choice.

And then there are some things that are a real pain to simulate such as
records which have a special DTYP and no soft channel support.  Usually,
I end up doing something like the sed hack you mentioned where I
generate a simulated database from a real one.  Or, I write a simulated
database but with my GUIs and other clients designed to accept a field
separator character so that a reference like "ioc23:status.BI03" could
be replaced with one like "ioc23:status:BI03" where I simulated the BI03
status bit field instead with a bi record named "ioc23:status:BI03" in
my simulation database.  (BTW, in my view, this is one big plus for
databases composed of the standard records rather than special purpose
records: a database of standard records is a lot easier to simulate.)

Lewis

-- 
J. Lewis Muir
Software Engineer
IMCA-CAT

Replies:
Re: Testing UIs against real databases using simulation mode emmanuel_mayssat
References:
Testing UIs against real databases using simulation mode Angus Gratton

Navigate by Date:
Prev: Strange IOC crash Benjamin Franksen
Next: Re: EPICS Base 3.14.12 released. Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Testing UIs against real databases using simulation mode tom.cobb
Next: Re: Testing UIs against real databases using simulation mode emmanuel_mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 29 Nov 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·