04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Section 7. Installation<br />

'Global variables (Used only outside subroutine by choice)<br />

'Declare Counter in the Main Scan.<br />

Public counter(2) As Long<br />

'Declare Product of PI * counter(2).<br />

Public pi_product(2) As Float<br />

'Global variable (Used only in subroutine by choice)<br />

'For / Next incrementor used in the subroutine.<br />

Public i_sub As Long<br />

'Declare Data Table<br />

DataTable(pi_results,True,-1)<br />

Sample(1,counter(),IEEE4)<br />

EndTable<br />

'Declare Subroutine<br />

'Declares j(4) as local array (can only be used in subroutine)<br />

Sub ProcessSub (j(2) As Long,OutVar(2) As Float)<br />

For i_sub = 1 To 2<br />

j(i_sub) = j(i_sub) + 1<br />

'Processing to show functionality<br />

OutVar(i_sub) = j(i_sub) * 4 * ATN(1) '(Tip: 4 * ATN(1) = pi to IEEE4 precision)<br />

Next i_sub<br />

EndSub<br />

BeginProg<br />

counter(1) = 1<br />

counter(2) = 2<br />

Scan(1,Sec,0,0)<br />

'Pass Counter() array to j() array, pi_pruduct() to OutVar()<br />

Call ProcessSub (counter(),pi_product())<br />

CallTable pi_results<br />

NextScan<br />

EndProg<br />

7.8.5 Wind Vector<br />

The WindVector() instruction processes wind-speed and direction measurements<br />

to calculate mean speed, mean vector magnitude, and mean vector direction over a<br />

data storage interval. Measurements from polar (wind speed and direction) or<br />

orthogonal (fixed East and North propellers) sensors are supported. Vector<br />

direction and standard deviation of vector direction can be calculated weighted or<br />

unweighted for wind speed.<br />

7.8.5.1 OutputOpt Parameters<br />

In the <strong>CR1000</strong> WindVector() instruction, the OutputOpt parameter defines the<br />

processed data that are stored. All output options result in an array of values, the<br />

elements of which have _WVc(n) as a suffix, where n is the element number. The<br />

array uses the name of the Speed/East variable as its base. table OutputOpt<br />

Options (p. 189) lists and describes OutputOpt options.<br />

188

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!