Hej Mark and Markus,
I think that "Case 2" needs to things to work:
a) The database definition (as described)
b) Support in the driver itself.
That is a little bit tricky:
A PLC variable, that is written from EPICS (like an ao record),
needs to be treated as an output inside the driver.
When 'info(asyn:READBACK, "1")' is defined in the database,
it must be treated as an input "as well": Values from EPICS into
the PLC must be written as before, and at the same time, some
reading from the PLC must be in place.
In most cases, a cyclic polling inside the driver is good enough-
assumed that the change rate inside the PLC is "slower"
than the pollrate.
Having said that: I can not speak for the driver you mentioned.
It may be an idea, to open an issue on github.
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.
So far no one has seriously asked for that feature.
HTH
/Torsten
On 2024-04-12 18:11, Mark Rivers via Tech-talk wrote:
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-LUyW3RghomFH88t9jP45toKnZq8oo1pt5gT5tQhGnPd9QXmCruzGkJg$
- References:
- Readback of output variables in adsDriver Meyer, Markus via Tech-talk
- RE: Readback of output variables in adsDriver Mark Rivers via Tech-talk
- Navigate by Date:
- Prev:
RE: Remote reset of MVME-2700 possible through serial console Mark Rivers via Tech-talk
- Next:
Example of using a record field from an external IOC as an INPA link on a calcout record Wlodek, Jakub 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: Readback of output variables in adsDriver Mark Rivers via Tech-talk
- Next:
Re: Readback of output variables in adsDriver Jure Varlec 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>
|