Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The BACNET object corresponds to the BacNet system object.

The BACNET object generates sends events listed presented in the table below. Procedures start are started when the corresponding event occurs. The format of the event procedure for the BacNet object:

Code Block
OnEvent("BACNET","_id_","_event_")

BACNET object events description:

 

EventEvent descriptionEventDescription
ERRORError message received
EVENT_OCCURES

Message acknowledgmentMessage confirmation

WRITE_OCCURES

Recording confirmation
WRITE_RESULTRecording result

 Operator format for describing actions with the BacNet object :

Code Block
DoReact("BACNET","_id_","_command_" [,"_parameters_"]);

The list List of commands and parameters for the BACNET object is presented in the table.:

Command
description
ParametersParameters description

WRITE

send a value to the 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
ID

bacnet_device_id<>

BACnet device
id
ID in the system
EVENT –
EVENTsend a message to the BACnet device

event_type<>

Event type

from_state<>

Change state from

to_state<>

Change state to

message_text<>

Event text

 Examples

The examples code is given in JScript, see The Script object. Programming using the JScript language.

Write to an object using a script

Code Block
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 :

...

Code Block
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

Code Block
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:

...