12.07.2015 Views

PLCHandler Programming Guide - Esco Drives & Automation

PLCHandler Programming Guide - Esco Drives & Automation

PLCHandler Programming Guide - Esco Drives & Automation

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PLCHandler</strong> <strong>Programming</strong> <strong>Guide</strong>2 C<strong>PLCHandler</strong> Class2.1 Constructor and Configuration of the <strong>PLCHandler</strong>A <strong>PLCHandler</strong> object of the C<strong>PLCHandler</strong> class always is assigned to a single PLC. Thus at creationof the object it has to be configured, with which PLC resp. which communication interface the<strong>PLCHandler</strong> should work. The configuration is specified in chapter 3.There are various constructors for creating the <strong>PLCHandler</strong> object:1. C<strong>PLCHandler</strong>(unsigned long ulId, char *pszIniFile,SysLog *pLogFile = NULL):Parameter ulId designates the index of the <strong>PLCHandler</strong> assumed that more instances areused.An ini-file for reading the configuration will be handed over to the constructor. The SDKprovides two sample files (OPCServerARTI.ini and OPCServerSimu.ini). The structure isdescribed in detail in the Appendix of this guide.Optionally a log file can be specified for recording all errors and internal states. The SysLogclass is contained in the <strong>PLCHandler</strong>.2. C<strong>PLCHandler</strong>(PlcConfig *pPlcConfig, PlcDeviceDesc *pDeviceDesc,SysLog *pLogFile = NULL):The parameters on the one hand define general configuration data in the <strong>PLCHandler</strong>(pPlcConfig) and on the other hand the communication settings for the (pDeviceDesc). Thedata are identic with the entries in the ini-file. Thus both constructors can be used according tothe actual requirements.Optionally also here a log file can be specified for recording all errors and internal states. TheSysLog class is contained in the <strong>PLCHandler</strong>.The PlcConfig structure contains the configuration data for the <strong>PLCHandler</strong>:struct PlcConfig{PlcConfig(void);~PlcConfig(void);unsigned long ulId;unique ID for every PLCchar *pszName; name of the PLCItfType it; interface type of the PLC (IT_ARTI, IT_GATEWAY, ...)char ulSize; size of the variablechar bActive; flag if the PLC is active or notchar bMotorola; flag if data has to be swapt for motorola byte orderchar bLogin; flag if the application can do a loginchar bLogToFile; flag if the application should log to a filechar bPreCheckIdentity; flag if the project identity will be checkedbefore every read / write of variablesunsigned long ulTimeout; communication timeout in msunsigned long ulNumTries; number of tries of receive's before throwing aCOMM_FATAL errorunsigned long ulWaitTime; total time in ms to wait for a reconnection to the PLCunsigned long ulReconnectTime; time interval in ms to try for a reconnectionchar *pszHwType; HW type of the PLC (PLCC_HW_STANDARD,PLCC_HW_MAX4)unsigned long ulHwVersion;unsigned long ulBufferSize;HW versioncommunication buffersize of the runtime systemrunning on the PLC; 0 = default sizechar *pszProjectName; name of the CoDeSys project running on theruntime system; only of interest in simulationchar *pszDllDirectory; directory where to find the (Sym-)ARTI Dll'sGatewayConnection *gwc; pointer to the gateway connection if using thegateway interface 3S - Smart Software Solutions GmbH<strong>PLCHandler</strong> Programmming <strong>Guide</strong>.doc Page 4 of 17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!