3 programming for data-acquisition, Crbasic example 67. implementation of dnp3, P. 371) – Campbell Scientific CR3000 Micrologger User Manual

Page 371

Advertising
background image

Section 8. Operation

371

 

8.6.1.2.3 Programming for Data-Acquisition

As shown in CRBasic example Implementation of DNP3

(p. 371),

program the

CR3000 to return data when polled by the DNP3 master using the following three
actions:

1. Place DNP() at the beginning of the program between BeginProg and Scan().

Set COM port, baud rate, and DNP3 address.

2. Setup the variables to be sent to the master using DNPVariable(). Dual

instructions cover static (current values) and event (previous ten records) data.

o For analog measurements:

DNPVariable

(Variable_Name,Swath,30,2,0,&B00000000,0,0)

DNPVariable

(Variable_Name,Swath,32,2,3,&B00000000,0,10)

o For digital measurements (control ports):

DNPVariable

(Variable_Name,Swath,1,2,0,&B00000000,0,0)

DNPVariable

(Variable_Name,Swath,32,2,3,&B00000000,0,10)

3. Place DNPUpdate() after Scan(), inside the main scan. The DNP3 master is

notified of any change in data each time DNPUpdate() runs; e.g., for a 10
second scan, the master is notified every 10 seconds.

CRBasic Example 67. Implementation of DNP3 

Public

IArray(4)

As Long

Public

BArray(2)

As Boolean

Public

WindSpd

Public

WindDir

Public

Batt_Volt

Public

PTemp_C

Units

WindSpd=meter/Sec

Units

WindDir=Degrees

Units

Batt_Volt=Volts

Units

PTemp_C=Deg C

'Main Program

BeginProg

'DNP communication over the RS-232 port at 115.2kbps. Datalogger

'DNP address is 1

DNP

(COMRS-232,115200,1)

'DNPVariable(Source, Swath, DNPObject, DNPVariation, DNPClass, DNPFlag,

'DNPEvent, DNPNumEvents)

DNPVariable

(IArray,4,30,2,0,&B00000000,0,0)

'Object group 30, variation 2 is used to return analog data when the CR3000

'is polled. Flag is set to an empty 8 bit number(all zeros), DNPEvent is a

'reserved parameter and is currently always set to zero. Number of events is

'only used for event data.

DNPVariable

(IArray,4,32,2,3,&B00000000,0,10)

DNPVariable

(BArray,2,1,1,0,&B00000000,0,0)

DNPVariable

(BArray,2,2,1,1,&B00000000,0,1)

Advertising