This is a function to close the connection with a Beckhoff PLC via the ADS
protocol. The function utilised from the C API provided by Beckhoff is
AdsPortClose()
. Errors are reported.
int funAdsDestructor(void) { long nErr; // Variable for error codes from ADS // Close communication port nErr = AdsPortClose(); if (DEBUG_FLAG != 0) ModelicaFormatMessage("Call of AdsPortClose(), done!\n"); if (nErr != 0) {// Error checking ModelicaFormatMessage("Error: AdsPortClose(): %i\n",nErr); return(1); } if (DEBUG_FLAG != 0) ModelicaFormatMessage("AdsPortClosed successful!\n"); return(0); }
function funAdsDestructor output Integer ans "Error handling: 0 = OK!, 1 == Error, see simulation tab for info"; end funAdsDestructor;