Go to documentation repository
The BACNET object corresponds to the BacNet system object.
The BACNET object generates events listed in the table below. Procedures start when the corresponding event occurs. The format of the event procedure for the BacNet object:
OnEvent("BACNET","_id_","_event_")
BACNET object events description:
Event | Description |
ERROR | Error message received |
EVENT_OCCURES | Message acknowledgment |
WRITE_OCCURES | Recording confirmation |
WRITE_RESULT | Recording result |
Operator format for describing actions with the BacNet object :
DoReact("BACNET","_id_","_command_" [,"_parameters_"]);
The list of commands and parameters for the BACNET object is presented in the table.
Command – description | Parameters | Parameters description |
WRITE – send value to BACnet device | bacnet_application_tag<> | Data type. Possible values: NULL = 0 BOOLEAN = 1 UNSIGNED INT = 2 SIGNED INT = 3 REAL = 4 DOUBLE = 5 OCTET STRING = 6 CHARACTER STRING = 7 BIT STRING = 8 |
bacnet_value<> | Parameter value | |
bacnet_objtype<> | Object type: ANALOG INPUT = 0 ANALOG OUTPUT = 1 ANALOG VALUE = 2 BINARY INPUT = 3 BINARY OUTPUT = 4 BINARY VALUE = 5 | |
bacnet_instance<> | BACnet unique global device identifier | |
bacnet_property_id<> | Property id | |
bacnet_device_id<> | BACnet device id in the system | |
EVENT – send message to BACnet device | event_type<> | Event type |
from_state<> | Change state from | |
to_state<> | Change state to | |
message_text<> | Event text |
The examples code is given in JScript, see The Script object. Programming using the JScript language
Write to an object using a script
var msg = CreateMsg(); //bacnet_application_tag var BACNET_APPLICATION_TAG_NULL = 0; var BACNET_APPLICATION_TAG_BOOLEAN = 1; var BACNET_APPLICATION_TAG_UNSIGNED_INT = 2; var BACNET_APPLICATION_TAG_SIGNED_INT = 3; var BACNET_APPLICATION_TAG_REAL = 4; var BACNET_APPLICATION_TAG_DOUBLE = 5; var BACNET_APPLICATION_TAG_OCTET_STRING = 6; var BACNET_APPLICATION_TAG_CHARACTER_STRING = 7; var BACNET_APPLICATION_TAG_BIT_STRING = 8; //bacnet_objtype var OBJECT_ANALOG_INPUT = 0; var OBJECT_ANALOG_OUTPUT = 1; var OBJECT_ANALOG_VALUE = 2; var OBJECT_BINARY_INPUT = 3; var OBJECT_BINARY_OUTPUT = 4; var OBJECT_BINARY_VALUE = 5; //bacnet_property_id var PROP_PRESENT_VALUE = 85; msg.StringToMsg("BACNETINT|1|WRITE"); msg.SetParam("bacnet_application_tag", BACNET_APPLICATION_TAG_UNSIGNED_INT); msg.SetParam("bacnet_value",30); msg.SetParam("bacnet_objtype",OBJECT_ANALOG_VALUE); msg.SetParam("bacnet_instance",0); msg.SetParam("bacnet_property_id",PROP_PRESENT_VALUE); msg.SetParam("bacnet_device_id",12345); DoReact(msg);
In case of successful script execution, an event will appear in the Debug window
Event : BACNETINT|1|WRITE_OCCURES|sender<Udp:47808>,slave_id<ASUS>,fraction<186>,invoke_id<43>,owner<ASUS>,module<bacnetint.vshost.exe>,date<27-11-18>,value<PROP_PRESENT_VALUE>,guid_pk<{E23BD6CB-19F2-E811-8B83-C860008A29F9}>,object_id<OBJECT_ANALOG_VALUE:0>,core_global<1>,adr<192.168.0.197:56747>,time<10:55:33>,source_guid<557367ce-19f2-e811-8b83-c860008a29f9>
Generate event
DebugLogString("Script2"); var msg = CreateMsg(); msg.StringToMsg("BACNETINT|1|EVENT"); msg.SetParam("event_type", "0"); msg.SetParam("from_state", "1"); msg.SetParam("to_state", "0"); msg.SetParam("message_text", "test_text1!"); DoReact(msg);
If the module receives an event, the following event will be displayed in the Debug window:
Event : BACNETINT|1|EVENT_OCCURES|sender<Udp:47808>,slave_id<ASUS>,fraction<683>,owner<ASUS>,event_type<EVENT_CHANGE_OF_BITSTRING>,module<bacnetint.vshost.exe>,message_text<test_text1!>,date<27-11-18>,guid_pk<{6D34BA08-1CF2-E811-8B83-C860008A29F9}>,from_state<EVENT_STATE_FAULT>,core_global<1>,adr<192.168.0.197:57878>,to_state<EVENT_STATE_NORMAL>,time<11:11:34>,source_guid<bd51a40d-1cf2-e811-8b83-c860008a29f9>
Read indicators from an object
var msg = CreateMsg(); //bacnet_application_tag var BACNET_APPLICATION_TAG_NULL = 0; var BACNET_APPLICATION_TAG_BOOLEAN = 1; var BACNET_APPLICATION_TAG_UNSIGNED_INT = 2; var BACNET_APPLICATION_TAG_SIGNED_INT = 3; var BACNET_APPLICATION_TAG_REAL = 4; var BACNET_APPLICATION_TAG_DOUBLE = 5; var BACNET_APPLICATION_TAG_OCTET_STRING = 6; var BACNET_APPLICATION_TAG_CHARACTER_STRING = 7; var BACNET_APPLICATION_TAG_BIT_STRING = 8; //bacnet_objtype var OBJECT_ANALOG_INPUT = 0; var OBJECT_ANALOG_OUTPUT = 1; var OBJECT_ANALOG_VALUE = 2; var OBJECT_BINARY_INPUT = 3; var OBJECT_BINARY_OUTPUT = 4; var OBJECT_BINARY_VALUE = 5; var OBJECT_CHARACTERSTRING_VALUE = 40; //bacnet_property_id var PROP_PRESENT_VALUE = 85; msg.StringToMsg("BACNETINT|1|READ"); msg.SetParam("bacnet_objtype",OBJECT_ANALOG_INPUT); msg.SetParam("bacnet_instance",0); msg.SetParam("bacnet_property_id",PROP_PRESENT_VALUE); msg.SetParam("bacnet_device_id",123456); DoReact(msg);
In case of successful reading, the following event will be displayed in the Debug window:
Event :
BACNETINT|1|READ_RESULT|slave_id<example>,fraction<387>,owner<example>,module<bacnetint.run>,date<10-11-21>,
guid_pk<{622928D6-3349-EC11-96F2-309C23D50163}>,core_global<1>,bacnet_value<20,8>,
time<15:26:03>,param0<ok>,source_guid<e8f7ded1-3349-ec11-96f2-309c23d50163>