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

Subject: Re: EpicsSharp issues
From: Alain Bertrand <[email protected]>
To: "Christopher J. Pendleton" <[email protected]>, [email protected]
Date: Fri, 22 Nov 2013 19:21:31 +0100
Hi Christopher,

You should be able to work with floats indeed. However it could be that I didn't tested it correctly. I will do some trials next week and let you know. In the mean time, can you please try to grab it as double[] instead of float[] and see if it works?

Sincerely,

Alain Bertrand

On 11/22/2013 4:10 PM, Christopher J. Pendleton wrote:
Hello. Let me start by saying that I started using EPICS to interface to our
company's devices (http://ptcusa.com/) earlier this year and it has been a
pleasure to work with. You guys are doing great work and I hope I can
contribute to the cause.

One of my colleagues is a big fan of C#, so I pointed him to the EpicsSharp
library. I started using it to help him sort through some issues he was
having. The major one I am seeing is with float arrays (arrays in general?)
while using the MonitorChanged event.

Details:

I have a channel access server running, serving up a float array PV. Both
Python (PyEpics) and LabVIEW (CA Lab) client interfaces see this PV and
recognize it as a float array. No problems here. When I use EpicsSharp, I
can get the float array by using the synchronous call Get<float[]>() on the
channel object. Also no problems here. I see unexpected behavior when I use
the MonitorChanged event. My code:

///
     static class Program
     {
         [STAThread]
         static void Main()
         {
             EpicsClient client = new EpicsClient();
             EpicsChannel<float[]> record =
client.CreateChannel<float[]>("r_I128_channels_test");
             record.MonitorChanged += new
EpicsDelegate<float[]>(record_MonitorChanged);
             Console.ReadKey();
         }

         static void record_MonitorChanged(EpicsChannel<float[]> sender,
float[] newValue)
         {
             Console.WriteLine("Help!");
         }
     }
///

I would expect to see an event fire into my handler, but I don't. What I do
see is an exception in my console window:

///
System.Collections.Generic.KeyNotFoundException: The given key was not
present i
n the dictionary.
    at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
    at PSI.EpicsClient2.EpicsChannel`1.<Disconnect>b__3(EpicsChannel action)
in D
:\Projects\epicsC#\client\EpicsGenericChannel.cs:line 99
///

I dug into the client library code and found that the exception was
happening in EpicsGenericChannel.cs, line 99.

//
p.DataType = (ushort) TypeHandling.Lookup[typeof (TType)];
//

typeof (TType) evaluates to Single[], which isn't in TypeHandling
Dictionary, so an exception is thrown.

Do you expect this behavior? Is there a problem in my client program code? I
found another example on techtalk by Alain Bertrand
(http://www.aps.anl.gov/epics/tech-talk/2011/msg01584.php) that shows almost
the same code with an int[], so I am a little lost. Thanks in advance for
your help!

Regards,
Chris

Christopher J. Pendleton
Director, Software Development
Pyramid Technical Consultants, Inc.
Office: +1 781-402-1700 x114
Cell: +1 781-249-3031






References:
EpicsSharp issues Christopher J. Pendleton

Navigate by Date:
Prev: Re: Why should I care about breakpoint table monotonicity? Andrew Johnson
Next: RE: Why should I care about breakpoint table monotonicity? Emmanuel Mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: EpicsSharp issues Christopher J. Pendleton
Next: RE: EpicsSharp issues Christopher J. Pendleton
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·