Worstcase example, Worstcase parameters – Campbell Scientific CR9000X Measurement and Control System User Manual
Page 194

Section 6. Data Table Declarations and Output Processing Instructions
Parameter
& Data Type
Enter
WORSTCASE PARAMETERS
TableName
name
The name of the data table to clone. The length of this name should be 4 characters or less so the
complete names of the worst case tables are retained when collected (see NumCases).
NumCases
The number of “worst” cases to store. This is the number of clones of the data table to create. The
cloned tables use the name of the table being cloned (up to the first 6 characters) plus a 2 digit number
(e.g., Evnt01, Evnt02, Evnt03, …). The numbers give the tables unique names, they have no
relationship to the ranking of the events. RTDAQ uses this same name modification when creating a
new data file for a table. To avoid confusion and ambiguous names when collecting data with RTDAQ,
keep the base name four characters or less (4character base name + 2 digit case identifier + 2 digit
collection identifier = 8 character maximum length).
MaxMin
A code specifying whether the maximum or minimum events should be saved.
Constant
Value Result
0
Min, save the events using minimum ranking; (i.e., Keep track of the
RankVar associated with each event stored. If a new RankVar is less
than the highest ranked minimum event, copy this highest ranked
minimum event over with the new minimum event).
1
Max, save the events associated with the maximum ranking; i.e., copy
if the new RankVar is greater than previous lowest ranking variable
(over event with previous minimum)
Change
Constant
The minimum change that must occur in the RankVariable before a new worst case is stored.
RankVar
Variable
The Variable to rank the events by.
WorstCase Example
This program demonstrates the Worst Case Instruction. The trigger for the start of a data event is when TC(1) exceeds
30 degrees C. To use the worst case instruction with events of varying duration, the event table size must be selected
to accommodate the maximum duration expected (or needed).The ranking criteria is the max temperature that TC(1)
sees during the triggered event. The greater the temperature the “worse” the event.
Const RevDiff= 1 : Const Del= 40 : Const Integ= 70 : Const NumCases= 5 : Const Max= 1
Public RefTemp, TC(5) : Units RefTemp=degC : Units TC=degC
Public I, MaxTemp
'
Declare index and the ranking variable
DataTable (Evnt,1,10)
DataInterval(0,0,msec,10)
'
Set the sample interval equal to the scan
DataEvent(1,TC(1)>30,-1,8)
'
1 records before TC(1)>30, 8 records after TC(1)>30
Sample(1,RefTemp,IEEE4)
'
Sample the reference temperature
Sample(5,TC,IEEE4)
'
Sample the 5 thermocouple temperatures
EndTable
BeginProg
Scan(500,mSec,0,0)
ModuleTemp(RefTemp,1,4,30)
TCDiff(TC(),5,mV50C,4,1,TypeT,RefTemp,RevDiff,Del,Integ,1,0)
CallTable Evnt
If Evnt.EventEnd(1,1)
'Check if an Event just Ended
MaxTemp = 0
'Initialize MaxTemp below lowest threshold possible
For I = 1 To 10
'Loop through TC measurements to find event max
If Evnt.TC(1,I) > MaxTemp Then MaxTemp = Evnt.TC(1,I)
Next I
WORSTCASE
(Evnt,NumCases,Max,0,MaxTemp)
'Check for worst case
EndIf
NextScan
EndProg
6-10