fwConfigs  8.4.5
fwPeriphAddressBACnet.ctl File Reference

Functions

void _fwPeriphAddressBACnet_set (string dpe, dyn_anytype addressConfig, dyn_string &exceptionInfo)
 Internal function to setup the BACnet addressing. More...
 
void _fwPeriphAddressBACNET_set (string dpe, dyn_anytype addressConfig, dyn_string &exceptionInfo)
 
void _fwPeriphAddressBACnet_get (string dpe, dyn_anytype &addressConfig, bool &isActive, dyn_string &exceptionInfo)
 Retrieve configuration from _address config for BACnet. More...
 
void _fwPeriphAddressBACNET_get (string dpe, dyn_anytype &addressConfig, bool &isActive, dyn_string &exceptionInfo)
 
 _fwPeriphAddressBACnet_delete (string dpe, dyn_string &exceptionInfo)
 Internal function to cleanup before deleting the BACnet _address and _distrib configs TODO: create function body. More...
 
void _fwPeriphAddressBACnet_check (dyn_anytype &addressConfig, dyn_string &exceptionInfo)
 Function to check and correct BACnet address configuration parameters before attempting to save them to the DP element. More...
 
void _fwPeriphAddressBACNET_check (dyn_anytype &addressConfig, dyn_string &exceptionInfo)
 
bool _fwPeriphAddressBACnet_isDataTypeValid (string dataType)
 
bool _fwPeriphAddressBACnet_isReferenceValid (string reference)
 
dyn_string _fwPeriphAddressBACnet_explodeReference (string reference)
 
bool _fwPeriphAddressBACnet_isDeviceValid (string device)
 
bool _fwPeriphAddressBACnet_isObjectIdValid (string objectId)
 
bool _fwPeriphAddressBACnet_isPropertyValid (string object, string property)
 
bool _fwPeriphAddressBACnet_isIndexValid (string index)
 
void _fwPeriphAddressBACnet_showTransformationTypes ()
 
void _fwPeriphAddressBACnet_showObjectTypes ()
 
void _fwPeriphAddressBACnet_showDevices (string dpe)
 
void _fwPeriphAddressBACnet_showPollingGroups (string dpe)
 
void _fwPeriphAddressBACnet_getModes (int addressMode, int &directionMode, int &receiveMode)
 
void _fwPeriphAddressBACnet_showDeviceAddress (string dp)
 
void _fwPeriphAddressBACnet_showObjectProperties (string objectType)
 
void _fwPeriphAddressBACnet_setIOMode (int directionMode, int receiveMode)
 

Variables

const int fwPeriphAddress_BACNET_REF_MIN_ELEM_NO = 4
 Separator used in reference _address field.
 
const int fwPeriphAddress_BACNET_REF_MAX_ELEM_NO = 5
 Minimum number of elements in reference _address field.
 
const int fwPeriphAddress_BACNET_REF_DEV_IDX = 1
 Maximum number of elements in reference _address field.
 
const int fwPeriphAddress_BACNET_REF_OBJ_TYPE_IDX = 2
 Index for device name in peripheral address.
 
const int fwPeriphAddress_BACNET_REF_OBJ_ID_IDX = 3
 Index for object type in peripheral address.
 
const int fwPeriphAddress_BACNET_REF_PROP_IDX = 4
 Index for object id in peripheral address.
 
const int fwPeriphAddress_BACNET_REF_IDX_IDX = 5
 Index for property in peripheral address.
 
const int fwPeriphAddress_BACNET_TYPE_DEFAULT = 800
 Index for property's index in peripheral address.
 
const int fwPeriphAddress_BACNET_TYPE_BOOL = 801
 Default.
 
const int fwPeriphAddress_BACNET_TYPE_UINT = 802
 Boolean.
 
const int fwPeriphAddress_BACNET_TYPE_INT = 803
 Unsigned Integer.
 
const int fwPeriphAddress_BACNET_TYPE_REAL = 804
 Signed Integer.
 
const int fwPeriphAddress_BACNET_TYPE_DOUBLE = 805
 Real.
 
const int fwPeriphAddress_BACNET_TYPE_ENUM = 809
 Double.
 
const dyn_int fwPeriphAddress_BACNET_TYPES
 Enumerated.
 

Detailed Description

Functions to set _address config for datapoint for BACnet driver.

Naming: when possible names used in WinCC OA help are used (e.g. "reference" is preferred over "address"). FW_PARAMETER_FIELD_AAABBB constants are used, not the fwPeriphAddress_AAABBB (who know which one is correct?). TODO: it would be better to switch to fwPeriphAddress_AAABBB as everybody else is using it.

Note that config identifier is "BACnet", but the driver uses "BACNET", in some cases it might cause confusion, that's why there are wrapper functions using "BACNET" have been added. Probably it was better to use "BACNET" from the start even though it's not correct...

Initial code was written based on WinCC OA help file on BACnet and _address config entry. Other things were taken from BACnet examples (BACnet_Samples.dpl in dplist directory of BACnet directory in WinCC OA installation, look for "PeriphAddrMain"). Also panels:

  • panels/para/address_bacnet.pnl (used to set _address),
  • panels/para/bacnet.pnl (to create/setup a device; might not be used here). Note: version WinCC OA 3.11 was used.

Table for _datatype. Help only defines 800, but these values were used in various places: 800 default 801 Boolean 802 UnsignedInteger 803 SignedInteger 804 Real 805 Double 809 Enumerated 806 skipped, see bacnetDrvPara.ctl, line 740 Valid IDs: 800-899.

Code based on other fwPeriphAddressAAABB.ctl files.

Note that setting _address is not enough to make it work appriopriate BACnet device datapoint has to exist (_BacnetDevice).

Changelog (put only important stuff here):

  • 2016-01-12: added wrappers for BACNET (lgoralcz & msudera)
  • 2015-12-08: fixes (lgoralcz)
  • 2015-11-30: initial creation (lgoralcz)

Function Documentation

void _fwPeriphAddressBACnet_set ( string  dpe,
dyn_anytype  addressConfig,
dyn_string &  exceptionInfo 
)

Internal function to setup the BACnet addressing.

Constraints
Should only be called from fwPeriphAddress_set
Reviewed:
2018-06-21 fwPeriphAddressExtension
Parameters
dpeDatapoint element to act on
addressConfigAddress object is passed here:

exceptionInfoDetails of any errors are returned here
void _fwPeriphAddressBACNET_set ( string  dpe,
dyn_anytype  addressConfig,
dyn_string &  exceptionInfo 
)

This is to fix problem with different config type identifier ("BACnet") and different driver identifier ("BACNET"). This function is just a wrapper around "proper" function. Proper BACnet name is "BACnet", but for whatever reason driver uses (and some of our panels use this information /fwPeriphAddress.pnl/) "BACNET".

void _fwPeriphAddressBACnet_get ( string  dpe,
dyn_anytype &  addressConfig,
bool &  isActive,
dyn_string &  exceptionInfo 
)

Retrieve configuration from _address config for BACnet.

Constraints
Should only be called from fwPeriphAddress_get
Reviewed:
2018-06-21 fwPeriphAddressExtension
Parameters
dpeDatapoint element to read from
addressConfigAddress object is returned here (configParameters).
See Also
_fwPeriphAddressBACnet_set()
Parameters
isActiveTRUE if address config is active, else FALSE
exceptionInfoDetails of any errors are returned here
void _fwPeriphAddressBACNET_get ( string  dpe,
dyn_anytype &  addressConfig,
bool &  isActive,
dyn_string &  exceptionInfo 
)

This is to fix problem with different config type identifier ("BACnet") and different driver identifier ("BACNET"). This function is just a wrapper around "proper" function. Proper BACnet name is "BACnet", but for whatever reason driver uses (and some of our panels use this information /fwPeriphAddress.pnl/) "BACNET".

_fwPeriphAddressBACnet_delete ( string  dpe,
dyn_string &  exceptionInfo 
)

Internal function to cleanup before deleting the BACnet _address and _distrib configs TODO: create function body.

Constraints
Should only be called from fwPeriphAddress_delete
Reviewed:
2018-06-21 fwPeriphAddressExtension
Parameters
dpeDatapoint element to read from
exceptionInfoDetails of any errors are returned here
void _fwPeriphAddressBACnet_check ( dyn_anytype &  addressConfig,
dyn_string &  exceptionInfo 
)

Function to check and correct BACnet address configuration parameters before attempting to save them to the DP element.

Note: in other cases this function is public (no "_" prefix), but there's no reason why to make it private.

Parameters
addressConfigThe address configuration object is passed here. In some cases, an amended (fixed) version may be returned here
exceptionInfoDetails of errors in the address configuration are returned here
void _fwPeriphAddressBACNET_check ( dyn_anytype &  addressConfig,
dyn_string &  exceptionInfo 
)

This is to fix problem with different config type identifier ("BACnet") and different driver identifier ("BACNET"). This function is just a wrapper around "proper" function. Proper BACnet name is "BACnet", but for whatever reason driver uses (and some of our panels use this information /fwPeriphAddress.pnl/) "BACNET".

Reviewed:
2018-06-21 fwPeriphAddressExtension
bool _fwPeriphAddressBACnet_isDataTypeValid ( string  dataType)

Validate datatype.

Parameters
dataType(string) IN datatype (as string), ex. "800".
Returns
value of type 'bool' true if datatype is acceptable, false if not
bool _fwPeriphAddressBACnet_isReferenceValid ( string  reference)

Validate BACnet address reference.

Example reference: "Device_6789.AnalogInput.1.Min_Pres_Value" or: "Device_6789.BinaryValue.3.Reliability.2". Note: last element is optional.

<Device>.<Object_Type>.<Object_Id>.<Property>.<Index /optional/>

Parameters
reference(string) IN BACnet address reference
Returns
value of type 'bool' true if address is valid, false otherwise
dyn_string _fwPeriphAddressBACnet_explodeReference ( string  reference)

Explodes string representing BACnet reference. *

Parameters
reference(string) IN BACnet reference string, ex. "
Returns
value of type 'dyn_string' List of elements (ex. BACnet device, object id, etc.) or empty list if string was invalid
bool _fwPeriphAddressBACnet_isDeviceValid ( string  device)

Check if a given BACnet device exists in the configuration.

This function simply check if a datapoint of a given name and type "_BacnetDevice" exists.

TODO: stub, returns always true

Parameters
device(string) IN BACnet device name
Returns
value of type 'bool' True if device exits, false if BACnet device doesn't exist
bool _fwPeriphAddressBACnet_isObjectIdValid ( string  objectId)

Check if BACnet object ID is valid for _reference element.

Note, this does not check if an object id really exists in the device, only if it is correct, i.e. a number.

Parameters
objectId(string) IN BACnet object id
Returns
value of type 'bool' true if valid BACnet object id, false if not valid
bool _fwPeriphAddressBACnet_isPropertyValid ( string  object,
string  property 
)

Check if BACnet object's property is valid for _reference element.

Note1: that cat file that is being used is not the same cat file that is used to store translated messages ("msg" directory). Note2: code based on one of the WinCC OA BACnet libraries.

Parameters
property(string) IN BACnet object's property
Returns
value of type 'bool' true if property is valid, false otherwise
bool _fwPeriphAddressBACnet_isIndexValid ( string  index)

Check if given BACnet object's property index is valid.

Parameters
index(string) IN object's property index
Returns
value of type 'bool' true if BACnet object's property index is valid, false otherwise
void _fwPeriphAddressBACnet_showTransformationTypes ( )

This function shows BACnet transformation types in 'transformation_BACnet' combobox.

void _fwPeriphAddressBACnet_showObjectTypes ( )

This function finds BACnet Object Types and shows in the 'objectType_BACnet' combobox.

void _fwPeriphAddressBACnet_showDevices ( string  dpe)

This function finds BACnet devices available for given DPE and shows in the 'device_BACnet' combobox.

Parameters
dpeData point element for which available BACnet devices should be found
void _fwPeriphAddressBACnet_showPollingGroups ( string  dpe)

This function finds the polling groups stored in dp and shows in the 'pollGroupName_BACnet' combobox.

Parameters
dpeData point element with device name
void _fwPeriphAddressBACnet_getModes ( int  addressMode,
int &  directionMode,
int &  receiveMode 
)

This function reads Direction and Receive Mode flags from the "_address.._mode" property

Parameters
addressModevalue of "_address.._mode" property of dpe
directionModereturned Direction flag
receiveModereturned Receive Mode flag
void _fwPeriphAddressBACnet_showDeviceAddress ( string  dp)

This function reads the IP address and port of given BACnet server (device) and shows them.

Parameters
dpBACnet device data point
void _fwPeriphAddressBACnet_showObjectProperties ( string  objectType)

This function finds list of Properties for given BACnet Object Types and shows them in the property_BACnet combobox.

Parameters
objectTypeObject Type for which list of properties has to be found
void _fwPeriphAddressBACnet_setIOMode ( int  directionMode,
int  receiveMode 
)

This function controls enabling of objects in Receive Mode and Polling Group frames on the panel depending on the choosen Direction and Receive Mode.

Parameters
directionModedirection mode (Output, Input, Input/Output)
receiveModereceive mode (Unsolicited, Polling, Single Query, Alarm)