Hi Torsten,
my test system using the epics-twincat-ads driver is running now without issues and the readback is working as expected like you said. Once I got the "adsAsynPortDriver::drUserCreate: Parameter created: "ADSPORT=851/GVL.var?"" (index 1) output message everything started working.
The problem was, that I specified the driver info without commas, e.g. "field(OUT, "asyn($(PORT) 0 1)$(ADSPORT)/GVL.var?") is wrong, but "field(OUT, "asyn($(PORT),0,1)$(ADSPORT)/GVL.var?")" is correct. Not using commas will cause the sscanf() in https://github.com/EuropeanSpallationSource/epics-twincat-ads/blob/045f40f2e80057025befe015b89b80288157c479/adsApp/src/adsAsynPortDriver.cpp#L1338 to fail silently.
Thanks again for your help.
Markus
-----Ursprüngliche Nachricht-----
Von: Torsten Bögershausen <tboegi at edom.se>
Gesendet: Montag, 22. April 2024 06:12
An: Meyer, Markus <m.meyer at hzdr.de>; tech-talk at aps.anl.gov
Betreff: Re: AW: Readback of output variables in adsDriver
Hej again,
I haven't manage to find the time to set up a test system yet - hope that you have more luck.
Here are the good news.
After chatting with out expert:
epics-twincat-ads does support read back of output records !
One precondition is the '?' at the end of the OUT field:
<https://github.com/EuropeanSpallationSource/epics-twincat-ads/blob/045f40f2e80057025befe015b89b80288157c479/adsExApp/Db/adsTestAsyn.db#L12>
The "SetFAmplitudeRB" record should do what you ask for:
Writing to the EPICS PV changes the value in the PLC.
Once the value in the PLC is changed, that change should be seen in the output record.
HTH - and please let us know, how it goes.
On 2024-04-15 18:21, Torsten Bögershausen via Tech-talk wrote:
> Hej all,
>
> I did have a short look into the driver - adsTestAsyn.db does have a
> READBACK, but I couldn't find anything in the code, to switch it on or
> off.
> But I know for sure, that people from SLAC have contributed a bulk
> read, so far only 1Hz.
> Similar to Jure's driver, so far nobody had asked seriously enough for
> READBACK so no time had been invested here.
>
> Having said that, why do you not get any data ?
>
> Wrong "ads port" ?
> I sometimes run wireshark to find out, what is going on.
>
> /Torsten
>
>
>
> On 2024-04-15 16:54, Meyer, Markus via Tech-talk wrote:
>> Hello Jure, Mark and Torsten,
>>
>> Thank you all for your responses and explanations of the 2 cases.
>>
>>> I kindly ask you to open a pair of issues on the Github repo. I
>>> can't say when we we'll be able to take a closer look (we're
>>> stretched pretty thin right now), but having open issues helps raise the priority.
>> I will do that and maybe I can help with some code after I have
>> finished my evaluation of the other available drivers.
>>
>>> Case 2, at least, is probably not that hard to implement. Case 1, on
>>> the other hand, is a bit thornier because of the design of the driver.
>> It may be OK to do the readback after iocInit only in a cyclic interval.
>>
>>> We here at ESS use a different driver for ADS, and if that one can
>>> do the readback ? I haven't checked - but I highly suspect that it doesn't.
>> I have compiled the latest source of the driver from ESS [1] and can
>> connect to my plc but unfortunately I get no values from the plc at
>> all. I am still investigating what I am doing wrong here. I expect a
>> readback because it's explicitly mentioned in the adsTestAsyn.db of
>> adsExApp.
>>
>> Thanks,
>> Markus
>>
>> [1]
>> https://urldefense.us/v3/__https://github.com/EuropeanSpallationSourc
>> e/epics-twincat-ads__;!!G_uCfscf7eWS!cWY-oNbq-4U-gg1N5Q8SvI_E4DLNAd9t
>> Vgk5xrioIeV8ejfmVohmnmNpsp_rKDUJGlJGz2RJXqJ_poyPHDdx8g$
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Tech-talk <tech-talk-bounces at aps.anl.gov> Im Auftrag von Jure
>> Varlec via Tech-talk
>> Gesendet: Montag, 15. April 2024 12:49
>> An: tech-talk at aps.anl.gov
>> Betreff: Re: Readback of output variables in adsDriver
>>
>> Hello Markus,
>>
>> Mark made a nice breakdown of the two cases. Right now, the adsDriver
>> module supports neither. We are aware of this, but honestly, nobody
>> has needed it badly enough yet :) . I kindly ask you to open a pair
>> of issues on the Github repo. I can't say when we we'll be able to
>> take a closer look (we're stretched pretty thin right now), but
>> having open issues helps raise the priority.
>>
>> Case 2, at least, is probably not that hard to implement. Case 1, on
>> the other hand, is a bit thornier because of the design of the driver.
>> It is focused on doing bulk reads, which are needed to get sufficient
>> performance with lots of variables. But such reads can only be done
>> after all the records are initialized and ADS variables made known to
>> the driver. So, initial readbacks were disabled for simplicity. They
>> can be added for sure, but it won't be a simple bolt-on.
>>
>> Cheers,
>> Jure
>>
>> On 4/12/24 18:11, Mark Rivers via Tech-talk wrote:
>>> Caution: This email originated from outside of Cosylab.
>>>
>>>
>>> Hi Markus,
>>>
>>> There are 2 separate cases here:
>>>
>>> 1) The PV value getting set to the PLC value during iocInit.
>>> 2) The PV value getting set to the PLC value when the PLC values
>>> changes after iocInit.
>>>
>>> Case 1 is handled as follows:
>>> - During iocInit the ao record device support (devAsynFloat64.c)
>>> does a read from the driver to get the current PLC value. If that
>>> read operation returns asynSuccess then the PV should be set to the
>>> PLC value, otherwise it is not changed. This definitely works fine
>>> with the Modbus driver, for example. I am not sure about the
>>> adsDriver, since I have not used it. You can add debugging to the
>>> driver to track that down.
>>>
>>> Case 2 is handled by adding the line you did to database:
>>> info(asyn:READBACK, "1")
>>>
>>> That should make the ao record value update to match the PLC value
>>> when the PLC value is changed outside of EPICS. Note that this line
>>> is NOT required for getting the behavior described in Case 1 above.
>>>
>>> Mark
>>>
>>>
>>> -----Original Message-----
>>> From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Meyer,
>>> Markus via Tech-talk
>>> Sent: Friday, April 12, 2024 10:25 AM
>>> To: tech-talk at aps.anl.gov
>>> Subject: Readback of output variables in adsDriver
>>>
>>> Dear all,
>>>
>>> I am evaluating possibilities to communicate with a plc and other
>>> hardware from beckhoff. I have successfully build the adsDriver [1]
>>> device support and it seems to work very well for input variables. I
>>> can also write output variables, but if the value gets changed on
>>> the plc itself (e.g. by the interlock logic or by another connected
>>> protocol) it is not synced back to the pv. It also seems that the
>>> current value is not initially read on startup of the IOC.
>>>
>>> For example, this is the pv definition:
>>>
>>> record(ao, "$(P):IC:CB01-SSet") {
>>> field(DTYP, "asynFloat64")
>>> field(PREC, "2")
>>> field(EGU, "%")
>>> field(DRVH, "100")
>>> field(DRVL, "-100")
>>> field(OUT, "@asyn($(PORT) 0 0) REAL W P=PLC_TC3
>>> V=HMI.IC.CB01.SSet")
>>> info(asyn:READBACK, "1")
>>> }
>>>
>>> Before I start the IOC, the plc value is set to 2. If I start the
>>> IOC, the value of the pv is set to 0. The Timestamp is updated. The
>>> value in the plc gets not changed. I expected, that the pv value is
>>> also set to 2. Writing a value to the pv is working as expected.
>>>
>>> Did I miss something here? What can I do to subscribe for changes of
>>> output variables?
>>>
>>> Thanks,
>>> Markus
>>>
>>> [1]
>>> https://urldefense.us/v3/__https://github.com/Cosylab/adsDriver__;!!
>>> G_
>>> uCfscf7eWS!eovU-aYXFfsZIvbTx6Y3tTGma4zwbWLi1xy-LUyW3RghomFH88t9jP45t
>>> oK
>>> nZq8oo1pt5gT5tQhGnPd9QXmCruzGkJg$
>>
>>
>>
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
- References:
- Re: AW: Readback of output variables in adsDriver Torsten Bögershausen via Tech-talk
- Navigate by Date:
- Prev:
behavior of PINI Di Wang via Tech-talk
- Next:
Re: Alarm Log Table Josh West via Tech-talk
- 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>
- Navigate by Thread:
- Prev:
Re: AW: Readback of output variables in adsDriver Torsten Bögershausen via Tech-talk
- Next:
Remote reset of MVME-2700 possible through serial console Jennings, Guy via Tech-talk
- 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>
|