Campbell Scientific CR10 CR10 Measurement and Control - Page 119

Final Storage Areas, Saving Data

Page 119 highlights

SECTION 8. PROCESSING AND PROGRAM CONTROL EXAMPLES 8.8 USE OF 2 FINAL STORAGE AREAS . SAVING DATA PRIOR TO EVENT One of the uses of 2 Final Storage Areas is to save a fixed amount of data before and after some event. ln this example,,a load cell is measured every second. lt is assumed that at some random intervalthe load willexceed 25 pounds for less than 10 seconds. Exceeding 25 pounds is the event to be captured. The data from the 10 seconds before the event and 10 seconds after the event is to be saved (21 seconds including the scan in which the load first exceeds 25 pounds). Every second the load cell is measured; hoursminutes, seconds, and the load are output to Final Storage Area 2 (4 values with the Array lD). 84 locations are allocated to Final Storage Area2. Thus, Area 2 holds 21 seconds (4 values/second x 21 seconds = 84 locations). When 25 pounds is exceeded, 10 is loaded into an input location and flag 1 is set high. The input location is used as a down counter. The flag indicates an event has occurred and prevents the input location from being reloaded until 11 seconds have passed. The down counter is decremented by 1 each time the table is executed. When it equals 0 all the data in Final Storage Area2 is transferred to Final Storage Area 1 (using lnstruction 96) and Flag 1 is set low. The down counter is set to 10 instead of 11 because it is decremented after checking to see if it is 0. Input Location Labels: 1:FORCE LBS 2:DOWN CNT * 1 01: 1 TablelPrograms Sec. Execution lnterval 01: 01: 02: 03: 04: 05: 06: Q7: 08: PG FullBridge 1 Rep 22 7.5 mV 60 Hz rejection Range 1 lN Chan 1 Excite all reps w/EXchan 1 25OO mV Excitation 1 Loc [:FORCE LBSI 33.333 Mult 0 Offset 02: P86 01: 10 03: P80 01: 2 O2: 10 04: P77 01: 11 05: P70 01: 1 02: 1 06: P89 01: 1 02: 3 03: 25 04; 30 07: P91 01: 21 02: 30 0081: : P86 11 09: P30 01: 02: 10 0 03: 2 10: P95 11: P95 12: P89 01: 2 02: 1 03: 0 04: 30 13: P91 01: 11 02: 30 14: P96 01: 81 15: P86 01: 21 16: P95 17: P94 18: P34 01: 2 Q2: -1 03: 2 19: P95 Do Set high Flag 0 (output) Set Active Storage Area FinalStorage Area2 Anay lD or location RealTime Hour-Minute,Seconds Sample Reps Loc FORCE LBS lf XF X Loc FORCE LBS >= F Then Do lf Flag/Port Do if flag 1 is low Then Do Do Set high Flag 1 Z=F F Exponent of 10 Z Loc [:DOWN CNT ] End End lf XF X Loc DOWN CNT F Then Do lf Flag/Port Do if flag 1 is high Then Do SerialOutput All data to other FS Area Do Set low Flag 1 End Else Z=X+F X Loc DOWN CNT F Z Loc [:DOWN CNT ] End End Table 1 8-9

  • 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
8.8
USE OF
2 FINAL STORAGE AREAS
.
SAVING DATA
PRIOR
TO
EVENT
One
of
the
uses
of
2
Final Storage
Areas
is
to
save
a
fixed
amount of
data
before and
after
some event.
ln this example,,a load cell is measured every
second.
lt
is assumed
that
at
some
random
intervalthe
load
willexceed
25
pounds
for
less
than
10
seconds.
Exceeding
25
pounds
is
the
event
to
be
captured.
The data from
the
10
seconds before the event
and
10
seconds
after
the
event
is
to
be
saved
(21
seconds
including
the scan in which
the
load first exceeds 25
pounds).
Every second the load cell is measured; hours-
minutes, seconds, and
the
load are output
to
Final Storage Area
2
(4
values with the Array
lD).
84
locations
are
allocated
to
Final Storage
Area2.
Thus, Area
2
holds
21 seconds
(4
values/second x 21 seconds
=
84
locations).
When
25 pounds
is
exceeded,
10
is loaded into
an
input location and
flag
1
is set
high.
The
input location is used as a down
counter.
The
flag
indicates an
event
has occurred and
prevents
the
input location
from being
reloaded
until
11
seconds
have passed.
The down
counter
is
decremented by
1
each
time the
table
is
executed.
When
it
equals
0
all
the
data
in
Final
Storage Area2
is
transferred
to
Final Storage
Area
1
(using lnstruction 96) and
Flag
1 is
set
low.
The
down
counter
is set
to
10
instead
of
11
because it is decremented after checking
to
see
if it
is 0.
Input Location Labels:
1:FORCE LBS
2:DOWN CNT
*
1
TablelPrograms
01:
1
Sec. Execution lnterval
PG
FullBridge
1
Rep
22
7.5
mV
60
Hz rejection Range
1
lN Chan
1
Excite
all
reps
w/EXchan
1
25OO
mV Excitation
1
Loc
[:FORCE
LBSI
33.333
Mult
0
Offset
03:
P80
01:
2
O2:
10
04:
P77
01:
11
05:
P70
01:
1
02:
1
02:
P86
01:
10
13:
P91
01:
11
02:
30
14:
P96
01:
81
15:
P86
01:
21
16:
P95
17:
P94
18:
P34
01:
2
Q2:
-1
03:
2
19:
P95
Do
Set high Flag
0
(output)
Set Active Storage Area
FinalStorage Area2
Anay
lD
or
location
RealTime
Hour-Minute,Seconds
Sample
Reps
Loc
FORCE LBS
lf X<=>F
X
Loc FORCE LBS
>=
F
Then
Do
lf
Flag/Port
Do
if
flag
1
is low
Then
Do
Do
Set high
Flag
1
Z=F
F
Exponent
of
10
Z
Loc
[:DOWN
CNT
]
End
End
lf X<=>F
X Loc DOWN
CNT
F
Then
Do
lf
Flag/Port
Do
if
flag
1
is high
Then
Do
SerialOutput
All
data
to other
FS
Area
Do
Set low
Flag
1
End
Else
Z=X+F
X Loc
DOWN CNT
F
Z
Loc
[:DOWN
CNT
]
End
End
Table
1
06:
P89
01:
1
02:
3
03:
25
04;
30
07:
P91
01:
21
02:
30
08:
P86
01:
11
09:
P30
01:
10
02:
0
03:
2
10:
P95
11:
P95
12:
P89
01:
2
02:
1
03:
0
04:
30
01:
01:
02:
03:
04:
05:
06:
Q7:
08:
8-9