beautypg.com

Campbell Scientific CR23X Micrologger User Manual

Page 117

background image

SECTION 8. PROCESSING AND PROGRAM CONTROL EXAMPLES

8-7

08:

Scaling Array (A*Loc+B) (P53)
1:

5

Start Loc [ WS_out ]

2:

10

A1 ;Scale WS, 0 to 100
mph = 0 to 1000 mV

3:

0

B1

4:

1.8519

A2 ;Scale WD, 0 to 540
deg = 0 to 1000 mV

5:

0

B2

6:

25

A3 ;Scale Temp, 0 to 40
C = 0 to 1000 mV

7:

0

B3

8: 1000

A4 ;Scale Rad, 0 to 1 KW
= 1 to 1000 mV

9:

0

B4

09:

SDM-A04 (P103)
1:

4

Reps

2:

30

Address

3:

5

Loc [ WS_out ]

10:

If time is (P92)
1:

0

Minutes (Seconds --) into a

2:

60

Interval (same units as above)

3:

10

Set Output Flag High

11:

Wind Vector (P69)
1:

1

Reps

2:

180

Samples per Sub-Interval

3:

00

S, é1, & е(й1) Polar

4:

1

Wind Speed/East Loc
[ WS ]

5:

2

Wind Direction/North Loc
[ 0_360_WD ]

12:

Average (P71)
1:

2

Reps

2:

3

Loc [ Ta ]

INPUT LOCATIONS

1 WS
2 0_360_WD
3 Ta
4 Rs
5 WS_out
6 WD_out
7 Ta_out
8 Rs_out

8.7 CONVERTING 0-360 WIND

DIRECTION OUTPUT TO 0-540 FOR
STRIP CHART

If 0-360 degree wind direction is output to a strip
chart the discontinuity at 0/360 will cause the pen
to jump back and forth full scale when the winds
are varying from the north. In the days of strip
charts this was solved with a 0-540 degree pot on
the wind vane (direction changes from 540 to 180
and from 0 to 360 so the pen only jumps once
when the wind is out of the north or south).

When faced with the necessity of strip chart
output (see previous example), the following
algorithm can be used to change a 0-360
degree input to 0-540. (If you have a 0-540 pot,
it can be used with the CR23X since the Wind
Vector Instruction, 69, will work with this output.)

To change 0-360 degrees to the 0-540 degrees,
360 degrees must sometimes be added to the
reading when it is in the range of 0 to 180. The
following algorithm does this by assuming that if
the previous reading was less than 270, the vane
has shifted through 180 degrees and does not
need to be altered. If the previous 0-540 reading
was greater than 270, 360 degrees is added.

This example is written as a subroutine which is
used by the previous example to output an
analog voltage to a strip chart.

*

Table 3 Subroutines

01:

Beginning of Subroutine (P85)
1:

1

Subroutine 1

02:

IF (X<=>F) (P89)
1: 10

X Loc [ 0_540_WD ]

2:

3

>=

3: 270

F

4: 30

Then Do

03:

Do (P86)
1: 11

Set Flag 1 High

04:

Else (P94)

05:

Do (P86)
1: 21

Set Flag 1 Low

06:

End (P95)