.ModelicaADS.Functions.ADS.funAdsDestructor

Information

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.

C Source Code of Function

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);
}  

Interface

function funAdsDestructor
  output Integer ans "Error handling: 0 = OK!, 1 == Error, see simulation tab for info";
end funAdsDestructor;

Revisions


Generated at 2024-11-22T19:25:38Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos