Beruflich Dokumente
Kultur Dokumente
C o p y r i g h t © 2 0 1 0 - 2 0 1 1
C a m p b e l l S c i e n t i f i c , I n c .
Table of Contents
PDF viewers note: These page numbers refer to the printed version of this document. Use
the Adobe Acrobat® bookmarks tab for links to specific sections.
2. DAQ Components.....................................................2-1
2.1 Datalogger Comparisons and Selection ............................................ 2-1
2.1.1 Datalogger Descriptions (listed from smallest to largest)...... 2-4
2.1.1.1 CR200X-series Datalogger/Wireless Sensor ................. 2-4
2.1.1.2 CR800-series Measurement and Control System......... 2-4
2.1.1.3 CR1000 Measurement and Control System.................. 2-5
2.1.1.4 CR3000 Measurement and Control System.................. 2-8
2.1.1.5 CR5000 Measurement and Control System................ 2-10
2.1.1.6 CR9000X Measurement and Control System............. 2-12
2.1.2 Datalogger Measurement Support Comparison .................. 2-14
2.1.3 Specifications ........................................................................... 2-20
2.1.3.1 Specification Terminology ............................................ 2-20
2.1.3.2 CR1000 Specifications................................................... 2-22
2.2 CR1000 Memory............................................................................... 2-25
2.2.1 Storage Media ......................................................................... 2-25
2.2.2 Data Storage ............................................................................ 2-27
2.2.2.1 CPU: Drive..................................................................... 2-27
2.2.2.2 USR: Drive ..................................................................... 2-28
2.2.2.3 CRD: Drive .................................................................... 2-28
2.2.2.4 USB: Drive ..................................................................... 2-29
2.2.3 Default Tables ......................................................................... 2-29
2.2.4 Memory Conservation ............................................................ 2-30
2.2.5 Memory Reset ......................................................................... 2-30
2.2.5.1 Full Memory Reset ........................................................ 2-30
2.2.5.2 Program Send Reset...................................................... 2-31
2.2.5.3 Manual Data Table Reset ............................................. 2-31
i
Table of Contents
ii
Table of Contents
iii
Table of Contents
iv
Table of Contents
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
ix
Table of Contents
x
Table of Contents
xi
Table of Contents
xii
Table of Contents
xiii
Table of Contents
xiv
Table of Contents
xv
Table of Contents
Appendices
A. Glossary ...................................................................A-1
A.1 Terms ................................................................................................. A-1
A.2 Concepts........................................................................................... A-11
A.2.1 Accuracy, Precision, and Resolution ................................... A-11
B. Power Supplies........................................................B-1
xvi
Table of Contents
xvii
Table of Contents
xviii
Section 1. Data Acquisition Systems
1.1 Know the Issues that NEED Investigation and Why
1.1.1 Principle Body Requesting the Information
Know up front who is requesting the data, the purpose for the monitoring, who
will be responsible for the data collection/storage, and who will be responsible
for analyzing the data. Consider the following questions:
Know the locations and proximities of the measurement points. Know the
critical points and locations that might need redundant sensors/measurements.
You should also verify the accuracy and resolution requirements for the
various measurements.
1-1
Section 1. Data Acquisition Systems
SENSOR COMPATIBILITY/COUNT
• Physical Phenomena to be measured DATA LOGGER SELECTION
• Sensor Selection • Measurement Rate SUPPORT SOFTWARE
• Excitation Requirements • Excitation Required • Data Logger Used
• Measurement Rate • Sensor Output • Level of Programming required
• Sensor Output • Channel Count • Communication Device Support
• Test Duration • Real Time Viewing Requirements
• Publish to a Web Page
• Network of Loggers?
• Scheduled Data Collection
SENSOR INTERFACES & EXPANSION
DEVICES
• Vibrating Wire: AVW1, AVW100
• Bridges: Terminal Input Modules
• Multiplexers
• Synchronous Devices for Measurement
COMMUNICATION
OPTIONS
• Direct
• PDA
• Ether Net
POWER SUPPLIES • Landline Modem
• Battery Backup
• Voice Synthesizer
• AC Power Availability • Cell Phone Coverage
MEMORY OPTIONS • Solar Panels
• Data Storage Rate
• Radios
• Vehicle Power • Satellite
• Data Resolution • Deep Discharge Battery • Short Haul Modem
• Interval between Collections
1-2
Section 1. Data Acquisition Systems
1.2.3 Datalogger
Dataloggers can measure almost any sensor with an electrical output.
Dataloggers read electrical signals and convert them into engineering units,
perform calculations and reduce data using statistical methods.
1. Number and type of sensors. What type of signal is output from the
sensors? What type and level of excitation do the sensors require? Can
multiplexers be utilized for the sensors being used?
2. Measurement rate. How often do the sensors need be measured and at
what rate will the data be stored. This should be considered in conjunction
with the number of sensors being measured to determine the aggregate
measurement rate.
3. Resolution. What level of measurement resolution is required?
4. Test duration and environmental conditions. How long will the logger
have to be on site making measurements? What temperature extremes will
it have to endure?
1. Number and resolution of data points to be stored per data storage output
time period. Is the data to be stored in high resolution (4 bytes per datum)
or low resolution (2 bytes per datum)? Don’t forget to take into account
the time stamp and record number memory requirements (12 bytes).
2. Data Storage Rate. At what rate will the data be stored? Will there be
more than one data table?
3. Time between data collection. What duration will the storage media be
required to fill before ringing? How long between data collections.
1-3
Section 1. Data Acquisition Systems
1. Is AC power available?
2. If sensors require excitation, what stress does this put on the power
supply?
3. For longer term monitoring applications without AC power will a deep
discharge battery and/or Solar panel be needed? If so what battery
capacity and solar panel size is required?
See Appendix B for an application note on power supplies along with help on
selecting solar panel size and battery capacity based on system’s power usage
and location latitude.
Data is copied, not moved, from the datalogger to the PC. Multiple users may
have access to the same datalogger without compromising the data or having to
coordinate collections.
1-4
Section 1. Data Acquisition Systems
1-5
Section 1. Data Acquisition Systems
1.2.7.1.1 EZSetup
As you work through the steps for the wizard, each screen has fields that are
completed with the pertinent information about your station. After you have
entered information for each field, press the Next button to move on to the next
step. Once you have moved to the next step, you may return to any previous
step(s) by pressing the Previous button.
Help is provided for each step of the wizard. This is accessed by pressing the
Help button.
After you have progressed through all steps of the wizard, press the Finish
button to save the configuration and return to the main EZSetup window. If
you want to change something in the datalogger setup, select that datalogger
from the main EZSetup window, and press the Edit button. The wizard will
open, and you can move through the steps using the Next button, or you can
navigate quickly to a particular page in the wizard by selecting it from the
Progress column.
The first time PC200W is opened after installation, the EZSetup Wizard is
opened. The Wizard can also be opened by clicking on the “Add Datalogger”
Icon on the toolbar.
1-6
Section 1. Data Acquisition Systems
Short Cut is a simple “program generator” software application for the PC that
creates datalogger programs based on sensors and output intervals you select.
There are several ways to write a datalogger program. The simplest is to use
Campbell Scientific’s program generator called Short Cut. For more complex
programming the CRBasic editor will be used.
1-7
Section 1. Data Acquisition Systems
sensors and choose output data. Short Cut then creates a program file for
transfer to the datalogger. Programs created by Short Cut can later be edited in
Short Cut or CRBasic.
Short Cut can be launched from the PC200W tool bar Icon or it can be
installed on its own.
There are four steps for generating or editing a program. The first step is to
identify the datalogger type (or, open an existing program) and specify a scan
rate. The next step is to specify the sensors to be measured. The third step is
to specify the type and frequency of data stored in datalogger memory. And
the fourth step is to generate the program and wiring diagram. The Wizard is
designed with a Progress panel down the left side of the page, which indicates
where you are in the process of generating a program. Navigation buttons at
the bottom of the page will move you sequentially through the steps.
Additionally, at any time during programming, you can move to another step
by choosing that step from the Progress panel.
1-8
Section 1. Data Acquisition Systems
Step 2. Sensors
• Default measurement (Battery Voltage)
• Add Wiring Panel Temperature. Note: A reference temperature in
degrees C is required for thermocouple measurements. Therefore, a
wiring panel temperature sensor must be selected and configured for
degrees C before adding a thermocouple.
• Add two Differential Type T Thermocouples (Degrees C)
• Next
Step 3. Outputs
• Select 5 second output rate for Table 1
• Rename Table 1 – “FiveSec”
• Store Average Thermocouple Temperatures
• Finish
Step 4. Finish
• Give the program a name and note where it is being stored. In the office,
it is recommended that you print out the Results, Summary and Wiring
Diagram or Text for your files.
• Do not send the program to the datalogger yet.
• Wire sensor according to the wiring diagram.
1-9
Section 1. Data Acquisition Systems
1-10
Section 1. Data Acquisition Systems
Exercise con’t: User entered expressions are supported under Step 2. Sensors.
Select “Step 2. Sensors” from the Progress Panel. Navigate to “User Entered”
under the Calculations & Control / Calculations folder. Add the following
expression:
Temp_F = Temp_C*1.8 + 32
1-11
Section 1. Data Acquisition Systems
After clicking OK you may edit your one minute output table (Step 3.
Outputs) to include the average temperature in degrees F.
Click on Finish and Send the Program to the datalogger. Using the Monitor
Data tab in PC200W, bring up Table 1 and the Public table and monitor the
sensor’s output in real time.
Exercise con’t: Collect data from logger and View data file using the View
utility.
1-12
Section 1. Data Acquisition Systems
Collect the data table “FiveSec” and view the historical data using View.
1-13
Section 1. Data Acquisition Systems
1-14
Section 2. DAQ Components
2.1 Datalogger Comparisons and Selection
Campbell Scientific manufactures a complete line of dataloggers that range in
size and complexity. Dataloggers vary in the supported scan rates, number and
type of input/output channels, analog resolution, and analog voltage accuracy.
• Measure sensors
• Process data onboard
• Initiate measurement and control functions based on time or event
• Control external devices such as pumps, motors, alarms, freezers, and
valves
• Operate independently of ac power, computers, and human interaction
• Use our PC support software to program the logger
• Consume minimal power from a 12 Vdc source
• Interface with on-site and telemetry devices
• Perform reliably under adverse conditions
To help customers choose the best datalogger for their application, we describe
below the different features of the dataloggers, provide a brief summary of
each datalogger model available, and include a chart that compares
measurement types supported among the dataloggers.
Analog Inputs 5 SE (no diff) 6 SE or 3 diff 16 SE or 8 diff 28 Se or 14 diff 40 SE or 20 diff 28 SE or 14 diff per CR9050,
CR9051E, or CR95055(E)
Switched 2 voltage 2 voltage 3 voltage 4 voltage, 3 current 4 voltage, 4 10 voltage per CR9060
Excitation current
Channels
Digital Ports 2 I/Os 4 I/Os or 2 8 I/Os or 4 RS- 1 SDM, 8 I/Os or 4 8 I/Os, 1 SDM 1 SDM, 8 outputs per CR9060
RS-232 232 COM RS-232 COM or 16 I/Os per CR9071
COM
2-1
Section 2. DAQ Components
Communication 1 RS-232 1 CS/IO, 1 1 CS/IO, 1 RS- 1 CS/IO, 1 RS-232, 1 CS/IO, 1 RS- 1 CS/IO, 1 RS-232,
/Data Storage RS-232 232, 1 Parallel 1 Parallel Peripheral 232
Ports Peripheral 1 10baseT/100baseT
Analog Voltage ± (0.25% of ± (0.06% of ± (0.06% of ± (0.04% of reading ± 0.05% FSR, 0º ± (0.07% of reading + 4 A/D
Accuracy reading + reading + reading + + offset), 0º to 40ºC to 40ºC counts), -25º to +50ºC
1.2mV offset), offset), 0º to offset), 0º to
-40º to +50ºC 40ºC 40ºC
A/D Bits 12 13 13 16 16 16
Weight (lbs) CR200X/295X 1.5 2.1 w/o battery 12.2 (w/battery), Lab enclosure:~30
0.5 3.6 4.5(w/o battery) Field enclosure:~40,
CR206X Alkaline battery CR9000XC:~27
CR211X/216X 8.3
0.6( Rechargeable Batt
10.7
SDI-12 yes yes yes yes yes No
Supported
2-2
Section 2. DAQ Components
Software Supported
Short Cut yes yes yes yes yes no
PC400 1.0 or higher 1.4 or higher 1.2 or higher 1.3 or higher 1.0 or higher 1.0 or higher
LoggerNet 2.1 or higher 3.3 or higher 3.0 or higher 3.2 or higher 2.0 or higher 2.0 or higher
2-3
Section 2. DAQ Components
Design Features: These are our smallest and lowest-cost dataloggers. The
input channel configuration of the CR200X-series dataloggers is optimal for
measuring one or two sensors. Three of the models include an internal spread
spectrum radio, which allows the dataloggers to be used as wireless sensors.
The CR200X series uses an external power supply.
Models Available: CR200X (no radio), CR206X (915 MHz radio), CR211X
(922 MHz radio), CR216X (2.4 GHz radio), CR295X (supports GOES satellite
telemetry).
2-4
Section 2. DAQ Components
Limitations: The CR800 series have fewer channels than the CR1000 and do
not have programmable switched current outputs or removable terminal strips.
The CR800 series also have no parallel peripheral port for the NL115/NL120
Ethernet Interface or the CFM100 CompactFlash Module. However, they do
support Ethernet communications via the NL100 Ethernet Interface.
Limitations: The CR1000 has fewer channels than the CR3000 and does not
have programmable switched current outputs or removable terminal strips.
2-5
Section 2. DAQ Components
Limitations: The CR1000 has fewer channels than the CR3000 and does not
have programmable switched current outputs or removable terminal strips.
2-6
Section 2. DAQ Components
2-7
Section 2. DAQ Components
Limitations: The CR3000 has fewer channels and a slower sampling rate than
the CR5000.
2-8
Section 2. DAQ Components
2-9
Section 2. DAQ Components
2-10
Section 2. DAQ Components
2-11
Section 2. DAQ Components
Models Available: Standard CR9000X includes the base system and slots for
up to nine I/O modules; the user chooses either the lab or environmental
enclosure. The CR9000XC includes the base system, slots for up to five I/O
modules, and an environmental enclosure.
2-12
Section 2. DAQ Components
2-13
Section 2. DAQ Components
Required
Measurement Peripheral Expansion
and Control Logger Standard Option or Module(s) Peripheral
CR510 2 Diff, 4 SE, 64 Hz None None Supported
CR10X 6 Diff, 12 SE, 64 Hz None AM16/32B, AM25T
12 Diff, 24 SE,
CR23X None AM16/32B, AM25T
100 Hz
5 SE, 0 V to 2.5 V,
CR200X None None Supported
6 mV resolution
± 2.5 V DC
Analog Input CR800/CR850 3 diff, 6 SE, 100 Hz None AM16/32B, AM25T
CR1000 8 Diff, 16 SE, 100 Hz None AM16/32B, AM25T
CR3000 14 Diff, 28 SE 100 Hz None AM16/32B, AM25T
20 Diff, 40 SE, 2000
CR5000 None AM16/32B, AM25T
Hz
To 126 Diff, 252 SE, CR9050(E), CR9051E,
CR9000X AM25T
100 kHz CR9052DC
CR510 2 Diff, 4 SE, 64 Hz VDIV2:1 TIM None Supported
CR10X 6 Diff, 12 SE, 64 Hz VDIV2:1 TIM AM16/32B, AM25T
12 Diff, 24 SE,
CR23X None AM16/32B, AM25T
100 Hz
CR200X Not Supported Not Applicable None Supported
2-14
Section 2. DAQ Components
2-15
Section 2. DAQ Components
2-16
Section 2. DAQ Components
2-17
Section 2. DAQ Components
2 Low Level + 1 Hi
CR510 None None Supported
Level Pulse Inputs
2 Low Level + 2 Hi
CR10X None SDM-INT8
Level Pulse Inputs
4 Low Level + 4 Hi
CR23X None SDM-INT8
Level Pulse Inputs
1 Low Level + 2 Hi
CR200X None None Supported
Level Pulse Inputs
Pulse
2 Low Level + 4 Hi
Counters CR800/CR850 None SDM-INT8
Level Pulse Inputs
2 Low Level + 8 Hi
CR1000 None SDM-INT8
Level Pulse Inputs
4 Low Level + 8 Hi
CR3000 None SDM-INT8
Level Pulse Inputs
2 Low Level + 2 Hi
CR5000 None SDM-INT8
Level Pulse Inputs
CR9000X 12 per CR9071E CR9071E SDM-INT8
CR510 Not Supported Not Applicable None Available
CR10X Requires Periph. Requires Periph. SDM-CD16AC, A21REL-12
CR23X Requires Periph. Requires Periph. SDM-CD16AC, A21REL-12
Relay CR200X Not Supported Not Applicable None Available
AC/DC CR800/CR850 Requires Periph. Requires Periph. SDM-CD16AC
Switching CR1000 Requires Periph. Requires Periph. SDM-CD16AC
CR3000 Requires Periph. Requires Periph. SDM-CD16AC
CR5000 Requires Periph. Requires Periph. SDM-CD16AC
CR9000X Requires Periph. Requires Periph. SDM-CD16AC
CR510 Supported None Required None Available
CR10X Supported None Required None Available
CR23X Supported None Required None Available
CR200X Supported None Required None Available
SDI-12
CR800/CR850 Supported None Required None Available
Communication
CR1000 Supported None Required None Available
CR3000 Supported None Required None Available
CR5000 Supported None Required None Available
CR9000X Not Supported Not Applicable None Available
CR510 1 9-pin RS-232 port None Required SDM-SI04
CR10X 1 9-pin RS-232 port None Required SDM-SI04
CR23X 1 9-pin RS-232 port None Required SDM-SI04
1 via 9-pin RS-232
CR200X None Required None Available
port
2 standard RX/TX
CR800/CR850 None Required SDM-SI01, SDM-SI04
pairs + one 9-pin
Serial Interface
4 standard RX/TX
CR1000 None Required SDM-SI01, SDM-SI04
pairs + one 9-pin
4 standard RX/TX
CR3000 None Required SDM-SI01, SDM-SI04
pairs + one 9-pin
1 via 9-pin RS-232
CR5000 None Required None Available
port
1 via 9-pin RS-232
CR9000X None Required SDM-SI04
port
2-18
Section 2. DAQ Components
4WFB120, 4WFB350 if
CR510 2 Standard None Available
completion required
4WFB120, 4WFB350 if
CR10X 6 Standard AM16/32B
completion required
4WFB120, 4WFB350 if
CR23X 12 Standard AM16/32B
completion required
CR200X Not Supported Not Applicable None Available
2-19
Section 2. DAQ Components
2.1.3 Specifications
The specifications for our loggers are all in the same format, so we will only
cover the CR1000 specifications, as we are using it in the class. First we will
cover some of the terminology.
Accuracy = 0.1 g
100 g 100.1 g
RESOLUTION
Higher Resolution
100 g 101 g 100 g 106.2
PRECISION
99.9
18 times
100.0
12 times
105.2 100.1
70 times 19 times
2-20
Section 2. DAQ Components
HYSTERESIS
Source: http://en.wikipedia.org/wiki/Hysteresis
LINEARITY
Linearity
0g
50 g 50 g
50 g
100 g
50 g 100 g
2-21
Section 2. DAQ Components
Temperature Ranges
Communications Rates
These rates apply to the RS-232 port, CS I/O port and Control Ports.
Communication rates will generally be controlled by the device connected to
the port. For example, the RF400 series is limited to 9600.
Common Mode
± 16 VDC maximum
Remember, all sensors connected to the same excitation channel receive the
same amount and type—DC or AC—of excitation voltage.
2-22
Section 2. DAQ Components
Accuracy
Offset for diff measurement w/ input reversal = 1.5* Basic Resolution+ 1.0uV
Offset for diff meas w/out input reversal =3*Basic Res. +2uV
Offset for single ended meas. =3*Basic Resolution + 3uV
Pulse Counters
2-23
Section 2. DAQ Components
Power Requirements
Voltage
9.6 to 16 VDC
Current Drain
Sleep Mode ....................................................................................... ~0.6 mA
1 Hz scan (8 diff. measurements, 250uS integration, 2 pulse meas.) ..... 1 mA
1 Hz scan (8 diff. measurements, 60Hz rejection, 2 pulse meas.)....... 4.2 mA
100 Hz scan (4 diff measurements, 250uS integration) .................... 16.2 mA
Clock Accuracy
± 3 minutes per year (-30° to 85° C)
2-24
Section 2. DAQ Components
2. Flash Memory
The table below illustrates how CR1000 memory is structured around these
media. The CR1000 utilizes and maintains most memory features
automatically. However, users should periodically review areas of memory
wherein data files, CRBASIC program files, and image files reside. Review
and management of memory are accomplished with the File Control feature of
LoggerNet, PC400, RTDAQ, or PC200W.
2-25
Section 2. DAQ Components
SRAM 4 Mbytes* Operational memory used by the OS regardless of the user program;
Settings and properties; CRBasic program, final storage data tables;
communications memory.
Flash 2 Mbytes Operating system
Serial Flash 512 Kbytes Total
Optional <= 2 Gbytes CompactFlash devices include the CFM100 (CF card slot only) and the
Compact Flash NL115 (network link with CF card slot). Holds program files. Holds
Card final storage table data as files when CardOut () instruction is used.
When data are requested by a PC, data first are provided from SRAM.
If the requested records have been overwritten in SRAM, data are sent
from CRD:. Alternatively, CRD: data can be retrieved in a binary
format using File Control. Binary files are converted using CardConvert
software.
Optional 2 Gbytes The SC115 is a lightweight, portable instrument that can serve as a 2-
CS/IO Flash GB storage device or a USB-to-CS I/O synchronous device
Drive communications (SDC) adapter. When serving as a storage device, the
SC115 holds final storage table data as files when the TableFile ()
instruction is used.
*Prior to September 2007, CR1000s were shipped with 2 Mbyte SRAM. Additional 2 Mbyte was
optional. From September 2007, all CR1000s are shipped with 4 Mbyte SRAM.
NOTE All programs sent to the CR1000 are retained in SRAM (flash
memory size minus what the file system requires for the FAT,
and directory information). When the CR1000 program buffer is
full LoggerNet will give you an error. At that point you’ll need
to use LoggerNet’s Tools | File Control feature to delete
programs stored by the CR1000.
2-26
Section 2. DAQ Components
3.7 M
Table 1
Five Minute Data
Table 5
One Minute Data
Table 2
Daily Data
Table 3
Hourly Minute Data Table 6
Cooperator Data
The CR1000 can “auto allocate” its data tables so that the newest data begins to
overwrite the oldest data at approximately the same time. There is a field in
the Status Table that indicates how long it will take before the oldest data in a
table is overwritten by the newest data.
2-27
Section 2. DAQ Components
CSI CF card modules connect to the CR1000 peripheral port. Each has a slot
for Type I or Type II CF cards. A maximum of 30 data tables can be created on
a CF card.
When a data table is sent to a CF card, a data table of the same name in SRAM
is used as a buffer for transferring data to the card. When the card is present,
the status table will show the size of the table on the card. If the card is
removed, the size of the table in SRAM is shown.
When a new program is compiled that sends data to the CF card, the CR1000
checks if a card is present and if the card has adequate space for the data tables.
If no card is present, or if space is inadequate, the CR1000 will warn that the
card is not being used. However, the user program is run and data stored to
SRAM. When a card is later inserted, accumulated data is copied to the card.
2-28
Section 2. DAQ Components
The SC115 can be used with most Campbell Scientific dataloggers, and is the
only storage device compatible with the CR800 and CR850 dataloggers. This
lightweight, portable device has a CS I/O connector at one end for attachment
to datalogger CS I/O ports, and a USB 2.0 connector at the other end for
attachment to a PC.
The primary function of the SC115 is to collect data from one or more
Campbell Scientific dataloggers. The user simply plugs the CS I/O end of the
SC115 into a datalogger containing a program with a TableFile() instruction
with the NumRecs/TimeIntoInterval and Interval parameters set to zero. When
a datalogger contains a program with this command, it will detect the SC115
and begin copying data collected since the SC115 was last inserted (or all data
the first time the SC115 has been inserted). The LED will flash repeatedly as
the data is transferred. Once the transfer is complete, the LED will stop
flashing and the SC115 may be removed from the datalogger.
Variable:
Measurement result is placed into a variable named
TC_Temp.
TC_Temp = 23.01
2-29
Section 2. DAQ Components
• Reduce arrays to the minimum size needed. Each variable, whether or not
part of an array, requires about the same amount of memory.
Approximately 720 variables will fill available memory.
• Use variable arrays with aliases instead of individual variables with unique
names. Aliases consume less memory than unique variable names.
2-30
Section 2. DAQ Components
Full memory reset does not affect the CRD: drive directly. Subsequent user
program uploads, however, can affect CRD:.
2-31
Section 2. DAQ Components
http://www.campbellsci.com/documents/technical-papers/pow-sup.pdf
Solar Panel current > ((system Ahr/day) * 1.2) / (hours of peak sun)
2-32
Section 2. DAQ Components
2.3.2.2 Regulator
Rechargeable batteries need a regulator to keep them charged at the optimal
voltage and to keep them from being overcharged and damaged. The regulator
should adjust the charging voltage based on temperature, and should be of
sufficient capacity to accept the maximum charge supplied by the charging
source.
2.3.2.3 Batteries
A system can be setup with rechargeable batteries with a charging source or
simply use alkaline batteries.
2.3.2.3.1 Alkaline Batteries
If the system designer decides to use alkaline batteries, he should calculate the
average daily power required by the system to determine how often the
batteries will need to be replaced. Campbell Scientific offers the BPALK
alkaline battery power supply for power remote systems. It consists of 8
alkaline batteries that will supply 7.5 Amp-Hours or power. It comes with a
temporary AA pack that should be used while replacing the D cell batteries to
insure uninterrupted power.
2-33
Section 2. DAQ Components
factors into the system design. It is possible to measure the system power load
using the CH200 smart regulator. For example, set up all the equipment before
field deployment including the datalogger program and communication
equipment. Then use the CH200 regulator to measure the load under real world
conditions.
#1 #2 #3 #4 #5 #6
Step 1) Select the system components in the “loads” section on the left
Step 2) Adjust the scan interval and communication interval
Step 3) Select the desired battery reserve for this station
Step 4) Select a battery that will sustain this system the desired time
2-34
Section 2. DAQ Components
Step 5) If the site is to have solar panels, research the solar resource
available at the site.
Hint: Find the MJ/m2/day from a nearby weather station or go to:
http://www.nrel.gov/ or similar websites).
Step 6) Select a solar panel that can deliver enough power to keep the
system running during the worst month of the year.
bmaxwell@campbellsci.com or info@campbellsci.com
2-35
Section 2. DAQ Components
• LoggerNet
• RTDAQ
• PC400
• PC200W
2-36
Section 2. DAQ Components
2-37
Section 2. DAQ Components
• Phase 5: The data collected from one or more dataloggers into the central
location is reviewed, analyzed, examined, and published. This collected
information is often called "Historical Data".
2-38
Section 2. DAQ Components
• EZSetup [Deployment]
• Troubleshooter [Communications]
2-39
Section 2. DAQ Components
2-40
Section 2. DAQ Components
2.4.2.1.3 PakBusGraph
PakBus Graph is a utility that graphically depicts the devices and connections
in a PakBus datalogger network. Some PakBus settings are viewable and
editable on dataloggers and other PakBus devices by using PakBus Graph.
2-41
Section 2. DAQ Components
Short Cut also generates a wiring diagram for connecting your sensors to the
datalogger. Short Cut was designed to help the beginning datalogger
programmer create datalogger programs quickly and easily. Short Cut
effectively insulates the user from having to know the nuances of datalogger
programming as well as the tradeoffs and differences between the Edlog and
CRBasic programming languages. It supports the most commonly sold sensors
from Campbell Scientific, as well as generic measurements (such as
differential voltage, bridge, and pulse), commonly used calculation and control
functions (such as heat index calculation, alarm conditions, and simple
controls), and multiplexer analog channel expansion devices. More detail about
SCWIN can be found in section 2.4.4.
2-42
Section 2. DAQ Components
The CRBasic Editor is a programming tool which can be used with the
CR1000, CR3000, CR200 Series, CR800 Series, CR5000, CR9000, and
CR9000X dataloggers. It is intended for use by experienced datalogger
programmers who need more flexibility and control over the datalogger
operation than can be achieved using Short Cut. The CRBasic programming
language is similar in syntax, program flow, and logic to the Structured BASIC
programming language.
2-43
Section 2. DAQ Components
2-44
Section 2. DAQ Components
2.4.2.2.5 Troubleshooter
The Troubleshooter utility is used to identify possible problems disrupting
communications or data collection. You can narrow the display to show only
the dataloggers in the network, or expand it to view all devices on the network.
Problems are highlighted in different colors to indicate levels of severity. When
narrowing down a problem, you can launch a separate Communications Test
utility or open the server logs.
The window has three tabs. The Summary tab provides an overview of
important status information in the datalogger, including the information about
the datalogger model and its firmware, program details, program errors, battery
voltage levels, and card memory (if one is present).
The Table Fill Times tab lists the tables in the datalogger, along with the
maximum number of records the table can hold, the estimated amount of time
that it will take the table to fill, and the estimated date and time that the table
will fill based on the time the datalogger program was downloaded and the
table size. A data table can be reset from this window by pressing the Reset
Tables button.
2-45
Section 2. DAQ Components
NOTE Resetting a table will erase the data in the datalogger and in the
data cache.
The Status Table tab lists all of the status table fields in the datalogger along
with their values. By default, all of the fields in the status table are displayed.
To select only certain status data to be viewed, press the Select Fields button.
This will display a list of the status data available in the datalogger. Select one
or more of the fields and then press OK. The current values will be displayed in
the table. If you select a cell within the Status Table and right click, a short cut
menu will be displayed. From this menu you can select fields or view/modify a
value (if it is a writable value).
►► Use the LoggerNet Toolbar to Open the Connect Screen, then connect to
your CR1000 datalogger, then select the Station Status Item from the toolbar
and view the three tabs of the Station Status screen.
2-46
Section 2. DAQ Components
2-47
Section 2. DAQ Components
2-48
Section 2. DAQ Components
2.4.2.3.5 LogTool
The LogTool application is available to view operational log messages for the
server as well as the low-level communication between dataloggers and the
server. It can be used to troubleshoot problems since it makes clear what
particular operations are currently being performed by the communications
server. The logs displayed in this screen are often captured to file and sent to
CSI support personnel for further scrutiny as a means of solving difficult or
complex issues.
2-49
Section 2. DAQ Components
2-50
Section 2. DAQ Components
The Graphical Displays in LoggerNet are activated with the “Graphs” button of
the Connect Screen. Three uniquely configured screens are available. A small
grid is displayed which shows names and values of data items available on the
currently connected datalogger similar to a Numeric display. Individual data
items can be placed on the grid using the “Add” button. Once started, the
Graphical Display will show the latest value known to LoggerNet for the
particular data item in the grid, and also add a point in the graphical display
area. As points are added to the display, it accrues a history of the value over
time. Scheduled collections or Collect Now events will update the values in
this screen.
2-51
Section 2. DAQ Components
2-52
Section 2. DAQ Components
2-53
Section 2. DAQ Components
2-54
Section 2. DAQ Components
Further detail about the programs and utilities briefly mentioned here can be
found in the LoggerNet, RTDAQ, PC400, or PC200W manuals.
2-55
Section 2. DAQ Components
2.4.3.1 PC200W
PC200W is a no-cost starter package available for download from the
Campbell Scientific website, or found on the Campbell Scientific Resource
DVD. Basic functionality is provided to directly connect (via serial cable) to a
datalogger, configure it, and send a program to it. Features include :
2-56
Section 2. DAQ Components
2.4.3.2 PC400
PC400 is a mid-level ($315) package for managing datalogger networks. All of
the functionality of PC200W is included. The following additional features are
also provided :
• The CRBasic Editor for creating and editing datalogger programs at the
programming language level (i.e., creation from “scratch”).
• EdLog Editor for creating and editing programs for legacy Campbell
Scientific Dataloggers
2-57
Section 2. DAQ Components
2.4.3.3 RTDAQ
RTDAQ is a specialized package ($525) for managing industrial or other high-
speed datalogger deployments. Only the modern dataloggers are supported in
this package (CR9000X, CR5000, CR3000, CR1000 and CR800 series). The
basic functionality of PC400 is provided, as well as the following specialized
functions:
• Support for very fast (near real-time) graphical data displays (millisecond
to microsecond record intervals)
2-58
Section 2. DAQ Components
2.4.3.4 LoggerNet
LoggerNet is Campbell Scientific's full-featured package ($599) for managing
datalogger networks. All of the essential functionality found in PC400 is
provided as well as the following:
• Network Planner
• Troubleshooter
2-59
Section 2. DAQ Components
►► Use the chart shown above to determine which product is the one needed
for your next datalogger deployment project.
2-60
Section 2. DAQ Components
By default, the LoggerNet menus are not shown on the toolbar. Press the arrow
button in the upper right corner to view the LoggerNet menus as shown below.
The arrow button will change direction and can then be used to hide the menus.
The menus can also be displayed by pressing and releasing the Alt key.
Use the restore button on the toolbar to toggle it between the large display
mode and the compact display mode.
2-61
Section 2. DAQ Components
►► Use the Device Configuration Utility to view the settings in the CR1000.
2-62
Section 2. DAQ Components
2-63
Section 2. DAQ Components
2-64
Section 2. DAQ Components
The creation of custom sensor files can be enabled from Short Cut’s Tools
|Options menu item. Once enabled, custom sensor files can be created by right-
clicking on a sensor in the Available Sensors and Devices list and choosing
Create Custom Sensor.
2-65
Section 2. DAQ Components
The resulting dialog box will allow the user to make changes to the chosen
sensor file and then save it with a new name. (See Short Cut’s Online Help for
additional information on changes that can be made.) By default, custom
sensor files will be created in the folder C:\CampbellSci\SCWin\SENSORS,
which is a different location than that of Short Cut’s standard sensor files.
Once the custom sensor file has been saved, it will be added to the Available
Sensors list.
The first step in developing a Network Planner model is to create the stations.
A station is created by adding a root device to the Drawing Canvas. Examples
of root devices include PakBus dataloggers, the LoggerNet server, as well as
radio and phone modems. Once the root device is added to the model, any
peripherals that connect to the root device are added. After adding the stations
to your network, you must identify links between stations and the activities that
occur over those links.
2-66
Section 2. DAQ Components
After the stations, peripherals, links, and activities have been added, all items
on the Configure Devices list will need to be completed in order to configure
the devices in the system. Check boxes are provided that allow items to be
checked off as an indication that they have been completed.
At anytime, details about a station can be viewed and edited by selecting the
station on the Drawing Canvas and viewing the Station Summary.
2-67
Section 2. DAQ Components
appear on the canvas. The appearance of that icon will either be a small image
of that station's root device or a balloon shape depending upon the state of the
Options | Show Device Images menu item. The name of the station will be
shown under that station. A default, unique name will be generated when the
station is first created and can be changed by pressing the F2 key while the
station is selected. A station is selected by clicking on it with the left mouse
pointer. The selected station will be highlighted in the Configure Devices list
and will be shown in the Station Summary.
You can delete a station by pressing the Delete key with the station selected.
The Configure Devices panel lists tasks that need to be completed before the
network can be deployed. These tasks include configuring any LoggerNet
servers and writing settings to devices. The Configure Devices panel is divided
into two sections. The list box at the top lists all of the Configure Devices items
and provides check-boxes that allow these items to be checked off to indicate
when an item has been completed. The bottom portion of the panel displays a
more detailed description of the selected item. If the item has been completed,
the description will include the date and time when it was completed. Unless
the selected item must be performed manually (setting a dip-switch on a
COM220, for instance), the item description will also contain a link that can be
2-68
Section 2. DAQ Components
followed to initiate the action associated with that item. When the selected
station on the drawing canvas changes, the selected item in the Configure
Devices list box will also change to the item, if any, associated with the root
device of that station.
In some cases, LoggerNet client applications display only data that has been
collected. In other cases, LoggerNet initiates the retrieval of data to display.
These cases are described below:
Final storage data from mixed array dataloggers is retrieved only when
data collection from the datalogger occurs (initiated manually from the
Connect Screen or based on a schedule). Therefore, the final storage
information on the data displays will be updated only as often as data
collection is performed for these dataloggers. Input locations do not have
to be scheduled for collection to be displayed. When connected, these
values are updated based on the update interval of the display (but limited
by how fast measurements are actually being made in the datalogger).
When connected, data from table data dataloggers is updated based on the
Update Interval. (This is referred to as real time monitoring.) Note that
data can be updated no faster than the data values are being generated by
the datalogger. When not connected, data from table data dataloggers is
updated only as often as data collection is performed. (This is referred to
as passive monitoring.) Therefore, for input locations or public variables
to be updated when not connected, they must be included for scheduled
collection.
RTMC
In RTMC, data displays will be updated no more frequently than data is being
collected from the datalogger, either manually or on a schedule.
2-69
Section 2. DAQ Components
2.4.4.5.2 Intervals
One of the most significant considerations for setting up data collection is all of
the intervals associated with reading, storing, and retrieving data. The intervals
and their significance for data handling are described below.
2-70
Section 2. DAQ Components
every two minutes. The time to make a call and start communications should
be considered when you are collecting from multiple stations by phone.
Sufficient time should be allowed for the server to dial the station, retrieve the
data, and then contact the next station. There should be enough time between
calls to the first station that the calls to the other stations using the same
modem can be completed. Otherwise the collection schedule will be delayed
waiting for the previous stations to finish.
RF networks with repeaters also add time delays since each modem must be
contacted and then pass the message on to the next RF modem and so on. Each
of these operations takes time so the time schedule for RF networks with
repeaters should allow enough time for the link to be established with the
datalogger and collect the data.
To set up a data collection schedule for a datalogger, first ensure that your
device map has been configured with all of the devices listed as they actually
exist. Next, determine which tables or final storage areas should be collected
from the datalogger each time a data collection attempt is made. If no tables
are selected on the Data Files tab or the Final Storage Area is not enabled for
collection, no data will be collected from the datalogger.
You should check the directory path and the data file options to make sure the
files are where you want them and in the right format. Note that for table-
based dataloggers, each table must be configured separately (i.e., selected for
collection, file name provided, file format specified, etc.).
The data collection schedule should be set up next. Set the initial date and time
to when you would like the first data collection attempt to occur and set the
interval at which subsequent data collection attempts should occur. Make sure
that communications are enabled for all devices in the communications path,
and that scheduled collection is enabled. If the initial date and time is set to a
time that has already passed, data collection will begin immediately.
The Status Monitor screen (Section 6) can be used to ensure that data
collection is occurring on the defined schedule. Some issues will also be
2-71
Section 2. DAQ Components
• The Scheduled Collection Enabled box on the Schedule tab for the
datalogger must be selected. This turns the schedule "on". You can
temporarily disable data collection by clearing this check box and applying
the change.
• The tables or final storage areas from which you desire data should be
enabled for collection in the Data Files or Final Storage Area tab of the
Setup Screen.
• All devices in the communications path to the datalogger must have the
Communications Enabled check box on the Hardware tab selected.
• Unsuccessful attempts to communicate with the datalogger may exhaust
the number of Primary Retries specified so that the Secondary Retry
interval is in effect. Check the date and time listed for the next data
collection in the Status Monitor.
• Look at the collection state data for the datalogger in the Status Monitor.
This is displayed as one of four states.
− Normal collection
− Primary retry
− Secondary retry
− Collection disabled
• Check the Status window and ensure the Pause Schedule check box is
cleared.
• For table-based dataloggers, ensure the table definitions have been
retrieved from the datalogger and are current.
2-72
Section 2. DAQ Components
Each table is saved in a separate file so there will be one file created for each
table that is selected.
2-73
Section 2. DAQ Components
Collect Mode
− Newest Number of Records will retrieve the number of records specified
in the Starting Record Information area going back from the last record
collected.
− Data Since Last Collection will retrieve the data stored since the last time
a custom collection was performed. LoggerNet keeps track of the records
collected from each table every time a custom collection is executed. This
option will work even if the last custom collection used a different option.
− All the Data will get from the datalogger all the data available from all of
the selected tables. If the datalogger is full this could take a long time,
especially with large memory dataloggers or over slow communication
links.
− Data From Selected Date and Time uses the starting and ending time and
dates to get the data from the datalogger stored between those times. If the
datalogger does not have data for the specified time range a blank file will
be created. (CR5000, CR9000, CR9000X, and CR200 Series dataloggers
do not support this collection option.)
File Mode
File Mode is used to choose whether the collected data should be appended to
the file if it exists, overwrite the existing file, or create a new file. If Create
New File is selected and the named file exists, a new file will be created with
the specified file name and a sequence number added to it.
File Format
This option is used to select the file format in which to store the collected data.
Appendix B provides information on File Formats.
Record Information
This box is used to specify whether a timestamp and record number are
included with each record.
2-74
Section 2. DAQ Components
2-75
Section 2. DAQ Components
Pressing the Graphs button and selecting one of the numbered graphs will bring
up a graphical display. An example is shown below. If a Graphical Display
screen is already active but hidden behind other windows, selecting it from the
drop-down list will bring it to the front.
To begin, select the table you wish to monitor from the drop-down list. The
fields of the specified table will be displayed in the Field/Value grid.
When data is being monitored, you can press the Stop button to stop the
monitoring of data. The text on the button will change to Start and it can be
pressed to start monitoring data again.
2-76
Section 2. DAQ Components
The Interval determines how often data in the table monitor will be updated.
This interval controls how often the table monitor is updated, only when you
are actively connected to a station (by pressing the Connect button).
When you are not actively connected to a station, the table monitor will be
updated only when data is collected (on a schedule or by pressing the Collect
Now or Custom buttons).
Project Component List - The panel on the left shows the hierarchy of the
display components and how they are associated with each other. Every
component of the display screen is shown in this list and it provides a shortcut
to get to any graphical component.
Project Workspace - The right panel is the display screen workspace. The
graphic components are placed in the workspace, as they should appear on the
final display.
Component Toolbox - The toolbox on the top contains the display screen
components that can be placed in the workspace. Selecting a component and
clicking in the workspace places the component and brings up the Properties
window for that component.
2-77
Section 2. DAQ Components
Many images have been included with RTMC. The directory in which these
files are stored is C:\Campbellsci\Lib\RTMCMediaLib. Custom images can be
used as well; these should be placed in the media library directory to make
them available for RTMC's use.
The RTMC workspace is a container for holding one or more display screens.
As new display screens are added (Project | Add New Screen) they appear as
tabs in the project. The size of the workspace (and the resulting run-time
window) can be changed by selecting Project | Configure WorkSpace.
2-78
Section 2. DAQ Components
Display Components
Display components are the objects that are used to display data. To add a
component to the workspace, click an item on the Component Toolbox and
then click anywhere in the workspace. The component’s Properties window is
automatically displayed when the object is first placed in the work area. The
Properties window is used to set colors, scale values, text, etc., and to assign
the data value to be displayed by the component.
After a component's properties have been set, select OK to enable the changes
and close the Properties window. Once the link to the data value has been
applied, if there is data available from LoggerNet for the component, the value
on the display will update.
Available Components
The following is an overview of the display components available. The online
help has detailed information about each of the components and their
properties.
Status Bar depicts the selected data value as a single vertical bar.
Digital depicts the selected data value as a numeric value, text string,
or Boolean.
Slider depicts the selected data value as a single horizontal bar. The
data value can also be set to a new value by moving the slider.
2-79
Section 2. DAQ Components
Chart displays one or more traces on a line graph. The time stamp on
the X axis reflects the server clock. Note that a difference in the
server clock and the datalogger clock, coupled with a small time
window for the chart, could result in no data being displayed.
Time displays the server time, server time at last data collection,
station time, station time of last record stored, or PC time.
Table Display displays the data from a datalogger table in a row and
column format.
2-80
Section 2. DAQ Components
Expressions
“Server:CR5000.TempData.Temp1” * 1.8 + 32
As shown above, double quotes are used in RTMC to enclose the name of a
data value (or source, datalogger, or table depending on the component).
Therefore, when defining a literal string, a dollar sign is used as a prefix. This
indicates to RTMC that you are defining a literal string rather than a data value.
For example, to search for the position of the sequence abc in the data value
mystring, you would use the following expression:
Expressions can also use “Functions with State” that involve the state of a data
value over a period of time. For instance, you can return the maximum value of
a data value over the past 24 hours using the expression:
MaxRunOverTime(“Server:CR1000.QtrHour.Temp”,Timestamp(“Server:
CR1000.QtrHour.Temp”),nsecPerDay)
StartRelativeToNewest(nsecPerDay,ordercollected);
MaxRunOverTime(“Server:CR1000.QtrHour.Temp”,Timestamp(“Server:
CR1000.QtrHour.Temp”),nsecPerDay)
2-81
Section 2. DAQ Components
Aliases
Alias(alias_name, data_value)
For example,
StartAtOffsetFromNewest(5,OrderCollected);IIF(ABS(("Server:CR1000.MyTa
ble.Value"-
ValueAtTime("Server:CR1000.MyTable.Value",TimeStamp("Server:CR1000.
MyTable.Value"),30*nsecPerSec,0))>10 AND
ABS(ValueAtTime("Server:CR1000.MyTable.Value",TimeStamp("Server:CR
1000.MyTable.Value"),30*nsecPerSec,0)-
ValueAtTime("Server:CR1000.MyTable.Value",TimeStamp("Server:CR1000.
MyTable.Value"),60*nsecPerSec,0)))>10,1,0)
Alias(X,"Server:CR1000.MyTable.Value");StartAtOffsetFromNewest(5,Order
Collected);IIF((ABS(X-ValueAtTime(X,TimeStamp(X),30*nsecPerSec,0))>10
AND ABS(ValueAtTime(X,TimeStamp(X),30*nsecPerSec,0)-
ValueAtTime(X,TimeStamp(X),60*nsecPerSec,0)))>10,1,0)
Synchronizing Variables
The ValueSynch function can be used to synchronize data values coming from
multiple data sources so that you can display the results of a calculation on
those data values in a single component. The Value Synch function takes the
form:
ValueSynch(synchronized_name, data_value)
For example, if you wish to display the average air temperature of two stations
on a chart, the following expression can be used to synchronize the timestamps
of the stations and then calculate the average air temperature:
ValueSynch(air_temp_1,"Server:CR1000_1.SECOND.air_temp");ValueSynch
(air_temp_2,"Server:CR1000_2.SECOND.air_temp"); (air_temp_1 +
air_temp_2) / 2
2-82
Section 2. DAQ Components
If the timestamps of the stations are not the same (for example, if
one datalogger is a few minutes behind the other), the component
will display the exclamation point indicating no data, until the
data sources have common timestamps and, therefore, can be
synchronized.
All of the functions available in RTMC are described below. For details on a
function, refer to RTMC’s online help.
2-83
Section 2. DAQ Components
When the run-time display screen is started, the display components will have
a red exclamation point in the upper right corner until data is received from
LoggerNet. If data is not displayed, check to see that the data is being
collected on a schedule by LoggerNet.
Once a project file has been created, the display screen can be run without
starting the development mode window. Select Data | RTMC Run-Time from
the LoggerNet toolbar. In the Run-Time window select File | Open to select
the RTMC project screen to run.
In Run-time mode, you can print an image of the RTMC display screen by
selecting File | Print Screens. A new form to be run is selected under File |
Open.
2-84
Section 2. DAQ Components
RTMC Pro is used to create and edit a real-time graphic display screen to
display the data collected from the dataloggers. Once the screen is built and
saved as a project, *.rtmc2, the screen can be displayed using RTMC Run-time.
This allows graphic display screens to run on other computers with just the
RTMC Run-time program.
For help in getting started with RTMC, there is a tutorial provided on the
Downloads page of our website, http://www.campbellsci.com/downloads. The
tutorial is done using standard RTMC development, but the same concepts
apply to RTMC Pro.
The same RTMC Run-time is used to run projects developed in either RTMC
Pro or the standard RTMC Development.
One copy of RTMC Run-time is provided with LoggerNet and RTDAQ. For
LoggerNet, additional copies to run on remote machines can be purchased
separately.
2-85
Section 2. DAQ Components
Project Tree - The panel on the left shows the hierarchy of the display
components and how they are associated with each other. Every component of
the display screen is shown in this list and it provides a shortcut to get to any
graphical component.
Project Workspace - The middle panel is the display screen workspace. The
graphic components are placed in the workspace, as they should appear on the
final display.
Component Toolbox - The toolbox on the right contains the display screen
components that can be placed in the workspace. Selecting a component and
clicking in the workspace places the component and brings up the Properties
window for that component.
2-86
Section 2. DAQ Components
Many images have been included with RTMC Pro. The default directory in
which these files are stored is C:\Campbellsci\Lib\RTMCMediaLib. Custom
images can be used as well; these should be placed in the media library
directory to make them available for RTMC Pro's use.
2.4.4.7.4 LoggerNet
When RTMC is run from LoggerNet, the Project | Manage Data Sources menu
item allows the user to specify additional communications server(s), data
file(s), and/or databases to be used as data sources in RTMC. Each
communications server, data file, and database specified will be added to the
Data Source Browser that is used to select data for RTMC components.
A server, data file, or database can be added by pressing the Add button,
selecting the appropriate option and filling out the resulting dialog box as
described below.
A server, data file, or database can be removed by selecting it and then pressing
the Remove button. The Edit button can be used to bring up the Server Data
Source, File Data Source, or Database Data Source Properties dialog box and
make modifications. Note that if you change the name of a server, the change
will be made to all references to that server in the project.
If a project contains only one data source, the status bar at the bottom right of
the RTMC window will indicate the data source and connection state
(connected or disconnected). If a project contains multiple data sources, the
Status Bar will say Data Source Status. The background will be green if
RTMC is able to connect to all of the data sources and red if there is a problem
with at least one of the data sources. Double-clicking on Data Source Status
will bring up the Manage Data Sources dialog box. The data source(s) to which
RTMC is having trouble connecting will be indicated with a red X as shown
2-87
Section 2. DAQ Components
below. You can select the data source from the list, press the Edit button, and
modify the settings so that RTMC is able to connect to the data source.
The View Pro button on the LoggerNet toolbar brings up View Pro. This
program can be used to open data files (*.DAT) or other CSI file types
(*.DLD, *.CSI, *.FSL, *.LOG, *.CR1, *.CR3, etc.). View Pro can easily
handle files up to 2 Gigabytes in size. View Pro can also be used to view data
from a LoggerNet database table created with LNDB.
Once a data file or database table is opened, data can be printed or graphed in
several different graph types including Line Graphs, Histograms, XY Plots,
FFTs (Fast Fourier Transforms), or Rainflow Histograms as appropriate for the
data type. (Note that these graphical windows are only available for *.DAT
files and database tables. Other file types are viewable only as text.)
Since View Pro is primarily a file viewing utility, a file cannot be edited or
saved using this program.
View Pro can also be run as a stand-alone program by using the Windows Start
Menu and selecting Programs | Campbell Scientific | LoggerNet | Data | View
Pro or by using Windows Explorer and double-clicking on the ViewPro.exe
file in the C:\Program Files\CampbellSci\View Pro folder. A desktop shortcut
can be created by right-clicking on this file in Windows Explorer and choosing
Create Shortcut.
2-88
Section 2. DAQ Components
View Pro is closed by selecting File | Exit from the menu or pressing the red X
in the upper right-hand corner. When View Pro is closed, all open graphs and
data files will also be closed.
A file that has been recently opened, can be quickly opened again by selecting
it from the File | Recent Files list. The file will be opened in the same format
as it was originally opened (data, text, or hex).
2-89
Section 2. DAQ Components
If a data file is opened that contains multiple arrays, the entire data file will be
opened in one window. In addition, each array will be opened in a separate
window. The window containing the entire data file is for viewing only. Data
must be graphed from the individual array windows.
2.4.4.8.4 Graphs
Once a data file is opened, data values can be displayed in several different
graphical forms including a Line Graph, Histogram, XY Plot, Rainflow
Histogram, or FFT. Each of these are launched from a button on the View Pro
toolbar. Graph buttons are enabled only if the graph type is appropriate for the
opened data file. For instance, if there is no data appropriate for an FFT, the
FFT button will be disabled on the View Pro toolbar. Multiple instances of
each type of graph can be launched.
Data from multiple data files can be displayed in a single graph. This is done
by opening multiple data files and selecting data to be graphed as described for
each graph type below. This may be useful when comparing data from
multiple datalogger stations.
Options
Each type of graph has several different options that can be set by the user.
Options that apply to the entire graph are generally set from a dialog box that is
opened by pressing the Options button at the lower-left of the graph window,
by pressing the Graph Options button on the toolbar, or by right-clicking on
the graph and choosing Options. Note that the XY Plot does not have an
Options button, so the Options dialog box is opened by pressing the Graph
Options button on the toolbar or right-clicking on the graph.
Options that apply to individual traces are set by selecting the trace in the list
of data values being graphed, and then pressing the Edit button located below
that list. The XY Plot does not have user-configurable trace options.
For information on graph options refer to the online help. Help for a graph can
be accessed by pressing the ? button in the upper-right corner of the graph.
2-90
Section 2. DAQ Components
Zoom Feature
You can zoom in on a particular area of a graph by holding the left mouse
button and dragging the mouse cursor from top-left to bottom-right over the
area to be zoomed. Dragging the mouse cursor from bottom-right to top-left
will undo the zoom. This can also be accomplished by pressing the Undo
Zoom button on the toolbar.
For a Rainflow Histogram or for a Histogram or FFT in 3D View, you can also
zoom in and out by using the Page Down and Page Up buttons on your
keyboard.
Rotation
The currently selected graph can be kept in front of the data view window by
selecting View | Keep Graph on Top from the menu or pressing this button
on the main View Pro toolbar .
2-91
Section 2. DAQ Components
• Includes all of the LoggerNet Admin clients except for the Service
Manager
2-92
Section 2. DAQ Components
2-93
Section 2. DAQ Components
Cons
• The main drawback to cellular communication is the monthly cost of
cellular service.
2-94
Section 2. DAQ Components
Contact the cellular carrier if you are not sure which technology the carrier is
using.
One way to conserve power is to turn the modem off when it is not needed.
Most dataloggers have a switched 12 V terminal. Connecting the modem’s 12
Volt lead to the datalogger’s switched 12 V terminal allows the datalogger to
control the modem power via program control. For example, the datalogger
can turn the modem on for 10 minutes at the top of every hour or twice a day
based on the collection interval needed.
If the site has AC power or large solar panels and batteries, the current drain of
the modem may not be an issue.
2-95
Section 2. DAQ Components
• Serial Server method – The serial server method is a basic setup which
only requires configuration of the Raven modem. This method is
supported by all dataloggers. Refer to Section 5 of the RavenXTG
manual for instructions on setting up communication using the serial
server method.
• PPP (Point to Point Protocol) method – This method is supported by
only the CR800, CR850, CR1000 and CR3000 dataloggers. The
advantage of this method is gaining access to the datalogger’s TCP/IP
stack and supported protocols like SMTP (email), HTTP (web browser),
FTP (File Transfer Protocol) and NTP (Network Time Protocol). For
example, the datalogger will be able to send an email for an event driven
alarm. This email can be sent, converted to a text message, and received
on a cell phone through most cellular networks’ email to SMS gateways.
The message can contain specific text and measurements. Another
advantage is that the datalogger can accept several simultaneous
connections, each making independent requests of the datalogger. Refer
to the RavenXTG manual in Appendix D for information on configuring
the modem for PPP communication.
2.5.3.2 Software Configuration
Refer to Section 6 in the RavenXTG manual for information on setting up
cellular communication in LoggerNet or PC400.
When power is applied to the Raven Modem, the power light will turn on solid.
The Network and Signal lights will flash with different patterns as the modem
connects and negotiates with the cellular network. On average the modem will
take about 40 to 60 seconds to connect and negotiate with the network. Once
the modem has connected and successfully negotiated with the network the
Network light will be on solid. The Signal light will continue to flash at a rate
based on signal strength. A solid or fast blinking light indicates a strong signal,
while a slow blinking light indicates a weaker signal. More accurate signal
strength measurements can be determined by connecting to the modem with
the Sierra Wireless Ace Manager software. The Activity light blinks when
there is active communications with the modem.
Refer to Section 5.3 of the RavenXTG manual for more information on the
indicator lights and the meaning of the light patterns.
2-96
Section 2. DAQ Components
2-97
Section 2. DAQ Components
2-98
Section 3. CRBasic and Measurements
3.1 CRBasic
3.1.1 CRBasic: Editor and Programming Language
The Short Cut program generator is a useful tool for creating CRBasic
datalogger programs, but it only uses a portion of the functionality available
within the language. Explicit CRBasic programming is provided for
programmers who need more flexibility and control over datalogger operation
than is available in programs generated with the program generators.
The CRBasic Editor is the program editor used to write programs in the
CRBasic language. The CRBasic language is used to create programs which
specify how the CR1000 and other CRBasic dataloggers operate. The CRBasic
Editor is included with LoggerNet, PC400, and RTDAQ software packages.
Although CRBasic programs can be written with any text editing program,
there are many advantages for the programmer when using the CRBasic Editor
to create and edit CRBasic programs. You can start the CRBasic Editor by
3.1.2 Template
The CRBasic Editor provides a program template for each datalogger type.
Using the template simplifies the task of creating new programs. Templates
may be customized to your needs in order to accelerate program development.
CRBasic offers a template for creating programs for each datalogger type. Each
datalogger has its own set of instructions that may be different than the other
dataloggers. When beginning a CR1000 program choose the CR1000
template. Template files are associated with a specific datalogger type.
►► Open a new program based on the default CR1000 template. Click File
| New | CR1000 Program File.
3-1
Section 3. CRBasic and Measurements
As shown in Figure 3.1.3-1, the CRBasic Editor's main window is divided into
three parts: the Program Entry Window, the Instruction Panel, and the
Message area.
The Instruction Panel on the right side is a list that comprises the instructions
for a particular datalogger in the CRBasic language. Use F5 or View | View
Instruction Panel to show or hide the Instruction Panel. Select the down
arrow button on the drop-down list box to see the available instruction
categories for the logger whose template was invoked.
For the CR1000, there are fifteen predefined categories: All, Custom Menus,
DataTables/Output Processing, Datalogger Status/Control, File I/O, Internet
Protocols, Math Functions/Calculations, Measurements, Operators, PakBus,
Program Structure/Control, SDM, Special Communications Protocol, Serial
I/O, and String Manipulation.
Select the “All” category to see all available instructions. Instructions can be
selected from this list or entered directly into the Program Entry Window on
the left.
3-2
Section 3. CRBasic and Measurements
The Message area at the bottom becomes visible after a program is compiled
and shows results of the compile and any errors detected. The message area
will also give you warnings for potential program syntax errors. Double
clicking on the error or warning will highlight the line in the program that
generated the error or warning.
3-3
Section 3. CRBasic and Measurements
Select the Show Parameter Hints checkbox for instruction hints to be active,
set the amount of time the cursor must hover over the instruction before the
popup hint appears, and set the background color of the popup hint.
3-4
Section 3. CRBasic and Measurements
Select Insert Tabs or set the number of spaces to be used when the CRBasic
Editor automatically indents an instruction. The Tab Width field indicates the
number of spaces that will be used when the keyboard's Tab key is pressed or
when the Insert Tabs option is chosen in the Auto-Indenting group box.
You can customize the appearance of the text by selecting normal text,
keywords, comments, operators, and numbers from the drop-down list, and
then selecting a different font style and color for each one. In this way you can
make the currently displayed program easier to read and edit. Text colors and
styles can be disabled by clearing the Syntax Highlighting checkbox. After
you have selected the desired color and font type for each item, press OK.
3-5
Section 3. CRBasic and Measurements
Select Instruction:
Toggles the focus of the cursor between the Instruction Panel and the program
editing window. The function key for this feature is F8.
Insert Variable:
Displays a pick list that contains all of the variables that have been defined in
the program. If a variable is selected from this pick list, it will be inserted in
the program at the cursor location. This pick list can also be displayed by
pressing F9.
Replace Variable:
This option is similar to Insert Variable, except that it will replace an existing
variable rather than add the new variable to whatever text exists. This pick list
can also be displayed by pressing F10 or by right-clicking a parameter that is
defined as using a variable for input.
The CRBasic editor has GoTo and Bookmark features to enable navigating
through programs quickly.
3-6
Section 3. CRBasic and Measurements
Bookmarks are lines of code in the program that the user marks, which can
be quickly navigated to using the Next, Previous, and List Bookmark functions.
All bookmarks can be removed from the program by selecting Clear
Bookmarks. All bookmarks are automatically cleared when closing a program.
To create a User-Defined Category, select the Add New Category button. You
will be prompted to enter a name for the category; this name is added to the
User-Defined Categories field. Select the category from this field and press the
Edit Category button. A new window will appear with tabs for the predefined
categories. To add instructions to your new category, select the check boxes
next to the instructions that you want to include. Instructions can be removed
from a category by clearing the check boxes.
3-7
Section 3. CRBasic and Measurements
In the instance shown in Figure 3.1.3-7, a new category "Exercise 1" has been
added. Highlight that category and click the Edit Category button to display
the Select Instructions dialog box that is shown below.
The window shown in Figure 3.1.3.8 allows the user to select the instructions
to be included in the custom instruction list. The custom list will contain only
those items selected by the user. Browse through the tabbed categories to see
all instructions available for this datalogger. Check the instructions which
should be displayed in the Instruction Panel list screen when this category is
selected, then press OK to save the list.
Show Labels:
This option displays a list of tables in the program along with the output
interval and a list of fields for each table.
3-8
Section 3. CRBasic and Measurements
To place the panel temperature value in the variable RefTemp (using a 250
microsecond measurement integration time) the code is:
PanelTemp(RefTemp, 250)
A Parameter dialog box will appear when an instruction is added, using the
Instruction Panel List, that has one or more parameters or when the cursor is
placed on an existing instruction and the right mouse button is pressed. This
dialog box contains a field for each of the parameters in the instruction. Edit
these fields as necessary and then press the Insert button (or Alt-I) to paste the
instruction into the program.
For example, if the user selected “Sample” from the Instruction Panel list, and
the “Show Instruction Dialog” box is checked in the “Instruction Panel
Options” screen (View/Instruction Panel Preferences), the dialog box shown in
Figure 3.1.3-9 would be invoked.
3-9
Section 3. CRBasic and Measurements
Sample (Reps,Source,DataType)
To output the first element of the variable array named RefTemp stored in the
IEEE4 format, the instruction would look like:
Sample (1,RefTemp,IEEE4)
The editor will place default values for the parameters, but these will usually
not be the correct input for a given application. If you right mouse click on the
parameter in the dialog box, it will either invoke help for the given parameter
or will come up with a list of available inputs for that parameter.
The use of these instructions should become clearer as we go through the next
Exercises.
Use right clicks to see options relevant to the cursor’s position. Right clicking
or pressing F2 on an instruction parameter will bring up a list of parameter
values, options, or pop-up help. F10 brings up a list of available variables to be
used as parameters.
Pressing the F1 key or selecting “Help” brings up additional help along with a
list of possible options where appropriate.
►► While proceeding through the next exercise, try using right clicks, F1,
F2, and F10 at various cursor locations.
The editor uses *.CHM and *.DEF files to provide online help. These files are
located in the C:\Campbellsci\Lib\CRBasicDefFiles folder and named after the
associated datalogger model. When a new datalogger operating system is
downloaded and installed from the Campbell Scientific website, these files
should be updated to reflect the instructions and updated help topics for the
latest datalogger operating system.
3-10
Section 3. CRBasic and Measurements
Comments can be inserted into the program by preceding the text with a single
quote character (‘). When the program is compiled, the datalogger compiler
will ignore any text that is preceded by a single quote until it reaches the end of
that line of text. A comment can be placed at the beginning of a line or it can
be placed after program code. Several lines can be commented (or
uncommented) at once by highlighting them with the mouse cursor, right
clicking, and selecting Comment (or Uncomment) from the context (floating)
menu.
►► CRBasic Exercise: Remove and replace some of the single quotes in the
default template program to observe lines change from being commented to
being active in the program.
3-11
Section 3. CRBasic and Measurements
The default CRBasic templates provide the basic structure for programming.
3-12
Section 3. CRBasic and Measurements
NOTE The CRBasic Editor’s online help has example programs for many
instructions demonstrating their use within a working program.
This provides the programmer with concrete examples of CRBasic
code snippets and working datalogger programs. It is recommended
that the programmer borrow and copy from these examples
liberally as a learning exercise.
3-13
Section 3. CRBasic and Measurements
Variables must be declared before they can be used in the program. Variables
declared as Public can be monitored by LoggerNet using the Numeric Monitor
screen or the Graphical Display. Variables declared using Dim cannot be
displayed. Variables assigned to a fixed value are used as Constants. Aliases
can also be created that will allow an element of an array or other variable
declaration to be referred to by a different name.
Items which have a fixed value throughout the life of the program should be
declared as constants (using Const) instead of variables (Public, Dim).
Aliases can also be created (using Alias) that will allow a variable to be
referenced by a different name.
Syntax
Public VarName (size subscripts) Or
Public VarName (size subscripts) As Type Or
Public VarName (size subscripts) As Type = {3,6,2, . , , ,5}[initialize values]
Syntax
DIM VarName (size subscripts) Or
DIM VarName (size subscripts) As Type Or
DIM VarName (size subscripts) As Type = {3,6,2, . , , ,5}[initialize values]
3-14
Section 3. CRBasic and Measurements
Remarks
In CRBasic, ALL VARIABLES MUST be declared. Variables are typically
declared at the beginning of the program and the default value is initialized to a
value of 0 unless otherwise declared.
A Public or DIM statement can be used for each variable declared, or multiple
variables can be defined on one line with one Public or DIM statement. If the
latter is done, the variables should be separated by a comma (e.g., "Public
Scratch1, Scratch2, Test" declares three variables). A variable array is created
by following the variable name with the number of elements enclosed in
parenthesis (e.g., Public Temp(3) creates Temp(1), Temp(2), and Temp(3)).
Two- and three-dimensional arrays can also be defined. A declaration of Dim
Temp(3,3,3) would create 29 variables: Temp(1,1,1), Temp(1,1,2),
Temp(1,1,3), Temp(1,2,1), Temp(1,2,2) … Temp(3,3,3). In the program, the
array can be referenced using the multi-dimensional form, or using an index
into the array.
VarName This parameter is the name for the defined variable. Variable names can be up
to 39 characters in length. Note, however, when outputting the variable to a
data table, the suffix containing the output type (e.g., _avg) is appended to the
end of the variable name. Therefore, to stay within the 39 character limit, most
variables should be no more than 35 characters (which allows for the 4
additional characters that may be needed for output processing identifiers).
Size The size subscript parameters are optional. They are used to set up the
dimensions of a variable array. The maximum number of array dimensions
allowed in a Public statement is three (two if setting up an array of Strings). If
you attempt to dimension a variable higher than three dimensional, an error
will occur.
For example:
Public Flow(8,3,5) would create a three-dimensional array called Flow that has
8 x 3 x 5, or 120 elements.
Public TCTemp(9) would create a one-dimensional array with 9 elements
called TCTemp.
The Option Base for dimensions is always 1; therefore, the lowest number in a
dimension is 1 and not 0. If a variable is dimensioned to a size that is too small
for its use in the program, a "Variable out of bounds" error will be returned
when the program is compiled by the datalogger or when the discrepancy is
encountered during run time.
As Type The Public instruction can be used with the optional As Type descriptor to
define the data format for the variable (e.g., PUBLIC Flag1 As BOOLEAN).
The data types are FLOAT, LONG, BOOLEAN, and STRING. The default
type is FLOAT.
Float: The default IEEE4 data type; a 32-bit floating-point with a 24-bit
mantissa data type. Float gives a range of roughly -3x10^34 to 3x10^34 with
about seven digits of precision. If no data type is specified, Float is used.
3-15
Section 3. CRBasic and Measurements
Long: Sets the variable to a 32-bit long integer, ranging from -2,147,483,648
to +2,147,483,647 (31 bits plus the sign bit). There are two possible reasons a
user would do this: (1) speed, since the CR1000 Operating System can do
math on integers faster that with FLOATs, and (2) resolution, since the LONG
has 31 bits compared to the 24 bits in the FLOAT. A good application of the
AS LONG declaration is a counter that is expected to get very large.
Boolean: Sets the variable to a 4-byte Boolean. Boolean variables are typically
used for flags and to represent conditions or hardware that have only 2 states
(e.g., On/Off, Ports). A Boolean variable uses the same 32-bit long integer
format as a Long but can set to only one of two values: True, which is
represented as –1, and false, which is represented with 0.
String * size: Sets the variable to a string of ASCII characters, NULL
terminated, with size specifying the maximum number of characters in the
string (note that the null termination character counts as one of the characters in
the string). The size argument is optional. The minimum string size, and the
default if size is not specified, is 16 (15 usable bytes and 1 terminating byte).
String size is allocated in multiples of 4 bytes. Thus, a string declared as 18
bytes will actually be 20 bytes (19 usable bytes and 1 terminating byte). A
string is convenient in handling serial sensors, dial strings, text messages, etc.
When declaring a data type for the variable, the variable is declared before
initialization:
Public StringVar as String * 30 = "Test String"
3-16
Section 3. CRBasic and Measurements
The Units declaration can used to assign a label to a variable in the program
Field name 39
Field Name 64
Description
3-17
Section 3. CRBasic and Measurements
BeginProg
Scan
<Measurements>
<Processes>
<Controls>
CallTable
NextScan
EndProg
3.1.6.2.1 BeginProg and EndProg Instructions
All of the instructions for the main program are placed between the BeginProg
and EndProg statements. Program variables, data tables, functions, and
subroutines must be defined in the program code before the main program
section.
3.1.6.2.2 Scan/NextScan Instructions
Use a Scan/NextScan construct to set up measurements, processing, and calls
to data tables which should be repeated indefinitely (i.e., until the program
stops), or repeated a certain number of times by the datalogger. The looping
and repeating nature of Scan…NextScan constructs determines the sequence
and timing of the datalogger program. Usually, measurement instructions
should be used within a Scan/NextScan block to set up the measurement
hardware and make a measurement (usually from a sensor). The measurement
results are placed into a variable and are then available for output processing.
3-18
Section 3. CRBasic and Measurements
In Example Program 3.1.6-2, the scan rate is 100 millisecond, three scans are
buffered, and the measurements and output continue indefinitely:
BeginProg
Scan(100,mSec,3,0)
Battery(Batt_Volt)
PanelTemp(RefTemp,250)
TCDiff(TC,1,mV25C,1,TypeT,RefTemp,RevDiff,Del,Integ,Mult,Offset)
CallTable Temp
Next Scan
EndProg
Example Program 3.1.6-2 CRBasic Scan Instruction
Repetitions: The number of times the measurement should be made. Measurements are
made on consecutive channels. If the Repetitions parameter is greater than
1, the Destination parameter must be a variable array. Note: entering
DiffChannel as a negative number forces all reps to be on the same
channel.
3-19
Section 3. CRBasic and Measurements
Range: The expected absolute maximum expected voltage output from the sensor.
Table 3.1.6-3 Voltage Range Options, list the available range codes for
the CR1000.
The resolution of a measurement is one part in 7500 over the full scale
range (FSR). The smaller the voltage range selected, the better the
absolute resolution. In general, a measurement should use the smallest
fixed voltage range that will accommodate the full scale output of the
sensor being measured.
The ranges that are specified with a code ending in C (e.g. mV2_5C)
check for an open circuit and at the same time pull the signal into common
mode range. Normally the C option should be used with thermocouples
that are measured differentially. This will dissipate any static charge that
may have built up on the thermocouple which could push the voltage
range beyond the input limits of the datalogger (-5 to +5 VDC). This will
be covered in more detail in Section 3.2.1.2 Nulling of Residual Common
Mode Voltage.
Diff Channel: The differential channel on which to make the first measurement. If the
Repetitions parameter is greater than 1, the additional measurements will
be made on sequential channels. If the DiffChan number is entered as a
negative value, all Reps will be performed on the same channel.
3-20
Section 3. CRBasic and Measurements
TCType: The codes for the thermocouple type are listed in Table 3.1.6-4.
Settling Time: The amount of time to delay before making the measurement after setting
the measurement up. Refer to Table 3.1.6-5 for default Settling Times.
Integration: The amount of time, in microseconds, to integrate a signal for the channel
being measured. Refer to Table 3.1.6-6 for a list of Integration options.
Mult & Offset: The raw output of the TCDiff instruction is in Celsius. Use the multiplier
and offset parameters to convert to different engineering units. A
multiplier of 1.8 and an offset of 32 will convert the temperature to
degrees.
3-21
Section 3. CRBasic and Measurements
TCDiff(AirTemp_C,1,mV2_5C,1,TypeT,PTemp_C,True,0,_60Hz,1,0)
To convert from degrees Celsius to degrees Fahrenheit multiply by 1.8 and add
32. In the following example the results are degrees Fahrenheit:
TCDiff(AirTemp_F,1,mV2_5C,2,TypeT,PTemp_C,True,0,_60Hz,1.8,32)
3-22
Section 3. CRBasic and Measurements
Values in variables are temporary and will be lost when the program ends or as
they are updated with new values. To make a permanent record of what values
have been measured or obtained, use a data table to store the data. Once these
items are stored in a table, they can then be retrieved from the datalogger to
files on the PC during data collection. The declarations of tables using the
DataTable instruction must appear in the program before the main scan.
Trigger: constant, variable, or expression which is evaluated to either true or false (i.e.,
as a Boolean value) to determine whether a call to the table will allow or
prevent values from being stored into final storage. If the Trigger evaluates to
3-23
Section 3. CRBasic and Measurements
false or zero, the DataTable’s output will not be triggered, and therefore new
records will not be saved by the DataTable. If the Trigger evaluates as true or
non-zero, the DataTable will output normally (i.e., if all other output
conditions are met).
Size: A data table is comprised of rows and columns. The DataTable size
determines the number of records (or rows) to be allocated to that table in the
CR9000X memory. The number of values (or columns) in the DataTable is
determined by the output processing instructions contained in the DataTable
declaration.
If a negative number is entered for a DataTable's size parameter, all memory
that remains after creating other fixed-sized tables at program start will be
allocated to that table. If multiple DataTables are declared with a negative
value for size, the available memory will be divided among those dynamically
allocated tables. The datalogger attempts to allocate memory to dynamically
allocated tables so that they fill at about the same time.
For data to be written to a DataTable, the table must be called from the
Main program using the CallTable instruction. A data table is usually called
after the measurements update the variables of interest.
For example, in a program with a main scan of 20 msec, you can set up 3
different tables to store data every 60, 100 and 200 msec. Each of the three
tables would be called from the main scan every 20 msec, but the tables would
not write out any values until the specified output interval is reached (i.e. every
3rd, 5th or 10th scan). The main motivation for having the table write out its data
3-24
Section 3. CRBasic and Measurements
You can use the Average output instruction, for example, within a 200 msec
table (set by the DataInterval instruction) that is called from a 20 msec main
scan. The table is called every 20 msec, but only writes out data every 200
msec (i.e every 10th scan). The first 9 times the table is called, it keeps track of
a specified value without writing it out. Then on the 10th call of the table, it
writes out the single average value for those 10 measurements into the table.
See Section 3.1.6.6.4.1 Average Output Processing Instruction for more about
the Average output instruction.
DataInterval(TimeIntoIntv,Intv,Units,Lapses)
Intv: The Intv (interval) parameter specifies how frequently the data will be
stored.
TimeIntoIntv: The TimeIntoIntv (time into interval) argument allows the programmer to
define an offset from the specified interval parameter which controls
exactly when data will be stored to the DataTable. For example, if the Intv
argument is set at 60 seconds, and TimeIntoIntv is set to 5, data storage will
occur at 5 seconds into the minute, every minute, based on the datalogger's
real-time clock. If the TimeIntoIntv is set to 0, data storage will occur at the
top of the minute, every minute.
0, 60 60
5
Units: Used to specify the units on which the TintoInt and Interval arguments will
be based. The options are msec (milliseconds), sec (seconds), min
(minutes), hr (hours), or day (days).
Lapses: Sometimes the storage of data records into a table occurs with timing that
is inconsistent or which cannot be predicted by the data storage interval of
the table. This may be caused by the missed storage of a record due to a
skipped scans in the program or other processing tasks that are being
performed. A condition or trigger used to control output to the table may
also result in data storage at irregular time intervals.
The irregular time storage of records in a table is called a data lapse. When
a lapse occurs, an "extra" timestamp header is created to ensure that the
proper reference timestamp is stored into the table for records in a group
subsequent to the lapse.
3-25
Section 3. CRBasic and Measurements
DataTable(Table1,True,-1)
DataInterval (0,1,Min,10)
CardOut (0,-1)
…. additional output instructions
EndTable
CardOut(StopRing, Size)
StopRing Enter 0 for a Ring mode table, 1 for a Fill and Stop table.
3-26
Section 3. CRBasic and Measurements
NOTE Filemarks can only be stored on the PC card using the binary TOB3
format. The events can be parsed out into separate files through the use of
the CardConvert utility. The TOB3 file from a PC card can be accessed by
removing the card and inserting it into the card slot of a PC and copying
it, or by copying the file using RTDAQ’s File Control window.
PreStartTrigRecs The number of records to be stored in the data table that occurred before
the expression in the StartTrig argument evaluated as true.
StartTrig This is a condition or set of conditions which trigger (start when the
evaluation is true) the process of writing data to the output table in the
datalogger. This can be any legal expression such as TBlk1(2) > 72. For
this example, when the variable TBlk1(2) contains a value greater than 72
the StartTrig argument is true and the event starts.
StopTrig This is a condition or set of conditions which terminate (stop when the
evaluation is true) the process of writing data to the output table in the
datalogger. This can be any legal expression such as TBlk1(2) < 60. For
this example, when the variable TBlk1(2) contains a value less than 60 the
StopTrig argument is true and the event stops.
PostStopTrigRecs The number of records to be stored in the data table that occurred after the
expression in the StopTrig argument evaluated as true.
3-27
Section 3. CRBasic and Measurements
Note that the CallTable (Event) instruction is located in the main program (not
shown).
The normal record count for a single trigger data event is the number of pre-
trigger records requested + 1 (the start trigger record) + the number of post-
trigger records requested.
The normal record count for a dual trigger data event is the number of pre-
trigger records requested + 1 (the start trigger record) + the number of records
until the Stop trigger evaluates as true + 1 (the stop trigger record) + the
number of post-trigger records requested.
It should be noted that for a given table, a new event cannot be triggered while
an existing event is currently being captured. If an event occurs before the
requisite number of pre- or post-trigger records have passed since the last
trigger, the logger will still not write duplicate records to the data table. This
may result in events which have a smaller number of records than expected.
Following are some examples in point:
The following examples show how Single triggered events (which is capturing
pre-trigger data) can have a varying number of records based on when the
trigger occurs.
Figure 3.1.6-4 depicts a signal that is being conditionally stored to a data table
using a single trigger condition that evaluates as true when the signal is greater
than 4 volts. The table is configured to collect 10 records before and 10
records after the trigger (a normal event should have 21 records stored per
event). As can be seen, only 5 records were available before the first trigger
occurred. This resulted in only 16 records being stored for the first event. In
this example, subsequent events had 21 records.
3-28
Section 3. CRBasic and Measurements
Figure 3.1.6-5 is a plot for a similarly triggered output table, only this time the
table is configured to collect 10 records before and 30 records after the trigger
(a normal event should have 41 records stored per event). Again, only 5
records were available before the first trigger occurred. This results in only 36
records being stored for the first event. The next trigger occurs before 10
records have passed, resulting in 36 records stored, counting the trigger record.
In this example, subsequent events all have 36 records because the signal is
synchronized with the triggers, and there are always 5 records available for pre-
trigger capture.
Figure 3.1.6-6 is of a plot for an output table that is triggered when the signal is
greater than 4 volts and is configured to store 10 pre-trigger records and 40
post-trigger records (a normal event should have 51 records stored per
event). Again, only 5 records were available before the first trigger occurred.
This results in 46 records being stored for the first event. The next trigger
occurs immediately after the first event. This results in zero pre-trigger
records, the trigger record, and 40 post-trigger records being stored for this
event (total of 41 records). The next trigger does not occur until Sample
#114, allowing for 10 pre-trigger records, the trigger, and 40 post trigger
records being stored (a total of 51 records).
3-29
Section 3. CRBasic and Measurements
Any defined table must be called by the main program or a subroutine (using
the CallTable instruction) in order for the processing of applicable values to
take place. Within a program using an Output Processing instruction such as
Average, the table should be called more frequently than it writes out its data,
as these output processing instructions calculate statistics that require multiple
data points for their calculation. In other words, the table output interval should
have a slower rate than the interval at which the table is called. The most
common way to do this is to call a table from a main scan at a given rate, but
setup that table to have a slow output rate using the DataInterval instruction
within the DataTable definition. Then the table is called each time the main
scan executes (frequently), but the table is only written out when the
DataInterval is reached (less frequently). This allows for multiple samples of
the variable’s value to calculate the given statistic.
A data table is usually called each time a measurement updates the variable of
interest. When the table is called, its output processing instructions update
their calculations based on the current values of their variable arguments.
When the trigger conditions and table interval values indicate the need for
output, then the processed values are written to the data table.
When you evaluate Example Program 3.1.6-3, you will see that the DataTable
TEMP is called every 20 mSecs (every Scan) but TEMP only stores a record
once every 400 mSec. So the output rate is twenty times slower than the main
scan interval of 20 msec. This will result in 20 samples of the RefTemp
variable’s value being used for each of the statistical calculations included in
the TEMP data table for each output interval or record.
3-30
Section 3. CRBasic and Measurements
Public RefTemp
DataTable (TEMP,1,2000)
DataInterval(0,400,msec,10)
Average(1,RefTemp,FP2,False)
Totalize(1,RefTemp,FP2,False)
StdDev(1,RefTemp,FP2,False)
Maximum(1,RefTemp,FP2,False,True)
Minimum(1,RefTemp,FP2,False,True)
EndTable
BeginProg
Scan(20,mSec,0,0)
PanelTemp (RefTemp,250)
CallTable TEMP
NextScan
EndProg
Example Program 3.1.6-3 CRBasic DataTable/CallTable
This number (Reps) does not represent how many measurements are
factored into the calculation of the statistical value (such as an
average) of a measurement. That is determined by the ratio of how
often the table is called compared to its output interval or event. This
number is an expression of how many simultaneous distinct
statistical calculations will be made with one instruction.
Source Name of the variable for which an average should be calculated and stored.
If the Reps parameter is greater than 1, a variable array must be specified
for the Source argument. Otherwise a Variable Out of Bounds error will be
returned when the program is compiled.
DataType Used to select the data representation in which to save the calculated
average. For Output Processing instructions, this is usually set to FP2 or
IEEE4, depending on the resolution required for the storage of the final
3-31
Section 3. CRBasic and Measurements
values. See Table 3.1.6-7 Data Storage Data Type Options for output
format options.
Example Program 3.1.6-4 creates a table named TEMP which writes out data at
zero msec into its interval relative to the real time clock (i.e. “on” the interval).
The interval is 100 milliseconds, and the table can handle 10 lapses without
losing record space.
The output includes the averages of all readings in the 100 mSec interval of the
variable RefTemp (i.e. 5 readings for each average).
3-32
Section 3. CRBasic and Measurements
The Maximum and Minimum instructions are declared in a similar way to the
Average instruction, and return the maximum or minimum value measured
during the output interval. The syntax for these parameters are:
Maximum( Reps, Source, DataType, DiableVar, Time )
Minimum( Reps, Source, DataType, DisableVar, Time )
The parameters for these instructions are identical to the parameters for the
Average instruction with one exception: the Time parameter.
Time When this argument is true, then the time that the maximum or minimum
occurred during the output interval will be written out as part of the stored
record in the table. Do not confuse this with the main timestamp included
at the beginning of each record stored, which is the time that the output was
written.
3-33
Section 3. CRBasic and Measurements
The stored data format is selected using the program instruction that defines the
stored data inside of the DataTable definition, i.e., Sample, Average,
Maximum, etc. Data can only be stored in the Boolean, BOOL8, String, and
NSEC formats when using the Sample instruction.
The two most common formats for storing data in a data table are IEEE4 and
FP2. Data stored as IEEE4 has a representation in the table identical to the
Float representation for declared variables in the program. To store an
Average using 4 bytes and with no change in resolution from the program
variable, use an output instruction like this:
Average(1,AirTemp,IEEE4,0)
To store that same measurement with only 2 bytes (reducing resolution) use an
instruction like this:
Average(1,AirTemp,FP2,0)
While Float (IEEE 4-byte floating point) is used for declared variables and
internal calculations, in some applications FP2 can be an adequate data
representation for the final storage of that same data. Campbell Scientific 2-
byte floating point (FP2) provides 3 or 4 significant digits of resolution (versus
7 digits of resolution using IEEE4), and requires only half the memory space as
IEEE4 (2 bytes per value for FP2 vs. 4 bytes per value for IEEE4).
The resolution of FP2 is reduced to 3 significant digits when the first (left
most) digit is 8 or greater. Thus, it may be necessary to use IEEE4 output or
an offset to maintain the desired resolution of a measurement. For example, if
water level is to be measured and output to the nearest 0.01 foot, the level must
be less than 80 feet for FP2 output to display the 0.01 foot increment. If the
water level is expected to range from 50 to 90 feet the data could either be
output in IEEE4 or could be offset by 20 feet (transforming the range to 30 to
70 feet).
The Long format is a 4 byte signed integer. It has a range from -2,147,483,648
to +2,147,483,647 with a resolution of 1.
UINT2 is a 2 byte unsigned integer with a range from 0 to 65,535 and a
resolution of 1.
3-34
Section 3. CRBasic and Measurements
DataTable(Main,True,-1)
DataInterval(0,5,Sec,0)
Average(1,AirTemp_C,IEEE4,0)
Maximum (1,AirTemp_C,IEEE4,0,False)
Minimum (1,AirTemp_C,FP2,0,False)
Minimum (1,Batt_Volt,FP2,0,False)
Sample (1,counter,Long)
Sample (1,Name,String)
EndTable
Send program to the CR1000, wait a minute to allow for the generation of
some records in the DataTable Main. Collect and view data.
Public TCTemp(6)
Unique names and units can be given to the individual elements of a variable
array though the use of the Alias and Units instructions:
3-35
Section 3. CRBasic and Measurements
Not only can this save code in the Declarations portion of the program, but
most measurement and output instructions allow the use of repetitions when
using arrays, also greatly reducing the program code. To use a repetition of
more than 1, the variables being acted upon must be declared as arrays.
Sample(6,TCTemp(),FP2)
The repetition’s value of 6 indicates how many elements of the array to store
values for. The TCTemp() parameter indicates to the program that it should
store values starting with the first element of the array.
When using Output processing instructions, an element other than (1) can be
specified for the starting element. If it was desired to store the last 4 elements
of the array, skipping the first 2 elements, the code should look like:
Sample(4,TCTemp(3),FP2)
3.1.6.7.3 Measurement Instructions using Array Notation for the Destination Parameter
An example of a Measurement instruction’s use of Array Notation and
Repetitions using just one TCDiff instruction to measure all 6 Type T
thermocouples with look like the following:
TCDiff(TCTemp(),6,mV50C,3,TypeT,MTemp_C,True,0,_60Hz,1,0)
The TCTemp() parameter indicates to the program that it should place the
measurement results into an array starting with the first element. The
repetitions value of 6 indicates how many thermocouple measurements should
be made. The channel parameter of 3 indicates that the first of the 6
measurements should be made on channel 3, with successive measurements
made one channel higher for each subsequent repetition up to 6 (i.e., channels
3,4,5,6,7,8). So the results for the thermocouple in channel 3 will be written to
TCTemp(1), channel 4 to TCTemp(2), ... channel 8 to TCTemp(6).
3-36
Section 3. CRBasic and Measurements
To write Temperature measures into TCTemp(5) through (7), write code like
this:
VoltSE(TCTemp(5),3,mV2500,4,1,0,100,Mult,Offset)
3.1.6.7.4 Measurement Instructions using Array Notation for the Mult & Offset
Parameters
Multiplier and Offset parameters for most measurement instructions can be
declared as variable arrays and used when the Measurement’s Reps argument is
greater than 1. This allows for unique multipliers and offsets being applied to
the different elements of the measurement array.
As noted above, when using arrays for the Output’s Source parameters or the
Measurement’s Destination parameters, using “TCTemp()” is the same as
“TCTemp(1)” or “TCTemp”. This is not the case when using arrays for the
measurement instructions’ Multiplier and Offset parameters.
When using multiplier and offset arrays, you should not specify the first
element (i.e. “Mult(1)”) unless you want the same multiplier ( element 1) to be
used on all the repetitions of the instruction. In other words, if a specific
element of an array is specified, such as Mult(1), all reps in that instruction will
use the value from that element for the multiplier. If you use Mult() or Mult,
then the first rep will use Mult(1), the second Mult(2), the third Mult(3) .... etc.
If you want to step through from a specific array element other than the first
element, you must insert empty parenthesis following the parameter:
Mult(2)(). In this case the first rep will use Mult(2), the second Mult(3), the
third Mult(4) .... etc
This CRBasic code example sets up unique multipliers and offsets for the
single ended voltage measurement, and sends results to the Pressure() variable
array:
3-37
Section 3. CRBasic and Measurements
VoltSE(Pressure(3),3,mV1000,6,1,0,100,Mult(3)(),Offset(3)())
Note that Repetitions is set at 3. This is set to measure three sensors, apply
Multipliers and Offsets based on elements 3, 4, and 5 of their respective
arrays, and store the results in elements 3, 4 and 5 of the Pressure array.
Public Accel(6)
Public Mult(6) = {1.012,1.121,1.106,1.134, 1.125, 1.101}
Public Offset(6) = {0.1, 0.2, 0.3,0.4,0.5,0.6}
DataTable (Main,1,1000)
DataInterval (0,15,Sec,10)
Sample (6,Accel(),FP2)
EndTable
BeginProg
Scan(1,Sec,0,0)
VoltDiff(Accel(),4,mV2500,1,True ,200,500,Mult(),Offset())
VoltDiff(Accel(5),2,mV5000,5,True ,200,500,Mult(5)(),Offset(5)())
CallTable Main
NextScan
EndProg
3-38
Section 3. CRBasic and Measurements
'Measurement Instruction :
TCDiff (TC(),2,mV2_5C,1,TypeT,PTemp,True ,0,250,Mult,Offset)
3-39
Section 3. CRBasic and Measurements
Figure 3.1.6-7 depicts control connections. The power, ground, reset, and clock
connections are essentially the same regardless of the datalogger used. The
datalogger 12 VDC supply and ground terminals are connected to the
AM16/32B 12V and ground terminals. One control port is required for
clocking and a second control port for reset. The cable’s shield is grounded on
both ends as illustrated in Figure 3.1.6-7.
3-40
Section 3. CRBasic and Measurements
The same logic could be accomplished using a For/Next loop. The advantage
of using a SubScan/NextSubScan construct is that you can use it in a program
running in PipeLine mode, whereas using the For/Next Loop construct with
measurement instructions requires the program to run in Sequential mode.
The CRBasic program sequence for using a For/Next Loop, which is very
similar to the SubScan/NextSubScan construct, follows:
3-41
Section 3. CRBasic and Measurements
HardWare Set-up:
AM16/32 Multiplexer should be set to 2x32 mode.
Wire up control per Figure 3.1.6-7, using C7 for the Reset, C8 for the Clock
Tie the Common Odd H on the multiplexer to Differential channel 8 H on
the CR1000.
Tie the Common Odd L on the multiplexer to Differential channel 8 L on
the CR1000.
Wire TC1 on the multiplexer’s Bank 1, channel 1.
Wire TC2 on the multiplexer’s Bank 1, channel 2
Program Set-up:
Scan rate of 1 Sec.
Use a Single VoltDiff instruction within a Subscan construct, having a
SubScanCount parameter of 2, to measure both sensors.
The first sensor should have a multiplier of 200 and offset of 2.
The second sensor should have a multipler of 300 and offset of 5 (use
variable array for the VoltDiff’s mult and offset parameters).
Data Table Storage rate synchronized to the Scan rate (once a second)
Store results from both VoltDiff measurements
3-42
Section 3. CRBasic and Measurements
3-43
Section 3. CRBasic and Measurements
The CAL file initially does not contain any values for the calibration factors.
As sensors setup for calibration using the FieldCal or FieldCalStrain
instructions are calibrated, the CAL file will be populated with their new
calibration coefficients (multipliers and/or offsets). Any calibration factors that
have not been adjusted by a field calibration will not be written to the Cal file.
Function Used to specify the type of calibration that will be performed. Code to be
entered for different calibration types is listed below.
Digit Function
0 Zero or Tare calibration
1 Offset Calibration
2 Two Point Calibration; Slope and Offset (Multiplier and Offset)
3 Two Point Calibration; Slope only (Multiplier only)
4 Load Zero Basis Point
MeasureVar The variable or variable array for the sensor(s) being calibrated. Must be
dimensioned large enough to accommodate the number of Reps.
Reps Variable whose value specifies the number of sensors to be setup for
calibration. Must be set equal to either 1 or the size of the MeasureVar
parameter array at the time of calibration. When Reps is set to the size of
the MeasureVar array (the Index parameter must be set to 1); all elements
of the MeasureVar array will be calibrated in a single scan. When Reps is
set to 1, a single element of the MeasureVar array, specified by the Index
parameter, will be calibrated.
If the Reps parameter is declared as a variable, the value can be changed
during program operation. This allows the calibration of a complete array
at one point, and following up later with a calibration on a single element
of the array. Reps should be initialized to either 1 or the size of the
MeasureVar array prior to starting a calibration.
3-44
Section 3. CRBasic and Measurements
MultiplierVar Zero (Function = 0), Offset (Function = 1), or Zero Basis (Function =
4): zero can be entered for this parameter (not used).
Two Point: Variable or Variable array which will be populated with the
computed Multiplier(s) from the calibration(s). MultVar should be
dimensioned to the same size as the MeasureVar variable array. The
element of the array for the primary calibration is set by the Index
parameter. If MultVar is equal to 0 or NAN prior to the calibration, then it
will be set equal to1 during the calibration process.
ModeVar This variable parameter stores an integer that indicates the current state of
the calibration. This value can be changed through automatic software or
manually by the user using a Keyboard display or using CSI’s Software
packages. The only values valid for manual entry is 1 (Start Calibration) or
4 (second point for two point calibration is entered).
Digit Edge
-1 Error in the Calibration setup
-2 Multiplier set to 0 or = NAN, measurement = NAN
-3 Reps is set to a value other than 0, 1 or the size of the MeasureVar array
0 Calibration has not been done
1 Start Calibration. (For Offset or 2 Point, KnownVar holds first set point)
2 Computing (set by logger)
3 Only for Two Point. Ready to set the KnownVar to the second value
4 Only for Two Point. KnownVar holds the second set Point
5 Only for Two Point. Computing (set by logger).
6 Calibration is complete.
Index If Reps is set to the size of the MeasureVar, then Index must be set equal
to 1 (complete array will be calibrated starting with the first element). If
Reps is set to 1, then Index specifies which element of the MeasureVar
array will be calibrated.
If Index is declared as a variable, it must be initialized to a non-zero value
before a calibration can be performed. If Index is set to a negative value,
the calibration setup for this FieldCal instruction will be disabled.
Avg Used to specify the number of points (Scans) to average when performing a
calibration.
3-45
Section 3. CRBasic and Measurements
Instruction Description
FieldCal or Main calibration instruction. The CRBasic program should
FieldCalStrain contain one FieldCal instruction per measurement
requiring calibration. This instruction is placed before the
measurement instruction to which it applies.
LoadFieldCal (optional) This instruction loads values into program
variables from the calibration file (*.cal), if it exists and
has been populated with the calibration factors’ values. It
will also indicate whether the attempt to load those values
was successful or not by returning a boolean result.
SampleFieldCal (optional) This is a table output instruction. It writes the
latest calibration factors, for all measurements that are
setup for calibration using a FieldCal or FieldCalStrain
instruction, to a data table (separate from the *.cal file).
NewFieldCal (optional) This is a boolean system value indicating when a
calibration has succeeded. During one scan cycle, directly
following the completion of a calibration, this value will be
true. At the top of the following Scan, its value is
automatically set to false, and will remain false until
another calibration occurs. The value of this variable
cannot be set within a CRBasic Program, but only
evaluated. The main purpose for this variable is to be used
as the Trigger parameter in the Data Table instruction, for
the data table using the SampleFieldCal instruction to
output one table record per calibration.
3-46
Section 3. CRBasic and Measurements
output of the sensor in this specialized condition (the zero condition) and
subtracting this output result from the current offset variable value, and using
the resultant for the new offset variable. This will yield a measurement result of
zero for this “Zero State”. Note that this process only changes the offset
variable that is shared between the measurement instruction and the FieldCal
instruction. The multiplier is unaffected.
To setup a zero calibration in the CRBasic program, hard code the FieldCal
instruction’s Function parameter to 0. The Calibration Wizard can be used to
calculate and apply the proper offset while the program is running in the
datalogger, or code can be configured within the CRBasic program to trigger
the zeroing event based on flags or other user-defined conditions that occur
while the program runs.
3-47
Section 3. CRBasic and Measurements
To setup an offset calibration in the CRBasic program, hard code the FieldCal
instruction’s Function parameter to 1. The Calibration Wizard can be used to
calculate and apply the proper offset while the program is running in the
datalogger, or code can be configured within the CRBasic program to trigger
the offset event based on flags or other user-defined conditions that occur while
the program runs.
3-48
Section 3. CRBasic and Measurements
Public Accel(6)
Public Mult(6) = {1.1,1.2,1.3,1.4,1.5, 1.6} ’Declare and initialize Mult
Public Offset(6) = {0.1, 0.2, 0.3,0.4,0.5,0.6} ’Declare and initialize Offset
‘Declare variables for Calibration
Public RepsZero, ModeZero, IndexZero, AvgZero, LoadTest, KnownVar(6)
DataTable (Main,1,1000)
DataInterval (0,1,Sec,10)
Sample (6,Accel(),IEEE4)
EndTable
DataTable (Calib,NewFieldCal,10)
SampleFieldCal
EndTable
BeginProg
‘Initialize FieldCal Parameters
RepsZero = 6 : IndexZero = 1 : AvgZero = 1
LoadTest = LoadFieldCal(0)
Scan (1,Sec,0,0)
VoltDiff (Accel(),6,mV2500,1,True ,200,500,Mult(),Offset())
FieldCal (1,Accel(),RepsZero,0,Offset(),ModeZero,KnownVar,IndexZero,AvgZero)
CallTable Main
CallTable Calib
NextScan
EndProg
The sensor is placed into the first condition, and the known value, in
engineering units, for that condition is provided to the datalogger program. An
average of one or more measurements of that first condition are stored, and
then the datalogger informs the user that the second known condition should
now be applied to the sensor.
Next, the second condition is applied and its known value is provided to the
datalogger. The datalogger then records the sensor’s output at this second
condition.
When the measurement of the second point condition is complete, a linear fit of
the two points is calculated. The results are a slope value (m value, or
multiplier), and a y-intercept (b value or offset). Thus the simple form y=mx+b
is a representation of the linear fit, where m is the new multiplier value used
and b is the new offset used. (See Appendix E Calibration of Linear Sensors
for Data Acquisition for more information about the mathematical techniques
used for calculating multipliers and offsets).
3-49
Section 3. CRBasic and Measurements
The second known weight is placed on the scale (15 lbs). The second point of
calibration is triggered, the user informs the datalogger of the value of the
second known weight, and the measurement is read. At this point the new
multiplier and offset are calculated by the datalogger and the variables are
adjusted accordingly to ensure that the scaling gives a properly matched
reading for those two conditions. For future measurements, a linear response
will be used based on the line defined by those two points.
DataTable (Main,1,1000)
DataInterval (0,1,Sec,10)
Sample (6,Accel(),IEEE4)
EndTable
DataTable (Calib,NewFieldCal,10)
SampleFieldCal
EndTable
BeginProg
‘Initialize FieldCal Parameters
RepsZero = 6 : IndexZero = 1 : AvgZero = 1
LoadTest = LoadFieldCal(0)
Scan (1,Sec,0,0)
VoltDiff (Accel(),6,mV2500,1,True ,200,500,Mult(),Offset())
FieldCal (2,Accel(),RepsZero,Mult,Offset,ModeZero,KnownVar,IndexZero,AvgZero)
CallTable Main
CallTable Calib
NextScan
EndProg
Example Program 3.1.7-3. FieldCal Instruction for Multiplier & Offset Calibration
3-50
Section 3. CRBasic and Measurements
The sensor is subjected to the first condition, and the known value for that
condition is provided to the datalogger. The output from the sensor at this state
is noted, and then the datalogger informs the user that the second known
condition should be applied to the sensor.
The sensor is next subjected to the second condition, and the known value for
that state is provided to the datalogger. The datalogger measures the second
condition. After completing the measurement of the second point condition, a
best fit of the two points is calculated, resulting in a slope value (m value or
multiplier). In essence, the technique is to use two Cartesian coordinates for
each of two points and calculating the resultant slope.
For example: With a load of 5 pounds a scale outputs 2 mv, and with a load of
9 pounds it outputs 4 mV, we would have our two points on the Cartesian
plane: (5,2) and (9,4). To calculate the slope (m) we simply divide the
difference in the X coordinates by the difference in the Y coordinates:
9−5
m= =2
4−2
To setup a 2-Point Multiplier Only calibration in the CRBasic program, hard
code the FieldCal instruction’s Function parameter to 3. The Calibration
Wizard can be used walk the user through the two different known conditions
and calculate the new multiplier when the program is running in the datalogger.
Public Accel(6)
Public Mult(6) = {1.1,1.2,1.3,1.4,1.5, 1.6} ’Declare and initialize Mult
Public Offset(6) = {0.1, 0.2, 0.3,0.4,0.5,0.6} ’Declare and initialize Offset
‘Declare variables for Calibration
Public RepsZero, ModeZero, IndexZero, AvgZero, LoadTest, KnownVar(6)
DataTable (Main,1,1000)
DataInterval (0,1,Sec,10)
Sample (6,Accel(),IEEE4)
EndTable
DataTable (Calib,NewFieldCal,10)
SampleFieldCal
EndTable
BeginProg
‘Initialize FieldCal Parameters
RepsZero = 6 : IndexZero = 1 : AvgZero = 1
LoadTest = LoadFieldCal(0)
Scan (1,Sec,0,0)
VoltDiff (Accel(),6,mV2500,1,True ,200,500,Mult(),Offset())
FieldCal (3,Accel(),RepsZero,Mult,0,ModeZero,KnownVar,IndexZero,AvgZero)
CallTable Main
CallTable Calib
NextScan
EndProg
Example Program 3.1.7-4. FieldCal Instruction for 2-Point, Multiplier Only Calibration
3-51
Section 3. CRBasic and Measurements
FieldCal (4,Accel,1,0,ZeroState,Mode,0,1,Avg)
Using the syntax shown above, when a calibration is performed the current
Accel variable’s value will simply be loaded into the ZeroState variable.
A common application for this calibration type would be where the result is
based not only on the zero offset for a single sensor, but the zero state of
multiple sensors. For example, a non-vented Piezometer whose result should
take into account not only a zero reading from the sensor, but also effects due
to temperature and barometric pressure changes with respect to their values at
the time of calibration. Such an equation might look like:
Press = G(R0 – R1) + K(T0 – T1) + (S0 – S1)
Where Press = current result in the correct engineering units
3-52
Section 3. CRBasic and Measurements
'CR1000
'Declare Variables and Units
Public Pressure1 : Units Pressure1 = PSI
Public VW(1,6)
Public Equation_Parameters(3)
Alias Equation_Parameters(1) = Digits1 : Units Digits1 = Digit
Alias Equation_Parameters(2) = Temperature1 : Units Temperature1 = Deg_C
Alias Equation_Parameters(3) = BaroPressure1 : Units BaroPressure1 = mBar
Public ZeroFactor(3)
Alias ZeroFactor(1) = Digit_ZeroPoint : Units Digit_ZeroPoint = Digits
Alias ZeroFactor(2) = Temperature_ZeroPoint : Units Temperature_ZeroPoint = Deg_C
Alias ZeroFactor(3) = Baro_Zero : Units Baro_Zero = mBar
DataTable (Table1,True,-1)
DataInterval(0,0,0,10)
Sample (1,Pressure1,IEEE4)
Sample(6,VW(),IEEE4)
EndTable
DataTable (CalFact,NewFieldCal,10)
SampleFieldCal
EndTable
BeginProg
SerialOpen(Com1,38400,0,0,500)
‘Set Sensor’s Gage Factor and Temperature correction coefficient
' Linear GF1 (G) Thermal Factor (K)
GF1 = 0.01664 : : Temperature1_K = -0.00517
'Initialize zero points to factory defaults (from calibration sheet
'Factory Zero Digit (Ro) : Factory Zero (To) :Factory Barometer (mbar) :Baro Pressure
Digit_ZeroPoint = 8746 : Temperature_ZeroPoint = 21.4 : Baro_Zero = 991 : BaroPressure1 = Baro_Zero
LoadResult = LoadFieldCal(False) 'load the calibration constants stored in the cal file after a zero is performed
Scan(10,Sec,1,0)
'CS100 Barometric Pressure Sensor measurement BP_mmHg
PortSet(3,1)
Delay(0,2,Sec)
VoltSE(BaroPressure1,1,mV2500,5,1,0,_60Hz,0.2,600)
PortSet(3,0)
3-53
Section 3. CRBasic and Measurements
3.1.7.5.6 FieldCal Exercise: Two-Point Multiplier and Offset & Zero Calibration
►► CRBasic Exercise 3.1.7-1; FieldCal Instruction: FieldCal2Point.CR1
Objective: Use CRBasic to create a new program to measure two Type T
thermocouples on sequential channels using a single VoltDiff instruction. The
program will have the following requirements:
Public HotTips(2)
Alias HotTips(1) = GoodTip : Alias HotTips(2) = BadTip
Public Mult(2) = {300,300)
Public Offset(2) = {5,5}
Public Reps, Mode, Index, Avg, LoadTest, KnownVar(2)
Public RepsZero,ModeZero,IndexZero
DataTable (Main,1,1000)
DataInterval (0,1,Sec,10)
Sample (2,HotTips,IEEE4)
EndTable
DataTable (Calib,NewFieldCal,10)
SampleFieldCal
EndTable
BeginProg
Reps = 1 : Index = 1 : Avg = 1
RepsZero = 1 : IndexZero = 1
LoadTest = LoadFieldCal(True)
Scan (1,Sec,0,0)
VoltDiff (HotTips(),2,mV2_5,1,True ,200,500,Mult(),Offset())
FieldCal (2,HotTips(),Reps,Mult,Offset,Mode,KnownVar(),Index,Avg)
FieldCal (0,HotTips(),RepsZero,0,Offset(),ModeZero,0,Index,Avg)
CallTable Main
CallTable Calib
NextScan
EndProg
3-54
Section 3. CRBasic and Measurements
Most values of the mode variable represent the status of the calibration for that
affected measurement. A few values of the mode variable are set by the user of
the datalogger to instruct the program to proceed with calibrations.
The following values of the mode variable give the status of the calibration:
0 Mode variable not been used to perform Calibration since program startup.
2 Calibration in progress OR first stage of two-point calibration in progress
3 Waiting for second stage of two-point calibration to begin
5 Second stage of two-point calibration in progress
6 Calibration complete
-1 Error Code: Calibration error
-2 Error Code: Multiplier set to 0 or = NAN, measurement = NAN
-3 Error Code: Reps is set to a value other than 0, 1 or the size of the
MeasureVar array with.
The following values of the mode variable are used to initiate a calibration
process:
1 Start the calibration, OR start the first point of a two point calibration
4 Start the second point of a two point calibration
By properly changing the known value variables and the mode variables in a
calibrating program, a manual calibration can be performed on a sensor. Steps
for doing this are given below.
3-55
Section 3. CRBasic and Measurements
3-56
Section 3. CRBasic and Measurements
3-57
Section 3. CRBasic and Measurements
3.1.7.7.2 Using the Wizard to Perform Two-Point Multiplier and Offset Calibrations
To perform a two-point calibration using the Wizard, run a program in your
datalogger utilizing a two-point multiplier/offset in the FieldCal instruction.
Connect to your datalogger and choose Calibration Wizard from the
Datalogger menu.
NOTE The steps for performing a two-point slope only (multiplier only)
calibration in the Wizard are nearly identical to those for a two-
point multiplier and offset calibration. Only a two-point
multiplier and offset calibration example will be shown here.
The Introduction screen for the Wizard will appear. Review the instructions
and press Next.
3-58
Section 3. CRBasic and Measurements
Now select the kind of calibration you wish to perform, which in this case is
Multiplier and Offset, and press Next.
Now select which sensor it is that you wish to calibrate and press Next. You
can select an entire array, or any single element of that array, as well as scalar
(single-valued) variables. Any items that have been aliased (i.e., given an
alternate name using the Alias instruction in the CRBasic program) will show
by the alias name, including aliased elements of an array.
3-59
Section 3. CRBasic and Measurements
Select the second sensor, BadTip, to perform the 2-point calibration on and
click on “Next”.
If the FieldCal’s Average parameter is a variable, then the next window will be
displayed.
3-60
Section 3. CRBasic and Measurements
The currently measured value for the sensor will be displayed in the next
screen. Now place the sensor into the first known condition, and enter that
known value into the First calibrated value box. Press Set First Value. Wait
for the calibration process to measure the first value. The word Calibrating
will be visible in the Current Value box until that process is complete. Now
place the sensor into the second known condition, and then enter the
corresponding known value into the Second calibrated value box. Press Set
Second Value. The calibration process measures the second point value. At
that point the datalogger calculates the new multiplier and offset and applies
them within the running program. These values are also written to the
calibration file.
After the multiplier and offset have been calculated and set, the ending screen
of the Wizard appears. You can conclude the calibration, or return to the
starting point to perform more calibrations of the same or different sensors.
3-61
Section 3. CRBasic and Measurements
Now you can monitor the reading on the sensor to be calibrated. Set the sensor
to the zero condition, and press Calibrate.
3-62
Section 3. CRBasic and Measurements
The Current Value box will be yellow during the calibration process. When it
finishes, you will see the new value of the sensor after the application of the
zeroing offset. Press Finish to end the calibration.
3-63
Section 3. CRBasic and Measurements
Now you can view the current reading on the sensor to be calibrated. Set the
sensor to the known value (“calibrate to” value). Enter that value into the
Enter Calibrated Value box. Press Calibrate. The current value will show
Calibrating until the process is complete. You will then have the opportunity
to press Finish, or press Previous to return and calibrate more sensors.
3-64
Section 3. CRBasic and Measurements
3-65
Section 3. CRBasic and Measurements
Figure 3.2-2 illustrates the instrumentation amplifier with the input signal
decomposed into a common-mode voltage (Vcm) and a DIFF mode voltage
(Vdm). The common-mode voltage is the average of the voltages on the H and
L inputs, i.e., Vcm = (VH + VL)/2, which can viewed as the voltage remaining
on both the H and L inputs when the DIFF voltage (Vdm) equals 0. The
voltage on the H and L inputs is given as VH = Vcm + Vdm/2, and VL = Vcm –
Vdm/2, respectively.
The term “Common-mode Range”, which defines the valid range of common-
mode voltages, is often used instead of “Input Limits.” For DIFF voltages that
are small compared to the Input Limits, Common-mode Range is essentially
equivalent to Input Limits. Yet from Figure 3.2-2,
3-66
Section 3. CRBasic and Measurements
SE 1 2
Diff 1
H L
1005 mV
995 mV
Measurement Returned: 10 mV
Thermocouple Value: 246 degrees C
Sensor
Sensors that have a floating output (the output is not referenced to ground
through a separate connection, such as thermocouples) may float outside of the
Input Limits, causing measurement problems. For example, a larger static
charge in Example 3.2.1-1 could result in an invalid thermocouple
measurement. Hence, the ability to null any residual common-mode voltage
prior to measurement is useful in pulling the H and L Instrumentation Amp
inputs within the ±5 V Input Limits.
Adding a “C” to the end of the range code (i.e. mV250C) enables the nulling of
the common-mode voltage prior to a differential measurement for the ±2.5 mV,
±7.5 mV, ±25 mV, and ±250 mV input ranges of the CR1000. It should be
noted that for single ended measurements, the low side is always pulled to
ground, nulling the common mode voltage.
Another useful feature for both SE and DIFF measurements is the detection of
open inputs due to a broken or disconnected sensor wire, preventing undetected
measurement errors. On the ±2.5 mV, ±7.5 mV, ±25 mV, and ±250 mV input
ranges, the “C” range code option results in a brief 50 microseconds internal
connection of the H and L inputs of the IA to 300 mV and ground,
respectively, while also connected to the sensor to be measured. The resulting
internal common-mode voltage is ±150 mV, which is well within the ±5 V
Input Limits. Upon disconnecting the internal 300 mV and ground
connections, the associated input is allowed to settle to the desired sensor
voltage and the voltage measurement made. If the associated input is open
(floating) the input voltages will remain near the 300 mV and ground, resulting
in an over range (NAN) on the ±2.5 mV, ±7.5 mV, ±25 mV, and ±250 mV
input ranges. If the associated sensor is connected and functioning properly, a
valid measured voltage will be returned.
Example 3.2.1-2: Start with example 3.2.2-1. If the static charge were to
build up to 5000 mV, with a thermoelectric voltage of 10 mV the VH
would equal 5005 mV. This is above the Input Limit of 5000 mV, and a
reliable measurement cannot be made without pulling the inputs to within
the allowable Input Limit range. If the 25mVC, Open Sense Detect, range
code, were utilized, the input voltages would be pulled within the Input
Levels and a good measurement could be made.
3-67
Section 3. CRBasic and Measurements
• If the input is not a truly open circuit, such as might occur on a wet
cut cable end, the open circuit may not be detected because the input
capacitor discharges through external leakage to ground to a normal
voltage within the settling time of the measurement. This problem is
worse when a long settling time is selected, as more time is given for
the input capacitors to discharge to a "normal" level.
• If the open circuit is at the end of a very long cable, the test pulse
(300 mV) may not charge the cable (with its high capacitance) up to a
voltage that generates NaN or a distinct error voltage. The cable may
even act as an aerial and inject noise which also might not read as an
error voltage.
• The sensor may "object" to the test pulse being connected to its
output, even for 100 microseconds. For most sensors, there is little or
no risk of damage, but the sensor output may be kicked into
temporary oscillation. Longer settling times may avoid this.
• Some sensors require that the excitation low side and the sensor’s
output low side are isolated from each other. If the C option is used
for these types of sensors, damage could occur to the sensor.
TABLE 3.2-1. Analog Voltage Input Ranges with Options for Common
Mode Null (CMN) and Open Input Detect (OID)
3-68
Section 3. CRBasic and Measurements
Can double the number of sensors that can fit on the wiring panel.
3-69
Section 3. CRBasic and Measurements
VoltSE( Dest, Reps, Range, SEChan, MeasOffset, Settling, Integ, Mult, Offset )
3-70
Section 3. CRBasic and Measurements
Voltage Range — the expected voltage range of the input to the CR1000 from
the sensor. See Section 3.2.1.3.
SEChan — the number of the Single Ended channel on which to make the first
measurement. If the Repetitions parameter is greater than 1, the additional
measurements will be made on sequential channels. If the SEChan number is
entered as a negative value, all Reps will be performed on the same channel.
Option Description
250 Performs a 250 microsecond integration.
_60Hz Performs a 16.667 millisecond integration; filters 60 Hz noise.
_50Hz Performs a 20 millisecond integration; filters 50 Hz noise.
Multiplier, Offset — The Multiplier and Offset parameters are each a constant,
variable, array, or expression by which to scale the results of the measurement.
With a multiplier of 1 and an offset of 0, the output is in mV.
3-71
Section 3. CRBasic and Measurements
The timing of these steps is dependent on the values entered for the Integration
and Settling parameters. For example, if the user selected the 250 μseconds
option for the Measurement’s Integration and 100 μseconds for the Settling
time, the complete measurement process would require 475 μseconds. If 600
μseconds where used instead of 100 μseconds for the Settling time, the
cumulative time for the measurement process would be 600 μseconds (Settling
time) + 250 μseconds (Integration time) + 125 μseconds (A/D conversion time)
which equals 975 μseconds.
3-72
Section 3. CRBasic and Measurements
First step is to determine the multiplier and offset. For those that like an
exercise in math, use the methods outlined in Appendix E. For the rest of us,
we will use the LogCalc.exe that is included on the class CD.
Invoke it and you should see a list of calculators. See Figure 3.2-6:
Select the X-Y Calculator and input the values for the mV minimum (0 mV)
and its associated pressure (600 mb) and the mV maximum (2500 mV) and its
associated pressure (1100). See Figure 3.2-7.
3-73
Section 3. CRBasic and Measurements
Use the calculated multiplier (0.2) and offset (600) for the measurement
instruction in the program.
DataTable (met_data,True,-1)
DataInterval (0,60,min,10)
Sample (1,pressure,IEEE4)
EndTable
BeginProg
Scan (1,Min,3,0)
If (IfTime (59,60,min)) Then PortSet(1,1) ‘'Turn on CS100 one minute before the hour
If (IfTime (0,60,min)) Then 'Make measurements at the top of the hour
VoltSe (Pressure,1,mV2500,15,False,200,250,0.2,600)
PortSet(1,0) 'Turn off CS100 after measurement
EndIf
CallTable met_data
NextScan
EndProg
Example Program 3.2.2-1 Barometric Pressure VoltSE Example
NOTE This same sensor can check for Hot Lips, only the calibration
constants are different. (Please, no kissing the sensors.)
3-74
Section 3. CRBasic and Measurements
3-75
Section 3. CRBasic and Measurements
are not tied directly to datalogger ground, sensors with low signal-to-noise
ratio, such as thermocouples, should normally be measured differentially.
The AM16/32B multiplexer can be tied into one DIFF channels on the
datalogger, using the AM16/32B in the 2x32 mode, to measure 32 DIFF
sensors. A single Voltage Divider can be placed on the logger’s wiring panel
for all 32 measurements.
VoltDiff( Dest, Reps, Range, DiffChan, RevDiff, Settling, Integ, Mult, Offset )
Voltage Range — the expected voltage range of the input to the CR1000 from
the sensor. See Section 3.2.1.3.
DiffChan — the number of the differential channel on which to make the first
measurement. If the Repetitions parameter is greater than 1, the additional
measurements will be made on sequential channels. If a negative number is
entered for the DiffChan parameter then all Reps will be performed on the
same channel.
3-76
Section 3. CRBasic and Measurements
Option Description
250 Performs a 250 microsecond integration.
_60Hz Performs a 16.667 millisecond integration; filters 60 Hz noise.
_50Hz Performs a 20 millisecond integration; filters 50 Hz noise.
Multiplier, Offset — The Multiplier and Offset parameters are each a constant,
variable, array, or expression by which to scale the results of the measurement.
With a multiplier of 1 and an offset of 0, the output is in mV.
3-77
Section 3. CRBasic and Measurements
See Appendix C The Benefits of Input reversal and Excitation Reversal for
Voltage Measurements, for more information on the benefits of using this
option.
The sequence for DIFF voltage measurements with input reversal on (RevDiff
parameter is set True) is:
1. Setup the measurement and delay, for the time duration set by the
Settling parameter, to allow the signal to settle after the datalogger’s
internal multiplexer has tied into the specified channel.
2. Integrate the signal for the length of time specified by the DIFF
Voltage’s Integration parameter.
3. Perform the first Analog to Digital conversion (Conversion A).
4. Reverse the input to the IA and delay, for the time duration set by the
Settling parameter, to allow the signal to settle.
5. Integrate the signal for the length of time specified by the DIFF
Voltage’s Integration parameter.
6. Perform the second Analog to Digital conversion (Conversion B).
7. Calculate the sign corrected average of the two A/D conversion
values: Result = (A-B)/2.
The timing of these steps is dependent on the values entered for the Integration
and Settling parameters. For example, if the user selected the 250 μseconds
option for the Measurement’s Integration and 100 μseconds for the Settling
3-78
Section 3. CRBasic and Measurements
time, the complete measurement process would require 950 μseconds. If 600
μseconds where used instead of 100 μseconds for the Settling time, the
cumulative time for the measurement process would be 600 μseconds (Settling
time) + 250 μseconds (Integration time) + 125 μseconds (A/D conversion time)
+ 600 μseconds (2nd Settling time) + 250 μseconds (2nd Integration time) + 125
μseconds (2nd A/D conversion time) which equals 1950 μseconds.
VOLTAGE OUTPUT MODEL 423 (5 VDC OUTPUT)
Excitation: 9 to 30 VDC operating
Output: 0.5 to 5.5 VDC
Zero Output: 0.5 VDC, ± 2.0% of FSO
Full Scale Output: 5.5 VDC, ± 1.0%
Protection: Reverse Polarity Protected
Minimum Load resistance: 2000 ohms
To get you started, the LogCalc screen is shown in Figure 3.2-13. Note that
there are scroll bars that you can use to determine the mV output for a given
psi.
3-79
Section 3. CRBasic and Measurements
Sensors that change in resistance are measured through the use of a resistive
bridge network. The sensor may already include the bridge completion
resistors or, they may need to be provided. Campbell Scientific supplies
several Terminal Input Modules (TIMs) to provide the completion resistors for
several common measurement resistive networks. Table 3.3-1 list these TIMs.
Model Description
4WFB120 120 ohm 4-wire Full-Bridge TIM Module
4WFB350 350 ohm 4-wire Full-Bridge TIM Module
4WFB1K 1 kohm 4-wire Full-Bridge TIM Module
3WHB10K 10 kohm 3-wire Half-Bridge TIM Module
4WHB10K 10 kohm 4-wire Half-Bridge TIM Module
4WPB100 100 ohm 4-wire PRT Bridge TIM Module
4WPB1K 1 kohm 4-wire PRT Bridge TIM Module
Through the use of these circuits, multiple sensor types are supported. For
instance, a short list of the sensors that bridge instructions are used for include
RTDs, thermistors, potentiometers, resistive accelerometers, load cells, scales,
pressure transducers, and multiple types of strain gage measurement circuits
(1/4 Bridge strain, half bridge Strain, and Full bridge strain circuits). Sensor
configuration and outputs determine which bridge instruction to use. Each
bridge measurement instruction has a particular output. Sensor manuals from
Campbell Scientific will tell you which instruction to use. For other
manufacturers’ sensors, the sensor’s specifications and calculation formulas
may suggest which instruction to use.
3-80
Section 3. CRBasic and Measurements
V Rs X
X= 1 = Rs = Rf
Vx Rs + Rf 1− X
R (1 − X )
Rf = s
X
X = result w/mult = 1, offset = 0 BRHalf3W Equations
BrHalf3W
2 V2 − V1 Rs Rs = Rf X
X= =
VX − V1 Rf Rf = Rs / X
BrFull6W (
X 2 = X / 1000 + R 2 / R1 + R 2 )
R4 X 2
H X = result w/mult = 1, offset = 0 R3 =
1− X2
L
H V ⎛ R R2 ⎞ (
R3 1 − X 2 )
X = 1000 2 = 1000⎜⎜ 3
− ⎟⎟ R4 =
L V1 ⎝ R3 + R4 R1 + R2 ⎠ X2
3-81
Section 3. CRBasic and Measurements
The term ratiometric is used to refer to outputs given in this way, the ratio of
the output to the input. It is necessary to multiply the result by the excitation
voltage to obtain a result in millivolts or volts for the measurement being made.
The BrHalf4W, BrFull, and BrFull6W instructions also include the option to
reverse the polarity of the measurement input channels and make secondary
measurements. The sign corrected average is used for the result. Input reversal
effectively removes the Instrumentation Amplifier common-mode rejections
errors, and the dc offset voltage errors internal of the instrumentation. See
Appendix C The Benefits of Input Reversal and Excitation Reversal for Voltage
Measurements for more information. Figure 3.3-2 depicts the sequence and
timing of a Differential Bridge Measurement, which utilizes both reverse
excitation and reverse measurement, based on the Integration selected.
3-82
Section 3. CRBasic and Measurements
FIGURE 3.2-2. Bridge Measurements Sequence & Timing using both RevDiff & RevEx Options
The sequence for Bridge measurements with input and excitation reversal both on (RevDiff & RevEx True) is:
1. Setup the measurement, switch on the excitation to the user set voltage
+ Polarity
Excitation: - Polarity Excitation: + Polarity Excitation: - Polarity Excitation: + Polarity
level and polarity. Delay, for the time duration set by the Settling
Conversion A
2. Integrate the signal for the length of time specified by the Bridge
measurement instruction’s Integration parameter.
3. Perform the first Analog to Digital conversion (Conversion A).
4. Reverse the excitation polarity and delay, for the time duration set by the
Conversion B
Settling parameter, to allow the signal to settle. Note that the inputs to the
IA have NOT been reversed for this step. Excitation: - Polarity,
IA Input: + Polarity
- Polarity IA Input:
5. Integrate the signal for the length of time specified by the Bridge
measurement instruction’s Integration parameter.
6. Perform the second Analog to Digital conversion (Conversion B).
7. Reverse the excitation back to the original user set polarity and reverse the
Conversion C
inputs to the IA. Delay, for the time duration set by the Settling parameter,
to allow the signal to settle. . Excitation: + Polarity, IA
Input: - Polarity
- Polarity IA Input:
8. Integrate the signal for the length of time specified by the Bridge
measurement instruction’s Integration parameter.
9. Perform the third Analog to Digital conversion (Conversion C).
10. Reverse the excitation polarity and reverse the inputs to the IA. Delay, for
the time set by the Settling parameter, to allow the signal to settle.
Conversion D
3-83
Section 3. CRBasic and Measurements
For the CR1000 the voltage excitation range is ±2500 mV with a compliance
sourcing/sinking current range to ±25 mA. See examples below for methods
of calculating the maximum number of sensors for a given sensor resistance
and excitation voltage, as well as for calculating the maximum excitation
voltage level for a given number of sensors and sensor resistance.
Example 1: Bridge type: Full Bridge strain, using 350 ohm gauges resulting in
a total bridge resistance of 350 ohms. If using 2500 mV excitation, how many
gauges can be connected to each excitation channel?
PortMaxI × SensorR
Sensor # = Equation 3.3-1
ExVolt
25 mA × 350 ohm
Sensor # = = 3.5
2500 mV
PortMaxI × SensorR
ExVolt =
Sensor # Equation3.3-2
25mA × 350ohm
ExVolt = = 2187mV
4
3-84
Section 3. CRBasic and Measurements
Many of the parameters are used in a similar way to the VoltSE instruction,
since ultimately the instruction does measure a voltage on the sensor leads after
excitation. Dest, Reps, Range, SEChan, SettlingTime, Integ, Mult, and Offset
are all used in the same way as the VoltSE instruction.
3-85
Section 3. CRBasic and Measurements
ExChan, MeasPEx, ExmV, and RevEx all relate to how the excitation of the
sensor is performed. ExChan indicates the starting excitation channel (VX) to
be used for providing the excitation voltage. ExmV indicates how many
millivolts of excitation to provide to the sensor. When RevEx is set to true,
then the sensor will be excited and measured with both positive and negative
(switched lead) excitation voltages. MeasPEx (measurements per excitation
channel) is used to setup the instruction to excite multiple sensors with one
excitation channel.
See Figure 3.3-6 for a depiction of the BrHalf instruction’s dialogue box.
3-86
Section 3. CRBasic and Measurements
BrHalf(WindDir,1,mV2500,1,Vx1,1,2500,True,0,_60Hz,355,0)
Error due to lead resistance of 8.25 ohms: Since both leads’ resistance is
included, the BRHalf_R result would be 116.5 ohms instead of 100 ohms.
With an alpha of 0.385 ohms per degree C, this results in a reading of about
42.9 degrees C instead of 0 degrees C, an error of about 43 degrees C.
3-87
Section 3. CRBasic and Measurements
Create a program which uses the BrHalf instruction to measure the 100 ohm
circuit provided. Assume an Rf of 10000 ohms. Save the program as
HalfBr_PRT.CR1.
2 V2 − V1 Rs Rs = Rf X
X= =
VX − V1 Rf Rf = Rs / X
3-88
Section 3. CRBasic and Measurements
The BrHalf3W instruction is used to measure this type of circuit. The result of
the BrHalf3W instruction is equivalent to the ratio of the sensor resistance, Rs
to the resistance of the fixed resistor, Rf.
Rs
Result =
Rf
Conversely, the advantage of the BrHalf3W circuit over the BrHalf4W circuit
is that the BrHalf3W only requires 2 SE voltage channels and 3 wires whereas
the BrHalf4W requires 2 Differential Channels (4 SE channels) and 4 wires.
The advantage of the BrHalf4W is that it fully compensates for the lead
resistance whereas the BrHalf3W compensates for lead wire resistance by
assuming that the resistance of wire A is the same as the resistance of wire B
(Figure 3.3-7). The maximum difference expected in wire resistance is 2%, but
is more likely to be on the order of 1%. The resistance of Rs calculated with
the BRHalf3W Instruction, is actually Rs plus the difference in resistance of
wires A and B: [Rs + (RB – RA)]. See the PRT example in Section 3.3.3.5
3.3.3.3 Using the 3WHB10K 3-Wire Half Bridge Terminal Input Module
The Campbell Scientific 3WHB10K, 3-Wire Half Bridge Terminal Input
Module (TIM), supplies the reference resistor for the 3 Wire Half Bridge
Circuit. See Figure 3.3-8 for the TIM schematic and wiring diagram.
3-89
Section 3. CRBasic and Measurements
Datalogger
Vx
10 kΩ
H H A
L L
or AG G B
or G
Shield
The 10k Ohm reference resistor is a temperature stable, precision resistor. The
resistor specifications are listed in Table3.3-2.
These parameters are used in a similar way to the BRHalf instruction, only the
SEChan parameter specifies the first of two SE channels required for each
Rep. If Reps is more than 1, then the second sensor would be wired to the next
two sequential SE channels. BrHalf3W always measures two single ended
voltages, one across the fixed reference resistor and the other across the sensor.
With a multiplier of 1 and an offset of 0, the result sent to the Dest variable will
be the ratio of the sensor’s resistance to the fixed resistor’s resistance. To
return the sensor’s resistance directly to the Dest variable, use the fixed
reference resistor’s value as the multiplier.
Example Program 3.3.3-1 Measuring a PRT using a 3 Wire Half Bridge (BrHalf3W)
Let us revisit the PRT example from Section 3.3.2.3 using the BrHalf circuit.
But in this case we will use a 3WHB10K TIM and the BrFull3W instruction to
measure a 100 ohm PRT with a European alpha of 0.00385. The PRT is again
separated from the datalogger by 500 feet of 22 awg wires. The average
3-90
Section 3. CRBasic and Measurements
resistance of 22 AWG wire is 16.5 Ohms per 1000 feet, which would give each
500 foot lead wire a nominal resistance of 8.25 Ohms. As noted above, the
maximum difference expected in wire resistance is 2%. The temperature is
resolved from the measurement result using the PRTCalc instruction. A
reference resistance of 10,000 ohms is used. Create a working program and
determine the error due to the maximum expected difference in wire resistance
when the PRT is at 0 degrees C. Name the Program PRT3W.CR1
Lead Resistance Error: Two percent of 8.3 Ohms is 0.17 Ohms. Assuming
that the greater resistance is in wire B, the resistance measured for the PRT
(R0 = 100 Ohms) at 0 degrees C would be 100.17 Ohms. The calculated
temperature using this result would be about 0.436 degrees C. An error of
about 1/2 of a degree. This is far less than the 43 degree error that would result
from the same exercise using the BrHalf circuit and instruction. It should be
noted that using the 4 wire half bridge circuit, the lead resistance error is
virtually non-existent.
The dialogue box for the BrHalf3W instruction is shown below. You should
note that the multiplier used is 100. The reason for this multiplier is that the
input required for the PRT instruction is R/R0, where R is the current resistance
of the PRT and R0 is the resistance of the PRT at 0 degrees C, which in our
case is 100 ohms. To return the actual resistance of the PRT, a multiplier of
10,000 would be used.
3-91
Section 3. CRBasic and Measurements
Create a program which uses the BrHalf 3Winstruction to measure a 100 ohm
PRT. Assume an Rf of 10000 ohms. Save the program as PRT3WA.CR1.
Upload the program and measure the circuit provided.
3-92
Section 3. CRBasic and Measurements
The BrHalf4W instruction is used to measure this circuit type. The result of
the BrHalf4W instruction is equivalent to the ratio of the sensor resistance, Rs
to the resistance of the fixed resistor, Rf.
Rs
Result =
Rf
3.3.4.3 Using the 4WPB100, 4WPB1K PRT Bridge Terminal Input Modules
The 4WPB100 and 4WPB1K TIMs are used to provide completion resistors
for 4 wire half bridge measurements of 100 Ohm and 1 killohm Platinum
Resistance Thermometer (PRT), respectively. See Figure 3.3-11 for the TIM
schematic and wiring diagram.
3-93
Section 3. CRBasic and Measurements
BrHalf4W always measures two DIFF voltages, one across the fixed reference
resistor and the other across the sensor. With a multiplier of 1 and an offset of
0, the result sent to the Dest variable will be the ratio of the sensor’s resistance
to the fixed resistor’s resistance. To return the sensor’s resistance directly to
the Dest variable, use the fixed reference resistor’s value as the multiplier.
Example Program 3.3.4-1 Measure a PRT using a 4 Wire Half Bridge (BrHalf4W)
Let us revisit the PRT example from Section 3.3.3.4 using the BrHalf3W
circuit. But in this case we will use a 4WPB100 TIM and the BrFull4W
instruction to measure a 100 ohm PRT with a European alpha of 0.00385.
Again the PRT is separated from the datalogger by 500 feet of 22 awg wires.
The average resistance of 22 AWG wire is 16.5 Ohms per 1000 feet, which
would give each 500 foot lead wire a nominal resistance of 8.25 Ohms. In the
case of the 4-Wire half bridge circuit, no current flows through the leads to the
measurement input channels, so the lead resistances do not affect the
measurement. Name the program PRT4W.CR1.
The 4WPB100 TIM has a current limiting resistor of 10K Ohms and a fixed
reference resistor of 100 Ohms. Assume that the maximum temperature that
the PRT will experience is 100 degrees C (138.5 ohms). Calculate the
3-94
Section 3. CRBasic and Measurements
excitation voltage that should be used if using the 25 mV range to make the
voltage measurement and create a working program.
The best resolution for the measurement is obtained when the excitation
voltage level is set such that the signal voltage fills the measurement voltage
range. The voltage across the PRT is equal to the current, I, multiplied by the
resistance of the PRT, Rs, and is greatest when Rs is greatest. For example, if it
is desired to measure a temperature in the range of -10 to 100°C, the maximum
voltage across the PRT will be at 100°C when Rs=138.5 Ohms. To find the
maximum excitation voltage that can be used when the measurement range is
±25 mV, we assume V2 equal to 25 mV and use Ohm's Law to solve for the
resulting current, I.
I = 25 mV/Rs
I = 25 mV/138.5 Ohms
I = 0.1805 mA
Vx = I(R1+Rs+Rf + 2RL)
Vx = 0.1805mA x (9500+138.5+100+30)ohms
Vx = 1747 mV
3-95
Section 3. CRBasic and Measurements
Create a program which uses the BrHalf 4W instruction to measure a 100 ohm
PRT using the 4WBP100. Save the program as PRT4WA.CR1. Upload the
program and measure the circuit provided.
3-96
Section 3. CRBasic and Measurements
(
X 1 = − X / 1000 + R 3 / R 3 + R 4 )
(
R2 1 − X1 )
R1 =
X1
BrFull R1X 1
R2 =
X = result w/mult = 1, offset = 0 1− X1
H (
X 2 = X / 1000 + R 2 / R1 + R 2 )
V1 ⎛ R R2 ⎞
L X = 1000 = 1000⎜⎜ 3
− ⎟⎟ R4 X 2
Vx ⎝ R3 + R4 R1 + R2 ⎠ R3 =
1− X2
(
R3 1 − X 2 )
R4 =
X2
The Wheatstone bridge circuit is used in many sensor types. Most built up
sensors will include all of the legs of the Wheatstone bridge. For these sensor
types, the sensor manufacturer will usually specify the mV/V bridge output
ratio against a given engineering unit value for measuring the physical
phenomena in question.
Occasionally, the sensor is a single resistive element that has small changes in
resistance due to large changes in the physical phenomena being measured.
Due to the small resistive change, a Wheatstone bridge is either mandated by
the sensor manufacturer, or simply is required by the instrumentation readout
in order to get the measurement resolution desired. This sensor type will
require the user or instrumentation readout to supply the other three legs of the
Wheatstone bridge. The equations used to resolve a single leg’s resistance,
assuming the other three legs keep a stable resistance, are shown in Figure 3.3-
13. The most common sensor of this type is the single foil bonded strain gage
(see Section 4.1 for more information on strain measurements).
3-97
Section 3. CRBasic and Measurements
Some Wheatstone bridge circuits utilize 6 lead wires in order to compensate for
lead resistance. See Section 3.6 for more information on the 6 wire full bridge
circuit/instructions.
The main benefits of using the 4 Wire Full Bridge (BrFull instruction) over the
6 Wire Full Bridge (BrFull6W instruction) is that it only uses one Differential
voltage channel, while the 6 Wire Full Bridge requires 2 differential channels.
The trade off is that the lead resistance compensation is not built into the
circuit.
Sensors that might only have one or two active legs, the other legs consisting
of temperature stable precision resistors, include foil bonded strain gages.
mVout
Raw Measurement Result =
Vin
The wiring setup, measurement result, and the equations used to derive
resistance from the measurement result are shown in 3.3-13.
All but one of the parameters used are identically to the BrHalf instruction.
The differential parameter is due to the fact that a Differential Analog input
channel is used instead of a SE input channel. So DiffChan is specified instead
of SEChan. DiffChan is used to specify the starting differential channel for the
measurement.
See Figure 3.3-13 for a depiction of the BrFull instruction’s dialogue box.
3-98
Section 3. CRBasic and Measurements
Solution: The first step is to calculate the multiplier and offset. It should be
remembered that the result’s units from the BRFull instruction is mV/V. The
manufacturer specified that the sensor will output 2 mV per volt at 6 pounds,
so we can simple multiply the mV/V measurement result by 6 lbs/(2 mV/V) to
get a multiplier of 3. Or we could use the mV/Volt calculator in the LogCalc
utility.
6 lbs 3 lbs
Mult = =
mv mv
2
V V
The next step is to determine the range code to use. If we are planning on
using the sensor to its full scale (6 lbs), then the full scale voltage output from
the sensor would be /Vin (2 mV/ Vin) x (Vin). If we are exciting with 2.5 Volts,
then the full scale mV output from the sensor would be 5 mV. We will use the
7.5 mV range to get the best measurement resolution.
3-99
Section 3. CRBasic and Measurements
BrFull(LoadCell,1,mV7_5C,1,VX1,1,2500,True,True,1000,1000,3,OffSet)
The program is shown below. You will note that the FieldCal instruction is
used for the logic to zero the loadcell. Refer to Section 3.1.7 for more
information about Sensor Calibrations using the FieldCal and associated
instructions.
DataTable(CalHist,NewFieldCal,50)
SampleFieldCal
EndTable
3-100
Section 3. CRBasic and Measurements
(
X 1 = − X / 1000 + R 3 / R 3 + R 4 )
(
R2 1 − X1 )
R1 =
BrFull6W X1
R1X 1
H X = result w/mult = 1, offset = 0 R2 =
1− X1
L
H
V ⎛ R R2 ⎞ (
X 2 = X / 1000 + R 2 / R1 + R 2 )
L X = 1000 2 = 1000⎜⎜ 3
− ⎟⎟
R4 X 2
V1 ⎝ R3 + R4 R1 + R2 ⎠ R3 =
1− X2
(
R3 1 − X 2 )
R4 =
X2
The sensor types and outputs are the same as for the 4-Wire Full Bridge. See
Section 3.3.5.2 for more information.
Sensors that might only have one or two active legs, the other legs consisting
of temperature stable precision resistors, include foil bonded strain gages.
These sensors only utilize a 6-Wire Full Bridge when the bridge completion
resistors are at the sensor location.
3-101
Section 3. CRBasic and Measurements
mVout
Raw Measurement Result =
Vin
The connections are made so that V1 is the measurement of the voltage drop
across the full bridge, and V2 is the measurement of the bridge output. Note
that virtually no current runs through the two sets of wire for the measurement.
Thus lead resistance does not affect the measurement quality.
The wiring setup, measurement result, and the equations used to derive
resistance from the measurement result are shown in Figure 3.3-15.
All but two of the parameters used are identically to the BrFull instruction.
The two parameters are Range1 and Range2. The range code for the first
measurement (V1 voltage across bridge) is specified by the Range1 parameter.
The range code for the second measurement (V2: voltage output from the
Wheatstone bridge) is specified by the Range2 parameter. See Figure 3.3-16
for a depiction of the BrFull instruction’s dialogue box.
Solution: The first step is to calculate the multiplier and offset. It should be
remembered that the result’s units from the BRFull instruction is mV/V. The
manufacturer specified that the sensor will output 2 mV per volt at 6 pounds,
so we can simple multiply the mV/V measurement result by 6 lbs/(2 mV/V) to
get a multiplier of 3:
6 lbs 3 lbs
Mult = =
mv mv
2
V V
3-102
Section 3. CRBasic and Measurements
The next step is to determine the range codes to use. The first range code
should be tied to the excitation voltage level. We will be using 2500 mV for
the excitation, so the range code to measure the excitation should be the
2500 mV range (Range1 = mV2500). For the second range code, if we are
planning on using the sensor to its full scale (6 lbs), then the full scale voltage
output from the sensor would be /Vin (2 mV/ Vin) x (Vin). If we are exciting
with 2.5 Volts, then the full scale mV output from the sensor would be 5 mV.
We will use the 7.5 mV range to get the best measurement resolution
(Range2 = mV7_5).
The third step is to determine how many sensors can be tied into one excitation
channel. To calculate this we will use Equation 3.3-3 from Section 3.3.1.0.
The CR1000’s excitation channels have a current compliance of 25 mA.
PortMaxI × SensorR
Sensor # =
ExVolt Equation 3.3-3
We can excite 3 sensors with a single excitation channel, but where we have 4
sensors, it is decided to use 2 sensors per excitation channel.
BrFull6W (LoadCell,4,mV2500,mV7_5,1,Vx1,2,2500,True,True,1000,1000,3,Offset())
The program is shown below. You will note that the FieldCal instruction is
used for the logic to zero the loadcell. Refer to Section 3.1.7 for more
3-103
Section 3. CRBasic and Measurements
References
3-104
Section 3. CRBasic and Measurements
Channels
Available for CRBasic
Model Description Pulse Input Input Types Data Option Instruction
CR1000 Measurement P1, P2 High Frequency Counts PulseCount()
and Control Low-Level AC Frequency
Datalogger Switch Closure Run Avg of Freq
CR1000 Measurement C1, C2, C3, C4, High Frequency Counts PulseCount()
and Control C5, C6, C7, C8 Switch Closure Frequency TimerIO()
Datalogger Low-Level AC (with Run Avg of Freq
LLAC4 Low-Level AC Interval
Conversion Module) Period
State
SDM-SW8A* Switch Closure IN1, IN2, IN3, Switch Closure Counts SDMSW8A()
(CR1000 Module IN4, IN5, IN6, Duty Cycle
Peripheral) IN7, IN8 State
SDM-INT8 * Interval Timer CH1, CH2, CH3, High Frequency Counts SDMINT8()
(CR1000 CH4, CH5, CH6, Switch Closure Frequency
Peripheral) CH7, CH8 Low-Level AC Interval
Period
Pulse Width
*SDM devices attached to CR1000 channels C1, C2, and C3. Up to 16 SDM devices can be attached to a single CR1000.
3-105
Section 3. CRBasic and Measurements
3-106
Section 3. CRBasic and Measurements
Equation 3.4-1
where:
FR = Frequency resolution of the measurement (Hz)
R = Timing resolution of the period measurement = 540 ns
P = Period of input signal (seconds) = 1 / 1000 Hz = 0.001 s
E = Rising edges per scan = 500 in 0.5 s scan, 5000 in 5.0 s scan)
Equation 3.4-2
Note that longer scan intervals improve frequency resolution. Longer scan
intervals, however, also reduce certainty of the frequency measurement.
TABLE 3.4-3. Example of Differing Specifications for Pulse Input Devices and Channels
CR1000 Digital
CR1000 I/O Channels
Pulse Channels C1, C2, C3, C4,
P1, P2 C5, C6, C7, C8 SDM-SW8A SDM-INT8
High Frequency Max (kHz) 250 1 0.1 10
Max Input Voltage (VDC) 20 16 20 20
State Transition Thresholds Count upon Count upon Count upon Count upon
(VDC) transition from transition from transition from transition from
<0.9 to >2.2. <1.2 to >3.8. <0.9 to >4.0. <1.5 to >3.5.
3-107
Section 3. CRBasic and Measurements
Input filters, however, attenuate the amplitude (voltage) of the signal. The
amount of attenuation is a function of the frequency passing through the filter.
Higher frequency signals are attenuated more. If a signal is attenuated enough,
it may not pass the state transition thresholds (thresholds are listed in Table
3.4-3) required by the detection device. To avoid over attenuation, voltage
must be increased at higher frequencies. Table 3.4-4 lists τ values for some
measurements. Table 3.4-5 lists some frequencies and the required voltages to
overcome filter attenuation. A good discussion of RC filters and attenuation
can be found at
http://www.st-andrews.ac.uk/~www_pa/Scots_Guide/experiment/lowpass/lpf.html.
Measurement τ
CR1000 Pulse Channel, High Frequency Mode 1.2
CR1000 Pulse Channel, Switch Closure Mode 3300
CR1000 Pulse Channel, Low-level AC Mode See Table 3.4-5
CR1000 Digital I/O, High Frequency Mode 0.025
CR1000 Digital I/O, Switch Closure Mode 0.025
3-108
Section 3. CRBasic and Measurements
• Use the LLAC4 module to convert non-TTL level signals, including low-
level AC signals, to TTL levels for input into digital I/O channels C1 – C8.
Public WindSpeed
DataTable (WindTab,True,-1)
DataInterval (0,10,Sec,10)
Average (1,WindSpeed,FP2,False)
EndTable
BeginProg
Scan (1000,mSec,3,0)
'Measure WindSpeed
TimerIO (WindSpeed,00000001,00000002,5,mSec)
'Convert measurement to windspeed m/s
WindSpeed = (WindSpeed * 0.8) + 0.447
If WindSpeed <= 0.477 Then WindSpeed = 0
CallTable (WindTab)
NextScan
EndProg
3-109
Section 3. CRBasic and Measurements
All serial connections need three connections; transmit, receive, and signal
reference. The transmit of one device is connected to the receive of the other
device. The voltage level of the transmit is driven to change the level of the
receive in reference to the signal reference. Using a defined threshold, the
voltage level of receive is interpreted as a boolean state. A running clock is
used to indicate when to check the state of receive, creating a series of boolean
states. The series of boolean states is binary data transmitted from one
electronic device to another. Transmit is normally labeled as Tx, receive as Rx,
and signal reference as G or 0V.
There are many different standards for connections. All physical layer
standards define voltage levels and boolean logic switching levels. Individual
equipment may vary from the standard, but should be within a range that is
acceptable to communicate with other equipment.
3-110
Section 3. CRBasic and Measurements
A lot of RS232 equipment deviates from the standard and actually switches
logic at inverted TTL levels. This allows dataloggers to communicate with
many RS232 devices using control port pairs. CSI dataloggers have
overvoltage protection on the control ports which allows the RS232 voltage
levels of a sensor to be connected without harm. However, on earlier revisions
of hardware, false low-level AC counts were registered by the dataloggers
when an RS232 sensor was connected directly to the control ports. The serial
number breaks at which the problem does not exist are; CR800 11534 or
greater, CR1000 27280 or greater, and CR3000 4428 or greater. A simple
circuit requiring only a resistor and a diode can be added to older hardware to
avoid the problem.
Single-ended signaling requires a single wire for transmit, a single wire for
receive, and a wire for reference. Differential signaling requires two wires for
transmit and two wires for receive. Differential interfaces also have a voltage
reference to keep devices within the voltage range of each other. The pairs of
connections are marked with “+” and “-” or “A” and “B”. Some RS485
interface manufacturers label these connections opposite of others. Thus, an
early step in trouble shooting RS485 is to try swapping “A” and “B”. Many
RS485 devices are compatible with RS422 due to the similar voltage levels.
3-111
Section 3. CRBasic and Measurements
allows communication in one of either direction at any given time. Thus half
duplex is able to use the same lines for transmission and reception. This kind of
physical connection allows point to multi-point communication. Point to multi-
point serial communication is often referred to as multidrop.
Tx Tx
Rx Rx
G G
TxA TxA
TxB TxB
RxA RxA
RxB RxB
G G
A A A
B B B
G G G
G G G
3-112
Section 3. CRBasic and Measurements
Common GPS units such as the GPR16X-HVS use RS232 to output the
location and clock data. There is also a PPS line which outputs a pulse every
second. The GPS instruction uses the combination of the RS232 data and the
PPS signal for setting the datalogger clock. Additional connections are used for
powering the GPS unit.
Datalogger GPS16X
Tx Tx
Rx PPS
Power
G Switch
Power
12V In
G G
G Shield
G Rx
3.5.3 Serial Sensors Pros and Cons, Issues with Using etc.
Pros: Multiple measurements over the same cable are possible. Some
sensors output over 100 values, which would not be feasible using
analogue signals.
Multiple sensors can be connected over the same cable. The sensor
must support some form of multidrop communication for this to
work.
3-113
Section 3. CRBasic and Measurements
Some sensors make a digital measurement by design, and thus serial output is
simpler to integrate than analogue output. An example of a natively digital
measurement is sonic anemometers.
Example 3.5.4-1: Using the SDI12 interface allows the ECI-1 from
Virginia Technologies Inc. to output 5 measurements over the same line.
Additionally, up to 10 sensors may use the same cable. Analogue signals
would need at least 52 conductors versus the 3 needed to connect 10 ECI-
1 units to a datalogger.
3-114
Section 3. CRBasic and Measurements
• Declare Variables
• Declare Data Tables
• Set Up Communication Port
• Read From Buffer
• Split Read Data.
• Process Split Data
• What are the signaling level, baud rate, parity, stop bits, and data bits?
(needed for SerialOpen)
• Does the sensor have to be polled (commands issued to sensor before it
sends data)?
• What is the polling command?
• What is the default output string?
• Do I need to change the sensor configuration?
• How do I change the sensor configuration?
• What will the output string be after I change the configuration?
The first instruction you need to put in your datalogger program is SerialOpen.
This instruction sets up the serial port for communication. This document will
not go into detail on all the parameters of CRBasic instructions. Those are
documented well in the help file of the CRBasic Editor. If your sensor uses
RS422 or RS485, an interface such as the SDM-SIO1 will be needed. Refer to
the SDM-SIO1 manual for additional format options beyond those specified in
the CRBasic help. The RS232 port on the datalogger provides RS232 voltage
levels and logic. The control port pairs provide TTL voltage levels and either
RS232 or TTL logic. Most RS232 sensors will work with the control ports. If
an RS232 sensor does not work on the control ports, it should be tried on the
RS232 port. BaudRate and Format must be selected correctly based on the
sensor specifications. TXDelay can usually be left at zero. BufferSize should
be set to at least the length of the output string + 1. Too small a buffer will cut
your data short. The buffers are ring memory, which means that the newest
data overwrites the oldest data.
3-115
Section 3. CRBasic and Measurements
The BufferSize should be greater than the total number of bytes received
during a scan interval. Allow for an extra record from the sensor to account for
clock differences.
Example 3.5.5-1:
The datalogger performs two checks before reading data from the buffer. The
first check is if the position of the write pointer has changed since the last
execution of SerialIn, SerialInBlock, or SerialInRecord. The second check is if
the number of bytes between the read pointer and the write pointer is greater
than or equal to the number of bytes expected.
SerialClose(ComPort)
3-116
Section 3. CRBasic and Measurements
SerialFlush(ComPort)
SerialFlush effectively erases the data in the buffer for a ComPort. The write
pointer and the read pointer are both placed at the beginning of the buffer.
Unlike SerialClose, SerialFlush leaves the port active and the buffer remains
allocated for incoming data.
ComPortIsActive(ComPort)
SerialInChk(Comport)
The SerialInChk function reports the number of bytes in a buffer between the
read and write pointers.
SerialInBlock(ComPort,Dest,MaxNumberBytes)
SerialIn(Dest,ComPort,TimeOut,TerminationChar,MaxNumChars)
SerialIn will read data out of a buffer and wait for more data if needed. A
TimeOut of 0 is not recommended. It could make your datalogger program
wait indefinitely if your serial sensor is not connected. SerialIn will read data
up to the point of the termination character or the maximum number of
characters has been received.
SerialInRecord(ComPort,Dest,BeginWord,NBytes,EndWord,NBytesRetur
ned,LoadNaN)
SerialInRecord has replaced the SerialIn instruction for most applications. One
benefit of the SerialInRecord instruction is that with some parameters set
constant, it will run in the datalogger measurement task. This allows better
timing and faster execution in some programs. The second benefit of the
SerialInRecord instruction is it can recognize when output from a sensor is a
complete message. The BeginWord and EndWord parameters are integers.
Hexadecimal notation is the easiest manner of entering 2 characters for either
one.
SerialOut(ComPort,OutString,WaitString,NumberTries,TimeOut)
SerialOutBlock(ComPort,Expression,NumberBytes)
SerialOutBlock is used if you need to send binary data out a port. Under proper
conditions, this instruction will run in the measurement task of the datalogger
in pipeline mode.
3-117
Section 3. CRBasic and Measurements
SplitStr(SplitResult,SearchString,FilterString,NumSplit,SplitOption)
The SplitStr instruction is used to divide data from a long string into smaller
strings. The original string remains intact. SplitStr should generally be used
instead of MoveBytes. Most serial sensor programs will use SplitStr with either
the NUMERIC or FOOTERFILTER option.
CheckSum(ChkSumString,ChkSumType,ChkSumSize)
MoveBytes(Destination,DestOffset,Source,SourceOffset,NumBytes)
The MoveBytes instruction is used for moving binary data between memory
locations. Manipulating binary data is an advanced topic and not covered in
this document. Strings containing null characters must be split with MoveBytes
instead of SplitStr.
The next level of complexity is that of a polled sensor. The datalogger must
send a command to the sensor, then receive the answer from the sensor.
3-118
Section 3. CRBasic and Measurements
An even higher level of complexity is when the datalogger must change the
commands it sends to the other device based on received messages. The other
device could be a host device such as a PC or datalogger.
3-119
Section 3. CRBasic and Measurements
C1
C2
C3
C4
• TTL, Even Parity, one stop bit, 8 data bits, 4800 baud
• 1 Hz output rate
• Values output are; a floating point number, an integer, and a string.
• Example output: <STX>1234E+04,1234,acbd<CR><ETX>
The first step in writing a program for a serial sensor is declare variables. You
will need a long string to hold the raw data from the sensor. You also need
variables to hold processed data and program status.
DataTable (Test,1,1000)
DataInterval (0,15,Sec,10)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
Sample (1,FloatValue,IEEE4)
Sample (1,IntegerValue,Long)
Sample (1,SplitStrings(3),String)
EndTable
RawString is our variable to hold raw data from the sensor. SplitStrings(3) are
three shorter strings to hold pieces of the raw data. FloatValue and
3-120
Section 3. CRBasic and Measurements
IntegerValue are variables to store the processed data in the format we want.
NbytesReturned is a variable to hold a result from the SerialInRecord
instruction. Data tables are declared as with any other sensor.
The second step is to set up the communication port. The communication port
is set up with the SerialOpen instruction. It is critical that the correct baud rate
and format are chosen to match the sensor. According to the specifications of
our sensor, we should chose Format option 18. Our example message is 21
bytes long. Expressions such as '<STX>' represent a single unprintable
character, they count as one byte. The datalogger will be running at a 1Hz scan
rate which is the same as the output interval of the sensor. Referring to the
equation for minimum buffer size for SerialOpen, the buffer needs to be at least
43 bytes. We will round up to a 50 byte buffer size. Below is our instructions
inserted into the basic CR1000 program template. At this point, you should
load the program into the datalogger and verify the sensor output with the 'W'
terminal mode as described in Section 3.5.5.5.
DataTable (Test,1,1000)
DataInterval (0,15,Sec,10)
Sample (1,FloatValue,IEEE4)
Sample (1,IntegerValue,Long)
Sample (1,SplitStrings(3),String)
EndTable
BeginProg
SerialOpen (Com1,4800,18,0,50)
SerialOpen (Com2,4800,18,0,50)
Scan (1,Sec,0,0)
CallTable Test
NextScan
SlowSequence
Scan (1,Sec,3,0)
SerialOut (Com2,CHR(2)&"1234E+04,1234,abcd"&CHR(13)&CHR(3),"",0,100)
NextScan
EndProg
Notice the second SerialOpen instruction and the SlowSequence scan. These
are added to emulate the sensor.
The next step is to read in the data from the buffer. This will be done with
SerialInRecord.
SerialInRecord (Com1,RawString,&h02,0,&h0D03,NBytesReturned,01)
Note the usage of hexadecimal notation, this is the easiest manner to use two
characters as the EndWord. With Nbytes of zero, SerialInRecord will place in
RawString the data that occurs between BeginWord and EndWord. We can
send the program to the datalogger and verify RawString is now updated with
data.
3-121
Section 3. CRBasic and Measurements
DataTable (Test,1,1000)
DataInterval (0,15,Sec,10)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
Sample (1,FloatValue,IEEE4)
Sample (1,IntegerValue,Long)
Sample (1,SplitStrings(3),String)
EndTable
BeginProg
SerialOpen (Com1,4800,18,0,50)
SerialOpen (Com2,4800,18,0,50)
Scan (1,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
SerialInRecord (Com1,RawString,&h02,0,&h0D03,NBytesReturned,01)
CallTable Test
NextScan
SlowSequence
Scan (1,Sec,3,0)
SerialOut (Com2,CHR(2)&"1234E+04,1234,abcd"&CHR(13)&CHR(3),"",0,100)
NextScan
EndProg
The next step is to divide the RawString into pieces with SplitStr. Looking at
the example string, we see that the data is separated by commas. We want the
value before the first comma and all values that follow commas. That
corresponds to the FooterFilter option of SplitStr. The maximum number of
strings is 3 and the destination is our array SplitStrings().
SplitStr (SplitStrings(),RawString,",",3,5)
The final step is to process our data. We will use the automatic data type
conversion of CRBasic.
FloatValue=SplitStrings(1)
IntegerValue=SplitStrings(2)
Merely copying the values from strings into floats or longs will change the data
type. These values can now be used in calculations in the same manner as
values from non-serial sensors. We now have a complete program to read our
serial sensor as follows.
3-122
Section 3. CRBasic and Measurements
DataTable (Test,1,1000)
DataInterval (0,15,Sec,10)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
Sample (1,FloatValue,IEEE4)
Sample (1,IntegerValue,Long)
Sample (1,SplitStrings(3),String)
EndTable
BeginProg
SerialOpen (Com1,4800,18,0,50)
SerialOpen (Com2,4800,18,0,50)
Scan (1,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
SerialInRecord (Com1,RawString,&h02,0,&h0D03,NBytesReturned,01)
SplitStr (SplitStrings(),RawString,",",3,5)
FloatValue=SplitStrings(1)
IntegerValue=SplitStrings(2)
CallTable Test
NextScan
SlowSequence
Scan (100,mSec,3,0)
SerialOut (Com2,CHR(2)&"1234E+04,1234,abcd"&CHR(13)&CHR(3),"",0,100)
NextScan
EndProg
Polled Sensor
For our example polled sensor, we will use the same simulated sensor as before
except that it now must receive “PollData” before it outputs data. The program
only needs two additional instructions for reading the polled sensor, a serial
output and a delay before reading from the buffer. For the serial output, we will
use SerialOutBlock. It can be placed before the other measurement
instructions, so they can execute when you would otherwise delay. The amount
of time needed for a polled sensor to respond is often not specified in the
manual. It can easily be verified with the 'W' terminal mode of the datalogger.
Below is the program to read our polled sensor. Notice the position of
SerialOutBlock and Delay in relation to SerialInRecord.
3-123
Section 3. CRBasic and Measurements
DataTable (Test,1,1000)
DataInterval (0,15,Sec,10)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
Sample (1,FloatValue,IEEE4)
Sample (1,IntegerValue,Long)
Sample (1,SplitStrings(3),String)
EndTable
BeginProg
SerialOpen (Com1,4800,18,0,50)
SerialOpen (Com2,4800,18,0,50)
Scan (1,Sec,0,0)
SerialOutBlock (Com1,"PollData",8)
PanelTemp (PTemp,250)
Battery (batt_volt)
Delay (0,100,mSec)
SerialInRecord (Com1,RawString,&h02,0,&h0D03,NBytesReturned,01)
SplitStr (SplitStrings(),RawString,",",3,5)
FloatValue=SplitStrings(1)
IntegerValue=SplitStrings(2)
CallTable Test
NextScan
SlowSequence
Scan (100,mSec,3,0)
SerialIn (SensorInput,Com2,10,13,16)
If InStr (1,SensorInput,"PollData",2) Then
SerialOut (Com2,CHR(2)&"1234E+04,1234,abcd"&CHR(13)&CHR(3),"",0,100)
EndIf
NextScan
EndProg
SplitStr Options
The most common split options used with SplitStr are Numeric and
FooterFilter. The following is a simple program can be used to see the behavior
of different options. The variables rawString and filterString can be changed in
real time by the user.
3-124
Section 3. CRBasic and Measurements
GPS16X-HVS
The GPS16X-HVS is measured with the GPS instruction on the CR800,
CR850, CR1000, and CR3000. Hardware of revision 008 or newer can set their
clocks with a resolution of 10 microseconds. Older hardware is capable of
setting their clock with a resolution of 10 millisecond. To use it with a CR5000
or CR9000 an SDM-SIO4 is used as described in the sensor manual.
GPS: (latitude_a,Com4,LOCAL_TIME_OFFSET*3600,0,nmea_sentence(1))
GPSArray: The destination for the processed GPS data. It should be an array of Float values.
TimeOffset: An offset from UTC time to which the clock should be set.
MaxTimeDiff: The parameter to adjust the frequency at which the datalogger clock is adjusted.
NMEAStrings: A parameter that allows viewing the unprocessed GPS data strings.
3-125
Section 3. CRBasic and Measurements
PipeLineMode
Const LOCAL_TIME_OFFSET = -6 'Local time offset relative to UTC time
Dim nmea_sentence(2) As String * 90
Public gps_data(15)
Alias gps_data(1) = latitude_a 'Degrees latitude (+ = East; - = West)
Alias gps_data(2) = latitude_b 'Minutes latitude
Alias gps_data(3) = longitude_a 'Degrees longitude (+ = East; - = West)
Alias gps_data(4) = longitude_b 'Minutes longitude
Alias gps_data(5) = speed 'Speed
Alias gps_data(6) = course 'Course over ground
Alias gps_data(7) = magnetic_variation 'Magnetic variation from true north (+ = East; - = West)
Alias gps_data(8) = fix_quality
'GPS fix quality: 0 = invalid, 1 = GPS, 2 = differential GPS, 6 = estimated
Alias gps_data(9) = nmbr_satellites 'Number of satellites used for fix
Alias gps_data(10) = altitude 'Antenna altitude
Alias gps_data(11) = pps
'usec into sec of system clock when PPS rising edge occurs
'typically 990,000 once synced
Alias gps_data(12) = dt_since_gprmc
'Time since last GPRMC string, normally less than 1 second
Alias gps_data(13) = gps_ready 'Counts from 0 to 10, 10 = ready
Alias gps_data(14) = max_clock_change
'Maximum value the clock was changed in msec
Alias gps_data(15) = nmbr_clock_change 'Number of times the clock was changed
'Define Units to be used in data file header
Units latitude_a = degrees
Units latitude_b = minutes
Units longitude_a = degrees
Units longitude_b = minutes
Units speed = m/s
Units course = degrees
Units magnetic_variation = unitless
Units fix_quality = unitless
Units nmbr_satellites = unitless
Units altitude = m
Units pps = ms
Units dt_since_gprmc = s
Units gps_ready = unitless
Units max_clock_change = ms
Units nmbr_clock_change = samples
BeginProg
'Use SetStatus prior to scan if baud rate needs to be changed for device
Scan (1,Sec,0,0)
GPS (latitude_a,Com4,LOCAL_TIME_OFFSET*3600,0,nmea_sentence(1))
NextScan
EndProg
3-126
Section 3. CRBasic and Measurements
SDI-12
SDI-12 sensors are measured with the SDI12Recorder instruction. SDI-12
communication can delay a program a significant amount of time before
timeout if there is an error. Therefore, the instruction is best used within
SlowSequence to avoid skipped scans.
SDI12Recorder returns an array of floating point values from the sensor. There
are 5 parameters to the instruction.
SDI12Recorder (EC1data(),1,0,"M!",1.0,0)
Destination, Behave just as they do on any measurement instruction which allows
Multiplier & repetitions. The datalogger automatically sets repetitions to the number of
Offset values the particular sensor returns.
SDIPort: The control port to which the sensor is connected.
SDIAddress The address configured in the sensor.
SDICommand The command to issue to the sensor. The sensor manual contains a list of valid
commands. The most common command for measurements is “M!”. The
datalogger automatically issues any necessary “D!” commands.
3-127
Section 3. CRBasic and Measurements
The CRBasic dataloggers have a special mode available through their terminal
commands for troubleshooting serial connections. At the datalogger prompt in
the terminal, type 'W' then press 'Enter'. A list of available communication
ports will be listed.
3-128
Section 3. CRBasic and Measurements
3-129
Section 3. CRBasic and Measurements
This interface provides a DTE RS232 port. The connection to the datalogger is
via Modem Enabled CSI/O. There is no special configuration of the peripheral
required.
SC105
The SC105 provides a DTE RS232 port. It has an internal data buffer allowing
both sides of the interface to operate at different baud rates. The SC105 may be
configured for Modem Enabled or SDC communication to the datalogger
allowing several to be connected to the CSI/O port simultaneously. However,
overall data throughput is limited by the CSI/O port baud rate. The interface
must be configured using Device Configuration. Baud rate, parity, stop bits,
and data bits are set the same as they would be in SerialOpen for a sensor
directly connected to the RS232 port. The SerialOpen instruction in the
datalogger should have the format option selection which matches these
settings. The buffer in the datalogger must still be sized appropriately. The
buffer of the SC105 is only to handle baud rate differences; data is passed to
the datalogger in a seemingly transparent manner.
3-130
Section 3. CRBasic and Measurements
MD485
SDM-SIO1
The SDM-SIO1 provides a serial port configured for either RS232, RS422, or
RS485. Connection to the datalogger is via SDM. Assigning separate addresses
allows up to 15 to be connected to a datalogger. The address is set by adjusting
a dial on the SDM-SIO1. The interface is configured by the parameters of
SerialOpen. The manual contains tables for setting the ComPort and Format
parameters. The internal buffer is 2047 bytes. Data is not moved from this
buffer to the datalogger until a SerialIn, SerialInBlock, or SerialInRecord
instruction is executed. This prevents the use of a SDM-SIO1 when a larger
buffer is required.
SDM-SIO4
The SDM-SIO4 provides four DTE RS232 ports and interfaces to the
datalogger via SDM. It behaves completely differently from the other serial
interfaces. Programming requires repeated use of the SDMSIO4 instruction in
place of the other serial instructions. An understanding of low-level serial
communication is necessary.
3-131
Section 3. CRBasic and Measurements
Vibrating Plucking/
Diaphragm Wire Pickup Coil
Because the tension in the wire is related to the wire’s fundamental resonant
frequency (see Equation 3.6-1), measuring the resonant frequency of the wire
measures the external physical parameter.
f = k σ½ Equation 3.6-1
3-132
Section 3. CRBasic and Measurements
Because our customers were having issues with measurement noise in their
VW measurements, CSI instrumentation engineers set out to find a method to
determine the resonant frequency of vibrating-wire sensors with improved
noise immunity. Section 3.6.2.2 VW Frequency Domain Measurement
Technique describes this method.
3-133
Section 3. CRBasic and Measurements
The external noise disrupts the signal, erroneously removing zero crossings. In
general, external noise may introduce errors by adding zero crossings to, or by
removing zero crossings from, the uncorrupted signal.
Even with this difficulty, engineers were able to gather useful data in noisy
environments at times. However, this required extra effort to eliminate noise
sources or schedule measurements around periods of increased noise. An
alternative approach required data analysts to identify and discard bad data by
comparing measurement data before and after noise events.
3-134
Section 3. CRBasic and Measurements
Using a standard Fourier transform on a vibrating wire does not return the
dominant frequency with the resolution required. This is because the total time
spent measuring the wire response determines the delta f between spectral
components in the spectrum, and a vibrating wire sensor vibrations die out
fairly quickly. For instance, if we could measure the response from the wire
for 0.25 seconds, the result would have a resolution of 4 Hz. This is
inadequate, as the vibrating wire manufacturers want us to resolve changes in
the resonant frequency 40 times better than that, to 0.1 Hz.
With the data converted to the frequency domain, the sensor's resonant
frequency can be determined even in the presence of external noise. As shown
in Figure 3.6-6, spectral analysis allows us to distinguish the sensor’s response
from measurement noise.
3-135
Section 3. CRBasic and Measurements
Datalogger
Vibrating Wire
Strain Gage Time Domain
AVW1
CR1000
AVW200
Although the actual strain changed by only a few tenths of a µstrain during the
test, the time-domain analysis gave errors of 12,000 µstrain. It should be noted
that there is no method for determining the influence noise has had on the Time
Domain Analysis. So the noise induced error could be anywhere from less
than 1 percent, to tens of 1000 percents. As shown by 3.6-8, the spectral
analysis gave errors of typically less than ± 0.5 µstrain during the same noise
event.
Transforming the sensor's response from the time domain into the frequency
domain provides additional advantages—specifically, diagnostics that are not
available with the time-domain approach. These include signal amplitude,
signal-to-noise ratio, and the dominate, competing noise frequencies (see
Figure 3.6-9). These diagnostics are useful for a variety of purposes including
validating measurements, understanding and identifying noise sources, and
determining long-term sensor health.
3-136
Section 3. CRBasic and Measurements
• COM ports
COM1 – Pakbus communication
– CR1000 AVW200() instruction
• SDI-12 Port
– CR10X, CR2xx & CR5000 support
SDI-12 – User control of the measurement
and multiplexing
Radio
• Radio
communication
– Pakbus Communication
– CR1000 AVW200() instruction
– Eliminates long cables
3-137
Section 3. CRBasic and Measurements
Using the 4 sets of Control ports of the CR1000 for communication, up to 256
Vibrating Wire sensors can be measured, when controlling the multiplexers
with the AVW200s.
AM16/32B
AVW200
CR3000 COM1
CR1000
CR800(2 COMs)
COM2
COM3
COM4
3-138
Section 3. CRBasic and Measurements
►► Hook up the AVW206 to COM2 (control ports 3 and 4), using the
SC110 cable supplied. Hook up the multiplexer to Channel 1 of the AVW200.
Use the AVW206 control ports to control the multiplexer. Hook up the
Geokon 4420 crack meter to channel 1 of the multiplexer. Note that most
Geokon VW sensors use the following wiring color code:
3.6.3.1.1 Serial Port Direct Connection with Logger Controlling the Multiplexers
The datalogger can be used to control the multiplexers while still using the
AVW200 instruction (PakBus loggers). This can only be accomplished when
the program is setup in SequentialMode (verses PipeLine mode). The benefit
of this option is that you can easily have up to 10 multiplexers using a single
AVW200 interface. The downside is that the programming can become far
more complex. Figure 3.6-13 depicts the multiplexers wired up to the
AVW200 without AVW200 control. Note that C1 on the AVW200 is used for
SDI-12 communications. The figure shows it being tied to a control port on
the Datalogger. This is only required when using SDI-12 communications
(non-PakBus loggers). When using a PakBus datalogger, use the RS232 port
with either an SC100 cable or a 9 pin serial cable.
3-139
Section 3. CRBasic and Measurements
CR10X,
CR800, CR3000, CR23X,
CR850 CR1000 CR5000
CABLE
MUXPOWER G G
SHIELD
SHIELD
12 V 12 V 12 V
GND
RES
CLK
12V
G G G
N
O
This option requires that the AVW206 control the multiplexers. A typical
wireless setup is shown in Figure 3.6-15.
3-140
Section 3. CRBasic and Measurements
AM16/32B
AVW206, AVW211, AVW216
CR3000
CR8xx
CR1000 PakAddr = 200
PakAddr = 201
PakAddr = 202
PakAddr = 203
The main drawback of the vibrating wire sensor is that they can only be used
for static measurements. They can also be more costly than some of their
counterparts.
1. Use the 19246 Power Cable (shipped with the AVW200) to connect the
AVW200 to the datalogger's 12 V supply or a regulated external power
source. When connecting the power leads, the ground lead should be
connected first and then the 12 V lead.
3-141
Section 3. CRBasic and Measurements
2. Connect the AVW200 to a COM port on your computer using the 10873
RS-232 cable (shipped with the AVW200).
3. Open DevConFigure.
5. Select the Serial Port matching the COM port on your computer in which
the AVW200 is connected.
Protocol—choose "PakBus" for the “Protocol” setting. Please note that the
“Protocol” setting for the RF401-series radio must be set to either “PakBus
Aware” or “PakBus Node” for communications to be successful.
RS-232 Baud Rate—enter the baud rate in which you want to communicate.
3-142
Section 3. CRBasic and Measurements
Hop Sequence—enter the radio ”Hop Sequence” that matches all of the RF401
radios and other AVW206 Interfaces in the network. Valid entries are 0-6.
Net Address—enter the radio network address that matches all of the RF401
radios and other AVW206 in the network. Valid entries are 0-3.
Power Mode—If not using a radio, select “Radio Off” for the Power Mode.
Otherwise, select a power mode that works with the RF401’s power mode (see
Table 3.6-1).
►► We will setup all of our AVW200s from this template, except we will
give each AVW206 a unique PakBus address starting with 200 for the
instructors.
3-143
Section 3. CRBasic and Measurements
See the AVW200 manual for a list of variables in the Status Table.
First connect the RS-232 port of the AVW200 to a serial port on your computer
using a 9-pin serial cable and follow the steps below.
2. Open DevConFigure
3-144
Section 3. CRBasic and Measurements
3. Highlight the AVW200 in the list of devices which appears in the left-hand
portion of the window.
4. Select the COM port to which the AVW200 is connected from the drop
down list box at the bottom left of the window.
5. Click the Send OS tab and follow the directions on the screen.
2. Click the Troubleshoot tab at the top of the DevConfig opening window.
3. Click the Options tab at the bottom of the Troubleshoot screen to set the
Begin and End frequencies and the excitation voltage you wish to use to
test a given sensor (Figure 3.6-19). Check the manufacturer’s
specification for the sensors frequency and excitation range before picking
the begin/end frequencies and excitation voltage. You may also choose to
poll (default) or not to poll the time series data from this Options window
by checking or un-checking the poll time series box (Polling the time
series data takes 10 or more seconds).
4. Select the AVW200 channel either 1 or 2 and the multiplexer channel that
the sensor is attached. If not using a multiplexer, then set the multiplexer
channel to one. It should be noted that only when using multiplexers
controlled by the AVW200, can you select the sensor (multiplexer bank) to
read. If the datalogger is controlling the multiplexers, the multiplexer
would have to be clocked, by the logger, to the channel where the sensor in
question is wired before querying it.
5. Once the appropriate settings have been specified, click OK on the Options
window and click the Poll tab at the bottom of the Troubleshoot window.
The results of the Poll will be displayed on a Spectrum graph and a Time
Series graph (see Figure 3.6-20).
3-145
Section 3. CRBasic and Measurements
6. The results of the poll may be saved by clicking the Save Last Results tab
at the bottom of the window.
In Figure 3.6-20, the bottom graph shows the raw time series data recorded
from a vibrating wire sensor after the sensor has been excited with the
frequency swept voltage signal and the top graph shows the spectrum after the
AVW200 has applied the FFT. In addition to the wire’s resonant frequency,
the spectrum shows the response amplitude, noise amplitudes frequencies.
Response
Amplitude Noise Amplitude
Ending Amplitude
Beginning Amplitude
The Signal to noise ratio and the Decay ratio values are also returned. The
AVW200 computes the signal-to-noise ratio diagnostic by dividing the
response amplitude by the dominate noise amplitude within the preselected
frequency band (set by the Begin Frequency and End Frequency settings). The
AVW200 computes the decay ratio diagnostic from the time-series ending
amplitude divided by the beginning amplitude.
3-146
Section 3. CRBasic and Measurements
2. SerialOpen Instruction: Used to setup the serial port used on the datalogger
to communicate with the AVW200.
The datalogger program can run the AVW200 instruction in either the pipeline
mode (Section 6.1.1) or sequential mode (Section 6.1.2). In the pipeline mode,
the first execution of the instruction sets up the AVW200; subsequent
execution intervals retrieve the data values. If different beginning and ending
frequencies are required to measure different types of sensors, use multiple
AVW200 instructions with different beginning and ending frequencies
specified in each instruction. The sequential mode performs each instruction in
sequence; waits for each instruction completion; and then repeats this process
for each execution interval. The minimum scan rate for an AVW200 program
is 2 seconds per sensor. In addition to frequency, diagnostic information is
returned for the sensor (see the Dest parameter).
3-147
Section 3. CRBasic and Measurements
Sytnax
AVW200 (Result, ComPort, Neighbor, PakBusAdr, Dest, AVWChan,
MuxChan, Reps, BeginFreq, EndFreq, ExVolt, ThermInteg, Mult, Offset)
Alphanumeric Description
ComRS232 AVW200 connects to datalogger’s RS-232
port via 18663 cable
ComME RF401 connects to datalogger's CS I/O port;
RF401 configured as modem enabled
ComSDC7 RF401 connects to datalogger's CS I/O port;
RF401 configured as SDC7
ComSDC8 RF401 connects to datalogger's CS I/O port;
RF401 configured as SDC8
ComSDC10 RF401 connects to datalogger's CS I/O port;
RF401 configured as SDC10
ComSDC11 RF401 connects to datalogger's CS I/O port;
RF401 configured as SDC 11
Com1 AVW200 connects to datalogger's control
ports 1 and 2 via 17855 cable
Com2 AVW200 connects to datalogger's control
ports 3 and 4 via 17855 cable
Com3 AVW200 connects to datalogger's control
ports 5 and 6 via 17855 cable
Com4 AVW200 connects to datalogger's control
ports 7 and 8 via 17855 cable
3-148
Section 3. CRBasic and Measurements
Dest The Dest parameter is the variable array in which to store the
results of the instruction. Dest is a single-dimensioned array of
5 or 6 (depending upon whether a thermistor is being
measured) if only one sensor is being measured. Dest is a
multi-dimensioned array of 5 or 6 if multiple sensors are being
measured using a multiplexer. The first dimension is set equal
to the number of sensors being measured and the second
dimension is set equal to the number of values returned for each
sensor (5 or 6). For example, to measure 4 sensors with
thermistor measurements attached to a multiplexer, Dest would
be declared as Array(4,6). Values for sensor 1 would be stored
in Array(1,1) through Array(1,6), values for sensor 2 stored in
Array (2,1) through (2,6), etc.
Samp= 1.16
Signal-to-Noise Ratio=Samp/SNoise
fnoise
3-149
Section 3. CRBasic and Measurements
3-150
Section 3. CRBasic and Measurements
EndFreq The EndFreq parameter is the ending frequency to use for the
vibrating wire measurement. The maximum value that can be
entered is 6500. Refer to the specifications of the vibrating
wire sensor for recommended EndFreq values.
Code Description
0 No thermistor measurement (5 values returned in Dest)
_60Hz Use 60 Hz noise rejection (6 values returned in Dest)
_50Hz Use 50 Hz noise rejection (6 values returned in Dest)
Sytnax
SerialOpen (COM Port , Baud Rate , Format , TX Delay , Buffer Size)
Alphanumeric Description
ComRS232 AVW200 connects to datalogger’s RS-232 port
via 18663 cable
ComME RF401 connects to datalogger's CS I/O port;
RF401 configured as modem enabled
ComSDC7 RF401 connects to datalogger's CS I/O port;
RF401 configured as SDC7
ComSDC8 RF401 connects to datalogger's CS I/O port;
RF401 configured as SDC8
ComSDC10 RF401 connects to datalogger's CS I/O port;
RF401 configured as SDC10
3-151
Section 3. CRBasic and Measurements
Baud rate The BaudRate parameter is used to set the rate, in bps, for
communication. The options are 300, 1200, 2400, 4800, 9600,
19200, 38400, 57600, and 115200. Selecting one of these
options fixes the baud rate at that rate of communication. If a
negative baud rate is entered, the first communication attempt
will be at the specified baud rate, but if communication fails at
that rate, the datalogger will go into autobaud mode (where it
will try different rates until successful or until the instruction
times out). Use 38,400 for communications with the AVW200.
3-152
Section 3. CRBasic and Measurements
Example 3.6-2 starts with Example 3.6-1 and adds code to store NAN if the
resonant frequency’s amplitude is <= 0.1. Also, it loads NAN into the
Thermistor value if the thermistor’s resistance > 6000. Added instructions are
highlighted.
3-153
Section 3. CRBasic and Measurements
f2
Units =
1000
Figure 3.6-22 shows a typical calibration sheet for the model 4000 gage.
For the model 4000 vibrating wire strain gage, to calculate µε, multiply the
digits by 4.062 which is the default gage factor for the Model 4000, and a
Batch Factor (K) for the specific batch of gages being used.
⎛ f2 ⎞
με = K × 4.062 × ⎜ ⎟ Equation 3.6-2
⎜ 1000 ⎟
⎝ ⎠
1
T = − 273.2
A + B(lnR ) + C (lnR ) + (lnR )
3
Equation 3.6-3
3-154
Section 3. CRBasic and Measurements
Where: T = Temperature in ˚C
LnR = Natural log of Thermistor R
A = 1.4051 x 10-3
B = 2.3690 x 10-4
C = 1.0190 x 10-7
With this arrow in our quiver, let us undertake a rewrite of Program Example
3.6-2 and calculate and store the microstrain and temperature (degrees C)
values. Again added instructions are highlighted.
Dim I
Units StrainFreq = Hz : Units StrainThermistor = ohms : Units StrainTemp = Degrees_F
Const BatchFactor = 0.91
Const A = 1.4051E-3 : Const B = 2.369E-4 : Const C = 1.019E-7
DataTable (Test,True,-1)
Sample (10,uStrain(),IEEE4)
Sample (10,StrainFreq(),IEEE4)
Sample (10,StrainTemp(),FP2)
Sample (10,StrainThermistor(),FP2)
EndTable
BeginProg
SerialOpen (Com2,38400,0,0,50)
Scan (30,Sec,20,0)
AVW200 (ResultStrain,Com2,0,200,AVWStrain(),1,1,10,450,1200,1,_60Hz,1,0)
For I = 1 To 10
If AVWStrain(I,2) > 0.1 Then
StrainFreq(I) = AVWStrain(I,1)
StrainDigits(I) = AVWStrain(I,1)^2/1000
uStrain(I) = BatchFactor * 4.062 * StrainDigits(I)
Else
StrainFreq(I) = NAN
EndIf
If AVWStrain(I,6) < 6000 Then
StrainThermistor(I) = AVWStrain(I,6)
StrainTemp(I) = (1/(A + B*LN(AVWStrain(I,6))+C*LN(AVWStrain(I,6))^3)-273.2)*1.8+32
Else
StrainThermistor(I) = NAN
EndIf
Next I
CallTable Test
NextScan
EndProg
3-155
Section 3. CRBasic and Measurements
3-156
Section 3. CRBasic and Measurements
Accelerometers, pressure sensors, microphones, and strain sensors are the most
common piezoelectric sensor types.
Piezoceramic sensors are the most sensitive of any piezoelectric sensor, but this
high level of sensitivity degrades over time. Interestingly, this degradation is
directly correlated with temperature. Crystal elements have less sensitivity but
possess almost infinite long term stability. These points should be considered
when purchasing sensors for long term testing or for use in extreme
temperatures.
There are three main principals of operation for piezoelectrics that are all
dependent on how the crystal material is cut; transverse, longitudinal, and
shear. To an end user, these principles should not matter as they pertain to
sensor design techniques, but keep in mind that piezoelectric sensors obey
Newton’s second law; F=ma. Sensor manufacturer’s design various product
models based on these three principals to provide different shock ratings,
sensor sensitivity, different sensor orientation, and to provide custom sensors
for unique applications.
Charge mode sensors are designed for the harshest of harsh environments,
especially where high temperatures are expected. Due to the high impedance
3-157
Section 3. CRBasic and Measurements
output of a charge mode sensor, the signal is susceptible to noise and external
interference. A very low capacitance cable should be used between the sensor
and charge amplifier to minimize the possibility of noise interference. Once
converted to a low impedance output, external noise sources pose very little
problem. It is recommended for all piezoelectric sensors that any extension
cables (that interconnect with BNC connectors) be of a low noise coaxial cable
to reduce the triboelectric effect (motion induced noise) and be properly
fastened down to eliminate cable movement.
In Figure 3.7-1, box 1 is the piezoelectric sensor. Box 2 is the amplifier circuit
used to convert the high impedance charge to a low impedance voltage signal.
Piezoelectric sensors use the same conductor wire (Vo) for both the signal
output and for the constant current sensor excitation. A high-impedance
piezoelectric sensor would only contain the circuitry shown in box 1 of Figure
3.7-1. The additional circuitry shown in box 2 and between boxes 1 and 2
would be in the external charge amplifier. All manufacturers of piezoelectric
sensors offer various options of charge amplifiers, ranging from multiple-
channel, AC powered, DC powered, AC/DC, and battery powered.
Output signals of these sensors are a low impedance voltage than can be read
with dataloggers, data acquisition systems and readout boxes. Regardless of
the sensor type, both require a constant current power supply otherwise the
sensors will not function. Common currents are 2 milliamps (mA), 4 mA, and
6 mA. Note: some sensors will require a minimum current level such as 4 mA.
A simplified constant current supply is shown in Figure 3.7-2.
3-158
Section 3. CRBasic and Measurements
Since capacitors and resistors are used in the decoupling circuit and charge
amplifier circuit, specific discharge time constants are inherent in the integrated
designs (low-impedance sensors). This will explain why some sensors have a
low frequency response of 0.1Hz where others have a low frequency response
of 1 Hz. Engineering firms and consultants who use many forms of
piezoelectric sensors find more utility in purchasing charge mode type sensors.
They can adjust or tune, the low frequency response (more specifically, the
adjustment of the discharge time constant) in their external signal conditioners.
Also some external amplifiers allow for adjustment of the upper frequency
response as well, adding to the “customization” of a generic sensor to the more
specific application. This flexibility is one of the highlights of high-impedance
piezoelectric sensors. Engineers and consulting firms need only to purchase a
limited variety of sensors and allow the specific tuning to be performed with
the external amplifiers.
The voltage mode sensors with the built in charge amplifiers have the ability to
measure the highest frequencies (>1 MHz). These sensors provide a very
linear frequency response at the higher frequencies. The rise time (RC time
attributed by the sensor lead wire resistance and capacitance and sensor
capacitance and impedances) of the voltage mode is considered faster than the
charge mode. Thus for performing modal analysis work, the voltage mode
sensors should be preferred over the charge mode.
The charge mode piezoelectric sensor can provide a more universal sensor to
consultants or companies that perform a wide range of measurement services,
but more care must be used to ensure proper sensor performance. Additionally,
the charge mode sensor is not used above 100 kHz frequency measurements.
The junction cables between the sensor and charge amplifier must be very low
3-159
Section 3. CRBasic and Measurements
capacitance. All interconnections must be kept dry and clean. Moisture due to
humidity or direct contact can distort and limit the upper frequency response of
the sensor. For these reasons the manufactures will recommend charge mode
sensors for lower frequencies and higher temperatures.
The equation below provides the formula for calculating the maximum
frequency based off cable capacitance, constant current power supply, and
sensor output in voltage.
Though using common sensor elements, the manufacturing processes for each
sensor type vary. Piezoelectric sensors have some tendency to exhibit more
than one physical quantity. For example, pressure sensors can show false
signals when subjected to vibrations. More sophisticated pressure transducers
incorporate acceleration sensing elements to reduce the possibility of false
pressure measurements due to vibration. When purchasing piezoelectric
3-160
Section 3. CRBasic and Measurements
pressure sensors (some manufactures will sell the separate sensing element for
custom applications) or pressure transducers, check for specifications that list
the sensitivity to vibration. A more sophisticated sensor may be substantially
more expensive than a sensor that does not provide any error correction for
vibration induced signals.
At the time of this document, the only product that Campbell Scientific
manufactures for measuring piezoelectric sensors is the CR9025IEPE Anti-
Alias and Filter module which is a module used in the CR9000X high speed
data acquisition system. Having seen the results and getting positive customer
feedback, future Campbell Scientific products will have the circuitry options to
support piezoelectric sensors.
http://www.meas-spec.com/
http://www.pcb.com/techsupport/
http://www.kistler.com/
http://www.dytran.com/go.cfm/en-us/content/index
http://www.endevco.com/
3-161
Section 3. CRBasic and Measurements
V=I*R
This voltage (V) is measured by the datalogger; usually as a differential
voltage. The primary reason for using a current output is that current remains
constant over very long distances, allowing critical data to be recorded at a
base station located hundreds of feet away.
NOTE Long distances have no affect on the 4-20mA signal. The current
signal is not degraded over long distances as an analog signal.
3.8.2.2 Disadvantages
1- Most transducers require constant current from power supply thus adding
cost and size.
2-Conditioned output quality may not be as good Compared to a similar
unconditioned sensor measured directly by a datalogger.
Output of transducer converts current to a voltage through CURS100..
3-162
Section 3. CRBasic and Measurements
3-163
Section 3. CRBasic and Measurements
3-164
Section 3. CRBasic and Measurements
3-165
Section 3. CRBasic and Measurements
3-166
Section 3. CRBasic and Measurements
3-167
Section 3. CRBasic and Measurements
You must also supply power for the 4-20 mA transmitter. For example, if the
sensor requires a minimum of 9VDC and you are using the CURS100, you
need to make sure that the supply voltage does decrease below Vmin.
3-168
Section 3. CRBasic and Measurements
'Main Program
BeginProg
'Main Scan
Scan(5,Sec,1,0)
'Default Wiring Panel Temperature measurement PTemp_C
PanelTemp(PTemp_C,_60Hz)
'Generic 4-20 mA Input measurement Measure
VoltDiff(Measure,1,mV2500,1,True,0,_60Hz,0.01,0)
'Call Data Tables and Store Data
CallTable(Table1)
NextScan
EndProg
3-169
Section 3. CRBasic and Measurements
3-170
Section 3. CRBasic and Measurements
RefTemp_F = RefTemp*1.8 + 32
And calculate the difference between the air temperature and the module
temperature.
DeltaT_F = TC – RefTemp_F
Declare the units for all variables. Store all temperatures and the delta
temperature to Data Table Temp. Save the program as DeltaT.CR1.
The logical expression X > 5 evaluates to either true or false. The CR1000
evaluates the boolean test and returns either true or false; 0 is the numeric
representation of false, -1 represents true. The words true and false are
predefined constants in CRBasic, and therefore need not be declared as
variables.
3-171
Section 3. CRBasic and Measurements
Boolean variables remain in their current state (true or false) until modified by
another instruction, or manually changed by the user. The default state of
Boolean variables upon program start is false.
When assigning a value from a Float or Long variable into a Boolean variable,
zero converts to false and any other number converts to true.
When assigning a value from a Boolean variable into a Float or Long variable,
true becomes -1 and false becomes zero.
CRBasic uses -1 for the Boolean True value so that the and/or operators will
function the same way for logical statements and binary bitwise comparisons.
The number -1 is expressed in binary form with all bits equal to 1, the number
0 has all bits equal to 0. When -1 is anded with any other number the result is
the other number. This ensures that the result will be non-zero when the other
number is non-zero (true).
The words true and false are predefined constants in CRBasic, and therefore
need not be declared before being used. However, when describing the state of
a port or flag, word pairs such as “on and off” or “high and low” are often
more representative of the physical measurement or condition. If you want to
use a naming scheme like this, you should declare them as Constants.
‘If DeltaT_C is greater than or equal to 3 then set Flag(1) high, else set it low.
3-172
Section 3. CRBasic and Measurements
The Ports and Flag window, launched from the Connect Screen, shows the
current state of selected Boolean variables and Control Ports. Any Boolean
variable can be selected to be displayed here (simply right click on one of the
Fields and select “Add” from the menu selection). If a Boolean variable is true
the button next to the name appears green; if it is false the button appears
black. The text fields are editable so you can be monitoring a Boolean variable
called Flag, but the text could show DeltaT>10. The Control Port status
variables are listed in the “Status” Table.
3-173
Section 3. CRBasic and Measurements
If ((TC(1) > 85) and (TC(1) < 95) or (TC(2) < TC(3)) and (TC(3) > 0))Then
Flag(1) = false
Endif
The Single Line form and the Block form. The single-line form is often useful
for short, simple conditional tests. The block form provides more structure and
flexibility than the single-line form and is usually easier to read, maintain, and
debug.
If condition1 Then
[statementblock-1]
[ElseIf condition2 Then
[statementblock-2] ]
[Else
[statementblock-n] ]
End If
Block Form Syntax Description
The Block form of an If/Then construct has these parts:
3-174
Section 3. CRBasic and Measurements
Part Description
If Keyword that begins the block If...Then decision control
structure.
condition1 First Boolean expression to be evaluated for deciding which
path to take.
Then Keyword used to identify the beginning of the actions to be
taken if condition1 is true.
statementblock-1 One or more CRBasic statements executed if condition1 is
true.
ElseIf Keyword indicating that alternative conditions must be
evaluated if condition1 is not satisfied. There can be
multiple ElseIf blocks within a single If/Then construct.
condition2 Second Boolean expression to be evaluated to decide
whether this path should be taken.
statementblock-2 One or more CRBasic statements executed if condition2 is
true.
Else Keyword used to identify the actions taken if none of the
previous conditions are satisfied.
statementblock-n One or more CRBasic statements executed if all previous
conditions within the If/Then construct are false.
End If Keyword that ends the block form of the If...Then.
If the first expression is false, CRBasic begins evaluating each ElseIf condition
in order of placement in the If/Then construct. When CRBasic finds a true
condition, the statements immediately following the associated Then are
executed. If none of the ElseIf conditions is true, the statements following the
Else are executed and then control jumps to the EndIf instruction. After
executing the statements following Then or Else, the program continues with
the statement following End If.
The Else and ElseIf clauses are both optional. You can have as many ElseIf
clauses as you like in a block If, but none can appear after an Else clause. Any
of the statement blocks can contain nested block If statements.
Consider the English expression: "If either the TC(1) variable or the TC(2)
variable is greater than 85, then set the Flag(1) variable high, otherwise set it
low."
3-175
Section 3. CRBasic and Measurements
Block Form
If DeltaT_F>=10 Then
Flag=true
Else
Flag=false
EndIf
Each of the eight digital I/O ports (Control Ports) can be configured as an output
port and set low or high (0 V low, 5 V high) using the PortSet instruction. A
digital output port is normally used to operate an external relay driver circuit
because the port itself has a limited drive capability (2.0 mA maximum at 3.5 V).
Additionally, Port 9 can be used to control the state of the Switched 12 volt
supply (wiring panel’s SW-12).
The PortSet Instruction will set the specified port high or low.
PortSet Syntax:
PortSet(Port, State)
If Flag(1)=true Then
PortSet (1,1)
Else
PortSet (1,0)
EndIf
3-176
Section 3. CRBasic and Measurements
PortSet (1,Flag(1))
The first parameter indicates the control port (1-8) and the second the state
(non-zero = high, 0 = low)
►► Exercise 3.9.1.5: Conditional PortSet
Start with Exercise 3.9.1.4 Program: DeltaTFlagSet.CR1. Add logic to set
Control Port 1’s logic state based on the variable Flag’s logic state. Save the
program as DeltaTPortSet.CR1. Upload it to the logger and monitor the state
of the port using the Ports and Flags window.
To ensure that data from previous intervals are not included in a processed
output, processing is reset any time an output interval is skipped. (An interval
could be skipped because the table was not called or another trigger condition
was not met.) The CR1000 resets the processing the next time that the table is
called after an output interval is skipped. If this next call to the table is on a
scheduled interval, it will not output. Output will resume on the next interval.
(If “Sample” is the only output processing instruction in the table, data will be
output any time the table is called on the interval because sampling uses only
the current value and involves no processing.)
Typically, time series data (averages, totals, maximums, etc.) that are output to
a table based on an interval only include measurements from the current
interval. After each output interval, the memory that contains the
measurements for the time series data is cleared. Even if an output interval is
missed (because all criteria are not met for output to occur), the memory is
cleared at the top of the next interval UNLESS the OpenInterval instruction is
contained in the DataTable declaration. This results in all measurements being
included in the time series data since the last time data was stored (even though
the data may span multiple output intervals).
3-177
Section 3. CRBasic and Measurements
BeginProg
Scan(500,mSec,0,0)
PanelTemp(RefTemp,250)
TCDiff(TC(),5,mV2_5C,1,TypeT,RefTemp,RevDiff,Del,Integ,1,0)
CallTable AvgTemp
NextScan
EndProg
Example Program 3.9-1 OpenInterval
3-178
Section 3. CRBasic and Measurements
NOTE If CardOut is set to Fill and Stop, when data storage stops in the card
it will also stop in the data table, regardless of whether the data table
in the datalogger is configured as fill and stop or has reached its
maximum number of records. Conversely, if a DataTable is set to
Fill and Stop (FillStop instruction), when data storage stops in the
table it will also stop in the card. Data storage will not resume until
the DataTable has been reset through the Status window in one of
CSI's software packages.
FillStop Example:
DataTable (Temp,1,2000)
DataInterval(0,10,msec,10)
FILLSTOP ' the table will stop collecting data after 2000 records.
Average(1,RefTemp,fp2,0)
Average(6,TC(1),fp2,0)
EndTable
Set the size of the new Data Table to 50 records, and set the Table as Fill and
Stop. Insert logic to call “Table2” when Flag is high. Save the program as
FillStop.CR1 and upload it to the logger. Raise the thermocouple temperature
so that Flag goes high.
Monitor both the “Temp” and the “Table2” data tables. Once “Table2” fills,
reset the Table using the Status window and again trigger the call to it through
elevating the thermocouples temperature and monitor “Table2”.
The Count parameter sets the number of times the Scan…NextScan loop will
be executed before moving forward to the code that follows it. A Count of 0
will force the Scan block to loop indefinitely (until the program is stopped), or
until the ExitScan instruction is encountered.
3-179
Section 3. CRBasic and Measurements
Slow sequences are typically run at a slower rate than the main program. If
multiple sequences are desired, each SlowSequence in the program must be
proceeded by a SlowSequence statement. Slow sequence instructions can be
inserted into a Scan/NextScan structure, or they can be placed within a
Do/Loop to execute whenever the datalogger is not busy with other tasks
Measurement tasks in the main scan have priority over all other tasks. The
measurement instructions in one or more slow sequence are performed, in the
order they appear in the program, during the times when the datalogger is not
running measurement tasks in the main scan. This can result in the
measurements of a slow sequence being performed over a longer period of
time than if they were placed in the main scan.
3-180
Section 3. CRBasic and Measurements
In PipeLine mode, the task sequencer determines the allowable time for
slicing in the Slow Sequence Scans’ measurement instructions between
subsequent main scans to insure that a Slow Sequence measurement is not
started that it will not be able to complete prior to the time for the start of the
next main Scan. This insures the precise timing of the execution of the
measurement instructions in the main scan.
It should be noted that, when there is adequate time for all measurements, a
background calibration is done in a slow sequence scan to provide continuous
adjustment as temperature changes. This Slow Sequence scan is automatically
setup to run with a 4 second interval unless a Calibrate instruction is present in
the running program. A common use case for the Slow Sequence scan is for
setting up the background calibration at a slower rate when there is not enough
time to run the default calibration (f the program does not allow enough time
for automatic calibration to be performed, the message "Warning when Fast
Scan x is running background calibration will be disabled" will be returned
when the program is compiled). The syntax for this use case is shown in
Example Program 3.9-3:
Data written to data tables within a slow sequence will be time stamped with
the start time of the slow sequence scan.
3-181
Section 3. CRBasic and Measurements
3.9.5.1 Subroutines
A Subroutine is a separate procedure that is called by the main program using a
A Subroutine can take variables, perform a series of statements, and change the
value of its variables. However, a Subroutine can't be used in an expression.
Call Syntax:
Call SubName(List of Variables) or
SubName(List of Variables) or
SubName
When a Subroutine is called from the Main Program Scan, a skipped scan will
occur if there is not sufficient time for the Subroutine measurements/processing
in addition to the main scan's measurement/processing time requirements.
3-182
Section 3. CRBasic and Measurements
statementblock Any group of statements that are executed within the body
of the Subroutine.
Boolean. Float is used for the default type if not declared. To
declare the type, use the "AS" command:
Sub SubName(Var1 as String * 20, Var2 as Long).
3-183
Section 3. CRBasic and Measurements
BeginProg
Scan (1,Sec,0,0)
If IfTime (0,1,Hr) Then Call SlowScan (AM25T_1_Avg)
NextScan
EndProg
Example Program 3.9-4 Subroutines
3.9.5.2 Functions
The Function command allows the creation of user defined Functions. All
Functions must be defined in the declarations area of the program (i.e., prior to
the BeginProg statement).
Function Function Name optional As DataType
Return ( expression ) (optional)
ExitFunction (optional)
EndFunction
Functions with their parameters are called just like built in functions; i.e., by
simply using their name with parameters anywhere within an expression (see
example below). When calling a function, closing parenthesis must be used
even if the function has no parameters. The parenthesis indicate a call to the
function. If parenthesis are omitted, the last value returned by the function is
used rather than the function running again. One difference between a Sub and
a Function is a Function returns a value, whereas a subroutine does not. By
default, the Function value returned is a Float, but it can be specified as a
String (with an optional * size), Long, or Boolean in the Function routine by
using the AS Datatype after the Function Name (and parameters if used) of the
Function Declaration (example: "Function Name(parameters) AS Long").
3-184
Section 3. CRBasic and Measurements
parameter values are copied into the Function's local parameter list. Unlike a
Subroutine Call, even if the local variables are modified in the Function
routine, these changes are not passed back to the Function call parameter
variables.
Part Description
statementblock Any group of statements that are executed within the body
of the Function.
3-185
Section 3. CRBasic and Measurements
AngleDegrees
Public Angle, Var, X, Y
Function Secant(F_Angle as Float) as Float
Dim F_Angle
Secant = 1/Cos(F_Angle)
EndFunction
BeginProg
X=1 : Y = 1 ' Initialize X, and Y so the angle is 45 degrees
Scan(1,Sec,3,0)
Angle = ATN2(X,Y)
Var = Secant(Angle)
NextScan
EndProg
Example Program 3.9-5 Functions
The CR1000 has several ways to access data from a DataTable, or to access
information relating to the properties of the DataTable. The most basic
method is through the use of the GetRecord instruction.
The GetRecord instruction is used to store the data, from one record in a
specified DataTable, into a variable array. It has the following syntax:
3-186
Section 3. CRBasic and Measurements
GetRecord(Dest,TableName,RecBack)
In Example Program 3.6-6, when the variable TCTemp rises above 30, the
GetRecord instruction is executed and the Data table BackData is triggered to
store data.
BeginProg
Scan(1,Sec,3,0)
PanelTemp( Tref,250)
TCDiff (TCTemp,1,mV2_5C ,1,TypeT,Tref,True ,450,250,1.0,0)
CallTable TC
CallTable BackData
NextScan
EndProg
3-187
Section 3. CRBasic and Measurements
Data stored in a table can be accessed from within the program. The format
used is:
Tablename.Fieldname_PRC( index,recordsback)
Where
Tablename The name of the table in which the desired value is stored. The table can be
a user defined table or the Status table.
Fieldname The name of the field in the table that is of interest.
_PRC Abbreviation for the field processing used in the storage process. For
example, PRC = AVG when the Average data processing instruction is
used. Do not use an _PRC for Sample processing, or for retrieving data from
the Status Table. See Table 3.9-1 Output Processing Abbreviations for a
list of these abbreviations.
TABLE 3.9-1. Output Processing Abbreviations
A use example for this syntax would be to calculate the change in an average
output between two records. For Example Program 3.1.6-4, to find the change
in the 100 millisecond average between the most recent average and the
3-188
Section 3. CRBasic and Measurements
average that was stored 101 records earlier for TC(1), you could insert
following code into the program:
Tdiff=Temp.TC_Avg(1,1)–Temp.TC_Avg(1,101)
In addition to accessing the data stored in a table, there are some pseudo fields
related to the data table that can be retrieved:
Tablename.EventEnd(1,1) Only valid for a data table using the DataEvent instruction, and is
only updated when the Table is called.
Tablename.EventCount(1,1) Only valid for a data table using the DataEvent Instruction.
Tablename.EventCount(1,1) returns the number of events that have
been completed in the table. An event is complete when the table
has stopped storing data for the event.
Tablename.Output(1,1) Returns a value based on whether data was written to the Table the
last time it was called. Returns -1 if data were output to the table the
last time the table was called, or 0 if data were not output. The result
from this instruction is only updated when the table is called.
Tablename.Record(1,n) Returns the record number of the record stored n records ago.
3-189
Section 3. CRBasic and Measurements
where:
M = Month
D = D
Y = Year
C = Century
hh = Hour
mm = Minute
ss.sssss = Seconds (10 microsecond resolution)
Example Program 3.9-7 tracks # of data table events, tracks whether data was
stored during the current scan interval, sets Flag(2) to True if the Data Table
becomes full, and tracks the number of records written to the table with the
variable RecordNum. It also uses the RecordNum value to ensure that enough
records have been written to the table to compare the current value of TC(1)
with the value of TC(1) 100 records back.
3-190