Campbell Scientific CR10 CR10 Measurement and Control - Page 118

To 0-540, Chart

Page 118 highlights

SECTION 8. PROCESSING AND PROGRAM CONTROL EXAMPLES 09: P 01: 4 02: 30 03: 5 10: P92 01: 0 02: 60 03: 10 11: P69 01: 1 02: 180 03: 00 04: 1 05: 2 12: P71 01: 2 A2: 3 13: P 103SDM-AO4 Reps Address Loc WS output lf time is minutes into a minute interval Set high Flag 0 (output) Wind Vector Rep Samples per sub-interval Polar Sensor/(S ,D1, SD1) Wind Speed/East Loc WS Wind Direction/North Loc 0-360 wD Average Reps Loc Ta End Table 1 8.7 CONVERTING 0.360 WIND DIRECTION OUTPUT TO 0-540 FOR STRIP CHART lf 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. (lf you have a 0-540 pot, it can be used with the CR10 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 27O, the vane has shifted through 180 degrees and does not need to be altered. lf 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. Input Location Labels: 2:0-360 WD 6:0-540 out 10:0-540 WD *3 01: P85 01: 1 Table 3 Subroutines Beginning of Subroutine Subroutine Number 02: P89 01: 10 02: 3 03: 270 O4: 30 lf XF X Loc 0-540 WD >= F Then Do 03: P86 01: 11 Do Set high Flag 1 04: P94 Else 05: P86 01: 21 Do Set low Flag 1 06: P95 End 07: P31 01: 2 O2: 10 Z=X X Loc 0-360 WD Z Loc [:0-540 WD] 08: P89 01: 10 o2: 4 03: 180 o4: 30 lf XF X Loc 0-540 WD F Then Do 09: P91 01: 11 02: 30 lf Flag/Port Do if flag 1 is high Then Do 10: P34 01: 10 02: 360 03: 10 Z=X+F X Loc 0-540 WD F Z Loc [:0-540 WD] 11: P31 01: 10 02: 6 Z=X X Loc 0-540 WD Z Loc [:0-540 out] P95 End 13: P9s End 't4: P95 End 15: P End Table 3 8-8

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238

SECTION
8.
PROCESSING
AND
PROGRAM
CONTROL EXAMPLES
09:
P
01:
4
02:
30
03:
5
10:
P92
01:
0
02:
60
03:
10
11:
P69
01:
1
02:
180
03:
00
04:
1
05:
2
12:
P71
01:
2
A2:
3
103SDM-AO4
Reps
Address
Loc
WS
output
lf
time
is
minutes into
a
minute interval
Set high Flag
0
(output)
Wind
Vector
Rep
Samples per sub-interval
Polar
Sensor/(S
,D1,
SD1)
Wind Speed/East
Loc WS
Wind
Direction/North Loc
0-360
wD
Average
Reps
Loc
Ta
13:
P
End
Table
1
8.7
CONVERTING
0.360
WIND
DIRECTION OUTPUT
TO 0-540
FOR
STRIP
CHART
lf 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.
(lf
you
have
a
0-540
pot,
it
can be
used with
the
CR10 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
27O,
the vane
has shifted
through
180 degrees and
does
not
need
to
be
altered.
lf
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.
>=
F
Then
Do
*3
01:
P85
01:
1
02:
P89
01:
10
02:
3
03:
270
O4:
30
03:
P86
01:
11
04:
P94
Input Location Labels:
2:0-360 WD
6:0-540 out
10:0-540 WD
05:
P86
01:
21
06:
P95
07:
P31
01:
2
O2:
10
08:
01:
o2:
03:
o4:
09:
01:
02:
10:
01:
02:
03:
11:
01:
02:
Table 3 Subroutines
Beginning of Subroutine
Subroutine Number
lf X<=>F
X Loc 0-540 WD
Do
Set high Flag
1
Else
Do
Set low Flag
1
End
Z=X
X
Loc 0-360 WD
Z
Loc
[:0-540
WD]
lf X<=>F
X Loc 0-540
WD
F
Then
Do
lf
Flag/Port
Do
if
flag
1
is high
Then
Do
Z=X+F
X
Loc 0-540 WD
F
Z
Loc
[:0-540
WD]
Z=X
X
Loc 0-540 WD
Z Loc
[:0-540
out]
End
End
Table
3
End
End
P89
10
4
180
30
P91
11
30
P34
10
360
10
P31
10
6
P95
P9s
P95
P
13:
't4:
15:
8-8