Herunterladen Inhalt Inhalt Diese Seite drucken

Bosch rexroth IndraWorks 15VRS Anwendungsbeschreibung Seite 391

Feldbusse
Vorschau ausblenden Andere Handbücher für rexroth IndraWorks 15VRS:
Inhaltsverzeichnis

Werbung

IndraWorks 15VRS Feldbusse
objID
: CmpBACnet.IEC_BACNET_OBJECT_ID;
i
: UDINT;
bacObj
: BACnetObjectBase;
runObjID
: CmpBACnet.IEC_BACNET_OBJECT_ID;
objCount
: UDINT := 0;
strBuffer
: STRING;
errCode
: CmpBACnet.IEC_BACNET_ERROR_CODE := 0;
bacResult
: CmpBACnet.IEC_BACNET_STATUS;
END_VAR
BACnetEventCallback := FALSE;
//Check if the issued service event is the one we are interested in
//meaning the create object event
IF EventId = CmpBACnet.EVT_CreateObject AND
usParamId = CmpBACnet.EVTPARAMID_CmpBACnet_CreateObject AND
usVersion = CmpBACnet.EVTVERSION_CmpBACnet_CreateObject THEN
//Get the service information using the proper
//event structure CmpBACnet.EVT_BACNET_CREATEOBJECT
pCreateObj := pParameter;
//The pCBStatus property of the event structure allows to define
//the result of this service hook. Choosing the default action
//will advice the API to use its default implementations if available
//(see also documentation of CB_STATUS_DEFAULT)
pCreateObj^.pCBStatus^ := CmpBACnet.IEC_BACNET_CB_STATUS.CB_STATUS_DEFAULT;
//Get the device instance number for the service request and check if it is
//our device that the request is for (only important for the case of multiple
//devices in one PLC)
bacResult := CmpBACnet.BACnetDeviceAddressToInstNumber(pCreateObj^.destinationAddress,
IF bacResult = CmpBACnet.IEC_BACNET_STATUS.BACNET_STATUS_OK
//Get the object specifier defining what to create
objSpec := pCreateObj^.pServiceInfo^.objectSpecifier;
//Check if the object type specified is creatable
IF IsBACnetObjectAMEVCreatable(objSpec.objectSpec.typ) THEN
//If no object ID is given find a free one
IF objSpec.tag = CmpBACnet.IEC_BACNET_CREATE_OBJECT_TYPE.CREATE_OBJECT_TYPE THEN
objID.typ := objSpec.objectSpec.typ;
objID.instNumber := 1;
objCount := GetObjectCount();
i := 1;
WHILE i <= objCount DO
GetObject(i, bacObj);
runObjID := bacObj.ObjectID;
IF runObjID.typ = objID.typ AND
objID.instNumber := objID.instNumber + 1;
i := 1;
END_IF
i := i + 1;
END_WHILE
BACnetEventCallback := TRUE;
//If the object ID is given check if it is a valid/free object ID
ELSIF objSpec.tag = CmpBACnet.IEC_BACNET_CREATE_OBJECT_TYPE.CREATE_OBJECT_ID THEN
objID := objSpec.objectSpec.objectID;
objCount := GetObjectCount();
i := 1;
BACnetEventCallback := TRUE;
WHILE i <= objCount DO
GetObject(i, bacObj);
runObjID := bacObj.ObjectID;
Beachten Sie die pCreateObj-Variable, welche die Basisinformation der
CreateObject-Anfrage trägt.
Das folgende Beispiel zeigt die Implementierung der BACnetEventCall-
back-Funktion des Funktionsbausteins CallbackFB.
Implementierungsteil:
Programm:
ADR(destInstNumber));
AND destInstNumber = m_Device.DeviceInstNumber THEN
runObjID.instNumber = objID.instNumber THEN
Gebäudeautomatisierung
R911393282_Ausgabe 05 Bosch Rexroth AG
379/395

Quicklinks ausblenden:

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis