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

Subject: Beckhoff ADS to EPICS IOC
From: Lesley via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Thu, 5 Jun 2025 23:08:05 +0800 (CST)
Hello!
I developed a Beckhoff ADS IOC application using this ADS driver (https://github.com/Beckhoff/ADS). After the IOC runs for some time, the following issue occurs: "WARNING dbEvent possible queue stall". Concurrently, the PVs in the OPI will disconnect and then automatically reconnect after a short period.
Here's a code snippet for reading data from the PLC using the ADS driver:
extern "C" {
struct WaterStatusStruct adsReadWaterStatusValue(){
        WaterStatusStruct CWStatusVar; 
        const std::string handleName = "GVL_RFQ.water_status";
        //Use mutex locks to protect access
        std::lock_guard<std::mutex> lock(plcMutex);
        
        const long handleStatus = AdsSyncReadWriteReqEx2(port,
                                                        &plcAddress,
                                                        ADSIGRP_SYM_HNDBYNAME,
                                                        0,
                                                        sizeof(handle),
                                                        &handle,
                                                        handleName.size(),
                                                        handleName.c_str(),
                                                        nullptr);
        if (handleStatus) {
            printf("adsReadWaterStatusValue Create handle failed with: %8lX\n", handleStatus);
            //out << "Create handle for '" << handleName << "' failed with: 0x" << std::hex << handleStatus << '\n';
            return CWStatusVar;
        }

        const long status2 = AdsSyncReadReqEx2(port,
                                                &plcAddress,
                                                ADSIGRP_SYM_VALBYHND,
                                                handle,
                                                sizeof(CWStatusVar),
                                                &CWStatusVar,
                                                &bytesRead);
        if (status2) {
                printf("adsReadWaterStatusValue ADS read failed with: %8lX\n", status2);
                //out << "ADS read failed with: " << std::dec << status << '\n';
                
        }
        const long releaseHandle = AdsSyncWriteReqEx(port, &plcAddress, ADSIGRP_SYM_RELEASEHND, 0, sizeof(handle), &handle);
        if (releaseHandle) {
            //out << "Release handle 0x" << std::hex << handle << "' failed with: 0x" << releaseHandle << '\n';
            printf("adsReadWaterStatusValue Release handle failed\n");
        }

    
        return CWStatusVar;
    } 
}

What can I do to fix this?Thank you for your time.


Replies:
RE: Beckhoff ADS to EPICS IOC GAGET Alexis via Tech-talk

Navigate by Date:
Prev: Re: StreamDevice and libpcre2 Jörn Dreyer via Tech-talk
Next: PVXS programmatically create pvalinks Dave Bracey 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  <2025
Navigate by Thread:
Prev: Re: StreamDevice and libpcre2 Jörn Dreyer via Tech-talk
Next: RE: Beckhoff ADS to EPICS IOC GAGET Alexis 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  <2025
ANJ, 06 Jun 2025 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions ·
· Download · Search · IRMIS · Talk · Documents · Links · Licensing ·