Primitive Value Objects
Primitive Value objects can be used to represent simple data types, such as strings, integer values, or for date or time specifications.
For dates, according to the BACnet standard, the year starts from 1900. The Month element can contain odd (13) and even (14) months in addition to the regular month information. The day of the month may include odd (33) and even (34) days of the month, as well as the last day (32) of the month, in addition to the regular day information.
When specifying specific dates, it is important that the day of the week matches the specified date.
For clock times, the range is 0-23 hours, 0-59 minutes, 0-59 seconds, and 0-99 hundredths of a second.
The value 255 stands as a placeholder for any value (e.g. every year or every hour) for the objects of the type Pattern. For the enumeration types, the enumerated value Unspecified can be used alternatively.
Variables
fbPositiveInteger : FB_BACnet_INT;
fbLargeAnalog : FB_BACnet_LAV;
fbCharacterString : FB_BACnet_String;
fbUnsignedInteger : FB_BACnet_UINT;
nValue : INT := 15;
fValue : LREAL := 42.3;
sValue : STRING := 'TwinCAT BACnet';
uiValue : UINT := 12345;
fbDate : FB_BACnet_Date;
fbDatePattern : FB_BACnet_DateP;
fbDateTime : FB_BACnet_DateTime;
fbDatetimePattern : FB_BACnet_DateTimeP;
fbTime : FB_BACnet_Time;
fbTimePattern : FB_BACnet_TimeP;
// specific date
stDate : ST_BA_Date := ( nYear := 122, eMonth := E_BA_MONTH.eDecember, nDay := E_BA_DAY.eDay02, eDayOfWeek := E_BA_WEEKDAY.eFriday );
// every year christmas eve (regardsless of the day of week)
stDatePattern : ST_BA_Date := ( nYear := 255, eMonth := E_BA_MONTH.eDecember, nDay := E_BA_DAY.eDay24, eDayOfWeek := E_BA_WEEKDAY.Unspecified );
// specific date and specific time
stDateTime : ST_BA_DateTime := (
stDate := ( nYear := 122, eMonth := E_BA_MONTH.eDecember, nDay := E_BA_DAY.eDay02, eDayOfWeek := E_BA_WEEKDAY.eFriday ),
stTime := ( nHour := 17, nMinute := 53, nSecond := 42, nHundredths := 19 ) );
// every year where the 1st of May is a Monday each hour / minute at 11 seconds
stDateTimePattern : ST_BA_DateTime:= (
stDate := ( nYear := 255, eMonth := E_BA_MONTH.eMay, nDay := E_BA_DAY.eDay01, eDayOfWeek := E_BA_WEEKDAY.eMonday ),
stTime := ( nHour := 255, nMinute := 255, nSecond := 11, nHundredths := 0 ) );
// specific time
stTime : ST_BA_Time := ( nHour := 11, nMinute := 42, nSecond := 38, nHundredths := 45 );
// every hour at minute 42
stTimePattern : ST_BA_Time := ( nHour := 255, nMinute := 42, nSecond := 0, nHundredths := 0 );
Code
fbPositiveInteger.nValue := nValue;
fbPositiveInteger();
fbLargeAnalog.fValue := fValue;
fbLargeAnalog();
fbCharacterString.sValue := sValue;
fbCharacterString();
fbUnsignedInteger.nValue := uiValue;
fbUnsignedInteger();
fbDate.stValue := stDate;
fbDate();
fbDatePattern.stValue := stDatePattern;
fbDatePattern();
fbDateTime.stValue := stDateTime;
fbDateTime();
fbDatetimePattern.stValue := stDateTimePattern;
fbDatetimePattern();
fbTime.stValue := stTime;
fbTime();
fbTimePattern.stValue := stTimePattern;
fbTimePattern();