You are on page 1of 322

Geotechnical-Structural

Instrumentation Training Manual


Revision: 7/11

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.

1. Data Acquisition Systems........................................1-1


1.1 Know the Issues that NEED Investigation and Why....................... 1-1
1.1.1 Principle Body Requesting the Information ........................... 1-1
1.1.2 Know the Parameters Needing to be Measured ..................... 1-1
1.2 Components of a Data Acquisition System ...................................... 1-2
1.2.1 DAQ Basics ................................................................................ 1-2
1.2.2 Sensors and Sensor Interfaces ................................................. 1-2
1.2.3 Datalogger.................................................................................. 1-3
1.2.4 Memory Requirements ............................................................. 1-3
1.2.5 Power Supply Requirements.................................................... 1-4
1.2.6 Data Retrieval ........................................................................... 1-4
1.2.6.1 On Site Data Retrieval .................................................... 1-4
1.2.6.2 Data Retrieval through Telemetry................................. 1-4
1.2.7 Software Selection..................................................................... 1-5
1.2.7.1 PC200W Starter Software .............................................. 1-5
1.2.7.1.1 EZSetup................................................................... 1-6
1.2.7.1.2 Short Cut Program Generator.................................. 1-7

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

2.3 Power System Design ........................................................................ 2-32


2.3.1 Overview/Comparison ............................................................ 2-32
2.3.2 Components for Power System .............................................. 2-32
2.3.2.1 Charging Source ............................................................ 2-32
2.3.2.2 Regulator ........................................................................ 2-33
2.3.2.3 Batteries.......................................................................... 2-33
2.3.2.3.1 Alkaline Batteries .................................................. 2-33
2.3.2.3.2 Rechargeable Batteries .......................................... 2-33
2.3.2.4 Determining System Loads ........................................... 2-33
2.3.3 Conclusion / Summary............................................................ 2-35
2.4 Software for Personal or Hosted Computers ................................. 2-36
2.4.1 Four Main Software Packages ............................................... 2-36
2.4.1.1 Unattended Nature of Datalogger Operation ............. 2-36
2.4.1.2 Periodic Communication With a Central Location.... 2-36
2.4.1.3 Multiple Utilities and Programs Within Each
Product ........................................................................ 2-37
2.4.2 Categorizing Utilities and Programs by Operational
Phase ..................................................................................... 2-37
2.4.2.1 Utilities : Datalogger Configuration and
Programming (Phase 1) ............................................. 2-41
2.4.2.1.1 DevConfig ............................................................. 2-41
2.4.2.1.2 Station Status......................................................... 2-41
2.4.2.1.3 PakBusGraph......................................................... 2-41
2.4.2.1.4 Network Planner.................................................... 2-41
2.4.2.1.5 Short Cut for Windows (SCWIN) ......................... 2-42
2.4.2.1.6 File Control............................................................ 2-42
2.4.2.1.7 CRBasic Editor...................................................... 2-43
2.4.2.2 Utilities : Datalogger Deployment and
Communications (Phase 2) ........................................ 2-43
2.4.2.2.1 EZSetup ................................................................. 2-43
2.4.2.2.2 Setup Screen .......................................................... 2-43
2.4.2.2.3 Connect Screen...................................................... 2-44
2.4.2.2.4 Clock/Program Tab of RTDAQ, PC400, PC200... 2-44
2.4.2.2.5 Troubleshooter....................................................... 2-45
2.4.2.2.6 Station Status......................................................... 2-45
2.4.2.2.7 PakBus Graph........................................................ 2-47
2.4.2.3 Utilities : Datalogger Data Collection (Phase 3).......... 2-48
2.4.2.3.1 Data Collect tab in RTDAQ, PC400, and
PC200W............................................................. 2-48
2.4.2.3.2 Custom Collection in LoggerNet........................... 2-48
2.4.2.3.3 Scheduled Collection in LoggerNet ...................... 2-48
2.4.2.3.4 Collect Now in LoggerNet .................................... 2-49
2.4.2.3.5 LogTool................................................................. 2-49
2.4.2.4 Utilities : Datalogger Monitoring and Control
(Phase 4) ...................................................................... 2-50
2.4.2.4.1 Table Monitor........................................................ 2-50
2.4.2.4.2 Numeric Displays in LoggerNet............................ 2-50
2.4.2.4.3 Graphical Displays in LoggerNet.......................... 2-51
2.4.2.4.4 Field Monitor in RTDAQ and PC400 ................... 2-51
2.4.2.4.5 Status Monitor in LoggerNet................................. 2-51
2.4.2.4.6 RTDAQ Real-time Windows ................................ 2-52
2.4.2.4.7 RTMC in LoggerNet and RTDAQ........................ 2-52
2.4.2.4.8 RTMC Pro for Data Monitoring............................ 2-52

ii
Table of Contents

2.4.2.5 Utilities : Collected Data Analysis and Publication


(Phase 5) ...................................................................... 2-53
2.4.2.5.1 Location and Format of .DAT files....................... 2-53
2.4.2.5.2 View in PC400 and PC200W................................ 2-53
2.4.2.5.3 LoggerNet Database (LNDB) ............................... 2-53
2.4.2.5.4 View Pro in LoggerNet and RTDAQ.................... 2-54
2.4.2.5.5 RTMC Pro for viewing Historical Data ................ 2-55
2.4.2.5.6 RTMC Web Server ............................................... 2-55
2.4.3 Product Selection .................................................................... 2-56
2.4.3.1 PC200W ......................................................................... 2-56
2.4.3.2 PC400 ............................................................................. 2-57
2.4.3.3 RTDAQ .......................................................................... 2-58
2.4.3.4 LoggerNet....................................................................... 2-59
2.4.3.5 Product Comparison Chart.......................................... 2-60
2.4.4 Key Software Components..................................................... 2-61
2.4.4.1 LoggerNet Toolbar........................................................ 2-61
2.4.4.2 Device Configuration Utility (DevConfig)................... 2-62
2.4.4.3 Using ShortCut to create Custom Sensor Templates. 2-64
2.4.4.4 Network Planner ........................................................... 2-66
2.4.4.4.1 Functional Overview............................................. 2-66
2.4.4.4.2 The Drawing Canvas............................................. 2-67
2.4.4.4.3 Adding Stations to the Network............................ 2-67
2.4.4.4.4 Configuring Devices ............................................. 2-68
2.4.4.5 Scheduled Collection and Custom Collection ............. 2-69
2.4.4.5.1 Data Collection Scheduling Considerations.......... 2-69
2.4.4.5.2 Intervals................................................................. 2-70
2.4.4.5.2.1 Datalogger Program Intervals ..................... 2-70
2.4.4.5.2.2 Data Collection Setting Intervals ................ 2-70
2.4.4.5.2.3 Communications Path Considerations ........ 2-70
2.4.4.5.3 Setting Up Scheduled Data Collection.................. 2-71
2.4.4.5.4 Custom Collection................................................. 2-73
2.4.4.6 Numeric and Graphical Displays in ConnectScreen,
Table Monitor............................................................. 2-75
2.4.4.6.1 Numeric Display Screens ...................................... 2-75
2.4.4.6.2 Graphical Display Screens .................................... 2-75
2.4.4.6.3 Table Monitor ....................................................... 2-76
2.4.4.7 RTMC and RTMC Pro................................................. 2-77
2.4.4.7.1 Real-Time Monitoring and Control....................... 2-77
2.4.4.7.1.1 Development Mode..................................... 2-77
2.4.4.7.1.2 RTMC Run-Time........................................ 2-84
2.4.4.7.2 RTMC Pro Introduction ........................................ 2-85
2.4.4.7.3 Development Mode............................................... 2-86
2.4.4.7.4 LoggerNet ............................................................. 2-87
2.4.4.8 View Pro ......................................................................... 2-88
2.4.4.8.1 Overview............................................................... 2-88
2.4.4.8.2 Opening a File ....................................................... 2-89
2.4.4.8.3 Data View ............................................................. 2-89
2.4.4.8.4 Graphs ................................................................... 2-90
2.4.4.8.4.1 Line Graph .................................................. 2-91
2.4.5 Advanced Software Considerations ...................................... 2-92
2.4.5.1 LoggerNet Admin.......................................................... 2-92
2.4.5.2 LoggerNet Remote......................................................... 2-92
2.4.5.3 LoggerNet for Linux ..................................................... 2-92
2.4.5.4 SDK and OPC Options ................................................. 2-93

iii
Table of Contents

2.5 Cell Phone Communication.............................................................. 2-94


2.5.1 When Should You Consider Cellular Communication?...... 2-94
2.5.2 What Do You Need to Do Before You Place an Order? ...... 2-94
2.5.2.1 Find a Cellular Provider ............................................... 2-94
2.5.2.2 Select a Cellular Modem Model ................................... 2-95
2.5.2.3 Select an Antenna .......................................................... 2-95
2.5.2.4 Determine the Modem-to-Datalogger Interface ......... 2-95
2.5.2.5 Consider Power Requirements..................................... 2-95
2.5.3 Setting up Cellular Communication ...................................... 2-96
2.5.3.1 Hardware Configuration—Serial Server Method or
PPP (Point to Protocol) Method ................................ 2-96
2.5.3.2 Software Configuration................................................. 2-96
2.5.3.3 The Raven Indicator Lights.......................................... 2-96
2.5.4 Common Problems in Configuring Cellular Comms........... 2-97

3. CRBasic and Measurements................................... 3-1


3.1 CRBasic................................................................................................ 3-1
3.1.1 CRBasic: Editor and Programming Language ...................... 3-1
3.1.2 Template..................................................................................... 3-1
3.1.3 CRBasic Editor Main Window ................................................ 3-2
3.1.3.1 Customizing the CRBasic Editor ................................... 3-3
3.1.3.1.1 Editor’s View Pull-Down Menu.............................. 3-4
3.1.3.1.1.1 View Pull-Down Menu: Editor Preferences.. 3-4
3.1.3.1.1.2 View Pull-Down Menu: Instruction Panel
Preferences ................................................ 3-5
3.1.3.1.2 Editor’s “Instruction” Pull-Down Menu ................. 3-6
3.1.3.1.3 Editor’s GoTo and Bookmarks................................ 3-6
3.1.3.1.4 Editor’s “Tools” Pull Down Menu .......................... 3-7
3.1.3.1.5 CRBasic Program Instructions ................................ 3-9
3.1.4 On-line Help............................................................................. 3-10
3.1.5 Adding Comments................................................................... 3-11
3.1.6 Datalogger Program Structure .............................................. 3-11
3.1.6.1 Variable Declarations.................................................... 3-14
3.1.6.1.1 Public & DIM Variable Declarations .................... 3-14
3.1.6.1.2 Units Declaration................................................... 3-17
3.1.6.1.3 Variable Nomenclature Rules................................ 3-17
3.1.6.1.4 Data Types and Formats........................................ 3-17
3.1.6.2 Main Program................................................................ 3-18
3.1.6.2.1 BeginProg and EndProg Instructions .................... 3-18
3.1.6.2.2 Scan/NextScan Instructions................................... 3-18
3.1.6.3 CRBasic Measurement Instructions ............................ 3-19
3.1.6.4 Save and Compile .......................................................... 3-22
3.1.6.5 Multipliers and Offsets.................................................. 3-22
3.1.6.6 Data Tables..................................................................... 3-23
3.1.6.6.1 DataTable Instruction ............................................ 3-23
3.1.6.6.2 DataTable; Ring Memory versus Fill and Stop ..... 3-24
3.1.6.6.3 Table Modification Instructions ............................ 3-24
3.1.6.6.3.1 Table Modification Instructions:
DataInterval............................................. 3-24
3.1.6.6.3.2 Table Modification Instructions: CardOut .. 3-26
3.1.6.6.3.3 Table Modification Instructions:
DataEvent................................................ 3-27

iv
Table of Contents

3.1.6.6.4 Output Processing Instructions ............................. 3-30


3.1.6.6.4.1 Average Output Processing Instruction ...... 3-31
3.1.6.6.4.2 Maximum & Minimum Output Processing
Instructions ............................................. 3-33
3.1.6.6.5 Data Storage Data Types....................................... 3-33
3.1.6.7 Array Notation and Repetitions................................... 3-35
3.1.6.7.1 Declarations using Array Notation........................ 3-35
3.1.6.7.2 Output Instructions using Array Notation............. 3-36
3.1.6.7.3 Measurement Instructions using Array Notation
for the Destination Parameter ............................ 3-36
3.1.6.7.4 Measurement Instructions using Array Notation
for the Mult & Offset Parameters ...................... 3-37
3.1.6.8 SubScan Instruction...................................................... 3-39
3.1.6.8.1 SubScan Instruction used to Control a
Multiplexer ........................................................ 3-40
3.1.7 Field Calibration of Linear Sensors ...................................... 3-43
3.1.7.1 Definition of Calibration............................................... 3-43
3.1.7.2 Cal File ........................................................................... 3-43
3.1.7.3 FieldCal CRBasic Instruction ...................................... 3-44
3.1.7.4 FieldCal Support Instructions...................................... 3-46
3.1.7.5 The Four Types of Calibrations ................................... 3-46
3.1.7.5.1 Zero Calibration (Function = 0) ............................ 3-46
3.1.7.5.2 Offset Calibration (Function = 1).......................... 3-48
3.1.7.5.3 Two-Point Multiplier and Offset Calibration
(Function = 2).................................................... 3-49
3.1.7.5.4 Two-Point Multiplier Only Calibration
(Function = 3).................................................... 3-51
3.1.7.5.5 Zero Basis Point Calibration (Function = 4) ......... 3-52
3.1.7.5.6 FieldCal Exercise: Two-Point Multiplier and
Offset & Zero Calibration ................................. 3-54
3.1.7.6 Performing a Manual Calibration ............................... 3-55
3.1.7.6.1 Mode Variable used for Calibration Status
and Control ........................................................ 3-55
3.1.7.6.2 Using the Mode Variable for Zero Calibration
Types ................................................................. 3-56
3.1.7.6.3 Using the Mode Variable for Offset Calibration
Types ................................................................. 3-56
3.1.7.6.4 Using the Mode Variable for 2-Point Calibration
Types ................................................................. 3-57
3.1.7.7 Using the Calibration Wizard with Running
Programs..................................................................... 3-58
3.1.7.7.1 Calibration Wizard Basic Operation ..................... 3-58
3.1.7.7.2 Using the Wizard to Perform Two-Point
Multiplier and Offset Calibrations..................... 3-58
3.1.7.7.3 Using the Wizard to Perform Zeroing
Calibrations........................................................ 3-62
3.1.7.7.4 Using the Wizard to Perform Offset Calibrations . 3-63
3.1.7.8 Strain and Shunt Calibration....................................... 3-64
3.2 Analog Voltage Measurements........................................................ 3-65
3.2.1 Programmable Gain Input Instrumentation Amplifier ...... 3-65
3.2.1.1 PGIA Input Limits ........................................................ 3-66
3.2.1.2 Nulling of Residual Common Mode Voltage .............. 3-67
3.2.1.3 Voltage Range Selections .............................................. 3-68

v
Table of Contents

3.2.2 Single Ended (SE) Voltage Measurement Details ................ 3-69


3.2.2.1 SE Voltage Wiring ......................................................... 3-69
3.2.2.2 SE Voltage Pros and Cons, Issues with Using............. 3-69
3.2.2.3 Which Instructions use SE Voltage Measurements.... 3-70
3.2.2.4 Expansion Peripherals .................................................. 3-70
3.2.2.5 Programming SE Voltage Measurements ................... 3-70
3.2.2.6 SE Voltage Measurement Sequence and Timing ........ 3-72
3.2.2.7 SE Voltage Measurement Programs............................ 3-73
3.2.3 Differential (DIFF) Voltage Measurement Details............... 3-75
3.2.3.1 DIFF Voltage Wiring..................................................... 3-75
3.2.3.2 DIFF Voltage Pros and Cons, Issues with Using ........ 3-75
3.2.3.3 Which Instructions use DIFF Voltage
Measurements ............................................................. 3-76
3.2.3.4 Expansion Peripherals .................................................. 3-76
3.2.3.5 Programming DIFF Voltage Measurements............... 3-76
3.2.3.6 VoltDIFF Measurement Sequence & Timing ............. 3-77
3.3 Resistive Bridge Measurements ....................................................... 3-80
3.3.1 Resistive Bridge Measurement Details .................................. 3-80
3.3.1.1 Excitation Compliance Current ................................... 3-84
3.3.2 Half Bridge Measurement (BrHalf Instruction)................... 3-84
3.3.2.1 BrHalf Pros and Cons ................................................... 3-85
3.3.2.2 What Sensors use the BrHalf Measurement
Instruction ................................................................... 3-85
3.3.2.3 Programming with the BrHalf Measurement
Instruction ................................................................... 3-85
3.3.3 Three Wire 1/2 Bridge Measurement: BrHalf3W
Instruction............................................................................ 3-88
3.3.3.1 BrHalf3W Pros and Cons ............................................. 3-89
3.3.3.2 What Sensors use the BrHalf3W Measurement
Instruction ................................................................... 3-89
3.3.3.3 Using the 3WHB10K 3-Wire Half Bridge Terminal
Input Module .............................................................. 3-89
3.3.3.4 Programming with the BrHalf3W Measurement
Instruction ................................................................... 3-90
3.3.4 Four Wire 1/2 Bridge Measurement: BrHalf4W
Instruction............................................................................ 3-92
3.3.4.1 BrHalf4W Pros and Cons ............................................. 3-93
3.3.4.2 What Sensors use the BrHalf4W Measurement
Instruction ................................................................... 3-93
3.3.4.3 Using the 4WPB100, 4WPB1K PRT Bridge Terminal
Input Modules............................................................. 3-93
3.3.4.4 Programming with the BrHalf4W Measurement
Instruction ................................................................... 3-94
3.3.5 Four Wire Full Bridge Measurement (BrFull Instruction) . 3-97
3.3.5.1 Full Bridge (BrFull) Pros and Cons ............................. 3-98
3.3.5.2 What Sensors use a Four Wire Full Bridge
Measurement............................................................... 3-98
3.3.5.3 Programming with the BrFull Measurement
Instruction ................................................................... 3-98

vi
Table of Contents

3.3.6 Six Wire Full Bridge Measurement: BrFull6W


Instruction.......................................................................... 3-100
3.3.6.1 Six Wire Full Bridge (BrFull6W) Pros and Cons..... 3-101
3.3.6.2 What Sensors use a 6-Wire Full Bridge
Measurement ............................................................ 3-101
3.3.6.3 Programming with the BrFull6W Measurement
Instruction................................................................. 3-102
3.4 Pulse Measurements ....................................................................... 3-105
3.4.1 Pulses to Measure.................................................................. 3-105
3.4.2 Pulse Input Channels............................................................ 3-105
3.4.3 Pulse Sensor Wiring.............................................................. 3-106
3.4.4 Pulse Measurement CRBasic Instructions.......................... 3-106
3.4.4.1 Frequency Resolution ................................................. 3-106
3.4.5 Pulse Measurement Pitfalls .................................................. 3-107
3.4.5.1 Pay Attention to Specifications .................................. 3-107
3.4.5.2 Input Filters and Signal Attenuation......................... 3-108
3.4.5.3 Pulse Measurement Averaging................................... 3-108
3.4.6 Pulse Measurement Tricks................................................... 3-109
3.4.7 Pulse Measurement Exercise................................................ 3-109
3.5 Digital/Serial Measurements.......................................................... 3-110
3.5.1 Serial Measurement Details, What They Are, How
They Work, How it is Measured ...................................... 3-110
3.5.2 Serial Sensor Wiring............................................................. 3-110
3.5.3 Serial Sensors Pros and Cons, Issues with Using etc. ........ 3-113
3.5.4 What Type of Sensors use Serial Output ............................ 3-114
3.5.5 Programming Serial Measurements.................................... 3-115
3.5.5.1 Important Questions You Need Answered ............... 3-115
3.5.5.2 Programming Instructions ......................................... 3-115
3.5.5.3 Different Levels of Protocol Complexity ................... 3-118
3.5.5.4 Step by Step Programming Examples ....................... 3-119
3.5.5.5 Terminal Mode W ....................................................... 3-128
3.5.6 Expansion Peripherals and Programming ......................... 3-130
3.6 Vibrating Wire (VW) Measurements ........................................... 3-132
3.6.1 Vibrating-Wire Measurement Principle ............................. 3-132
3.6.2 Vibrating-Wire Measurement Techniques ......................... 3-133
3.6.2.1 VW Traditional Time Domain Measurement
Technique.................................................................. 3-133
3.6.2.2 New VW Frequency Domain Measurement
Technique.................................................................. 3-134
3.6.2.3 Frequency Domain verses Time Domain Noise
Immunity................................................................... 3-135
3.6.3 AVW200 Wiring ................................................................... 3-137
3.6.3.1 Direct Connect through Serial Ports ......................... 3-137
3.6.3.1.1 Serial Port Direct Connection with Logger
Controlling the Multiplexers ........................... 3-139
3.6.3.2 Direct Connect through SDI12 Port .......................... 3-140
3.6.3.3 Wireless Connection through the RF400 series
Radios ........................................................................ 3-140
3.6.4 VW Pros and Cons, Issues with Using etc. ......................... 3-141
3.6.5 What Type of Sensors use VW Measurements .................. 3-141
3.6.6 DeviceConfig Utility.............................................................. 3-141
3.6.6.1 Deployment Tab: Setting up the AVW200................ 3-142
3.6.6.1.1 Deployment Tab: Communications window....... 3-142
3.6.6.1.2 Deployment Tab: Measurements Window.......... 3-143

vii
Table of Contents

3.6.6.2 DeviceConfig’s Data Monitor ..................................... 3-144


3.6.6.3 DeviceConfig’s Send OS.............................................. 3-144
3.6.6.4 DeviceConfig Troubleshoot Window ......................... 3-145
3.6.7 Programming for Vibrating Wire Measurements.............. 3-147
3.6.7.1 AVW200 Serial Communications Support
Instructions ............................................................... 3-147
3.6.7.1.1 AVW200 Measurement Instruction .................... 3-147
3.6.7.1.2 SerialOpen Instruction......................................... 3-151
3.6.7.2 Program Examples ...................................................... 3-152
3.7 Piezoelectric Sensor Measurements............................................... 3-157
3.7.1 Piezoelectric Sensor Measurement Details.......................... 3-157
3.7.2 Piezoelectric Sensor Classification and Wiring .................. 3-157
3.7.2.1 High Impedance Piezoelectric Sensors ...................... 3-157
3.7.2.2 Low Impedance Piezoelectric Sensors ....................... 3-158
3.7.3 Piezoelectric Sensor Pros and Cons, Issues with Using...... 3-159
3.7.4 Piezoelectric Sensor Manufacturers .................................... 3-161
3.8 4 to 20 mA Output Sensors ............................................................ 3-162
3.8.1 Typical Applications for 4-20mA transducers.................... 3-162
3.8.2 Advantages and Disadvantages for current Transducers . 3-162
3.8.2.1 Advantages ................................................................... 3-162
3.8.2.2 Disadvantages .............................................................. 3-162
3.8.3 Designing a Current Loop System....................................... 3-163
3.8.3.1 CSI CURS100............................................................... 3-163
3.8.3.2 CSI CURS100 Specifications ...................................... 3-163
3.8.3.3 Differential Measurement ........................................... 3-163
3.8.3.4 Common Mode Range................................................. 3-163
3.8.3.5 Ground Offset on Single-Ended Measurements ....... 3-164
3.8.4 Wiring of Transducers to Dataloggers ................................ 3-164
3.8.4.1 CR10(X), CR23X, CR800, CR850, CR1000,
CR3000, CR5000 ...................................................... 3-164
3.8.4.2 Transducer Wiring ...................................................... 3-164
3.8.4.2.1 Basic Two-Wire 4-20mA Current Loop.............. 3-165
3.8.4.2.2 Basic Three-Wire 4-20mA Current Loop............ 3-166
3.8.4.2.3 Basic Four-Wire 4-20mA Current Loop ............. 3-167
3.8.5 Sensor and Programming Example..................................... 3-168
3.8.5.1 Basic Program Example using CR1000 and
CURS100 ................................................................... 3-169
3.8.5.2 Important ShortCut Screen Shots for CURS100
Program........................................................................ 169
3.8.5.2.1 4-20 mA Sensor Selection Screen ....................... 3-169
3.8.5.2.2 Sensor Setup Screen ............................................ 3-170
3.8.5.2.3 Screen showing wiring diagram for sensor to
Datalogger........................................................ 3-170
3.9 Advanced CRBasic Topics ............................................................. 3-171
3.9.1 Expressions, Boolean Logic and Programming for
Control................................................................................ 3-171
3.9.1.1 Mathematical Expressions Exercise........................... 3-171
3.9.1.2 True and False ............................................................. 3-171
3.9.1.3 Using other Words for True and False ...................... 3-172
3.9.1.4 Conditional Statements ............................................... 3-174
3.9.1.5 Programming for Control........................................... 3-176
3.9.2 DataTable Modifiers ............................................................. 3-177
3.9.2.1 OpenInterval Instruction ............................................ 3-177
3.9.2.1 FillStop Instruction...................................................... 3-178

viii
Table of Contents

3.9.3 Multiple Scan…NextScan Instructions............................... 3-179


3.9.4 Using Slow Sequence Scans.................................................. 3-180
3.9.5 Declare Subroutines and Functions..................................... 3-182
3.9.5.1 Subroutines .................................................................. 3-182
3.9.5.2 Functions ...................................................................... 3-184
3.9.6 Accessing Data and Properties ............................................ 3-186
3.9.6.1 GetRecord Instruction ................................................ 3-186
3.9.6.2 Data Table Access Instructions .................................. 3-188

4. Measurement of Phenomena ...................................4-1


4.1 Measurement of Strain....................................................................... 4-1
4.1.1 Measurement Concepts ............................................................ 4-1
4.1.2 Metal Foil Bonded Strain Gages.............................................. 4-2
4.1.2.1 Metal Foil Bonded Strain Gages
Advantages/Disadvantages .......................................... 4-3
4.1.2.2 Quarter Bridge Strain Circuit........................................ 4-3
4.1.2.2.1 Quarter Bridge Strain with 3 Wire Strain Element . 4-4
4.1.2.2.1.1 Advantages/Strengths verses
Disadvantages/Weaknesses ...................... 4-4
4.1.2.2.1.2 Quarter Bridge Strain with 3 Wire Element
Wiring ....................................................... 4-5
4.1.2.2.1.3 Quarter Bridge Strain with 3 Wire Element
Calculations and Programming................. 4-6
4.1.2.2.1.4 CRBasic Instructions for Setting Up A
Zero Calibration...................................... 4-10
4.1.2.2.1.5 Calibration Wizard for Zeroing Foil
Bonded Strain Gages .............................. 4-15
4.1.2.2.1.6 Quarter Bridge Strain with 3 Wire Element
Wiring using a Multiplexer..................... 4-16
4.1.2.2.1.7 Quarter Bridge Strain Lead Resistance
Compensation ......................................... 4-18
4.1.2.2.1.8 Mathematical Lead Compensation for
3-Wire, ¼ Bridge Strain.......................... 4-19
4.1.2.2.1.9 Shunt Calibration Lead Compensation for
3-Wire, ¼ Bridge Strain.......................... 4-21
4.1.2.2.1.10 CRBasic Instructions for Setting Up a
Shunt Calibration .................................... 4-25
4.1.2.2.2 Quarter Bridge Strain with Dummy Gage............. 4-27
4.1.2.2.2.1 Quarter Bridge Strain with Dummy Gauge
Wiring Setup........................................... 4-29
4.1.2.2.2.2 Quarter Bridge Strain with Dummy Gauge
Calculations ............................................ 4-30
4.1.2.2.2.3 Quarter Bridge Strain with Dummy Gauge
Example Programs.................................. 4-30
4.1.2.3 Half Bridge Strain Circuit ............................................ 4-30
4.1.2.3.1 Advantages/Strengths verses
Disadvantages/Weaknesses ............................... 4-31
4.1.2.3.2 Half Bridge Bending Strain................................... 4-31
4.1.2.3.2.1 Half Bridge Bending Strain Wiring ............ 4-32
4.1.2.3.2.2 Half Bridge Bending Calculations .............. 4-32
4.1.2.3.3 Half Bridge Axial Strain ....................................... 4-34
4.1.2.3.3.1 Half Bridge Axial Strain Wiring................. 4-34
4.1.2.3.3.2 Half Bridge Axial Strain Equations and
Programming .......................................... 4-35

ix
Table of Contents

4.1.2.4 Full Bridge Strain Circuit ............................................. 4-37


4.1.2.4.1 Advantages verses Disadvantages......................... 4-37
4.1.2.4.2 Full Bridge Bending Strain.................................... 4-38
4.1.2.4.2.1 Full Bridge Bending Strain Wiring ............. 4-39
4.1.2.4.2.2 Full Bridge Bending Calculations ............... 4-39
4.1.2.3 Suppliers of Foil Bonded Strain Gages........................ 4-41
4.1.3 Strain Sensor: Welded, Bolted, Clamped.............................. 4-41
4.1.3.1 Advantages/Disadvantages ........................................... 4-41
4.1.3.2 Dynamic Measurement Strain Sensor ......................... 4-41
4.1.3.2.1 The ST350, an Example of a Dynamic
Measurement Gage ............................................ 4-42
4.1.3.2.1.1 ST350 Specifications................................... 4-42
4.1.3.2.1.2 ST350 Calibration Sheet Example .............. 4-43
4.1.3.2.1.3 ST350 Example Program ............................ 4-43
4.1.3.3 Static Measurement Strain Sensor............................... 4-44
4.1.3.3.1 Example of a Static Measurement Gage................ 4-44
4.1.3.3.1.1 Hitec HBWF-35-250-6-XGP-NT
Calibration Sheet Example...................... 4-45
4.1.3.3.1.2 HBWF-35-250-6-XGP-NT Example
Program................................................... 4-45
4.1.3.4 Suppliers of Strain Sensors........................................... 4-46
4.1.4 Amplified Strain Sensor/Strain Gage Amplifiers................. 4-46
4.1.4.1 Advantages/Disadvantages ........................................... 4-46
4.1.4.2 Strain Gage Amplifier Example ................................... 4-47
4.1.4.3 Amplified Strain Sensor Example................................ 4-48
4.1.4.3.1 Amplified Strain Sensor Calibration Information
Example ............................................................. 4-49
4.1.4.3.2 Amplified Strain Sensor Program Example .......... 4-49
4.1.3.4 Suppliers of Strain Sensor Amplifiers/Amplified Strain
Sensors......................................................................... 4-49
4.1.5 Vibrating Wire Strain Sensors............................................... 4-50
4.1.5.1 Advantages/Disadvantages ........................................... 4-50
4.1.5.2 Vibrating Wire Strain Sensor Example....................... 4-50
4.1.5.2.1 Vibrating Wire Strain Sensor Specification Sheet
Example ............................................................. 4-50
4.1.5.2.2 Vibrating Wire Strain Sensor Calibration Sheet
Example ............................................................. 4-51
4.1.5.2.3 Amplified Strain Sensor Program Example .......... 4-52
4.1.5.3 Suppliers of Vibrating Wire Strain Sensors................ 4-52
4.1.6 Bibliography ............................................................................ 4-52
4.2 Load Cells .......................................................................................... 4-54
4.2.1 Load Cell Types....................................................................... 4-54
4.2.2 Hydraulic Load Cells and Pneumatic Load Cells ............... 4-55
4.2.3 Electrical (Foil Strain Gage) Type Load Cells...................... 4-56
4.2.3.1 Advantages and Disadvantages .................................... 4-56
4.2.3.2 Data Sheet of a Typical Electrical Load Cell .............. 4-56
4.2.3.3 Measurement Issues – Wiring Diagrams..................... 4-57
4.2.3.3.1 Excitation............................................................... 4-57
4.2.3.3.2 Temperature Compensation................................... 4-57
4.2.3.3.3 Bridge Circuit Resistors ........................................ 4-57
4.2.3.3.4 Signal Conditioning............................................... 4-57
4.2.3.3.5 Making Good Measurements ................................ 4-58
4.2.3.4 Program Example for Electrical Load Cell................. 4-59
4.2.3.4.1 Program Example .................................................. 4-59

x
Table of Contents

4.2.4 Vibrating Wire Load Cells(5) ................................................ 4-60


4.2.4.1 Examples of Vibrating Wire Load Cells ..................... 4-60
4.2.4.2 Advantages and Disadvantages.................................... 4-60
4.2.4.3 VW Wiring Diagram..................................................... 4-61
4.2.4.4 Calibration Sheet Example........................................... 4-62
4.2.4.5 Vibrating Wire Load Cell Programming .................... 4-63
4.2.5 Fiber Optic Load Cells ........................................................... 4-64
4.2.6 Class Exercises ........................................................................ 4-64
4.2.6.1 Exercise #1 ..................................................................... 4-64
4.2.7 Manufacturers and References for Footnotes ...................... 4-64
4.3 Measurement of Acceleration .......................................................... 4-67
4.3.1 Accelerometer Types .............................................................. 4-67
4.3.2 Piezoresistive Accelerometers ................................................ 4-70
4.3.2.1 Short Cut Exercise: Program a 4-wire Resistive
Accelerometer ............................................................. 4-72
4.3.2.2 CRBasic: Program for a 4-wire Resistive
Accelerometer ............................................................. 4-73
4.3.3 Amplified Accelerometers ...................................................... 4-73
4.3.3.1 Short Cut Exercise: Program an Amplified
Accelerometer ............................................................. 4-75
4.3.3.2 CRBasic Program Code................................................ 4-76
4.3.4 Capacitive Accelerometers ..................................................... 4-76
4.3.5 Piezo Electric Accelerometers................................................ 4-77
4.3.5.1 Piezoelectric Power Supplies ........................................ 4-78
4.3.5.1.1 Short Cut Exercise: Program a piezoelectric
accelerometer..................................................... 4-78
4.3.5.1.2 CRBasic program for a Piezoelectric
accelerometer..................................................... 4-79
4.3.6 Servo Force Balance Accelerometers .................................... 4-80
4.3.6.1 Geophones ...................................................................... 4-80
4.3.6.2 Short Cut Exercise: Program a Force Balance
Accelerometer ............................................................. 4-81
4.3.6.3 CRBasic Program for Geophone Velocity
Transducer.................................................................. 4-82
4.3.7 Wiring Diagrams for Accelerometer Types.......................... 4-83
4.3.8 Advantages and Limitations of Accelerometer Types ......... 4-84
4.3.8.1 Piezoresistive Accelerometer ........................................ 4-84
4.3.8.2 Amplified Accelerometer .............................................. 4-84
4.3.8.3 Capacitive Accelerometer............................................. 4-85
4.3.8.4 Piezoelectric Accelerometer.......................................... 4-85
4.3.9 Choosing the Correct Accelerometer for the Application... 4-85
4.4 Measurement of Tilt ......................................................................... 4-88
4.4.1 Electrolevel Tiltmeters............................................................ 4-92
4.4.1.1 Advantages and Limitations......................................... 4-92
4.4.1.2 Example Specifications ................................................. 4-93
4.4.1.3 Example Calibration / Data Reduction Procedure..... 4-94
4.4.1.4 Example CRBasic Program.......................................... 4-95
4.4.1.5 Class Exercise 4.4-1 – Electrolevel Tiltmeter.............. 4-95
4.4.2 MEMS Tiltmeters ................................................................... 4-98
4.4.2.1 Advantages and Limitations......................................... 4-99
4.4.2.2 Example Specifications ............................................... 4-100
4.4.2.3 Example Calibration Sheet......................................... 4-101
4.4.2.4 Example CRBasic Program........................................ 4-102
4.4.3 Vibrating Wire Tiltmeters.................................................... 4-103
4.4.3.1 Advantages and Limitations....................................... 4-104

xi
Table of Contents

4.4.3.2 Example Specifications................................................ 4-104


4.4.3.3 Example Calibration Sheet ......................................... 4-105
4.4.3.4 Example CRBasic Program ........................................ 4-105
4.5 Measurement of Temperature ....................................................... 4-106
4.5.1 Thermocouples ...................................................................... 4-107
4.5.1.1 Advantages and Limitations of Thermocouples ....... 4-108
4.5.1.2 Short Cut Exercise: Program to Measure a
Thermocouple ........................................................... 4-109
4.5.1.2.1 ShortCut Generated Example Program ............... 4-110
4.5.1.3 Multiplexers ................................................................. 4-111
4.5.1.3.1 Program for Measuring Thermocouples on an
AM25T ............................................................ 4-111
4.5.1.4 Example Manufacturers, Distributers of
Thermocouples/ Thermocouple Wire ..................... 4-113
4.5.2 Thermistors............................................................................ 4-113
4.5.2.1 Example Program to Measure a Thermistor with
a Half-Bridge Measurement .................................... 4-117
4.5.2.2 Advantages and Limitations of Thermistors............. 4-117
4.5.2.3 Short Cut Exercise: Program to Measure a 107
Temperature Probe .................................................. 4-118
4.5.2.4 Example Program to Measure a 107-L Thermistor . 4-119
4.5.2.5 AM16/32B Multiplexer................................................ 4-119
4.5.2.6 AM16/32B Multiplexer with Campbell Scientific
107 Temperature Probes.......................................... 4-119
4.5.2.7 Example Manufacturers, Distributers of
Thermistors ............................................................... 4-122
4.5.3 Resistance Temperature Detectors (RTD)/Platinum
Resistance Thermometer (PRT)....................................... 4-122
4.5.3.1 PRT in 3-Wire Half Bridge with Terminal Input
Module....................................................................... 4-123
4.5.3.2 Short Cut Exercise: Program to Measure PRT
3-Wire with 3WHB10KTIM.................................... 4-124
4.5.3.3 PRT in 4-Wire Half Bridge with Terminal Input
Module....................................................................... 4-125
4.5.3.4 PRT in 4-Wire Half Bridge Program Example......... 4-126
4.5.3.5 Advantages and Limitations of RTDs/PRTs ............. 4-127
4.5.3.6 Example Manufacturers, Distributers of RTDs/
PRTs .......................................................................... 4-127
4.5.4 Vibrating Wire Temperature Sensors................................. 4-128
4.5.4.1 Advantages and Limitations of Vibrating Wire
Sensors....................................................................... 4-128
4.5.4.2 Typical Calibration Sheets for Vibrating Wire
Temperature Sensors ............................................... 4-129
4.5.4.3 Wiring for Vibrating Wire Temperature Sensor
Examples ................................................................... 4-131
4.5.4.4 Programming Exercise for Vibrating Wire
Temperature Sensor ................................................. 4-131
4.5.4.5 Example Programs for Vibrating Wire
Temperature Sensors ............................................... 4-132
4.5.4.6 Example Manufacturers, Distributers of Vibrating
Wire Temperature Sensors...................................... 4-134
4.5.5 Radiation Shield .................................................................... 4-134
4.5.6 References .............................................................................. 4-134

xii
Table of Contents

4.6 Joint / Crack Meters....................................................................... 4-135


4.6.1 Crack / Joint Meter Types ................................................... 4-135
4.6.2 LVDT General Information.................................................. 4-137
4.6.3 LVDT CLASSES................................................................... 4-139
4.6.3.1 Unguided Core(7) ........................................................ 4-139
4.6.3.2 Captive or Guided Core (7) ........................................ 4-139
4.6.3.3 Spring-Extended Core (7)........................................... 4-140
4.6.4 LVDT Theory and Operation (6) ........................................ 4-140
4.6.4.1 Basic Features.............................................................. 4-140
4.6.4.2 Friction-Free Operation.............................................. 4-140
4.6.4.3 Infinite Resolution ....................................................... 4-140
4.6.4.4 Unlimited Mechanical Life ......................................... 4-141
4.6.4.5 Over travel Damage .................................................... 4-141
4.6.4.6 Environmentally Robust............................................. 4-141
4.6.4.7 Null Point Repeatability.............................................. 4-141
4.6.4.8 Fast Dynamic Response .............................................. 4-141
4.6.5 DC-LVDT Operation(6) ....................................................... 4-142
4.6.5.1 Basic DC-LVDT Program .......................................... 4-143
4.6.5.1.1 Typical Calibration Sheet(11) ............................. 4-143
4.6.5.1.2 Example Program for a DC-LVDT..................... 4-145
4.6.6 String Potentiometers / Electrical Crack Meters (4) ......... 4-146
4.6.6.1 Advantages and Disadvantages.................................. 4-147
4.6.6.2 Components of a String Potentiometer (8)................ 4-147
4.6.6.3 Typical Outputs for String Potentiometers............... 4-147
4.6.6.4 Some Typical Applications Examples........................ 4-148
4.6.6.5 Basic String Potentiometer/CPT Program................ 4-148
4.6.7 Vibrating Wire (VW) Crack Meter / Joint Meter(5)......... 4-149
4.6.7.1 Vibrating Wire Load Cell Programming .................. 4-150
4.6.8 Specifications – Example of a Typical Crack Meter......... 4-153
4.6.8.1 Measurement Issues and Concepts – Wiring
Diagrams ................................................................... 4-153
4.6.8.2 Schematic for Datalogger to Crack Meter ................ 4-154
4.6.9 Additional Program Examples ............................................ 4-156
4.6.9.1 Example LVDT Program Using Multiplexer............ 4-156
4.6.10 Class Exercises .................................................................... 4-157
4.6.10.1 Exercise #1 Program for Using AVW200
Instruction................................................................. 4-157
4.6.11 Manufacturers and References for Footnotes .................. 4-157
4.7 Pressure Transducers..................................................................... 4-160
4.7.1 Measurement Concepts ........................................................ 4-160
4.7.1.1 Measurement Types .................................................... 4-160
4.7.1.1.1 Piezo-resistive Transducers................................. 4-161
4.7.1.1.2 Piezo-electric Transducers .................................. 4-162
4.7.1.1.3 Vibrating Wire Transducers................................ 4-162
4.7.1.2 Sensor Output.............................................................. 4-163
4.7.1.3 Attributes of Sensor Types ......................................... 4-163
4.7.2 Definitions.............................................................................. 4-164
4.7.3 Sensor Specifications ............................................................ 4-165
4.7.4 Pressure Sensor with Analog Voltage Output .................... 4-166
4.7.4.1 Calculating Multiplier and Offset.............................. 4-166
4.7.4.2 Wiring Instructions ..................................................... 4-167
4.7.4.3 Programming Example............................................... 4-167
4.7.5 Sensor with Ratiometric Output.......................................... 4-168
4.7.5.1 Sensor Specification Sheet Example .......................... 4-168
4.7.5.2 Using Sensitivity to Derive Multiplier ....................... 4-169

xiii
Table of Contents

4.7.5.3 Selecting the Excitation and Input Range ................. 4-169


4.7.5.4 Programming Example ............................................... 4-170
4.7.6 Pressure Sensor with 4-20mA Current Output .................. 4-171
4.7.6.1 Practical Exercise ........................................................ 4-173
4.7.7 Vibrating Wire Pressure Sensor .......................................... 4-173
4.7.7.1 Installation Procedures ............................................... 4-174
4.7.7.1.1 On-Site Calibration.............................................. 4-174
4.7.7.1.2 CRBasic Program that Acquires Zero Readings
using the FieldCal Instruction.......................... 4-174
4.7.8 Manufacturers and References for Footnotes .................... 4-179
4.8 Gravimetric and Volumetric Soil Water Content
Measurements............................................................................. 4-181
4.8.1 Measurement Concepts......................................................... 4-181
4.8.1.1 Gravimetric Water Content (GWC).......................... 4-181
4.8.1.1.1 Summary of GWC Measurements....................... 4-181
4.8.1.2 Volumetric Water Content (VWC)............................ 4-182
4.8.1.2.1 Summary of VWC Measurements....................... 4-182
4.8.2 Measuring in situ Volumetric Water Content (VWC)....... 4-182
4.8.2.1 Time Domain Reflectometry (TDR)........................... 4-183
4.8.2.1.1 Summary of TDR ................................................ 4-184
4.8.2.2 Water Content Reflectometer..................................... 4-184
4.8.2.2.1 Summary of Water Content Reflectometer ......... 4-186
4.8.2.3 Capacitance/Frequency Domain ................................ 4-186
4.8.2.3.1 Summary of Capacitance/Frequency................... 4-188
4.8.2.4 Neutron Thermalization.............................................. 4-188
4.8.2.4.1 Summary of Neutron Thermalization.................. 4-190
4.8.2.5 Thermal Conductivity Probes .................................... 4-190
4.8.2.5.1 Summary of Thermal Conductivity Probes ......... 4-192
4.8.3 Programming Examples ....................................................... 4-193
4.8.3.1 CS616 Description ....................................................... 4-193
4.8.3.1.1 CS616 Program Example .................................... 4-194
4.8.3.1.2 CS616-L Soil Water Content Sensor Exercise .... 4-194
4.8.3.1.2.1 Manual References for Exercise................ 4-194
4.8.3.1.2.2 Objectives.................................................. 4-195
4.8.3.1.2.3 Equipment and Software used in Break
Out Session: .......................................... 4-195
4.8.3.1.2.4 General Operational Details: ..................... 4-195
4.8.3.1.2.5 Using ShortCut to Generated CS616-L
Program................................................. 4-195
4.8.3.1.2.6 Actual Generated Program for the
CS616-L................................................ 4-197
4.8.3.2 Decagon 10HS Description ......................................... 4-198
4.8.3.2.1 Decagon 10HS Program Example....................... 4-199
4.8.3.3 CS630 TDR100 Description....................................... 4-200
4.8.3.3.1 CS630 TDR100 Program Example ..................... 4-201
4.8.4 Soil Terms/Definitions........................................................... 4-205
4.9 Slope Stability/Rock Mass Deformation ....................................... 4-206
4.9.1 Measurement Concepts......................................................... 4-206
4.9.2 Instrumentation..................................................................... 4-206
4.9.2.1 Time Domain Reflectometry (TDR)........................... 4-206
4.9.2.2 MEMS Vertical In-Place Inclinometer ...................... 4-210
4.9.2.3 ShapeAccelArray (SAA) ............................................. 4-211
4.9.2.4 Optical Time-Domain Reflectometer ......................... 4-212
4.9.2.5 Geotechnical Robotic Total Station ........................... 4-213
4.9.2.6 Slope Stability Radar (SSR)........................................ 4-215

xiv
Table of Contents

4.9.3 Advantages/Disadvantages................................................... 4-215


4.9.3.1 Time Domain Reflectometry (TDR) .......................... 4-215
4.9.3.2 MEMS Vertical In-Place Inclinometer (MEMS)...... 4-216
4.9.3.3 ShapeAccelArray (SAA) ............................................. 4-216
4.9.3.4 Optical Time-Domain Reflectometer (OTDR) ......... 4-216
4.9.3.5 Geotechnical Robotic Total Station (RTS)................ 4-217
4.9.3.6 Slope Stability Radar (SSR) ....................................... 4-217
4.9.4 Program Examples................................................................ 4-217
4.9.4.1 TDR100 System Description ...................................... 4-217
4.9.4.1.1 Using the TDR100 as a Cable Tester .................. 4-219
4.9.4.1.2 TDR100 Program................................................ 4-225
4.9.4.2 Measurand SAA Program Example .......................... 4-226
4.9.4.2.1 Measurand System Description........................... 4-226
4.9.4.2.2 Measurand Program Generator ........................... 4-227
4.9.4.2.3 Measurand Hardware Setup ................................ 4-228
4.9.4.2.4 Send Measurand Program ................................... 4-230

5. Advanced Measurement Topics ..............................5-1


5.1 Signal Settling Time............................................................................ 5-1
5.1.1 Calculating Settling Time......................................................... 5-2
5.1.1.1 The Input Settling Time Constant ................................. 5-2
5.1.1.1.1 Determining Source Resistance .............................. 5-4
5.1.1.1.2 Determining Lead Capacitance ............................... 5-5
5.1.1.1.3 Dielectric Absorption .............................................. 5-6
5.1.1.2 Example τ (time constant) Calculation.......................... 5-6
5.1.1.2.1 Calculating Ro......................................................... 5-7
5.1.1.2.2 Calculating Total Capacitance (CT)........................ 5-8
5.1.1.3 Transients Induced by Switched Excitation.................. 5-8
5.1.2 Minimizing Settling Errors ...................................................... 5-9
5.1.3 Measuring the Necessary Settling Time.................................. 5-9
5.1.3.1 Exercise for Measuring the Necessary Settling
Time............................................................................. 5-11
5.2 Ground Loops ................................................................................... 5-14
5.2.1 Single-Ended Measurement Reference ................................. 5-14
5.2.2 Ground Potential Differences ................................................ 5-14
5.2.2.1 SE Soil Temperature Thermocouple ........................... 5-14
5.2.2.2 External Signal Conditioner......................................... 5-14
5.2.3 Ground Looping in Ionic Measurements.............................. 5-15
5.3 A/D Resolution .................................................................................. 5-16
5.3.1 Binary Numbers ...................................................................... 5-16
5.3.1.1 IEEE4 - 4 Byte Floating Point ...................................... 5-17
5.3.1.2 CSI FP2 - 2 Byte Floating Point ................................... 5-17
5.3.2 ADC Analog to Digital Converts ........................................... 5-17
5.3.2.1 Successive Approximation ............................................ 5-18
5.3.2.2 Gain Ranging ................................................................. 5-18
5.3.2.3 Higher Resolution by Reversing Inputs ...................... 5-18
5.3.2.4 Effect of Noise on Resolution........................................ 5-18
5.3.2.5 Resolution’s Affect on Total Accuracy........................ 5-18
5.4 Aliasing/Filtering .............................................................................. 5-19
5.4.1 Aliasing .................................................................................... 5-22

xv
Table of Contents

6. MEMS Sensor Technology ...................................... 6-1


6.1 MEMS Sensor Introduction............................................................... 6-1
6.2 MEMS Mechanical to Electric Signal Conversion (transduction) . 6-1
6.3 MEMS Integration Levels .................................................................. 6-3
6.4 MEMS Sensing Possibilities ............................................................... 6-4
6.5 MEMS Sensor Examples .................................................................... 6-4
6.5.1 MEMS Triaxial Accelerometer Example................................ 6-5
6.5.2 MEMS Low Cost Single Axis Accelerometer Example ...... 6-11
6.5.3 MEMS Sensors with On-board Communications ................ 6-12
6.5.3.1 MEMS with Integrated Digital Data Bus
Communication........................................................... 6-12
6.5.3.2 MEMS with Integrated Multiplexed Analog Data
Bus................................................................................ 6-15
6.5.3.3 MEMS Sensor with On-board Processing, Shape
Accel Arrays................................................................ 6-16
6.5.3.4 OEM MEMS Sensor with RS232 Communications ... 6-17
6.6 MEMS Strain Sensor Possibilities ................................................... 6-19
6.7 MEMS Corrosion Sensor Possibility............................................... 6-19
6.8 Advantages and Disadvantages of MEMS Sensors........................ 6-20

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

C. The Benefits of Input Reversal and Excitation


Reversal for Voltage Measurements ...................C-1

D. RavenXTG Sierra Wireless Cellular Modem..........D-1

E. Calibration of Linear Sensors for Data


Acquisition ............................................................ E-1
E.1 Overview ............................................................................................ E-1
E.2 Removing the Mystery from Y=MX+B........................................... E-1
E.3 Calibrating a String Pot.................................................................... E-2
E.3.1 How to Calculate the Multiplier and Offset? ........................ E-3
E.4 Calibrating a Scale ............................................................................ E-3
E.4.1 How to Calculate the Multiplier and Offset? ........................ E-4

xvi
Table of Contents

F. Rainflow Histogram................................................. F-1


F.1 Rainflow Histogram ...........................................................................F-1
F.1.1 Rainflow Histogram Instruction .............................................F-1
F.1.2 Rainflow Histogram Example .................................................F-3
F.1.3 Using RTDAQ’s real-time Rainflow Viewer..........................F-6
F.1.3.1 Movement and Resizing of the Rainflow Window.......F-8
F.1.3.2 Selecting Tables and Bins for Display ...........................F-8
F.1.3.3 Using the Buttons and Controls.....................................F-9
F.1.3.4 X-Axis Mode..................................................................F-11
F.1.3.5 Zooming in on the Histogram ......................................F-12
F.1.3.6 Save and Print Options.................................................F-12
F.1.3.7 Setting the Options for the Rainflow Screen ..............F-14
F.1.3.7.1 Scaling the Axes ................................................... F-14
F.1.3.7.2 Visual Display Options ......................................... F-15
F.1.3.7.3 Trace Options........................................................ F-16
F.1.3.7.4 Using Saved Configurations ................................. F-17
F.1.3.8 Accepting or Abandoning Changes to the
Rainflow Options........................................................F-18
F.1.4 Displaying Historical Rainflow histograms with View
Pro.......................................................................................F-19
F.1.4.1 Selecting Data to be Graphed ......................................F-20
F.1.4.2 Options...........................................................................F-20
F.1.4.3 Rainflow Histogram Toolbar .......................................F-21

G. Preventing and Attacking Measurement Noise


Problems ...............................................................G-1

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:

• Is it the contractor requesting it for his workers’ protection or for civil


liability protection?
• Is it the state or federal government requiring it?
• Is it for short term monitoring during the construction process?
• Is it for long term health monitoring of the structure?
• Are the nearby property owners requesting the monitoring?
• Will you have the support of the main contractor, or will he put up
roadblocks?

1.1.2 Know the Parameters Needing to be Measured


It is important to know up front the type and number of physical phenomena to
be measured. Just because it can be measured does not mean that it should be
measured. Be wary of data overload.

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

1.2 Components of a Data Acquisition System


1.2.1 DAQ Basics
Once you know what phenomena needs to be measured and for whom, we can
start to worry about how to accomplish it. We will need to select the sensors,
the data acquisition system (DAQ), the data storage media, the software to
setup the DAQ as well as to collect and view the data, the communication/data
retrieval methods. In addition, in some cases, power can be a DAQ design
concern.

It should be remembered that dataloggers are only one part of a data


acquisition system. In order to get good data you must also have suitable
sensors and reliable data retrieval. A failure in any part of the system could
lead to “bad” data.

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

FIGURE 1.2-1. Basic Components of a DAQ System

1.2.2 Sensors and Sensor Interfaces


Suitable sensors transform an environmental phenomenon into measurable
electrical properties by outputting a voltage, outputting a current, changing
resistance, outputting pulses or sinusoidal signals, changing states, or
outputting a digital signal.

The selection of sensors should be done in parallel with the datalogger


selection to insure compatibility. For instance if vibrating wire sensors are

1-2
Section 1. Data Acquisition Systems

selected to measure a phenomena, it should be determined that the DAQ


supports vibrating wire sensors and what, if any, interface is required.
Another example is if piezo-electric sensors are being considered for a specific
application, then the interface requirements for the DAQ to read this type of
sensor, as well as the measurement speed requirements, should be taken into
account.

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.

Some of the considerations in selection a datalogger include:

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.2.4 Memory Requirements


Is an external memory device required or is datalogger internal memory
adequate?

Some of the considerations in determining external versus internal memory


requirements include:

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.

Example: It is desired to store twenty data points at 10 Hz. Thirteen of the


data points shall be stored in a low resolution format, the other seven shall be
stored in high resolution. A time stamp and record number shall be stored with
every record. Data will be collected from the datalogger after every 8 hours of
operation. What size of data storage media is required?

1-3
Section 1. Data Acquisition Systems

Bytes per data storage interval (10 Hz):


Low resolution data High resolution data Timestamp/Record #
(13 datum) x (2 Bytes/datum) + (7 datum) x (4 Bytes/datum) + 12 Bytes
= 66 Bytes per storage interval or data record

Bytes per eight hour period:


Bytes per record Records/Second Seconds/Hour # of Hours
(66 Bytes/record) x (10 records/Sec) x (3600 Sec/Hour) x (8 Hour)
= 19 MBytes between collections

For this example a minimum of 19 MB of data storage media is required. For


most loggers this would require a Compact flash card.

1.2.5 Power Supply Requirements


Some system power considerations:

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.

1.2.6 Data Retrieval


Generally, the main objective of a data acquisition system is to make
measurements and store data files on a PC.

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.2.6.1 On Site Data Retrieval


On-site communications are preferred if the datalogger is near the PC and the
PC can dedicate a serial port for that datalogger. This can be accomplished
with a USB to Serial converter. On-site methods are also used when the user
must visit a remote site with a laptop or Compact Flash Module because
telecommunications options are impossible, impractical or too expensive.

1.2.6.2 Data Retrieval through Telemetry


Telecommunications give you remote access and the ability to discover any
problems as early as possible with a minimum of data loss.
Telecommunications options include a wide variety of devices such as:
Ethernet, multidrop, radio, satellite, short haul modem, telephone and cellular
phone. Figure 1.2-2 is a schematic outlining some of the options. It should be
noted that not all options are shown (such as radio to cell phone or radio to
LAN).

1-4
Section 1. Data Acquisition Systems

FIGURE 1.2-2. Telemetry Options

1.2.7 Software Selection


The software package selected for the project should be determined by the
projects requirements. Some of the criteria for software selection include:

1. What dataloggers will be used on the project?


2. Programming requirements. Can the DAQ be setup with simple pick and
click programming tools, or are there complex logic requirements that
mandate a lower level programming choice (CRBasic).
3. Will there be multiple dataloggers networked together?
4. Will collecting data and monitoring the DAQ be done directly on site, or is
a telecommunication option desired?
5. What are the real time data viewing requirements?
6. Does the project require automatic scheduled data collection?
7. Is it desired to publish results to a web page?

1.2.7.1 PC200W Starter Software


Campbell Scientific’s PC200W is a free software tool that supports direct
communications between a computer and a datalogger. This software is
compatible with all of our contemporary dataloggers, all of our datalogger
operating systems (e.g.,-MA, -TD, -PB), and many retired dataloggers (e.g.,
CR510, CR10X, 21X, CR23X).

1-5
Section 1. Data Acquisition Systems

PC200W allows the user to:

1. Create programs using the Shortcut Program Generator utility.


2. Send programs to the dataloggers.
3. Display real-time measurements
4. Collect data from the dataloggers.
5. Set the datalogger’s clock
6. Access the terminal emulation mode
7. Convert binary data files stored a PC Cards or Compact Flash cards.

1.2.7.1.1 EZSetup

EZSetup uses a point-and-click format for setting up communications between


a CR1000 and the PC. This is the first step in using PC200W with your
datalogger.

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.

►► Use PC200W’s Easy Setup (EZSetup) to configure your datalogger connection.

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

Choose the CR1000 datalogger and give it an appropriate name. We’ll be


using a direct connect on COM1. Use the remaining defaults:
Baud Rate: 115200
PakBus Address: 1
Security Code: 0
Extra Response Time: 0 s
Max Time Online: 0 d 0 h 0 m
Connect the serial cable from the computer’s COM1 serial port to the
CR1000’s RS-232 port. Check communications.
Set the datalogger’s clock.

1.2.7.1.2 Short Cut Program Generator

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.

Datalogger programs are executed on a precise schedule termed the “Scan


Interval”, based on the datalogger’s internal clock.

Measurements are first stored in temporary memory called “variables” in the


Public Table. Variables are usually overwritten each scan. Periodically,
generally on a time interval, the datalogger stores data in tables. The Data
Tables are later copied to a PC using another client in PC200W.

The Short Cut Programming Wizard simplifies the creation of datalogger


programs; it creates a datalogger program and compatible wiring. Users select

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.

Get latest Short Cut sensor files from www.campbellsci.com Support |


Downloads | View by Download | select Short Cut.

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

►► Exercise 1.2-1. Air Temperature with 5 second Average

Using a CR1000, measure air temperature in degrees C with a Type T


thermocouple, and store five second average air temperatures.

Step 1. New Program


• Datalogger model (CR1000)
• Scan Interval (1 second)
• AC Noise Rejection (60 Hz)
• Sensor Support (Campbell Scientific, Inc.)

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.

►► Exercise 1.2-2. Air Temperature User Expression

Use an expression to create a new variable containing the thermocouple in


degrees Fahrenheit.

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

This will create a new variable in which to store the reading.

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

►► Exercise 1.2-2 con’t

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.

All Campbell Scientific dataloggers are able to:

• 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.

TABLE 2.1-1. Comparison of Datalogger Features

Feature CR200X CR800 CR1000 CR3000 CR5000 CR9000X


Series CR850

Max Scan Rate 1 100 100 100 1667 100,000


(Hz)

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)

Pulse Counters 2 2 2 4 2 12 per CR9071

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

Continuous 0 0 0 2 2 6 per CR9060


Analog Outputs

2-1
Section 2. DAQ Components

TABLE 2.1-1. Comparison of Datalogger Features

Feature CR200X CR800 CR1000 CR3000 CR5000 CR9000X


Series CR850

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

Input Voltage 0≤V≤2.5 ±5 ±5 ±5 ±5 ± 5 w/CR9050 or CR9051E,


Range (Vdc) ± 50 w/CR9055E,
± 60 w/CR9058E

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

Analog to 0.6 mV to 0.33 µV to 0.33 µV to 0.33 µV to 0.33 µV to 1.6 µV


Resolution

A/D Bits 12 13 13 16 16 16

Temperature -40 to +50 Standard: Standard: Standard: Standard: Standard:


Range (°C) -25 to+ 50 -25 to +50 -25 to +50 -25 to +50 -25 to +50
Extended: Extended: Extended: Extended: Extended:
(CR800) -55 to +85 -40 to +85 -40 to +85 -40 to +70
-55 to +85
(CR850)
-30 to +80
Memory (bytes) Program: OS:\ OS: OS: OS: OS:
Up to 19.6 k 2 M Flash 2 M Flash 2 M Flash 2 M Flash 2 M Flash
Data storage: CPU(data CPU(data and CPU(data and Program Storage Program Storage:
512k and program program program storage) 128 K 128 k
OS: storage) storage) 4M CPU data storage Data storage:
106 k 4M 4M 2M 128 M
Power 7 to 16 9.6 to 16 9.6 to 16 10 to 16 11 to 16 9.6 to 16
Requirements
(Vdc)
Typical Current W/O Radio Sleep mode: Sleep mode: Sleep mode: Sleep mode: Processing:
Drain (mA) Quiescent: ~ 0.6, ~ 0.6 2 1.5 750 to 1000
~0.2 w/o RS-232: w/o RS-232: 1 Hz sample rate: 1 Hz sample rate, Analog measurement:
Active: 1 to 16 1 to 16 3 4.5 750 to6000
~3 w/RS-232: w/RS-232: 100 Hz sample rate 5 kHz sample rate
17 to 28 17 to 28 10 200
Dimensions 5.5x3.0x1.9 9.5x4.1x2 9.4x4.0x2.4 9.5x7.0x3.8 9.8x8.3x4.5 Lab enclosure:15.75x9.75x8
(inches) Field enclosure:18x13.5x9,
CR9000XC:10x11x9

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

TABLE 2.1-1. Comparison of Datalogger Features

Feature CR200X CR800 CR1000 CR3000 CR5000 CR9000X


Series CR850

PakBus leaf node only yes yes yes no no


Supported

Modbus yes yes yes yes no no


Supported

DNP3 no yes yes yes no no


Supported

CE Compliant CR200X, yes yes yes yes yes


CR206X,
CR211X,
CR216X

Warranty 3 years 3 years 3 years 3 years 3 years 3 years

Software Supported
Short Cut yes yes yes yes yes no

PC200W 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

RTDAQ no yes yes yes yes yes

PConnect 3.0 or higher 3.3 or higher 3.1 or higher 3.2 or higher no no

PConnectCE 2.0 higher 2.2 or higher 2.0 or higher 2.1 or higher no no

2-3
Section 2. DAQ Components

2.1.1 Datalogger Descriptions (listed from smallest to largest)


2.1.1.1 CR200X-series Datalogger/Wireless Sensor

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).

Limitations: TheCR200X series dataloggers are not compatible with channel


expansion devices or thermocouples. They are limited to 5 single-ended
channels and have no differential channels. They also have no peripheral port
for the NL115/NL120 or the CFM100 CompactFlash® Module.

Ideal Applications: Wireless sensors, wind energy, rural water, aquaculture,


water quality.

2.1.1.2 CR800-series Measurement and Control System

Design Features: The CR800 series consists of measurement electronics


encased in a plastic shell and an integrated wiring panel. These research-grade
dataloggers have a custom ASIC chip that expands pulse count, control port,
and serial communications capabilities. They are compatible with channel

2-4
Section 2. DAQ Components

expansion peripherals and thermocouples, and support serial communications


with serial sensors and devices via I/O port pairs. The CR800 series uses an
external power supply—typically the BPALK Alkaline Battery Pack or PS100
Rechargeable Power Supply.

Models Available: The CR800 uses the portable CR1000KD keyboard


display; The CR850 includes a keyboard display as part of its integrated
package.

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.

Ideal Applications: Wind profiling, weather stations, ETo/agriculture, air


quality, soil moisture, water level/stage, aquaculture, vehicle testing, Time
Domain Reflectometry, SCADA, water quality.

2.1.1.3 CR1000 Measurement and Control System

Design Features: The CR1000 consists of a measurement and control module


and a detachable wiring panel. It uses an external power supply, usually the
BPALK or PS100, and a portable keyboard display, the CR1000KD. Besides
providing all of the design features for the CR800-series dataloggers, the
CR1000 has more channels and includes a 40-pin parallel peripheral port. The
peripheral port interfaces with the NL115 Ethernet Interface & CompactFlash
Module, the NL120 Ethernet Interface, or the CFM100 CompactFlash®
Module.

Limitations: The CR1000 has fewer channels than the CR3000 and does not
have programmable switched current outputs or removable terminal strips.

Ideal Applications: Fire weather, Mesonet systems, wind profiling, weather


stations, air quality, ETo/agriculture, soil moisture, water level/stage,

2-5
Section 2. DAQ Components

aquaculture, avalanche forecasting, Time Domain Reflectometry, vehicle


testing, SCADA, water quality.

Design Features: The CR1000 consists of a measurement and control module


and a detachable wiring panel. It uses an external power supply, usually the
BPALK or PS100, and a portable keyboard display, the CR1000KD. Besides
providing all of the design features for the CR800-series dataloggers, the
CR1000 has more channels and includes a 40-pin parallel peripheral port. The
peripheral port interfaces with the NL115 Ethernet Interface & CompactFlash
Module, the NL120 Ethernet Interface, or the CFM100 CompactFlash®
Module.

Limitations: The CR1000 has fewer channels than the CR3000 and does not
have programmable switched current outputs or removable terminal strips.

Ideal Applications: Fire weather, Mesonet systems, wind profiling, weather


stations, air quality, ETo/agriculture, soil moisture, water level/stage,
aquaculture, avalanche forecasting, Time Domain Reflectometry, vehicle
testing, SCADA, water quality.

2-6
Section 2. DAQ Components

2-7
Section 2. DAQ Components

2.1.1.4 CR3000 Measurement and Control System

Design Features: The CR3000 consists of a compact, integrated package with


a built-in power supply, a 128 x 64 pixel backlit graphical or eight-line numeric
display, and a 16-character keyboard. The CR3000 provides all of the
CR1000's design features, as well as more channels, programmable switched
current outputs, and removable terminal strips.

Base Options: Sealed chargeable battery, alkaline batteries, or low-profile (no-


battery) base.

Limitations: The CR3000 has fewer channels and a slower sampling rate than
the CR5000.

Ideal Applications: Eddy covariance, wind profiling, HVAC, weather stations,


vehicle testing, air quality, process control, Mesonet systems, agriculture, soil
moisture, Time Domain Reflectometry, water quality.

2-8
Section 2. DAQ Components

2-9
Section 2. DAQ Components

2.1.1.5 CR5000 Measurement and Control System

Design Features: The CR5000 consists of a compact, integrated package with


a built-in power supply, a 128 x 64 pixel backlit graphical or eight-line numeric
display, and a 16-character keyboard. The CR5000 has a sampling rate of up to
5000 Hz, an onboard PC-card slot for expanding its storage capacity, and
programmable switched current outputs.

Base Options: Sealed rechargeable battery or low profile (no-battery) base.

Limitations: The CR5000 does not support PakBus communications. The


CR5000 has fewer channels and a slower sampling rate than the CR9000.

Ideal applications: Eddy covariance, Bowen ratio, weather stations, vehicle


testing, HVAC, process monitoring and control, structural or fatigue analysis,
machinery testing, energy management and conservation.

2-10
Section 2. DAQ Components

2-11
Section 2. DAQ Components

2.1.1.6 CR9000X Measurement and Control System

Design Features: The CR9000X is a large modular datalogger that consists of


a base system and slots for user-specified I/O modules. The CR9000X supports
a measurement rate of up to 100,000 Hz, provides 180 MHz clock speed, has
an onboard PC-card slot for expanding its storage capacity, and includes an
onboard 10baseT/100baseT port. Also, the CR9000X can provide anti-aliasing
and real-time FFT capabilities by using a CR9052IEPE or CR9052DC module.

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.

Limitations: The CR9000 does not support PakBus communications or


vibrating wire measurements.

Ideal Applications: Vehicle testing, structural or seismic monitoring, or other


applications that require rapid sampling or a large number of high resolution
channels.

2-12
Section 2. DAQ Components

2-13
Section 2. DAQ Components

2.1.2 Datalogger Measurement Support Comparison


The table below compares measurement support among the different dataloggers. Diff = differential
measurements; SE = single-ended measurements; TIM = terminal input module; MUX = multiplexer.

Array-based, Edlog Dataloggers CRBasic/PakBus Dataloggers CRBasic/Non PakBus Dataloggers

TABLE 2.1-2. Comparison of Measurement Support Among the Different Dataloggers

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

± 5 V DC CR800/CR850 3 diff, 6 SE, 100 Hz None AM16/32B, AM25T


Analog Input CR1000 8 Diff, 16 SE, 100 Hz None AM16/32B, AM25T
14 Diff, 28 SE,
CR3000 None AM16/32B, AM25T
100 Hz
20 Diff, 40 SE,
CR5000 None AM16/32B, AM25T
2000 Hz
To 126 Diff, 252 SE, CR9050(E), CR9051E,
CR9000X AM25T
50 kHz CR9052DC
(± 25 V Supported
CR510 None None Supported
w/ VDIV10:1)
(± 25 V Supported w/ (± 25 V Supported w/
CR10X AM16/32B for 25 Volt
VDIV10:1) VDIV10:1)
12 Diff, 24 SE,
CR23X VDIV10:1 TIM AM16/32B
100 Hz
CR200X Not Supported Not Applicable None Supported
± 50 V DC
CR800/CR850 3 diff, 6 SE, 100 Hz VDIV10:1 TIM AM16/32B
Analog Input
CR1000 8 Diff, 16 SE, 100 Hz VDIV10:1 TIM AM16/32B
14 Diff, 28 SE,
CR3000 VDIV10:1 TIM AM16/32B
100 Hz
20 Diff, 40 SE,
CR5000 VDIV10:1 TIM AM16/32B
2000 Hz
To 126 Diff, 252 SE, CR9055(E) or
CR9000X Not Applicable
50 kHz VDIV10:1 TIM

2-14
Section 2. DAQ Components

CR510 Not Supported Not Applicable None Supported

CR10X Requires Expansion Requires Expansion SDM-CAN


Peripheral Peripheral
Requires Expansion Requires Expansion
CR23X SDM-CAN
Peripheral Peripheral
CR200X Not Supported Not Applicable None Supported
Requires Expansion Requires Expansion
CANBus CR800/CR850 SDM-CAN
Peripheral Peripheral
Interface
Requires Expansion Requires Expansion
CR1000 SDM-CAN
Peripheral Peripheral
Requires Expansion Requires Expansion
SDM-CAN
CR3000 Peripheral Peripheral
Requires Expansion Requires Expansion
CR5000 SDM-CAN
Peripheral Peripheral
Requires Expansion Requires Expansion
CR9000X SDM-CAN
Peripheral Peripheral
CR510 Not Supported Not Applicable None Supported
Requires Expansion Requires Expansion
CR10X SDM-AO4 or SDM-CVO4
Peripheral Peripheral
CR23X 2 CAO Channels None SDM-AO4 or SDM-CVO4
CR200X Not Supported Not Applicable None Supported
Continuous Requires Expansion Requires Expansion
Analog CR800/CR850 SDM-AO4 or SDM-CVO4
Peripheral Peripheral
Output Requires Expansion Requires Expansion
CR1000 SDM-AO4 or SDM-CVO4
Peripheral Peripheral
CR3000 2 CAO Channels None SDM-AO4 or SDM-CVO4
CR5000 2 CAO Channels None SDM-AO4 or SDM-CVO4
6 CAO Channels
CR9000X CR9060 SDM-AO4 or SDM-CVO4
per CR9060
CR510 1 I/O Port None None Supported
CR10X 8 I/O Ports Standard None SDM-CD16D
CR23X 8 I/O Ports Standard None SDM-CD16D
CR200X 2 I/O Ports None None Supported
CR800/CR850 4 I/O Ports Standard None SDM-CD16D
Control
Ports CR1000 8 I/O Ports Standard None SDM-CD16D
CR3000 8 I/O Ports Standard None SDM-CD16D
CR5000 8 I/O Ports Standard None SDM-CD16D
CR9071E:16 I/O,
CR9071E or CR9060
CR9000X CR9060: 8 Output SDM-CD16D
Module
Only
CR510 2 Standard CURS100 None Supported
CR10X 6 Standard CURS100 AM416, AM16/32B
CR23X 12 Standard CURS100 AM416, AM16/32B
CR200X Not Supported Not Applicable None Supported
Current
CR800/CR850 4 Standard CURS100 AM416, AM16/32B
Measurements
CR1000 8 Standard CURS100 AM416, AM16/32B
CR3000 14 Standard CURS100 AM416, AM16/32B
CR5000 20 Standard CURS100 AM416, AM16/32B
CR9000X 14 per CR9051E CURS100 and CR9050 Not Applicable

2-15
Section 2. DAQ Components

CR510 Not Supported Not Applicable None Supported


Requires Expansion Requires Expansion
CR10X SDM-CVO4
Peripheral Peripheral
Requires Expansion Requires Expansion
CR23X SDM-CVO4
Peripheral Peripheral
CR200X Not Supported Not Applicable None Supported

Regulated Current Requires Expansion Requires Expansion


CR800/CR850 SDM-CVO4
Output Peripheral Peripheral
Requires Expansion Requires Expansion
CR1000 SDM-CVO4
Peripheral Peripheral
3 Switched Current
CR3000 None SDM-CVO4
Excitation Channels
4 Switched Current
CR5000 None SDM-CVO4
Excitation Channels
CR9000X 6 per CR9052DC CR9052DC SDM-CVO4
CR510 Not Supported Not Applicable None Supported
Requires Expansion Requires Expansion
CR10X SDM-INT8
Peripheral Peripheral
Requires Expansion Requires Expansion
CR23X SDM-INT8
Peripheral Peripheral
Interval CR200X Not Supported Not Applicable None Supported
Timing
CR800/CR850 Up to 4 Standard None SDM-INT8
CR1000 Up to 8 Standard None SDM-INT8
CR3000 Up to 8 Standard None SDM-INT8
CR5000 Up to 6 Standard None SDM-INT8
CR9000X To 16 per CR9071E CR9071E Module SDM-INT8
CR510 1 I/O Port None None Supported
8 I/O Ports
CR10X None SDM-IO16
Standard
8 I/O Ports
CR23X None SDM-IO16
Standard
CR200X 2 I/O Ports None None Supported

I/O 4 I/O Ports


CR800/CR850 None SDM-IO16
Ports Standard
8 I/O Ports
CR1000 None SDM-IO16
Standard
8 I/O Ports
CR3000 None SDM-IO16
Standard
8 I/O Ports
CR5000 None SDM-IO16
Standard
CR9000X 16 I/O Ports/CR9071 CR9071 Module SDM-IO16
CR510 Not recommended Not Applicable None Available
CR10X Not recommended Not Applicable None Available
Up to 12 DC-DC
CR23X None AM16/32B
Type LVDT
CR200X Not recommended Not Applicable None Available
Up to 3 DC-DC Type
CR800/CR850 None AM16/32B
LVDT
LVDTs
Up to 8 DC-DC Type
CR1000 None AM16/32B
LVDT
Up to 14 DC-DC
CR3000 None AM16/32B
Type LVDT
Up to 20 DC-DC
CR5000 None AM16/32B
Type LVDT
up to 14 per CR9050 CR9050 or CR9051E &
CR9000X None Available
(51E) CR9060

2-16
Section 2. DAQ Components

Not Supported (due


CR510 Not Applicable None Available
to speed)
CR10X “ “ Not Applicable None Available
CR23X “ “ Not Applicable None Available
Not Supported (due
CR200X Not Applicable None Available
Piezoelectric to speed)
Accelerometer CR800/CR850 “ “ Not Applicable None Available
CR1000 “ “ Not Applicable None Available
CR3000 “ “ Not Applicable None Available
Requires 3rd party
CR5000 up to 20 @ 200 Hz None Available
signal conditioner
CR9000X 6 per CR9052IEPE CR9052IEPE None Available
CR510 Not recommended Not Applicable None Available
CR10X Not recommended Not Applicable None Available
CR23X Not recommended Not Applicable None Available
CR200X Not recommended Not Applicable None Available
CR800/CR850 Not recommended Not Applicable None Available
Piezoresistive Up to 8 channels @
CR1000 None None Available
Accelerometer 50 Hz
Up to 14 channels
CR3000 None None Available
@ 100 Hz
Up to 20 Channels
CR5000 None None Available
@ 200 Hz
14 Channels per
CR9000X 6 per CR9052DC None Available
CR9051E and CR9060
CR510 2 Standard 3WHB10K TIM None Available
CR10X 6 Standard 3WHB10K TIM AM416, AM16/32/B
CR23X 12 Standard 3WHB10K TIM AM416, AM16/32/B
Supports Five SE
CR200X 1/2 Bridge None None Available
Measurements
PRT
CR800/CR850 3 Standard 3WHB10K TIM AM416, AM16/32/B
3 Wire
CR1000 8 Standard 3WHB10K TIM AM416, AM16/32/B
CR3000 14 Standard 3WHB10K TIM AM416, AM16/32/B
CR5000 20 Standard 3WHB10K TIM AM416, AM16/32/B
3WHB10K TIM,
CR9000X 14 per CR9051E CR9050(E), CR9051E, N/A
CR9060
4WPB100 or 4WPB1K
CR510 1 Standard None Available
TIM
4WPB100 or 4WPB1K
CR10X 3 Standard AM416, AM16/32/B
TIM
4WPB100 or 4WPB1K
CR23X 6 Standard AM416, AM16/32/B
TIM
PRT CR200X Not Supported Not Applicable None Available
4 Wire
CR800/CR850 1 Standard 4WPB100 or 4WPB1K AM416, AM16/32/B
Half Bridge
CR1000 4 Standard 4WPB100 or 4WPB1K AM416, AM16/32/B
CR3000 7 Standard 4WPB100 or 4WPB1K AM416, AM16/32/B
4WPB100 or 4WPB1K
CR5000 10 Standard AM416, AM16/32/B
TIM
4WPB100 or 4WPB1K,
CR9000X 14 per CR9051E N/A
CR9051E and CR9060

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

Strain or 4WFB120, 4WFB350 if


CR800/CR850 3 standard AM16/32B
Full Bridge completion required
Measurements 4WFB120, 4WFB350 if
CR1000 8 Standard AM16/32B
completion required
4WFB120, 4WFB350 if
CR3000 14 standard AM16/32B
completion required
4WFB120, 4WFB350 if
CR5000 20 Standard AM16/32B
completion required
4WFB120,
CR9000X 14 per CR9051E 4WFB350,CR9050, None Applicable
CR9060
CR510 3 Standard None Required None Available
CR10X 5 Standard None Required SDM-SW8A
CR23X 8 Standard None Required SDM-SW8A
CR200X 4 Standard None Required None Available
Switch
CR800/CR850 6 standard None Required SDM-SW8A
Closure
CR3000 12 standard None Required SDM-SW8A
CR1000 10 Standard None Required SDM-SW8A
CR5000 8 Standard None Required SDM-SW8A
CR9000X 4 per CR9071E CR9071E SDM-SW8A
CR510 Not Supported Not Applicable None Available
CR10X 5 Diff, 11 SE CR10XTCR AM25T
CR23X 12 Diff, 24 SE None Required AM25T
Thermocouple CR200X Not Supported Not Applicable None Available
Types
B, E, J, K CR800/CR850 3 diff, 6 SE None Required AM25T
N, R, S, T CR1000 8 Diff, 16 SE None Required AM25T
Supported CR3000 14 Diff, 28 SE None Required AM25T
CR5000 20 Diff, 40 SE None Required AM25T
14 Diff, 28 SE per
CR9000X CR9051E AM25T (Req. CR9060)
CR9051E
CR510 Not Supported Not Applicable None Available
CR10X Requires Peripheral AVW200 AM16/32B
CR23X Requires Peripheral AVW200 AM16/32B
CR200X Not supported Not Applicable None Available
Vibrating
CR800/CR850 Requires Peripheral AVW200 AM16/32B
Wire
CR1000 Requires Peripheral AVW200 AM16/32B
CR3000 Requires Peripheral AM16/32B
CR5000 Requires Peripheral AVW200 AM16/32B
CR9000X 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.

2.1.3.1 Specification Terminology


ACCURACY

Accuracy is the ability of a measurement to provide a result that is as close as


possible to the actual value.

Accuracy = 0.1 g

100 g 100.1 g

RESOLUTION

Resolution is the smallest increment of a measurement.

Higher Resolution
100 g 101 g 100 g 106.2

PRECISION

Precision or Repeatability is the amount of agreement between repeated


measurements of the same quantity.

More Precise More Accurate


99.8
22 times

99.9
18 times

100.0
12 times

105.2 100.1
70 times 19 times

100 g 105.3 100 g 100.2


30 times 21 times

2-20
Section 2. DAQ Components

HYSTERESIS

Hysteresis is a property of systems whose states depend on their immediate


history. Output values depend on whether one is going upscale or downscale in
a sequential test.

A system may be explicitly designed to exhibit hysteresis, especially in control


theory. For example, consider a thermostat that controls a furnace. The furnace
is either off or on, with nothing in between. The thermostat is a system; the
input is the temperature, and the output is the furnace state. If one wishes to
maintain a temperature of 20 °C, then one might set the thermostat to turn the
furnace on when the temperature drops below 18 °C, and turn it off when the
temperature exceeds 22 °C. This thermostat has hysteresis. If the temperature is
21 °C, then it is not possible to predict whether the furnace is on or off without
knowing the history of the temperature.

Source: http://en.wikipedia.org/wiki/Hysteresis

LINEARITY

Linearity is the quality of delivering identical sensitivity throughout the


measurement

Linearity
0g

50 g 50 g

50 g
100 g
50 g 100 g

2-21
Section 2. DAQ Components

2.1.3.2 CR1000 Specifications


It is important to know the specifications and limitations of the sensors and
datalogger making measurements.

Detailed CR1000 specifications are provided in the datalogger manual.


Consult the sensor manufacturer for sensor specifications.

Temperature Ranges

Standard: -25° to +50° C


Extended: -55° to +85° C

Communications Rates

300 bps to 115.2 kbps

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

Range ± 5.0 VDC

Sustained Input Voltage without Damaging the CR1000

± 16 VDC maximum

Analog Outputs (Excitation)

Three individually switched voltages, only active during measurement.


Range - programmable between ±2.5 VDC
Maximum current = 25 mA
(Only relevant if using non-CSI sensors or multiple sensors excited by same
channel.)

Remember, all sensors connected to the same excitation channel receive the
same amount and type—DC or AC—of excitation voltage.

Measurement Ranges and Resolution

Input Range (mV) Basic Resolution (uV)


± 5000 1333
± 2500 667
± 250 66.7
± 25 6.7
± 7.5 2.0
± 2.5 0.67

2-22
Section 2. DAQ Components

Accuracy

The accuracy of a measurement ranges from approximately ± 0.06% to ±


0.18% of the reading + offset, depending on the temperature.

0° to 40° C ± 0.06% of reading + offset


-25° to 0° and 40° to 50° C ± 0.12% of reading + offset
-55° to -25° and 50° to 85° C ± 018% of reading + offset

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

Switch Closure 11 ms minimum


6mS open 5mS closed
High Frequency max 250 kHz
Low Level AC
Low Level AC
RMS (mV)Range (Hz)
20 1 to 20
200 0.5 to 200
2000 0.3 to 10,000
5000 0.3 to 20,000

Digital I/O (Control) Ports


High Frequency Max 400 kHz
Switch Closure Frequency Max 150 Hz
Input State (for monitoring device status, i.e. on or off)
High 3.8 to 16.0 VDC
Low -8.0 to 1.2 VDC
Output Voltage (to turn a device on or off)
High 5.0 ± 0.1 VDC
Low < 0.1 VDC
Max Output Current
2.0 mA at 3.5 V

Other function capability on all 8 Control Ports: asynchronous


communications, subroutine interrupts, edge timing. SDI-12 communications
are limited to C1, C3, C5, and C7. Up to 10 SDI sensors are supported per
port. SDM communications are limited to C1-C3.

Switched 12V Maximum Current Sourcing

SW12V < 900 mA depending on temperature


12V + SW12V < 3.00 A depending on temperature

See CR1000 manual page 38 (table 3) for details

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.2 CR1000 Memory


There are a total of 4 Mbytes of Static Random Access Memory (SRAM) in the
standard CR1000. Approximately 3.7 M of memory are available for data table
storage. The remaining memory is used for user programs and
communications. Additional data table storage is available by using an
optional Compact Flash card and module or an SC115 CS/IO Flash Memory
USB Drive. SRAM is battery backed, so data and programs remain in memory
when the CR1000 is powered down.

2.2.1 Storage Media


CR1000 memory consists of five non-volatile storage media:

1. Battery Backed SRAM

2. Flash Memory

3. Serial Flash Memory

4. CompactFlash® Card Memory (optional)

5. Flash Memory Drive with USB interface (optional)

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

TABLE 2.2-1. CR1000 Memory Allocation

Memory Size Comments

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

Device A backup of device settings, such as PakBus Address, Station Name,


Settings Beacon Intervals, Neighbor lists, etc. Rebuilt when a setting changes.
12 Kbyte
CPU: drive Holds program files, field calibration files, and other files not over
500 Kbytes written frequently. Slower than SRAM. When a program is compiled
and run, it is copied here automatically for loading on subsequent
power-ups. Files accumulate until deleted with File Control or the
FilesManage () instruction. Use USR: drive to store other file types.
Available CPU: memory is reported in Status Table field
"CPUDriveFree."

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.

The CR1000 Operating System is stored on a separate Flash EEPROM.

2-26
Section 2. DAQ Components

2.2.2 Data Storage


The CR1000 can be programmed to store each measurement or, more
commonly, to store processed values such as averages, maxima, minima,
histograms, FFTs, etc. Data are stored periodically or conditionally in data
tables as directed by the CRBASIC program. The DataTable () instruction
allows the user to set the size of the data table. Five areas are partitioned in the
storage media for data storage: Data table SRAM, CPU: drive, USR: drive,
CRD: drive and USB: drive. The number and size of data tables is defined by
the individual CR1000 program. The number of records (or rows) is defined
for each Data Table. The number of values (or columns) in the Data Table is
determined by the output processing instructions for that table (e.g, sample,
average, maximum, minimum, etc.). Numerous data tables can be used to store
data at different intervals. For example, Table 1 might be used to store data
every five minutes, Table 2 might be used to store daily data, and Table 3
might be used to store hourly averages etc. (Figure 2.2-1). Data are usually
erased from storage when a new program is sent to the CR1000. However,
options are available in LoggerNet, PC400, RTDAQ, or PC200W via File
Control and the CRBASIC Editor to preserve data when downloading
programs.

3.7 M

Table 1
Five Minute Data

Event Driven Data


Table 4

Table 5
One Minute Data

Table 2
Daily Data

Table 3
Hourly Minute Data Table 6
Cooperator Data

FIGURE 2.2-1. Example of SRAM partitioning for different data tables.

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.2.2.1 CPU: Drive


CPU: is the default drive to which programs and calibration files are stored. Do
not store data on the CPU:.

2-27
Section 2. DAQ Components

2.2.2.2 USR: Drive


SRAM can be partitioned to create a FAT32 USR: drive, analogous to
partitioning a second drive on a PC hard disk. Certain types of files are stored
to USR: to reserve limited CPU: memory for datalogger programs and
calibration files. Partitioning also helps prevent interference from data table
SRAM. USR: is configured using DevConfig settings or the SetStatus ()
instruction in a CRBASIC program. Partition the USR: drive to at least 8192
bytes in 512 byte increments. If the value entered is not a multiple of 512
bytes, the size is rounded up. The maximum size of the USR: is the total RAM
size less 400 Kbytes; i.e., for a CR1000 with 4 Megabyte memory, the
maximum size of the USR: is about 3.6 Megabytes.

2.2.2.3 CRD: Drive


The CRD: drive uses CompactFlash® memory exclusively. Its primary purpose
is the storage of binary data files.

CAUTION When installing or removing card storage modules, first


turn off CR1000 power. Removing a card from the module
while the CF card is active can cause data corruption and
may damage the card. Always press the removal button to
disable the card and wait for the green LED before
removing the card or switching off power prior to removal
of the card. To prevent losing data, collect data from the
CF card before sending a program to the datalogger.
When a program is sent to the datalogger all data on the
CF card may be erased.

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.

NOTE CardConvert software, included with LoggerNet / PC400 /


RTDAQ / PC200W support software, converts binary card data
to the standard Campbell Scientific data format.

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.

The CR1000 accepts cards formatted as FAT or FAT32; however, FAT32 is


recommended. Otherwise, some functionality, such as the ability to manage
large numbers of files (>254) is lost. Older CR1000 operating systems
formatted cards as FAT or FAT32. Newer operating systems always format
cards as FAT32.

2-28
Section 2. DAQ Components

2.2.2.4 USB: Drive


The USB: drive is the SC115 USB Thumb Drive. The SC115 is an innovative
instrument, typically serving as a 2-Gigabyte storage device with the ability to
interface directly with a Campbell Scientific datalogger. It also serves as a
USB to CS I/O synchronous device communications (SDC) adapter.

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.

2.2.3 Default Tables


There are two default tables in the CR1000, the Public Table and the Status
Table. These two tables contain only one record each. The Status Table
contains current system operating status information. It is only updated when
it is queried or written to. The Public Table contains the most current values
for each Public Variable. It is updated every program scan.

Intermediate memory is used by the datalogger as a “scratch pad” to keep track


of temporary calculations for measurements and eventual output to final
storage in Data Tables. For example, when an average is to be stored in an
hourly Data Table, the running total and numbers of counts of one-second
measurements are stored in intermediate memory.

Thermocouple Measurement Example


Using Variables, Intermediate and Final Storage
1H
Sensor measured on differential input channel #1
1L

Variable:
Measurement result is placed into a variable named
TC_Temp.
TC_Temp = 23.01

2-29
Section 2. DAQ Components

Total = 46.04 Value in variable is processed (averaged) in


intermediate storage. This is temporary storage used
Number of Scans = 2 for calculations.

Table1 Processed Value is Stored in a Final Storage Data Table


called Table1 (Intermediate Storage is Zeroed for Next
TC_temp_Avg = 23.02 Output Interval)

2.2.4 Memory Conservation


One or more of the following memory saving techniques can be used on the
rare occasions when a program reaches memory limits:

• Declare variables as DIM instead of Public. DIM variables do not require


buffer memory for data retrieval.

• 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.

• Confine string concatenation to DIM variables.

• Dimension string variables only to the size required.

2.2.5 Memory Reset


Four features are available for complete or selective reset of CR1000 memory.

2.2.5.1 Full Memory Reset


Full memory reset occurs when an operating system is sent to the CR1000
using DevConfig or when entering "98765" in the status table field
"FullMemReset." A full memory reset does the following:

• Clears and Formats CPU: drive (all program files erased)

• Clears SRAM data tables

• Clears Status Table Elements

• Restores settings to default

• Initializes system variables

• Clears communications memory

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.2.5.2 Program Send Reset


All SRAM and CRD: data are erased when user programs are uploaded, unless
preserve / erase data options are used. Preserve / erase data options are
presented when sending programs from LoggerNet, PC400, RTDAQ, or
PC200W File Control and CRBASIC Editor Compile / Save / Send.

2.2.5.3 Manual Data Table Reset


Data table memory is selectively reset from

• LoggerNet or PC400 or RTDAQ or PC200W | Datalogger | Station Status

• Keyboard Display | Data | Reset Data Tables

2-31
Section 2. DAQ Components

2.3 Power System Design


2.3.1 Overview/Comparison
All dataloggers require a good power source in order to make accurate,
continuous measurements. It is important to design your power supply such
that it is stable all year long.

Campbell Scientific has an Application Note about power supply design. It


can be found here (also included as Appendix B)

http://www.campbellsci.com/documents/technical-papers/pow-sup.pdf

2.3.2 Components for Power System


Each system requires one or more of these components to effectively ensure
that sufficient power is provided for your data acquisition system.

FIGURE 2.3-1. The Interaction of a power system’s components

2.3.2.1 Charging Source


The system designer must ensure that, on an average daily basis, the charge
going into your battery is sufficient to supply the average daily power required.
If using solar panels for your system, then you should make sure that the solar
panel’s total power output is greater than the system’s power requirements. The
following formula can be used to calculate the minimum panel size:

Solar Panel current > ((system Ahr/day) * 1.2) / (hours of peak sun)

Solar Panels offered by CSI:


SP5-L 5 watts
SP10 10 watts
SP20 20 watts
SP70-L 70 watts

In addition, two SP70-L can be wired in parallel to a Morning Star regulator to


supply 140 watts.

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.

TABLE 2.3–1. Regulators offered by Campbell Scientific

Regulator Max Solar Panel Battery Size


PS100 SP20 Internal 7 A-Hr
CH100 SP20 BP12, BP24, BP84
PS200 SP70 Internal 7 A-Hr
CH200 SP70 BP12, BP24, BP84
Morning Star 2 * SP70 BP84
DCDC18R Vehicle Internal 7 A-Hr

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.3.2.3.2 Rechargeable Batteries


When using a rechargeable battery, the system designer must size the battery
such that, based on your average daily draw, there will still be reserve
sufficient to sustain your system during times of stress such as during long
storms in winter. The following formula can be used to calculate the requisite
battery size:

Capacity = (average load) * (reserve time) / (0.8)

Batteries offered by CSI:


CR3000/CR5000 Battery Base 7 Ah internal
PS100/PS200 7 Ah internal
BP12 12 Ah
BP24 24 Ah
BP84 84 Ah

2.3.2.4 Determining System Loads


Many factors affect the average daily power load of the remote measurement
stations. These factors can include: which sensors are selected, peripheral
equipment, multiplexers, communication devices, programming scan
frequency, etc. It is important that the system designer consider all of these

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.

Campbell Scientific has created an Excel spreadsheet to help the system


integrator in configuring the requisite power system for a given application. It
is called the Power Budget Spreadsheet. A depiction of the spreadsheet is
shown in Figure 2.3-2.

#1 #2 #3 #4 #5 #6

FIGURE 2.3–2. Power Budget Spreadsheet with Steps to Use

The suggested process to use this spreadsheet is outlined below in a step by


step procedure. Refer to Figure 2.3 -2 where each step is high-lighted.

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.

2.3.3 Conclusion / Summary


It is important to know your power requirements when gathering data remotely
with any data acquisition system. Campbell Scientific provides tools as a
resource for planning purposes and encourages the user to use them to size
solar panels, to determine how often to change batteries, and to make sure the
datalogger will always make a quality measurement. Once the total power
load has been determine, it is imperative to add a contingency factor of at least
10% to the total. This contingency is for unforeseen circumstances, such as
solar panels or batteries operating below expectations, or some component
using more power than was foreseen. If you have any suggestions or see any
problems please send an email to:

bmaxwell@campbellsci.com or info@campbellsci.com

2-35
Section 2. DAQ Components

2.4 Software for Personal or Hosted Computers


Campbell Scientific offers a number of software packages designed for
computers which interface with Campbell Scientific dataloggers and
peripherals. This section provides a brief overview of the most commonly-used
packages, programs, and utilities which are available.

2.4.1 Four Main Software Packages


Campbell Scientific offers four main software packages to assist datalogger
users with their most common tasks :

• LoggerNet

• RTDAQ

• PC400

• PC200W

These packages enable a personal or hosted computer to be used to


communicate with and configure multiple dataloggers and peripherals.

2.4.1.1 Unattended Nature of Datalogger Operation


Campbell Scientific dataloggers are designed to operate in an unattended mode
for most deployments. The use of feature-rich firmware, self-contained
measurement circuitry, the ability to run sophisticated, user-customized
programs, and on-board memory capacity all combine to allow for the "stand-
alone" operational nature of these devices. A datalogger can function properly
at a remote location without the need for a local computer or a constant
connection back to a central location.

2.4.1.2 Periodic Communication With a Central Location


It is necessary, however, to communicate with a datalogger on a regular basis
to collect its stored data or perform necessary maintenance and
troubleshooting. It is important to connect to the datalogger frequently enough
to avoid the data loss that can be caused by the datalogger's memory filling up
or its changing into a data overwrite mode. Most commonly, a computer in a
centralized location is used to perform these communications.

Campbell Scientific provides multiple software packages to allow a personal


computer or server computer to contact dataloggers deployed in the field so
that data can be collected and other maintenance tasks performed. Software is
also provided to facilitate the tasks related to the organization and post-
processing of collected data. Most of Campbell Scientific's software packages
are designed to run on the Microsoft Windows™ Platform.

NOTE Although most software packages are designed to run on the


Windows platform, there are a few exceptions including the
Java™ SDK and LoggerNet for Linux.

2-36
Section 2. DAQ Components

2.4.1.3 Multiple Utilities and Programs Within Each Product


Each of the four main software packages contains multiple utilities and
programs for performing a variety of datalogger related tasks. Some utilities
are included in more than one of the main packages. Additional utilities and
products are sold as "Add-ons" for one of the main packages. "Add-ons" are
sold and installed separately. They require that the main package be installed
before they can operate properly. The pricing information shown here
corresponds to the functionality level of each of the main packages.

2.4.2 Categorizing Utilities and Programs by Operational Phase


Since there are a number of utilities and function-specific programs that are
used by the various product packages, and these are often shared between
multiple products, we should consider them individually . CSI software utilities
can be categorized in a number of ways, but perhaps the easiest way is to
consider the main tasks performed in the operation of a data acquisition
system.

• Phase 1: A datalogger is procured and tested, as well as configured and


programmed in the lab.

• Phase 2: A datalogger is deployed to the field location, and


communications are established between the datalogger and the
centralized computer location.

• Phase 3: A data collection scheme is designed and executed that


periodically contacts the datalogger and retrieves its important data.

2-37
Section 2. DAQ Components

• Phase 4: A datalogger is monitored via its collected data or other


communications. Control functions, operational adjustments, and
maintenance on the datalogger are performed.

• 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".

NOTE Although a program or utility may be associated with an


operational phase for the organizational and learning purposes of
this chapter, it should be remembered that this categorization is
approximate. Many of these utilities contain functionality that
applies to more than one phase. As each utility is used, a better
understanding of its role in datalogger management will become
clear to the user.

A categorization of the programs and utilities is given here for reference,


followed by a brief description of each item:

2-38
Section 2. DAQ Components

Datalogger Configuration and Programming (Phase 1)

• Device Configuration Utility (DevConfig) [Configuration]

• Station Status [Configuration]

• PakBus Graph [Advanced Configuration]

• Network Planner [Advanced Configuration]

• Short Cut for Windows (SCWIN) [Programming]

• File Control [Programming]

• CRBasic Editor [Advanced Programming]

Datalogger Deployment and Communications (Phase 2)

• EZSetup [Deployment]

• SetupScreen (LoggerNet only) [Deployment]

• ConnectScreen (LoggerNet only) [Deployment]

• RTDAQ/PC400/PC200 Clock/Program Tab [Deployment]

• Troubleshooter [Communications]

• Station Status [Communications]

• PakBus Graph [Advanced Communications]

Datalogger Data Collection (Phase 3)

• Data Collect Tab (RTDAQ, PC400, PC200W)

• Custom Collection (ConnectScreen, LoggerNet)

• Scheduled Collection (SetupScreen, LoggerNet)

• Collect Now (ConnectScreen, LoggerNet)

• LogTool (for troubleshooting data collection)

2-39
Section 2. DAQ Components

Datalogger Monitoring and Control (Phase 4)

• Table Monitor (ConnectScreen/LoggerNet and RTDAQ)

• Numeric Displays (ConnectScreen, LoggerNet)

• Graphical Displays (ConnectScreen, LoggerNet)

• Field Monitor (RTDAQ and PC400)

• Status Monitor (LoggerNet Scheduled Collection)

• RTDAQ Real-time Windows

• RTMC (LoggerNet and RTDAQ)

• RTMC Pro (Add-on product for LoggerNet and RTDAQ)

Organization, Analysis, and Publication of Collected Data (Phase 5)

• Location and Format of .DAT files

• View (PC400, PC200W)

• LoggerNet Database (LNDB) – (Add-on product for LoggerNet)

• View Pro (LoggerNet, RTDAQ)

• RTMC Pro (Add-on product for LoggerNet and RTDAQ)

• RTMC Web Server

2-40
Section 2. DAQ Components

2.4.2.1 Utilities : Datalogger Configuration and Programming (Phase 1)


2.4.2.1.1 DevConfig
The Device Configuration Utility (DevConfig) is used to send the latest
firmware (operating system) to a datalogger or other device. It is also used to
view and set device-specific settings, and access the terminal mode of a device
for diagnostics and troubleshooting. More detail about DevConfig can be found
in section 2.4.4.

2.4.2.1.2 Station Status


The Station Status screen is used to see a brief overview of the datalogger's
current condition, including currently loaded operating system and current
running program. It also allows the table-fill information to be viewed as well
as the full detail of the datalogger's status table to be both viewed and changed.
See section 2.4.2.2.6.

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.4.2.1.4 Network Planner


The Network Planner is a graphical application to assist in the design of
PakBus datalogger networks. Hardware and software stations are placed on a
“drawing canvas.” Then links are specified between stations. Finally, activities
between stations can be set. Then Network Planner can be launched from
LoggerNet's Tools category in order to automatically specify for LoggerNet
many individual device settings.

2-41
Section 2. DAQ Components

2.4.2.1.5 Short Cut for Windows (SCWIN)


The Short Cut program generator creates programs for Campbell Scientific
dataloggers in four easy-to-follow steps. Using a wizard-like interface, you:

1) select the datalogger type and scan interval


2) choose which sensors you wish to measure
3) setup output tables for final storage
4) finish and generate the program

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.4.2.1.6 File Control

CR5000, CR1000, CR3000, CR800 Series, and CR9000(X) dataloggers have a


built in file system much like a computer hard disk. Multiple files can be
persisted on the datalogger's internal storage location or on a compact flash
card, including data files and datalogger programs. Note that unlike older
dataloggers, these dataloggers retain in memory programs that have been sent
to them unless the programs are specifically deleted or the datalogger memory
is completely reset. File Control is used to manage all the files on these newer
dataloggers. The user can browse available programs on the file system and
choose to have one of them started in the datalogger and become the currently
running program.

2-42
Section 2. DAQ Components

2.4.2.1.7 CRBasic Editor

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.4.2.2 Utilities : Datalogger Deployment and Communications (Phase 2)


2.4.2.2.1 EZSetup
EZSetup is a simple, station-oriented wizard that walks the user through the
process of setting up a datalogger station on the network map of the main
application. This enables communication between the software and the
datalogger to occur. The wizard can also be used to modify settings for an
existing datalogger station.

2.4.2.2.2 Setup Screen


The Setup Screen is used to manually configure the datalogger network that
will be monitored using LoggerNet. The datalogger network can consist of one
datalogger connected directly to a computer, or many dataloggers connected by
more sophisticated means of communication such as phone modems, RF
modems, or TCP/IP. Connection information as well as scheduled collection
details (if used) are specified for each datalogger.

2-43
Section 2. DAQ Components

2.4.2.2.3 Connect Screen


Datalogger stations can be maintained using the Connect screen. Programs can
be sent to or retrieved from the datalogger, the datalogger clock can be set, and
data can be collected manually. Tools are also available to view or graph data.

2.4.2.2.4 Clock/Program Tab of RTDAQ, PC400, PC200


When RTDAQ, PC400 or PC200W is opened, the main window is displayed
with the Clock/Program tab active. Your configured datalogger stations will be
represented on the left side of the window. (If no dataloggers are shown, you
will need to configure your station(s) for communication using the EZSetup
Wizard.). The top right portion of the main window shows buttons that, when
pressed, launch various programs and utilities. You can Check and Set the
datalogger clock, view or retrieve the current program running on the
datalogger, and send a new program to the datalogger to be immediately
started for processing on the datalogger.

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.

2.4.2.2.6 Station Status


Information about the datalogger program, the execution of the program,
battery voltage, internal temperature, etc. can be viewed from the Station Status
screen.

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.4.2.2.7 PakBus Graph


PakBus Graph is a utility that graphically depicts the devices and connections
in a PakBus datalogger network. In PakBus graph, the LoggerNet or RTDAQ
server is typically represented by PakBus address 4094 or 4090, and each of
the PakBus dataloggers that have been configured will be shown by name and
address. PakBus Graph shows two types of links to PakBus devices from the
server: static links and dynamic links. Static links are the communication links
to dataloggers that have been set up on the device map, but which have not
been confirmed by communicating with the datalogger(s). You will see these
dataloggers listed in the Network map. Dynamic links are communication links
to dataloggers that have been confirmed. PakBus Graph may also show links to
leaf node dataloggers that have not been set up on the network map, but which
the server has "learned about" by querying the PakBus network.

To change settings for a PakBus device in PakBus Graph, right-click on the


device, and choose “Edit Settings”. The Settings screen for the device will
appear, and changes can be made and applied.

2-47
Section 2. DAQ Components

2.4.2.3 Utilities : Datalogger Data Collection (Phase 3)


2.4.2.3.1 Data Collect tab in RTDAQ, PC400, and PC200W
From the Collect Data tab a user manually initiates a process to collect data
from a datalogger into a data file stored on the local computer. The user can
choose what data to collect and where to store the retrieved data.

2.4.2.3.2 Custom Collection in LoggerNet


Using LoggerNet's custom collection screen, a user manually initiates a process
to collect data from a datalogger into a data file stored on the LoggerNet
computer. The user can choose what data to collect and where to store the
retrieved data. Collections performed with this option operate completely
independently from any Scheduled Collection or Collect Now operations.

2.4.2.3.3 Scheduled Collection in LoggerNet


Scheduled Collection (configured in the Setup Screen of LoggerNet) is used to
configure LoggerNet's automatic data collection behavior. LoggerNet may
contain connection information for many dataloggers, and that information can
be utilized to enable LoggerNet to periodically connect to dataloggers and
collect recent data from them. When scheduled collection is activated and
configured, and LoggerNet remains running, the data collection will proceed in
an unattended mode. Data collection events are triggered based on the system
time (i.e., the time on the computer running LoggerNet). More detail about
Scheduled Collection can be found in section 2.4.4.

2-48
Section 2. DAQ Components

2.4.2.3.4 Collect Now in LoggerNet


Collect Now is a function available in both the Connect Screen and Status
Monitor of LoggerNet. It is activated by the user to immediately initiate a
collection from a datalogger and store the results in the same file and using the
same collection parameters that are used when a scheduled collection data
retrieval event occurs. It is used mainly as a supplementary and immediate-
response mechanism in conjunction with Scheduled Collection.

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.4.2.4 Utilities : Datalogger Monitoring and Control (Phase 4)


2.4.2.4.1 Table Monitor
The Table Monitor in the center of the Connect Screen of LoggerNet can be
used to monitor the values for one entire table of a table data datalogger. To
begin, ensure you are connected to a datalogger, then 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. RTDAQ has a similar 3-table Table
Monitor screen which can be activated from the Monitor Data tab.

2.4.2.4.2 Numeric Displays in LoggerNet


The Numeric Displays in LoggerNet are activated with the “Num Display”
button of the Connect Screen. Three uniquely configured screens are available.
A grid is displayed which shows names and values of data items available on
the currently connected datalogger. Individual data items can be placed in
desired locations on the grid using the “Add” button. Once started, the Numeric
Display will show the latest value known to LoggerNet for the particular data
item. Scheduled collections or Collect Now events will update the values in
this screen.

2-50
Section 2. DAQ Components

2.4.2.4.3 Graphical Displays in LoggerNet

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.4.2.4.4 Field Monitor in RTDAQ and PC400


The Field Monitor can be accessed in PC400 and RTDAQ using the Monitor
Data tab. A grid is displayed which shows names and values of data items
available on the currently connected datalogger. Individual data items can be
placed in desired locations on the grid using the “Add” button. Once started,
the Field Monitor will show the latest value known to the server for the
particular data item. User initiated events must cause data to be updated or
written to a final storage table for value changes to occur in this screen.

2.4.2.4.5 Status Monitor in LoggerNet


The Status Monitor window in LoggerNet provides information on the
communication link and most recent data collection attempts with the
dataloggers in the network. Visual items help to indicate the current collection
status for each datalogger. The Status Monitor is a useful tool for monitoring
the ongoing progress of the scheduled collection automatically performed by
LoggerNet (i.e. the “heartbeat” of LoggerNet)

2-51
Section 2. DAQ Components

2.4.2.4.6 RTDAQ Real-time Windows


RTDAQ has several Real-time data monitoring screens that can be activated
from the Monitor Data tab. These windows include the Table Monitor, the
Graph, the Fast Graph, the XY Plot window, the FFT and Histogram monitor
as well as the Rainflow Histogram monitor. These windows allow for various
graphical representations of data being stored in the datalogger to be presented
in a very responsive mode. Specialized engineering displays can be used to
visually display advanced data structures that are generated by the datalogger,
such as Histograms or FFTs (Fast Fourier Transform frequency information).

2.4.2.4.7 RTMC in LoggerNet and RTDAQ


Both LoggerNet and RTDAQ include the RTMC (Real-time Monitoring and
Control) development and display package. RTMC allows a customized screen
to be created by the user which can monitor values that are being collected
from a datalogger, as well as send control commands to the datalogger which
can modify its operation. Once the customized screen is created in the
development environment, it is executed in the run-time environment. Proper
creation of screens in LoggerNet can allow those screens to be executed on
independent, remote machines. This allows multiple workstation computers to
monitor datalogger state in a consistent manner by using the same screen. See
section 2.4.4

2.4.2.4.8 RTMC Pro for Data Monitoring


Both LoggerNet and RTDAQ work in a tightly integrated fashion with the
RTMC Pro “Add-on” application. Users of LoggerNet or RTDAQ can
purchase this package for an additional cost. After installation, the RTMC Pro
development button shows directly on the LoggerNet or RTDAQ toolbar.
RTMC Pro is an extended development environment for the RTMC platform.
RTMC Pro gives more options to the user as they create data monitoring and
control applications for working with a datalogger. Many additional elements
are provided for visualizing data and executing controls than those that come
with the standard RTMC development package. The legacy functionality of
RTMC Pro will display data to the user as it arrives in the server's data cache.
In addition, extended functionality relating to email and FTP file transfer is
provided.

2-52
Section 2. DAQ Components

2.4.2.5 Utilities : Collected Data Analysis and Publication (Phase 5)


2.4.2.5.1 Location and Format of .DAT files
Both Scheduled Collection and Custom Collection in LoggerNet, as well as the
Collect Data tab in RTDAQ, PC400 and PC200W allow the user to specify
both the output format of a data file (binary, text) as well as the path and name
of the file, indicating where it will be created and updated when applicable. It
is important to know the location of the files that are being updated with data,
especially when using Scheduled Collection.

2.4.2.5.2 View in PC400 and PC200W


The View utility available in PC400 and PC200W allows data stored (i.e.
collected) in a Campbell Scientific data format (.DAT) to be reviewed. The
user can examine data files and display data in a tabular format by record or
array. A graph can be displayed to show an unlimited number of data traces.

2.4.2.5.3 LoggerNet Database (LNDB)


LoggerNet Database (LNDB) moves data from a LoggerNet server into a
single database. This enables data collected from multiple dataloggers to be
stored in an openly accessible database. The two main components of LNDB
are the LNDB Manager and the LNDB Engine. LNDB Manager is used to set
up a database and select the datalogger data tables that will be stored in the
database. It also provides tools to monitor the LNDB Engine and to review the
database data. LNDB Engine runs as a service and sends the selected data from
the LoggerNet data cache to the database. Additionally, LNDB includes
utilities for importing and exporting data. LNDB works with mySQL, MS SQL
Server and MS SQL Server compact databases.

2-53
Section 2. DAQ Components

2.4.2.5.4 View Pro in LoggerNet and RTDAQ


The View Pro utility available in LoggerNet and RTDAQ allows data stored
(i.e. collected) in a Campbell Scientific data format (.DAT) or data stored in a
LoggerNet Database (LNDB) format to be reviewed. The user can examine
data stores and display data in a tabular format record by record. A graph can
be displayed to show data traces. 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 stored data records.

2-54
Section 2. DAQ Components

2.4.2.5.5 RTMC Pro for viewing Historical Data


Both LoggerNet and RTDAQ work in a tightly integrated fashion with the
RTMC Pro “Add-on” application. Users of LoggerNet or RTDAQ can
purchase this package for an additional cost. After installation, the RTMC Pro
development button shows directly on the LoggerNet or RTDAQ toolbar.
RTMC Pro is an extended development environment for the RTMC platform.
RTMC Pro gives more options to the user as they create data monitoring and
control applications for working with a datalogger. Unlike regular RTMC
project, RTMC Pro projects can be configured to use data files (.DAT) from
the local file system, as well as a database that was created and is being
updated by the LoggerNet Database (LNDB) product. This enables the
customizable environment of RTMC Pro to provide a extensible way for
viewing historical (i.e. collected) data.

2.4.2.5.6 RTMC Web Server


RTMC Web Server is an add-on product for LoggerNet that allows RTMC or
RTMC Pro projects to be published from a computer outward as web pages.
These pages are suitable for viewing inside a browser program on a remote
computer. By implementing the RTMC web server, large numbers of users can
view data in the visual form that was defined in the RTMC project. No control
functions can be activated from a web page provided via the RTMC Web
Server. A customized web server runs on the computer on which RTMC Web
Server is installed. It periodically takes snapshots of the current state of an
RTMC project's run-time representation and provides them to browser clients
which have requested a copy of a particular RTMC screen using the HTTP
protocol.

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 Product Selection


With some initial knowledge of the various programs and utilities found in
Campbell Scientific's product offerings, you are better suited to select the
product that will meet your specific needs.

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 :

• EZSetup Wizard for establishing communications with the datalogger

• Short Cut (SCWIN) Program Generator for creating a program to be


loaded and executed in the datalogger

• Device Configuration Utility for updating firmware and configuring


datalogger settings

• Basic Datalogger Logger Control Functionality : Check/Set Clock, View


Station Status, File Control (for newer dataloggers), Send Program,
Retrieve Program

• Manual Data Collection

• Numeric Real-time Data Display

• View Data File (.DAT) Viewer

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”).

• Single-Hop TCP/IP, Modem, and Radio based Datalogger Connections

• EdLog Editor for creating and editing programs for legacy Campbell
Scientific Dataloggers

• LogTool used for troubleshooting datalogger connectivity and data


collection

• PakBus Graph for viewing basic PakBus networks and configuring


PakBus devices

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)

• Specialized Engineering displays including a Histogram viewer, Fast


Fourier Transform (FFT) viewer, Rainflow Histogram viewer, and XY
Plot display

• CAN (Controller Area Network) tool support for vehicle monitoring or


testing – support for CSI's SDM-CAN device, as well as helper modules

• Legacy CR5000 and CR9000X Program Generation

• View Pro data file viewer

• Calibration Wizard (used with FieldCal datalogger programs)

• RTMC Regular and Runtime included

• RTMC Pro and RTMC Web Server integration (Add-on support)

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:

• Scheduled (Automatic) Data Collection

• Complex Datalogger Connection Paths (Multi-hop, Phone to RF, etc.)

• Setup Screen for fine-grained control of the datalogger network map

• Network Planner

• LNDB (LoggerNet Database) integration (Add-on support)

• Troubleshooter

• Support for Multiple (complex) PakBus Networks

• Remote Access Options (including the LN Admin and LN Remote


versions – see section 2.4.5

2-59
Section 2. DAQ Components

2.4.3.5 Product Comparison Chart


The following chart should be helpful as you select which package is right for
your particular needs. LoggerNet, RTDAQ, PC400 and PC200W are compared
here on a feature by feature basis.

►► 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

2.4.4 Key Software Components


Next we consider some of the most commonly used and more useful software
programs and utilities in greater detail.

2.4.4.1 LoggerNet Toolbar

The toolbar is the centralized launch-pad of the LoggerNet software. This


window provides an easy way to navigate between the applications. As you
hover over a category in the list on the left, applications related to that category
will be shown on the right. Selecting an application in the right-hand list will
launch the application

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

2.4.4.2 Device Configuration Utility (DevConfig)


The Software used to configure a datalogger (usually before an in-field
deployment) is the Device Configuration Utility (DevConfig). Other devices,
such as an RF401 radio-modem, or an AVW200 spectrum analyzer can be
configured with this utility as well.

NOTE Ideally, all configuration and programming of the datalogger


would occur before it is deployed to its permanent in-field site.
However, in real-world scenarios, there are often adjustments
made to both the logger's configuration and its program after it
has been deployed. You should try to get the configuration and
programming of the datalogger as complete as possible before
deploying it to the field. However, most deployment scenarios
are also amenable to configuration and programming after the
logger has been deployed.

DevConfig assists in the set up of Campbell Scientific hardware. DevConfig


allows you to send new operating systems to devices with FLASH memory,
configure various PakBus or other settings in dataloggers, and edit settings for
communications peripherals such as the MD485 and RF401. DevConfig can
also be used to send programs to the datalogger and monitor data. DevConfig is
bundled with PC400, LoggerNet, and RTDAQ and can be downloaded, at no
charge, from our website. DevConfig can also be launched from the
LoggerNet toolbar using the Utilities category.

►► Use the Device Configuration Utility to view the settings in the CR1000.

• Launch the Device Configuration Utility.


• Connect a serial cable from the PC’s COM port to the CR1000’s RS-232
port.
• Select CR1000 from the Device Type list
• Click on the Connect button

2-62
Section 2. DAQ Components

Click on the Settings Editor Tab to review settings

Click on the Logger Control tab/Send Program to send a program

Click on the Data Monitor tab to view current data

2-63
Section 2. DAQ Components

Apply settings and close the Device Configuration Utility

2.4.4.3 Using ShortCut to create Custom Sensor Templates


As was shown in Section 1, you can start Short Cut by pressing the Short Cut
icon on the LoggerNet toolbar. You follow the steps shown on the left side of
the Short Cut main window to work through the process of generating a
datalogger program.

NOTE In order to operate properly, a datalogger requires a program to


be written and loaded into its memory. The source code for these
programs ( on modern dataloggers) is written in the CRBasic
Language. When the program is sent to the datalogger, the
source code is typically compiled into machine language that the
firmware of the datalogger understands, and the program begins
operating. The most common software packages used to create
programs for dataloggers are "Short Cut" (SCWIN), the
"CRBasic Editor", and "EdLog". We will cover only SCWIN and
the CRBasic Editor in this course.

The generation of programs in SCWIN relies on pre-configured files called


“sensor files” that come with the product. These are the files that contain
instructions for the settings used by each sensor as it is selected during the
program configuration process. A sensor file defines the presentation used in
Short Cut when adding a particular sensor or sensor array.

2-64
Section 2. DAQ Components

It is possible to make customizations of these sensor files to be more


configured for your individual needs.

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.

2.4.4.4 Network Planner


The Network Planner is a graphical application that assists you in designing
PakBus datalogger networks. You interact with a drawing canvas on which you
place stations and add peripheral devices to those stations. You then create
links between stations and specify the nature of those links. Finally, you
specify the activities that will take place between various devices within the
network. As you do these things, the Network Planner automatically specifies
many individual device settings such as PakBus address, neighbor lists, verify
intervals, network parameters, etc.

2.4.4.4.1 Functional Overview


A Network Planner model is made up of stations, links between these stations,
and activities that occur over these links.

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.

Each of these steps in creating a Network Planner model is described in detail


below. Refer to the online help for a step-by-step example of creating a simple
Network Planner model. The online help also has a step-by-step example of
creating a model for a simple wireless sensor network.

2.4.4.4.2 The Drawing Canvas


The Drawing Canvas is the large section in the center of the Network Planner
window that is highlighted in the figure below. As stations are added to the
network, they are placed on the drawing canvas. As links are added between
stations, they are indicated on the drawing canvas as lines between the stations.

2.4.4.4.3 Adding Stations to the Network


A station can be added to the canvas by first clicking on the appropriate device
type in the Device Palette. The mouse cursor will then change to finger
pointing to a plus sign surrounded by a square drawn with dashed lines. While
the canvas is in this mode, the station will be created when you click on an
empty part of the canvas. When this is done, a new icon for that station will

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.

2.4.4.4.4 Configuring Devices

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.

2.4.4.5 Scheduled Collection and Custom Collection


2.4.4.5.1 Data Collection Scheduling Considerations
One of the goals in datalogging applications is to retrieve the data from the
datalogger's memory to a computer so that it can be analyzed further.
LoggerNet can be used to retrieve the data from the datalogger manually, on
demand, or you can set up an automatic data collection schedule. When the
schedule is enabled and LoggerNet is up and running, the LoggerNet server
will initiate calls to the datalogger on the defined schedule and collect its data.
Remember that what data is collected, and how it is stored, is configured on the
datalogger's Data Files or Final Storage Area tab. When the data is collected, it
is stored to a file (unless the No File option is chosen when setting up what
data to collect), and it is also stored in LoggerNet's data cache. LoggerNet
client applications, such as the Numeric and Graphical Displays or RTMC,
retrieve their information from this data cache.

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:

Numeric Displays and Graphs (opened from the Connect Screen)

Mixed Array Dataloggers

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).

Table Data Dataloggers

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.4.4.5.2.1 Datalogger Program Intervals


There are two types of intervals written into the datalogger program which
affect the availability and collection of data:

• Program Execution Interval – The execution, or scan, interval


determines how often the datalogger carries out the instructions in the
datalogger program. It is specified in seconds and determines the
fundamental rate at which data is available. In typical programs the sensor
readings are taken at this rate and the values are stored in corresponding
Input Locations or variables. This execution interval is the fastest that data
measurements can be updated and data stored. (Depending on how the
program is written, sensor readings may occur at specified intervals and
not on every program execution.)

• Table Storage Interval or Output Data Interval – Most data tables or


final storage arrays are set up to store data records at regular intervals.
The data record consists of a record number and time stamp, followed by
the output processing (i.e., sample, average, min, max, etc.) of the input
location or variable values. This interval must be a multiple of the
program execution interval or storage intervals will be skipped. For
example, if the program execution interval is 5 seconds and the table
interval is set to 3 seconds, there will only be an entry in the table every 15
seconds. The interval specified determines the fastest rate the server can
collect new data that is stored to the datalogger’s final storage memory.

2.4.4.5.2.2 Data Collection Setting Intervals


The collection interval at which the LoggerNet server requests new data from
the datalogger is set up on the Schedule tab for that datalogger in the Setup
Screen. If the collection interval is faster than the rate at which data is being
stored to a data table by the datalogger program, data will not be collected
every call, but only at intervals when new data is available.

If data collection is enabled for input location data (Inlocs) on the


CR10X-TD/PB family dataloggers or Public tables on CR1000, CR3000,
CR800, CR5000 or CR9000 dataloggers, the current values will be collected
every time a scheduled collection occurs, whether or not the values have been
updated. Therefore if your scan interval were one minute in the datalogger
program, and the data collection interval were 30 seconds, you would get two
identical records in the Public table for each one minute scan.

2.4.4.5.2.3 Communications Path Considerations


When setting up data collection intervals for the dataloggers you should
consider the communications path to the datalogger, and its affect on how often
you can retrieve data.

Phone modems require anywhere from 10 – 30 seconds or more to establish


communication, negotiate baud rate, and start transferring data. Therefore, it is
not a good idea to schedule collection by phone modem more often than once

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.

Consideration should also be given to other operations such as clock sets,


program downloads, or manual data requests to the datalogger. These require
significantly more time and can affect RF network responsiveness.

Any network setup using a phone to RF should be reviewed for collection


scheduling issues due to the combinations of time delays associated with RF
data collection.

2.4.4.5.3 Setting Up Scheduled Data Collection


The data to be collected and the output file locations and format are specified
on the datalogger's Data File or Final Storage tab. The Schedule tab is used to
define the interval on which the LoggerNet server will check the datalogger for
new data. If new data exists, it will be stored in the data files and the
LoggerNet data cache.

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.).

NOTE For table-based dataloggers, if no table names appear on the Data


Files Tab, click the Get Table Definitions button.

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

identified by the Troubleshooter (Section 6). If data is not being collected,


check the following:

• 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

2.4.4.5.4 Custom Collection


Clicking the Custom button for a table-based datalogger brings up the dialog
box shown below. The options you can specify include how much data to
collect; the file format; whether to overwrite, append or create a new file; and
the tables you want to collect. With table-based dataloggers you also have the
option of choosing specific records or a time interval to collect.

Each table is saved in a separate file so there will be one file created for each
table that is selected.

NOTE While retrieving data from the datalogger using Custom


Collection, scheduled data collection will be suspended. The
default data file names for custom collection are separate from
the files for scheduled collection data and by default are placed
in a Data directory under the LoggerNet directory.

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.

− Specific Records will retrieve the specified number of records beginning


with the Starting Record # as specified in the Starting Record Information
area.

− 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.)

Starting/Ending Date and Time


The Starting and Ending Date and Time are used to specify the timestamp
range for the selected date and time option. The date can be chosen from the
drop down calendar and the time can be entered or edited using the arrows to
the right of the control.

Starting Record Information


− Starting Record # is used to specify a range of records to collect. The
data collection will begin at this record number and get the number of
records specified in the Number of Records.

− Number of Records is used to specify a range of records or the number of


records to go back from the last record stored in the datalogger.

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.4.4.6 Numeric and Graphical Displays in ConnectScreen, Table Monitor


2.4.4.6.1 Numeric Display Screens
Data values collected from the datalogger can be displayed in numerical format
on the Numeric Displays. Pressing the Num Display button and selecting one
of the numbered displays from the drop-down list will bring up a Numeric
Display screen. Each of the three Numeric Displays is configured separately,
and all three can be active at the same time if desired. The settings and
selected data values for a display are saved when the display, Connect Screen,
or LoggerNet is closed. The display settings for each datalogger are also saved
independently, so a different datalogger will have different settings.

An example of a Numeric Display is shown below. If a Numeric Display is


already active but hidden behind other windows, selecting it from the drop-
down list will bring it to the front.

NOTE A mixed-array datalogger's final storage data must be collected


by LoggerNet before it can be displayed.

NOTE When a value declared as a Long is being displayed,


-2147483648 (the most negative long value) is used to indicate
NAN (Not A Number).

2.4.4.6.2 Graphical Display Screens


Data values collected from the datalogger can be plotted on a line graph in the
Graphical Display. Like the Numeric Display, there are three graphs and all of
them can be active at the same time if desired. The settings and selected data
values for a graph are saved when the graph, Connect Screen, or LoggerNet is
closed. The graph settings for each datalogger are also saved independently, so
a different datalogger will have different settings.

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.

NOTE A mixed-array datalogger's final storage data must be collected


by LoggerNet before it can be displayed.

NOTE When a value declared as a Long is being graphed, -2147483648


(the most negative long value) is used to indicate NAN (Not A
Number).

2.4.4.6.3 Table Monitor


The Table Monitor in the center of the Connect Screen can be used to monitor
the values for one entire table.

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).

Double-clicking on a value in the Table Monitor will display the value in a


separate dialog box and allow you to change the value (if it is editable).

2.4.4.7 RTMC and RTMC Pro


2.4.4.7.1 Real-Time Monitoring and Control
The Real-Time Monitoring and Control (RTMC) software provides the ability
to create and run graphical screens to display real-time data as LoggerNet
collects it from the dataloggers. Controls are also provided to view and set
datalogger ports and flags, as well as input locations or variables. RTMC can
combine data from multiple dataloggers on a single display. As LoggerNet
collects data from the dataloggers, the displays in RTMC are automatically
updated.

RTMC has two operating modes: Development and Run-Time. The


Development mode allows you 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 file, 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. One copy of RTMC Run-Time is provided with
LoggerNet; additional copies to run on remote machines can be purchased
separately.

NOTE Scheduled data collection must be enabled in LoggerNet, or


RTMC’s display will never update.

2.4.4.7.1.1 Development Mode


RTMC Development is a graphic display editor that allows the user to easily
place graphical components on the display screen and associate them with data
values.

The RTMC Development window, as shown below, has three sections.

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

RTMC was designed to be easy and straightforward to use. Experiment with


different combinations and options to get the display results you are looking
for.

As seen in the example screen above, different types of graphical components


can be combined to create an attractive real-time display. Company logos,
maps, or any image stored in a standard graphic file format can be placed on
the screen.

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

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.

NOTE When a display component is linked to a data value, the value


will be automatically updated on the display when data is
collected by LoggerNet on a schedule. If scheduled data
collection is not set up in LoggerNet or the selected data value is
excluded from scheduled collection, the values will not update
and an exclamation point will appear in the upper right corner of
the component. Input locations, ports and flags for mixed-array
dataloggers are collected at the scheduled collection interval or
any time a manual collection is done.

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.

To make changes to display component settings, the Properties window can be


opened by double clicking the component. If you make changes to a
component’s properties but then decide to reject those changes, press the
Cancel button to return the properties to the last applied state. If Cancel is
selected when a component is first placed in the work area (and OK has not
been pressed), the display component will be removed from the screen.

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.

Pointer returns the cursor to a normal selection tool.

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.

Alarm provides visual and/or audible notification that a data value


has exceeded a defined limit. An audible alarm can be disabled by
right-clicking the component with your mouse and selecting
Acknowledge Alarm.

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

Label displays a text string that can be used to label other


components.

Switch indicates the state of a port, flag, input location, or Boolean


value. A 0 is considered Off (false); any non-zero number is
considered On (True). In run-time mode, right-click a switch to
change its state. The option to change the state of a switch with a
double-click can be enabled in the Properties window.

Image allows you to place a static image on the display.

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.

CommStatus Alarm provides a visual and/or audible alarm when


scheduled collection is disabled in the Setup Screen, the schedule is
paused from the Status Monitor, or communication has failed a
sufficient number of times to put the datalogger into a Primary or
Secondary Retry mode (the retry mode used is based on the
Sensitivity property for the component). An audible alarm can be
disabled by right-clicking the component with your mouse.

Time displays the server time, server time at last data collection,
station time, station time of last record stored, or PC time.

SetPoint depicts the selected data value as a numeric value, text


string, or Boolean. A data value can also be set to a new value by
double-clicking the component and entering a new value in the
resulting dialog box.

Gauge displays the selected data value on a gauge.

Table Display displays the data from a datalogger table in a row and
column format.

Value Forwarder reads a value in a datalogger and writes to another


value in that datalogger or a different datalogger. The value that is
written can be the value read, a 0 or -1, or a specified constant.

Thermometer displays the data value on the image of a


thermometer.

Compass provide an eight-point compass on which to display data.

2-80
Section 2. DAQ Components

Expressions

Components that display data values either numerically or graphically can be


processed using expressions. These expressions can include simple
mathematical expressions, functions to manipulate strings, or more complex
functions that deal with the state of a data value over time.

For instance, a temperature reading in degrees Celsius can be processed to


display in degrees Fahrenheit using a simple mathematical expression. This is
done by first selecting the data value in the Select Data field, and then entering
the mathematical expression after the defined data value. Using the above
example, if the data value is defined as “Server:CR5000.TempData.Temp1”
(“Source:datalogger.table.variable”), you would enter

“Server:CR5000.TempData.Temp1” * 1.8 + 32

to convert the temperature reading from degrees Celsius to degrees Fahrenheit.

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:

InStr( 1, “Server:CR1000.hourly.mystring”, $”abc”)

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)

When RTMC-RT is launched it begins processing with the newest record by


default. Therefore, using the above expression, a component will not
immediately display the maximum value over the past 24 hours. Rather, it will
display the maximum value since RTMC-RT was launched. The 24-hour
maximum will only be displayed after it has been running for 24 hours. In
order to get a 24 hour maximum immediately, you can use a “Start Option
Function” to cause RTMC to begin processing data at an earlier point. For
example,

StartRelativeToNewest(nsecPerDay,ordercollected);
MaxRunOverTime(“Server:CR1000.QtrHour.Temp”,Timestamp(“Server:
CR1000.QtrHour.Temp”),nsecPerDay)

would begin displaying a 24 hour maximum immediately, provided that the


data is available in the communications server’s data cache.

2-81
Section 2. DAQ Components

Aliases

If a data value is used multiple times in an expression, the expression can be


simplified by declaring an alias for the data value at the first of the expression,
in the form:

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)

can be replaced by:

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)

Where synchronized_name is the name of a new variable that will be used in a


calculation at the end of the expression and data_value is the name used within
RTMC to access the data value, i.e., Source:datalogger.table.variable.

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

NOTES Timestamps are truncated to seconds prior to synchronization.


Therefore, synchronizing sub-second data is not recommended as
the results will be unpredictable.

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.

RTMC will buffer up to 100,000 points of a data value while


waiting for a common timestamp from the other datalogger(s).
Once the buffer reaches 100,000 data points the oldest data value
will be removed from the buffer, each time a new data value is
collected.

All of the functions available in RTMC are described below. For details on a
function, refer to RTMC’s online help.

NOTE Spaces must be used to delimit the predefined constants and


functions. Operators allow but do not require spaces.

NOTE An expression can include data values from multiple dataloggers.

2-83
Section 2. DAQ Components

2.4.4.7.1.2 RTMC Run-Time


The run-time operation allows you to run the real-time graphic display screen
that was created in the developer mode. From the RTMC Development
window you can test the operation of the display screen using the File | Save
and Run Project menu or clicking the Run-Time icon on the toolbar. This will
start the project window with RTMC Run-Time as shown in the window
below.

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.

A copy of RTMC Run-Time comes with LoggerNet. If you want to run


RTMC projects on remote computers, additional copies of RTMC Run-Time
can be purchased separately. One copy is required for each computer on which
RTMC Run-Time will be used. As noted above, when running RTMC Run-
Time on a remote computer, the host computer must have Remote Connections
enabled (LoggerNet Toolbar, Tools | Options | Allow Remote Connections).

2-84
Section 2. DAQ Components

2.4.4.7.2 RTMC Pro Introduction


The RTMC (Real-Time Monitor and Control) Pro software provides the ability
to create and run graphical screens to display real-time data as LoggerNet or
RTDAQ collects it from the dataloggers. Controls are also provided to view
and set datalogger ports and flags, as well as input locations or variables. In
LoggerNet, RTMC Pro can combine data from multiple dataloggers on a single
display. In RTDAQ, RTMC Pro projects are limited to a single datalogger. As
LoggerNet or RTDAQ collects data from the dataloggers, the displays in
RTMC Pro are automatically updated.

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.

RTMC Pro is an enhanced version of the standard RTMC Development that


ships with LoggerNet and RTDAQ. RTMC Pro contains more graphical
components than RTMC. For example, more alarms (multi-state), alarm
events (email, FTP, run/open), switches (lever, rocker, rotary), charts (XY and
scope), gauges (rotary, compass), and layout components (group box, bevel,
panel) are available. For components that exist in both versions, more
properties have been exposed in RTMC Pro resulting in more design control.
RTMC Pro also includes run/open button, hotspot, snapshot, and alarm log
capabilities. In LoggerNet, you also have the ability to add data files,
databases, and additional LoggerNet servers as data sources for RTMC Pro
projects. See Section 2.5, Managing Data Sources, for more information.

NOTE A project that is created with the standard RTMC Development


version can be converted to RTMC Pro format. However, once a
project is converted to RTMC Pro format, it cannot be opened in
standard RTMC.

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.

RTMC projects can also be run using RTMC WebServer. In RTMC


WebServer, no run-time events are active. It provides a static snapshot view
only with no user interaction. Therefore, no values can be changed, alarms
cannot be acknowledged, and there are no audio, email, or run/open
capabilities.

2-85
Section 2. DAQ Components

NOTE In LoggerNet, data must be collected from the datalogger for


RTMC’s displays to be updated. Typically this is done by
setting up a schedule in LoggerNet’s Setup Window. It can also
be done from RTMC’s Project | Configure Override Scheduled
Collection menu item.

In RTDAQ, RTMC performs a manual poll to update project


data when RTDAQ is connected to the datalogger. Therefore,
RTDAQ must be connected to the datalogger for RTMC’s
display to be updated. You can override the default one-second
interval from the Project | Configure Override Scheduled
Collection menu item.

2.4.4.7.3 Development Mode


RTMC Pro is a graphic display editor that allows the user to easily place
graphical components on the display screen and associate them with data
values.

The RTMC Pro window, as shown below, has three sections.

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.

RTMC Pro was designed to be easy and straightforward to use. Experiment


with different combinations and options to get the display results you are
looking for.

2-86
Section 2. DAQ Components

As seen in the example screen above, different types of graphical components


can be combined to create an attractive real-time display. Company logos,
maps, or any image stored in a standard graphic file format can be placed on
the screen.

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.

2.4.4.8 View Pro


2.4.4.8.1 Overview

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.

2.4.4.8.2 Opening a File


View Pro provides three ways to open a file. The one you use depends on the
type of file being opened. Use File | Open to open a data file, File | Open as
Text to open other types of files, or File | Open as Hex to view a binary or text
file in hexadecimal format.

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).

No matter what option is used to open a file, it is closed by selecting File |


Close from the menu or pressing the red X in the upper right-hand corner of the
data file window.

2.4.4.8.3 Data View


The initial display for data files in View Pro is as normal text in a grid format.
The following figure shows the View Pro main screen with two data files open.
The data file windows have been tiled horizontally.

2-89
Section 2. DAQ Components

Array-based Data Files


When opening a data file from an array-based datalogger, you will be given the
option of loading an FSL (Final Storage Label) file. The FSL file will be used
to provide column headings. (The *.FSL file is created when a datalogger
program is compiled in Edlog or ShortCut.)

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.

Array-based data files do not contain timestamps. If an FSL file is associated


with the data file, View Pro will try to extract timestamps from the appropriate
columns. You can select Array Definitions from View Pro’s View menu to
specify how the timestamps are created. Note that if no timestamps are used,
data cannot be graphed.

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.

Graphing Data from Multiple Data Files

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

For a Rainflow Histogram or for a Histogram or FFT in 3D View, you can


rotate the graph by using the scroll bars at the bottom and right of the graph.

Keeping Graph on Top

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.4.4.8.4.1 Line Graph


From the Line Graph screen, you can graph data values on the y-axis against
their timestamps on the x-axis.

2-91
Section 2. DAQ Components

2.4.5 Advanced Software Considerations


2.4.5.1 LoggerNet Admin
For computer deployments that require LoggerNet functionality, the
LoggerNet Admin (Administrator Version) product can be considered instead
to obtain additional functionality. LoggerNet Admin Includes all LoggerNet
functions, as well as additional clients, capabilities, and tools that are useful
when managing a large datalogger network. LN Admin:

• Allows the LoggerNet server to be managed from a remote PC

• Provides the ability to run LoggerNet Admin as a Windows service


(which provides automatic startup and more reliability)

• Provides a client for enabling granular security features on the


datalogger network

• Exports data to third-party applications

• Launches multiple instances of the same client (Connect Screen,


Setup Screen, Status Monitor)

2.4.5.2 LoggerNet Remote


LoggerNet Remote allows you manage an existing LoggerNet datalogger
network from a remote location. Although the LoggerNet computer manages
the connections to the dataloggers, the LoggerNet remote machine can control
the operation of the LoggerNet machine from a different Windows-based
computer. LoggerNet Remote:

• Allows you to manage an existing datalogger network from a remote


location

• Includes all of the LoggerNet Admin clients except for the Service
Manager

The ability to access a LoggerNet server from a remote computer is a central


feature of LoggerNet Remote. To do this, you need to have a TCP/IP
connection available between the main LoggerNet computer and the remote
computer. You then “log in” to the server from the remote location. All of the
standard LoggerNet clients that are capable of accessing remote servers (such
as Setup, Connect, or Status) include a Select Server dialog box under the
application’s File menu. This allows the user to specify the TCP/IP address, as
well as a user name and password if security is enabled, for the remote server.

The Task Master is not available in LoggerNet Remote. It cannot be used to


connect to a remote LoggerNet server.

2.4.5.3 LoggerNet for Linux


LoggerNet Linux provides a solution for those who want to run the LoggerNet
server in a Linux environment. The package includes a Linux version of the
LoggerNet server and a Windows version of LoggerNet Remote. The
Windows-based client applications in LoggerNet Remote are run on a separate
(Windows platform) computer, and are used to manage the LoggerNet Linux

2-92
Section 2. DAQ Components

server (similar to a LoggerNet Admin and LoggerNet Remote pair of


computers). Rudimentary administration tasks can be done on the Linux server
itself using corascript and other manual configuration techniques, although
most users opt to use LoggerNet Remote because it is more fully-featured and
easier to use.

2.4.5.4 SDK and OPC Options


Other options can be used to make LoggerNet functionality available to third-
party systems. Windows and Java based SDKs allow for datalogger
configuration and data collection from within industry standard development
and programming environments. Custom applications can be developed to
interact with the LoggerNet communications server. The CSIOPC Server can
be used to publish data from dataloggers that are configured within LoggerNet
outward for use by industry standard OPC clients.

2-93
Section 2. DAQ Components

2.5 Cell Phone Communication


Campbell Scientific’s RavenXT-series modems can be used to set up wireless
communication with your datalogger. The RavenXT-series modems are full-
duplex devices that transmit data to a local cellular tower. A PC then retrieves
the data from the cellular tower via the Internet. Internet communications
provide faster communication rates and eliminate dialing delays and long
distance fees.

2.5.1 When Should You Consider Cellular Communication?


Pros
• Cellular communication can often be used when no other communication
options are available.
• Using cellular communication makes your datalogger station mobile. For
example, the datalogger station can be in a vehicle taking measurements
as the vehicle drives around a race track. Another example is a datalogger
station being moved from site to site without any reconfiguration.
• Eliminates the need to work through difficulties (obtaining IP address,
firewall permissions, etc.) of connecting to an existing network. Your
communication setup is taken care of as long as there is cellular coverage.
• Finally, cellular communication can be used to provide a wireless IP
solution.

Cons
• The main drawback to cellular communication is the monthly cost of
cellular service.

2.5.2 What Do You Need to Do Before You Place an Order?


2.5.2.1 Find a Cellular Provider
Determine which cellular carriers have the best coverage at your site. Most
carriers have coverage maps located on their web sites. This information can
be used to select a carrier. Make sure that the coverage map is for broadband
data, not voice. If you have a cell phone from that carrier, take it to the site to
see if there is sufficient signal strength to make a phone call.

When finding a cellular carrier, another consideration is static vs dynamic IP


addresses. All carriers will provide dynamic IP addresses, but some carriers
can also provide static IP addresses.

• A Static IP address is permanently assigned to a particular account and


will always be used whenever the Raven connects to the Internet.
• A Dynamic IP address is assigned on a “need to have” basis. A dynamic
IP address is used with a DDNS service (see RavenXTG manual, Section
5) to translate a domain name to a dynamic IP address, so that the Raven
can be contacted as if it had a static IP.

2-94
Section 2. DAQ Components

2.5.2.2 Select a Cellular Modem Model


Campbell Scientific offers two versions of the Raven cellular modem:

• RavenXTV—Code Division Multiple Access (CDMA) modem. This


modem is configured for Verizon networks ONLY.
• RavenXTG—General Packet Radio Service (GPRS) modem. This
modem is used on most GSM/GPRS networks such as AT&T.

Contact the cellular carrier if you are not sure which technology the carrier is
using.

For reference, the RavenXTG manual is provided as Appendix D of this


training manual. (The RavenXTV has its own manual with similar
information.)

2.5.2.3 Select an Antenna


There are internal and external antenna options available with different
amounts of gain. Most remote sites which are away from the normal
infrastructure need an external antenna with high gain. If your site is very
close to a cellular tower where the signal strength is strong, an internal antenna
may be adequate. The weaker the signal strength is at the site, the higher the
gain needs to be for reliable communication. Taking your cell phone to the site
may help you determine the strength of the cellular carrier’s signal. If making
a call at the site is difficult, most likely the signal is weak and a high gain
antenna may be required.

2.5.2.4 Determine the Modem-to-Datalogger Interface


The CR200(x), CR800, CR850, CR1000, CR3000, CR5000 and CR9000(x)
dataloggers have an RS-232 connection. In most cases a NULL modem cable
(CSI part # 18663) is used as the interface between the modem and the
datalogger. Dataloggers with only a CSI/O interface (i.e. CR10(X), CR510,
21X and CR7) require either an SC105 or SC932A to interface the modem’s
RS-232 port to the datalogger’s CS I/O port. An SC105 configured to SDC7 or
SDC8 is preferred for dataloggers running a PakBus operating system.

2.5.2.5 Consider Power Requirements


The Raven cellular modem has a current drain of approximately 40 mA in a
dormant state and 120 mA in an active state. This is considerately higher than
the datalogger’s current drain and therefore needs to be considered in
determining the power budget for your site.

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

2.5.3 Setting up Cellular Communication


2.5.3.1 Hardware Configuration—Serial Server Method or PPP (Point to
Protocol) Method
The Raven can be configured to communicate with a datalogger in two
different ways:

• 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.

2.5.3.3 The Raven Indicator Lights


When the RavenXTG is connected to power and an antenna, there is a specific
pattern to the lights to indicate its operation mode.

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.5.4 Common Problems in Configuring Cellular Comms


• The instructions in the Raven manual describe loading a template file of
settings into the modem via the Sierra Wireless Ace Manager application.
Sometimes this step is overlooked and the modem’s RS-232 is not
configured to operate with the datalogger.
• An incorrect cable or defective Null modem cable is used as an interface
between the modem and datalogger.
• The cellular account is setup on the network but not activated by the
carrier.
• The cellular account is setup with a private IP address instead of a public
IP address. If this happens, the modem can initiate communications
outbound towards the internet but inbound communications will be
blocked by the cellular carrier’s firewall.
• If Dynamic DNS is used as described in the manual, the DNS server may
take up to 5 minutes to be updated when a change is made. Waiting up to
5 minutes after the modem has been rebooted or the IP address has been
changed will fix a problem connecting with the modem and datalogger.

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.

Campbell Recorder Basic (CRBasic) is the programming language used to


create programs which run on Campbell Scientific CRBasic dataloggers,
including the CR1000, CR800, CR3000, CR5000, and CR9000X. This
programming language is similar in syntax and logic to the Structured BASIC
programming language.

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

pressing its button , or by choosing CRBasic Editor from the Program


menu.

►► Launch the CRBasic Editor

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

3.1.3 CRBasic Editor Main Window

FIGURE 3.1.3-1. CRBasic Editor’s Main Window.

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.

This category list contains the predefined instruction categories originally


installed with the CRBasic Editor, as well as any categories created by the
user. When a category is selected, only the instructions belonging to that
category will be displayed in the Instruction Panel.

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

FIGURE 3.1.3-2. CRBasic Editor’s Instruction Categories List

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.

CRBasic has special instructions for measurements. The results of all


measurements are written to variables or variable arrays. CRBasic has
additional instructions for creating tables to store processed data for retrieval.
Mathematical operations are written out much as they would be algebraically.

3.1.3.1 Customizing the CRBasic Editor


The CRBasic Editor can be customized in its look and syntax highlighting.
Customized instruction categories can also be created.

Customization choices can be accessed from the CRBasic Editor’s View,


Instruction, and Tools menus:
View
Editor Preferences
Instruction Panel Preferences
Font
Background Color
Wrap Text When Printing
Display Last Window Used
View Instruction Panel
Instruction
Edit Instruction Defaults
Insert User Function
Goto
Navigation
Bookmarks
Go to Line #
Tools
Associate Files
Edit Instruction Categories
Show Keyboard Shortcuts
Show Labels
Set DLD Extension

3-3
Section 3. CRBasic and Measurements

3.1.3.1.1 Editor’s View Pull-Down Menu


The View menu allows you to specify editing options used in the CRBasic
Editor and customize its look and syntax highlighting. Menu items under
“View” are shown in Figure 3.1.3-3.

FIGURE 3.1.3-3. CRBasic Editor’s View Menu.

3.1.3.1.1.1 View Pull-Down Menu: Editor Preferences


The Editor Preferences screen, depicted in Figure 3.1.3-4, sets up the
appearance options for the text instructions and the behavior of popup hints.

FIGURE 3.1.3-4. CRBasic Editor’s View/Editor Preferences

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.

The Syntax Highlighting (Figure 3.1.3-5) tab sets up the appearance of


different text elements in the program using different font styles and colors.

FIGURE 3.1.3-5. Editor Preferences Syntax Highlighting Tab

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.1.3.1.1.2 View Pull-Down Menu: Instruction Panel Preferences


The Instruction Panel Options screen (Figure 3.1.3-6) allows the user to
define how the insert function will behave in the program.

FIGURE 3.1.3-6. Editor Preferences Syntax Highlighting Tab

3-5
Section 3. CRBasic and Measurements

When the Show Instruction Dialog checkbox is selected, the Instruction


Parameters dialog box will appear when an instruction is added to the program
using the Instruction Panel list. When it is not selected, the instruction will be
immediately inserted, at the mouse cursor, using the default parameters. The
Instruction Dialog box can still be invoked by right mouse clicking on the
instruction name.

3.1.3.1.2 Editor’s “Instruction” Pull-Down Menu


This menu item lets you customize the appearance and functionality of the
CRBasic Editor's editing features.

Edit Instruction at Cursor:


When the cursor is placed on an instruction that has one or more parameters,
the Parameter Editing dialog box will appear. If the cursor is placed on a
parameter, a list of options or a list of variables will be displayed if either
exists, or help for that parameter will be displayed. The function key for this
feature is F2.

Edit Instruction Defaults:


Allows you to edit the default parameters for an instruction that is highlighted
in the Instruction Panel. This can be useful if an instruction is always used in a
similar application. Example, you always want to use the VoltDiff instruction
to measure using the 5000 mV range. The function key for this feature is F4.

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.

Insert User Function:


Displays a pick list that contains all user-defined functions found in the
program. (Refer to Function/EndFunction for dataloggers that support user-
defined functions.) The short cut key for displaying this pick list if F11.

3.1.3.1.3 Editor’s GoTo and Bookmarks

The CRBasic editor has GoTo and Bookmark features to enable navigating
through programs quickly.

All programs have certain common instructions, such as the declaration of


variables, data table definitions, the BeginProg/EndProg statements and
Scan/NextScan. The Goto function is used to move the cursor to the next
occurrence of a common instruction in the program.

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.

3.1.3.1.4 Editor’s “Tools” Pull Down Menu


Associate Files:
This option is used to associate CRBasic program file types to the CRBasic
Editor in the Windows operating system. Once a file type is associated, if a file
with that extension is opened from Windows Explorer, it will be opened using
the CRBasic Editor.

Edit Instruction Categories:


The Edit Instruction Categories screen (via Tools | Edit Instruction
Categories) allows the user to Create, Edit, and/or Delete custom categories
for instruction groups. The user created groups will be listed in the Instruction
Panel’s pull down list of categories.

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.

A User-Defined Category can be deleted by highlighting that category and


pressing the Delete Category button. When you close the dialog box with OK
you will be prompted to confirm the deletion of the category. If you press
Cancel, the category will not be deleted.

FIGURE 3.1.3-7. Edit User Defined Categories

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.

FIGURE 3.1.3-8. Instructions for Defined Categories

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 Keyboard Shortcuts:


Displays a list of keyboard short cut keys that can be used in the CRBasic
Editor.

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.

Set DLD extension:


Used to tie a file with a .dld extension to a particular datalogger. The editor
will use the instruction set, compiler, and help file associated with the logger
type selected.

►► Instruction Category Exercise

Create a new instruction category named FieldCal. Include the following


instructions:
DataTable/EndTable SampleFieldCal FieldCal
FieldCalStrain LoadFieldCal NewFieldCal

3-8
Section 3. CRBasic and Measurements

3.1.3.1.5 CRBasic Program Instructions

Each program instruction has a “keyword name” and “parameters” that


customize how the instruction will be executed.

As covered in previous sections, the various CRBasic instructions can be


grouped into different categories. Each instruction has a keyword name, and
most have a series of parameters that are programmed with the information
needed to complete their assigned task, whether it is to measure the output
from a sensor, or setup some output processing task. For example, the
instruction for measuring the temperature of the CR1000 input panel is:
PanelTemp (Dest, Integ).

PanelTemp is the keyword name of the instruction. The two parameters


associated with PanelTemp are:
Destination the name of the variable in which to put the temperature;
Integration the length of time to integrate the measurement.

To place the panel temperature value in the variable RefTemp (using a 250
microsecond measurement integration time) the code is:
PanelTemp(RefTemp, 250)

Note: “Keywords” include the words, or names, used for Instructions, as


shown in the Instruction Panel. Keywords cannot be declared as variables.

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.

FIGURE 3.1.3-9. Sample Instruction Dialog Box

3-9
Section 3. CRBasic and Measurements

The syntax for the Sample instruction is:

Sample (Reps,Source,DataType)

Sample is the keyword name of the instruction. The three parameters


associated with the Sample instruction are:
Reps: the number of samples to store to the DataTable,
Source: name of the variable for which a sample should be saved, and
DataType: the format in which to save the data.

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.

3.1.4 On-line Help


On-line help can be accessed using different methods such as right clicks, left
clicks, F1, F2, and F10.

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.

Left clicking within an instruction brings pop-up parameter hints.

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

3.1.5 Adding Comments

It is good practice to add comments in your program to document the author,


purpose of the program, program logic, revision dates, etc.

It is often useful to provide comments in your datalogger program. When you


or someone else reviews the program at a later time, comments provide
reminders and explanations to describe what is being done in various sections
of the program.

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.

The default CR1000 template contains comments, and commented out


instructions to show examples of valid syntax. Removing the preceding (‘)
will make the line active.

The CRBasic Editor, by default, highlights different types of elements in the


program using different font styles and colors. Comments, Instruction Names,
and other text elements each have a different appearance, making the program
easier to read and edit. You can customize or completely disable syntax
highlighting by changing your Editor Preferences (View | Editor Preferences |
Syntax Highlighting).

►► 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.1.6 Datalogger Program Structure


A typical CRBasic Datalogger program contains:
a) Variable, Constant, and other Declarations
b) Data Table Definitions
c) Subroutine Definitions (The use of subroutines is optional)
d) Program(s) including the Scan Interval, Measurements, Processes,
Controls, and calls to Data Tables

The structure of a CR1000 program requires that variables and subroutines be


defined before they can be used. The best way to do this is to put all the
variable declarations and output table definitions at the beginning, followed by
the subroutines, and then the program. Most programs do not need
subroutines; so, generally “subroutine definitions” are not used. Figure 3.1.6-1
and Example Program 3.1.6-1 show the structure of a typical CRBasic
program. Note that the online help has an example for each instruction to
demonstrate the use of the instruction in a program.

3-11
Section 3. CRBasic and Measurements

Declarations Make a list of what to measure and calculate.


Declare constants Specify identifiers for numeric or string values that do not change
during program execution.
Declare public variables Indicate identifiers for changeable values that are visible in the
Public table while the program is running,
Dimension variables Define identifiers for changeable values which are not visible
during program execution until stored into a table.
Define aliases Give an additional name to any of the measurement identifiers
defined previously.
Define data tables Specify details about the tables of data that will be stored while
the program makes its measurements.
Specify a process or storage trigger This determines when the data should be stored within the table.
Data can be stored when some condition is met, on a fixed
interval, or based on a combination of conditions and intervals.
Specify table size Configures the size of the table (number of records) in the
datalogger’s memory.
Specify other on-line storage devices Specifies that the data should be stored on a PC card or a user-
specified device instead of the default CPU memory location.
Specify data outputs Indicates what data are to be written out to tables and how they
are stored (current value, average, maximum, minimum, etc.)
Define Subroutines If there is a process or series of calculations that needs to be
repeated several times in the program, it can be packaged into
a subroutine and called as needed. This is preferable to
inserting an identical code block each time it needs to be used.
BeginProg This is the program section which defines the actions taken as the
datalogger operates. The datalogger begins its processing here
when the program starts.
Set scan interval (Scan) The scan sets the interval for a series of repeated measurements
or instructions.
Specify measurements Enter the repeated measurements to be made
Perform processing Enter any additional calculations to perform along with the
measurements
Call data table(s) Data tables must be called to process (store) output data
Perform control operations Check measurement values and control hardware devices with
port output if necessary, or change the flow of program
execution.
NextScan Loop back (and wait if necessary) for the next scan
EndProg The datalogger stops when it reaches this instruction

FIGURE 3.1.6-1. CRBasic Program Structure

The default CRBasic templates provide the basic structure for programming.

3-12
Section 3. CRBasic and Measurements

'Declare Public Variables


Public PTemp, batt_volt
'Declare Other Variables
Dim Counter
Declarations
'Declare Constants
Const PI = 3.141592654
'Define Data Tables
DataTable (Test,1,-1)
DataInterval (0,15,Sec,10)
Minimum (1,batt_volt,FP2,0,False) Data Tables
Sample (1,PTemp,FP2)
EndTable
'Define Subroutines
'Sub
'EnterSub instructions here Subroutines (optional)
'EndSub
'Main Program
BeginProg
Scan (1,Sec,0,0)
PanelTemp (PTemp,250)
Battery (Batt_volt)
'Enter other measurement instructions Main Program
'Call Output Tables
CallTable Test
NextScan
EndProg

Example Program 3.1.6-1. CRBasic Program Structure

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.

►► Program Structure Exercise


Identify the variable declarations, data table definitions, and main scan block
of the sample program given in the default CR1000 template in the CRBasic
Editor.

►► Programming with CRBasic Exercise 3.1.6.-1


Objective: During the next few sections, the following exercise will be
completed.
Use CRBasic to create a program to perform the following:
Store once every 5 seconds:
Average air temperature
Maximum air temperature
Minimum air temperature
Minimum battery voltage
Sample panel temperature

3-13
Section 3. CRBasic and Measurements

Measure every second:


CR1000 panel temperature
Air temperature in degrees C with two Type T thermocouples
Battery voltage

3.1.6.1 Variable Declarations


Declarations are defined as a list of variables and other identifiers that will be
used in the CRBasic program for storing measurements and performing
calculations.

The Declaration instructions include:


Public – declares & dimensions variables which are visible in the Public table
Dim – declares (dimensions) variables which do not appear in the Public table
Const – declares symbolic constants for use in place of numeric values
Alias – assigns a second name to an existing variable
StationName – sets the reported station name in the datalogger’s Status table
Units – assigns a label which identifies the engineering units of a variable

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.

Variables can be up to 39 characters in length. They must start with a letter


and can contain numbers and underscores (_). They cannot contain spaces.
CRBasic is not case sensitive. Several Variables can be declared on a single
line, separated by commas. For example:

Public Load, Force, Pressure

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.

3.1.6.1.1 Public & DIM Variable Declarations


The following description on syntax for declaring a variable applies to both the
Public and the DIM instructions.

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.

Variables declared by Public within a subroutine or function are local to that


subroutine or function. The same variable name can be used within other
subroutines or functions or as a global variable without conflict.

THE PUBLIC & DIM STATEMENTS HAVE THESE PARTS:

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.

As a special case, a string can be declared as String * 1. This allows the


efficient storage of a single character. The string will take up 4 bytes in
memory and when stored in a data table, but it will hold only one character.
Strings can be dimensioned only up to 2 dimensions instead of the 3 allowed
for other data types. (This is because the least significant dimension is actually
used as the size of the string.) To begin reading or modifying a string at a
particular location into the string, enter the location or begin reading a string at
a particular character, enter the character as a third dimension; e.g.,
String(x,y,n) where n is the desired character.

Initialize Variables can be initialized when declared. For example:


Public MyVar = 3.5 or Public MyVar = {3.5}
Public MyArray(3) = {3, 6, 9}
The braces are optional if a scalar is being initialized or if only the first variable
in an array is being initialized.

When declaring a data type for the variable, the variable is declared before
initialization:
Public StringVar as String * 30 = "Test String"

For all arrays, including multi-dimensional arrays, the least significant


elements are initialized first. In other words, if the array is not fully initialized,
the first elements will be initialized first, and the remainder will be initialized
to the default value of 0:
Public Array (2,3) = (1,2,3,4)
Results in ,
Array(1,1) = 1 Array(2,1) = 4
Array(1,2) = 2 Array(2,2) = 0
Array(1,3) = 3 Array(2,3) = 0

3-16
Section 3. CRBasic and Measurements

3.1.6.1.2 Units Declaration

The Units declaration can used to assign a label to a variable in the program

The Units instruction is an optional declaration used to assign a label to a


variable in the program to identify the units in which the associated
measurement is stored. The units are strictly for the user’s documentation, and
can be up to 38 characters long. CRBasic and the CR1000 make no use of or
checks on their accuracy. The declared units appear in the header of output
files.
3.1.6.1.3 Variable Nomenclature Rules
TABLE 3.1.6-1. Rules for Names lists the maximum length and allowed
characters for the names for Variables, Arrays, Constants, etc. The CRBASIC
Editor pre-compiler will identify names that are too long or improperly
formatted.

TABLE 3.1.6-1. Rules for Names

Maximum Length (number


Name for of characters) Allowed characters
Variable or Array 39 Letters A-Z, upper or lower case,
underscore "_", and numbers 0-9.
Constant 38 The name must start with a letter.
CRBASIC is not case sensitive
Units 38
Alias 39
Station Name 64
Data Table Name 20

Field name 39
Field Name 64
Description

3.1.6.1.4 Data Types and Formats


It is important to understand the different data formats and ranges and where
they are used. We’ll talk about data as it is created and manipulated in the
CR1000, data as it is displayed through LoggerNet and data as it is retrieved to
a computer file. Table 3.1.6-2 lists the various Data Types available. If a
format is not declared, the default used will be IEEE4.

TABLE 3.1.6-2 Declared Variable Data Types

Code Data Format Size Range Resolution


-45
IEEE4, IEEE 4 Byte 4 bytes ±1.4 x 10 to 24 bits
FLOAT, or Floating Point ±3.4 x 1038 (about 7 digits)
not declared
LONG 4 Byte Signed 4 bytes -2,147,483,648 to 1 bit (1)
Integer +2,147,483,647
BOOLEAN 4 byte Signed 4 bytes 0, or -1 True or False
Integer (-1 or 0)
STRING ASCII String Set by
program

3-17
Section 3. CRBasic and Measurements

►► CRBasic Exercise 3.1.6.-1; Variable Declarations


Start a new CR1000 program. Delete the program recommended by the
template. Declare these Public variables as float: RefTemp, AirTemp,
Batt_Volt. Declare a Public variable named Counter as Long and initialize it
to 1. Declare a Public variable MyName as String, sized long enough for your
name, and initialize it to your name. Declare units for Batt_volt (Volts),
RefTemp( Deg_C), and AirTemp (Deg_C).

Public Batt_Volt : Units Batt_Volt = Volts


Public RefTemp : Units RefTemp = Deg_C
Public AirTemp : Units AirTemp = Deg_C
Public counter AS LONG = 1
Public Name AS STRING * 16 = “Name”

Save your program as CRBasic1.CR1.

3.1.6.2 Main Program


The main program is the starting point for processing when the datalogger
begins executing a program. Place measurement, process, and control
instructions within the main body of the program.

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.

The Scan instruction’s syntax follows::


Scan(Interval, Units, BufferOption, Count)
Scan( 100, mSec, 500, 0 )

3-18
Section 3. CRBasic and Measurements

The Scan instruction has four parameters.


Interval The time between the scans.
Units The time units for the Interval (minutes, seconds, milliseconds, etc.)
BufferOption The size (expressed as a number of scans) of a buffer in the datalogger’s
program memory that holds the raw results of measurements. Using a buffer
allows the processing in the scan to lag behind the measurements without
affecting the measurement timing. BufferOption is only valid when running in
PipeLine mode (not in SequentialMode).
Count The number of scans to make before proceeding to the instruction following
NextScan (i.e. before exiting the Scan/NextScan block). A Count value of
zero instructs the datalogger to continue repeating the scan block at the
appropriate times (looping) until the program is stopped by a power-down or
by user intervention (i.e. repeats indefinitely).

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

►► CRBasic Exercise 3.1.6.-1 continued


Start with CRBasic1.CR1. Setup the Main Program, using the BeginProg/
EndProg, and Scan/NextScan constructs. Set the Scan interval to 1 second set-
up for infinite looping.

3.1.6.3 CRBasic Measurement Instructions


Measurement instructions set up the measurement hardware to make a
measurement and place the results in a variable or a variable array.

Each measurement instruction has a keyword name and a series of parameters


that contain the information needed to complete the measurement. For
example, the instruction for measuring the temperature using a thermocouple
is:
TCDiff(Dest,Reps,Range,DiffChan,TCType,TRef, RevDiff,Settling,Integ,Mult,Offset)
TCDiff is the keyword name of the instruction. The parameters associated
with TCDiff are:

Destination: The variable in which to store the results of the measurement.

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.

TABLE 3.1.6-3. Voltage Range Options

Entry Full Scale Range


mV5000 ± 5000 mV
mV2500 ± 2500 mV
mV250 ± 250 mV
mV25 ± 25 mV
mV7_5 ± 7.5 mV
mV2_5 ± 2.5 mV
autorange mV2_5 to mV5000; datalogger tests for and uses most
suitable range
mV250C ± 250 mV, checks for open input
mV25C ± 25 mV, checks for open input
mV7_5C ± 7.5 mV, checks for open input
mV2_5C ± 2.5 mV, checks for open input
autorangeC mV2_5 to mV250; datalogger checks for open input,
then tests for and uses most suitable range. Inputs >250
mV will overrange.

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.

AutoRange allows the CR1000 to automatically choose the voltage range


to use. The CR1000 AutoRange makes two measurements. The first
measurement determines the range to use. It is made with the 250µS
integration on the ± 2500mV range. The second measurement is made on
the appropriate range using the integration specified in the instruction.
AutoRange optimizes resolution but takes longer, and more power, than a
measurement on a fixed range because of the two measurements required.
If time permits, this option will result in the best resolution with the least
amount of effort.

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.

Table 3.1.6-4 TC Type Options


Alpha Code Numeric Code Thermocouple Type
TypeT 0 Copper Constantan
TypeE 1 Chromel Constantan
TypeK 2 Chromel Alumel
TypeJ 3 Iron Constantan
TypeB 4 Platinum Rhodium
TypeR 5 Platinum Rhodium
TypeS 6 Platinum Rhodium
TypeN 7 Nicrosil-Nisil (NiCRSi-NiSiMg)
TReference: The name of the variable that is the reference temperature for the
thermocouple measurements.
Reverse Diff: Option to reverse inputs to cancel offsets. The sign corrected average of
these measurements is used in the result. This technique cancels voltage
offsets in the measurement circuitry but requires twice as much time to
complete the measurement.

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.

Table 3.1.6-5 Settling Time Options


Entry Range Integration Settling Time
0 All 250 us 450 us (default)
0 All _50Hz 3 ms (default)
0 All _60Hz 3 ms (default)
>100 All All ms entered

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.

Table 3.1.6-6 Integration Options


Option Description
250 Performs a 250 microsecond integration.
_60Hz Performs a 16.667 millisecond integration; filters 60 Hz
noise. Minimum Settling Time is 3 ms.
_50Hz Performs a 20 millisecond integration; filters 50 Hz
noise. Minimum Settling Time is 3 ms.

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

The TCDiff Dialog box is depicted in Figure 3.1.6-2.

FIGURE 3.1.6-2. CRBasic Editor’s TCDiff Dialog Box

►► CRBasic Exercise 3.1.6.-1 continued


Start with CRBasic1.CR1. Add the following measurement instructions:
Battery PanelTemp TCDiff
Measure TCDiff on Differential channel 1.

3.1.6.4 Save and Compile


CRBasic has a pre-compiler for the CR1000. It may not catch all errors. Those
that it misses may be identified when the program is sent to the datalogger.

►► CRBasic Exercise 3.1.6.-1 continued


Save and Compile program to check for program errors.
3.1.6.5 Multipliers and Offsets
Each measurement instruction has a specific output. Use multipliers and
offsets to change the results to “engineering units” or other units.

The TCDiff instruction is used to make a thermocouple measurement on a


differential channel and convert the measurement to degrees Celsius. The last
two parameters of the instruction are the multiplier and offset. In the following
example the results are degrees Celsius:

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

►► CRBasic Exercise 3.1.6.-1 continued


Objective: Add an additional thermocouple measurement (on
Differential channel 2) but report the results in degrees Fahrenheit.
Save and Compile program to check for program errors.
• Declare a new variable, AirTemp2_F.
• Use a new TCDiff instruction to measure a second TC on channel 2.
• Save and Compile in CRBasic.
• Use the Connect screen to send the revised program to the datalogger
and view the variables.
3.1.6.6 Data Tables
Data tables define what data is stored in the long-term memory of the
datalogger or PC Card to be retrieved later to a file on the PC. Use the
DataTable instruction in your CRBasic program to identify items to be
stored in the final storage (long-term) memory of the datalogger. A CR1000
program can have up to 30 DataTables declared.

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.

A DataTable program construct has the following structure:


DataTable(Name,Trigger,Size)
DataInterval(TimeIntoIntv,Intv,Units,Lapses) (Optional)
DataEvent(RecBefore,StartTrig,EndTrig,RecAfter) (Optional)
<Additional Table Modification Instructions> (Optional)
<Output Processing Instructions> (At least one is recommended)
EndTable

3.1.6.6.1 DataTable Instruction


The DataTable instruction marks the beginning of a block of instructions
which specify the outputs for a particular table. It also defines the Name,
Trigger condition, and Size of an output table. The EndTable statement
designates the end of the output table definition. All output instructions
pertinent to a particular table must appear between the DataTable/EndTable
instructions. All DataTables must be defined in the declarations area of the
program (i.e., prior to the BeginProg statement). After a DataTable has been
defined, it must be called (i.e. activated) within the main program or a
subroutine using the CallTable statement in order to process or store its data.

The syntax for the DataTable instruction is:


DataTable(Name, Trigger,Size)
Descriptions for the DataTable instructions’ parameters follow:
Name: Can be up to 20 characters in length. It must start with a letter and can contain
numbers and underscores (_). It cannot contain spaces.

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.

3.1.6.6.2 DataTable; Ring Memory versus Fill and Stop


DataTables are set as ring memory by default. With this setting, when the
allocated space for a table fills up, the oldest records in the table begin to be
overwritten by the newest arriving records. You need to collect data in a
“ringing” table before it gets to this point in order to avoid data loss. If it is
desired to stop data storage once the table fills, a FillStop Table Modification
instruction may be used after the DataTable or DataInterval instruction.

►► CRBasic Exercise 3.1.6.-1 continued


Start with CRBasic1.CR1. Add a Data Table called MAIN using the
DataTable/EndTable construct. Use the Sample instruction to store the
values of variables Batt_Volt, RefTemp, AirTemp, and AirTemp2_F. Add a
CallTable instruction after the measurements in the main Scan. Save and
Send the program to the CR1000. Monitor the values.
3.1.6.6.3 Table Modification Instructions
The Table Modification instructions include DataInterval, DataEvent,
CardOut, FieldNames, OpenInterval, and TableHide. The DataInterval,
CardOut, and DataEvent instructions will be described in this Section. Other
Table Modification Instructions are described later in Section 3.9.2, DataTable
Modifiers.

3.1.6.6.3.1 Table Modification Instructions: DataInterval


The DataInterval instruction is used to set a regular time interval for a table’s
data storage based on the datalogger's real-time clock. Use this instruction
when you want a table to store its data at a different interval from the interval
at which the table is called.

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

at a longer interval than the interval at which it is called is to calculate statistics


from multiple values stored up during that longer interval (during the table
output interval).

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.

The DataInterval instruction is optional and has the following syntax:

DataInterval(TimeIntoIntv,Intv,Units,Lapses)

Descriptions for the DataInterval instructions’ parameters follow:

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

Figure 3.1.6-3 Time Into Interval Schematic

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

If lapses happen frequently during program execution, the space taken up


by the "extra" timestamps significantly reduces the number of records
stored in a data table. The Lapses argument of the DataInterval instruction
helps alleviate this problem by allocating extra memory in a table’s size for
a fixed number of lapses. After the specified number of lapses has been
exceeded during program execution, the number of records stored in a
table, as it rings or fills, will be reduced from the number of records
specified by the DataTable instruction because some of the allocated
memory will be used to record additional timestamps.

Example of a DataTable construct with DataInterval:


DataTable (Test,1,1000)
DataInterval (0,15,Sec,10)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,batt_volt, FP2)
EndTable

Set the DataInterval’s Lapse parameter to 0 to force the


storage of a timestamp with every record. To make efficient use of
the datalogger’s memory, a timestamp is not stored with each record in a
table that uses the DataInterval instruction (i.e. in an interval-driven table).
A timestamp is periodically written to a reference record in the table (i.e. a
"timestamp header") which enables the timestamp of the other records in the
group to be calculated using the known table interval and record number
offsets. For an interval-driven table the timestamps for most of the records
are calculated and stored only when the data is finally retrieved to a file on
the user’s PC

►► CRBasic Exercise 3.1.6.-1 continued


Start with CRBasic1.CR1. Add a DataInterval instruction such that data will
be store to the Data Table Main every 5 seconds. Send the program to the
logger and monitor the variables values.

3.1.6.6.3.2 Table Modification Instructions: CardOut


The CFM100 Compact Flash Module and the NL115 Compact Flash module
with EtherNet Interface are optional peripherals that can be used to expand the
CR1000’s memory. The CardOut instruction is used to direct final storage of
a table to the compact flash card. The CardOut instruction must be entered
within each DataTable declaration that is to store data on a CF card.

DataTable(Table1,True,-1)
DataInterval (0,1,Min,10)
CardOut (0,-1)
…. additional output instructions
EndTable

The CardOut instruction has this structure:

CardOut(StopRing, Size)

StopRing Enter 0 for a Ring mode table, 1 for a Fill and Stop table.

Size The number of records to be included in the DataTable on the card.

3-26
Section 3. CRBasic and Measurements

►► CRBasic Exercise 3.1.6.-1 continued; CardOut Instruction


Start with CRBasic1.CR1. Add a CardOut instruction to data table main. Setup
the card with 1000 records and with Ring memory.

3.1.6.6.3.3 Table Modification Instructions: DataEvent


The DataEvent instruction is used to store data to a DataTable for a specified
period of time when certain conditions are met. Trigger events can be specified
to determine when data storage begins and when data storage ends.
Additionally, a number of records to store before and/or after the beginning
and ending of the event can be stored. A Filemark is automatically stored in
the table between each event.

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.

The DataEvent instruction has the following syntax:

DataEvent( PreStartTrigRecs, StartTrig, StopTrig, PostStopTrigRecs )

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.

NOTE To reduce processing time, the DataInterval instruction, with at


least 1 lapse, should always precede the DataEvent instruction.
Usually in this case you would also set the DataInterval’s Interval
parameter to match the scan interval (CallTable interval).

In the following example, data is only stored when the difference in


temperature (DeltaT_C) is greater than or equal to 3. No pre-event or post-
event records are stored.

3-27
Section 3. CRBasic and Measurements

'Event Driven Data Table


DataTable(Event,True,1000) 'Important – specify explicit size of 1000
DataInterval (0,1,Sec,10)
DataEvent (0,DeltaT_C>=3,DeltaT_C<3,0)
Maximum (1,AirTemp_C,FP2,0,False)
Minimum (1,AirTemp_C,FP2,0,False)
Sample (1,DeltaT_C, FP2)
EndTable

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.

FIGURE 3.1.6-4. Single Trigger Event, 10 records before 10 Records After

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-5. Single Trigger Event, 10 records before 30 Records After

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).

FIGURE 3.1.6-6. Single Trigger Event, 10 records before 40 Records After

3-29
Section 3. CRBasic and Measurements

►► CRBasic Exercise 3.1.6-2; Data Event: CRBasic1_Trigger.CR1


Start with the program CRBasic1.CR1. Save the program under the name
CRBasic_Trigger.CR1. Change the DataInterval Instruction so that data will be
stored to the Data Table every Scan. Add a trigger using the DataEvent
instruction. Store 3 records pre-trigger and 5 records post-trigger. Use the
condition of AirTemp> 27 for the start trigger and AirTemp2_F > 80 for the
stop trigger. Send the program and verify operation (Trigger the Data Table 3
or 4 times). Press on the “Remove Button” on the CFM100 or NL115 to insure
that all of the data is flushed to the Card. Collect the data on the Card through
Logger Files. Use the Card Convert utility to convert the raw binary file into
ASCII, processing the File Marks and note that the single file is separated into
multiple files based on the File Marks’ locations. View the associated files
using the “View Files” button in the Card Convert utility. Convert the data
again without processing File Marks to see the complete data set.

3.1.6.6.4 Output Processing Instructions


In addition to the Sample (see Section 3.1.3.1.4 for more information on
Sample) output instruction, Campbell Scientific dataloggers allow for the
calculation and storage of statistical information on the measurements being
monitored through the use of the defined Output Processing Instructions.
These instructions include Average, Maximum, Minimum, StdDev and
Totalize. Advanced statistical output instructions include Histogram,
Covariance, Moment, Median, LevelCrossing, Rainflow, FFT,
WindVector, and ETsz.

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

3.1.6.6.4.1 Average Output Processing Instruction


The Average output processing instruction is used to store the average value of
the source variable, over the output interval, into a specified data table. The
Average, StdDev, and Totalize instructions all have similar syntax:

Average( Reps, Source, DataType, DisableVar )


Totalize( Reps, Source, DataType, DisableVar )
StdDev( Reps, Source, DataType, DisableVar )

This training manual will cover the Average instruction.


The Average instruction is placed inside a DataTable declaration.
Descriptions for the Average instruction’s parameters follow:

Reps The Reps (repetitions) argument specifies the number of elements in an


array for which multiple averages, totals, deviations, maximums or
minimums will be calculated. For example, with the Average instruction,
this argument enables distinct averages for multiple measurements to be
calculated and stored with one instruction. Use 1 for this parameter if you
wish to calculate and store averages for a single measurement value.

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.

DisableVar The DisableVar is a Constant, Variable, or Expression that is used to


determine whether the current measurement is included in the average
saved to the DataTable. The value will be included in the calculation of the
average if DisableVar evaluates as false or zero. The value will be
excluded if the parameter evaluates to true or non-zero. If DisableVar is an
array and Reps are greater than 1, a different DisableVar will be used for
each rep. Example 3.1.6-3 uses False for the disable variable parameter so
that all readings will be included in the average (i.e., the value is never
disabled).

An expression can be used for this argument, e.g. “RefTemp=NAN”. If the


expression evaluates as False, the current value will be included in the
processed statistic. If it evaluates as true, the current value will not be
included. When used this way, the DisableVar argument can prevent
unwanted measurements, such as NANs (the average of 19 good values and
1 NAN will be NAN), from impacting the statistical calculation.

Following is an example of the Average instruction:


Average(1, MTemp, FP2, 0)

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).

Public TC, RefTemp


DataTable (Temp,1,2000)
DataInterval(0,100,msec,10)
Average(1,RefTemp,IEEE4,TC=NAN)
EndTable
BeginProg
Scan(20,mSec,0,0)
PanelTemp (RefTemp,250)
TCDiff (TC,1,mV2_5C,1,TypeT,RefTemp,False,0,250,1.8,32)
CallTable Temp
NextScan
EndProg
Example Program 3.1.6-4 CRBasic Average Instruction

►► CRBasic Exercise 3.1.6.-1 continued


Start with CRBasic1.CR1. Add an Average instruction to the Main table to
write out the average of the AirTemp_F readings during the table interval (The
DataInterval specifies 5 times the main scan interval which causes 5 values to
be factored into each average). Save your program, send it to the datalogger,
and view the results in LoggerNet.

3-32
Section 3. CRBasic and Measurements

3.1.6.6.4.2 Maximum & Minimum Output Processing Instructions

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.

►► CRBasic Exercise 3.1.6.-1 continued


Add a 5 second maximum and minimum air temperature
(AirTemp2_F), and minimum battery voltage to Data Table Main. Save
and Send the program and monitor it using LoggerNet.

3.1.6.6.5 Data Storage Data Types


Data can be stored to Data Tables in multiple format types. Table 3.1.6-7
summarizes the 8 output types available.

TABLE 3.1.6-7. Data Storage Data Type Options

Data Type Description Size Range Resolution Where Used


IEEE4 IEEE four byte 4 bytes +/-1.8 *10^-38 to 24 bits All Output
floating point +/-1.7 *10^38 (about 7 digits) Instructions
FP2 Campbell Scientific 2 bytes -7999 to +7999 13 bits All Output
floating point (about 4 digits Instructions
Long 4-byte signed 4 bytes -2,147,483,648 to 1 bit (1) All Output
integer +2,147,483,647 Instructions
UINT2 2-byte unsigned 2 bytes 0 to 65535 1 bit (1) All Output
integer Instructions
Boolean 4-byte signed 4 bytes -1, 0 True (-1) or False Sample Output
integer with only ( 0) Instruction Only
two allowed values
BOOL8 1-byte signed 1 byte -1, 0 True (-1) or False Sample Output
integer with only ( 0) Instruction Only
two allowed values
String ASCII/ANSI String Set by ASCII/ANSI Sample Output
variable characters Instruction Only
declaration
NSEC Time Stamp 8 bytes Seconds since 1990 4 bytes of Sampled from
nanoseconds in Float or Long
the second values or from
timestamps

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).

Resolution and Range Limits of FP2 Data

Zero Minimum Magnitude Maximum Magnitude


0.000 ±0.001 ±7999.

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).

FP2 Decimal Location


Absolute Value Decimal Location
0 - 7.999 X.XXX
8 - 79.99 XX.XX
80 - 799.9 XXX.X
800 - 7999. XXXX.

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.

String, NSEC, and Boolean variables can


only be used with the Sample instruction.

3-34
Section 3. CRBasic and Measurements

►► CRBasic Exercise 3.1.6.-1 continued


Modify previous Data Type Exercise to output data in FP2, IEEE4, and Long
formats. Also include a Sample of the counter in the Long format and
“Name” in the String format.

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.

3.1.6.7 Array Notation and Repetitions


The use of array notation when declaring variables allows for compact program
code to perform operations on all variables of an array. This is also useful for
using distinct multipliers and offsets when calibrating an array of measurements.

3.1.6.7.1 Declarations using Array Notation


In a given measurement application there could be 3, 5, 10 or more similar
measurements to be made. For example, you might have 6 Type T
thermocouples, each measuring a distinct temperature. Rather than creating 6
different declarations using 6 different variable names, one declaration can be
made instead using a single variable name and a size (repetitions) of 6. The
declaration would look something like this:

Public TCTemp(6)

With this array of 6 elements declared, the references to individual


temperatures are given as TCTemp(1), TCTemp(2), TCTemp(3), ...
TCTemp(6). These 6 distinct elements of the array can be referenced together
(i.e., as a group) using the variable name TCTemp or TCTemp().

Unique names and units can be given to the individual elements of a variable
array though the use of the Alias and Units instructions:

Alias TCTemp(1) = Radiator : Units Radiator = Degrees_C


Alias TCTemp(2) = Exhaust : Units Exhaust = Degrees_C
Alias TCTemp(3) = Heater : Units Heater = Degrees_C
Alias TCTemp(4) = Air_Cond : Units Air_Cond = Degrees_C
Alias TCTemp(5) = Ambient : Units Ambient = Degrees_C
Alias TCTemp(6) = Seatback : Units Seatback = Degrees_C

NOTE Only individually aliased array elements can have an individual


Units declaration. A Units declaration on the array name will
always apply to the whole array.

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.

3.1.6.7.2 Output Instructions using Array Notation


As an example of a Data Table Output instruction’s use of repetitions, you
could use just one Sample instruction to store the results from all 6 Type T
thermocouples with code like this:

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 the element of an array is not specifically identified in an


Output instruction such as with “()”, then “(1)” is implied.
Using “TCTemp()” is the same as “TCTemp(1)” and the same as
“TCTemp”.

The first parameter of the Sample instruction represents the # of elements of


the array to store values for. The repetitions value of 6 indicates that 6 elements
of the TCTemp array should have their values stored. 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).

When the element of an array is not specifically identified in a Measurement


instruction, such as with “TCTemp()” or without any index identifier such as
“TCTemp”, then “TCTemp(1)” is implied (i.e. Using “TCTemp()” is the same
as “TCTemp(1)” or “TCTemp”)

3-36
Section 3. CRBasic and Measurements

When using repetitions in the Measurement instruction’ Destination parameter,


you may specify an element other than (1) as a starting point for the Dest
parameter simply by inserting the element # to start with (i.e. TCTemp(3)) .

To write Temperature measures into TCTemp(5) through (7), write code like
this:

VoltSE(TCTemp(5),3,mV2500,4,1,0,100,Mult,Offset)

Note that Repetitions is set at 3 to reference elements 5, 6 and 7.

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.

If variable arrays are used as the Multiplier and Offset parameters in


measurements that use repetitions, the instruction can automatically step
through the multiplier and offset arrays as it steps through the channels. When
this is done starting with element number 1, it allows a single measurement
instruction to measure a series of individually calibrated sensors. It does this by
applying the correct calibration (i.e. multiplier and offset values) to each
sensor. If the multiplier and offset are not arrays or a single element of an
array is entered for the multiplier or offset (ex: Mult(2), then the same
multiplier and offset are used for all repetitions.

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:

‘Declare variable arrays:


Public Pressure (5)
Dim Mult(5) = {0.123,0.115,0.133,0.105,0.116}
Dim Offset(5) ={0.231,0.234,0.236,0.222,0.209}

3-37
Section 3. CRBasic and Measurements

‘Apply multipliers and offsets:


VoltSE(Pressure(),5,mV1000,4,1,30,100,Mult(),Offset())

To write the measurement results into Pressure(3) through Pressure(5),


stepping through the Mult and Offset arrays, starting with their third elements,
for the instructions multipliers and offsets, write code like this:

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.

Example program 3.1.6-5 is set to measure 6 accelerometers. The first 4 will


be measured using one VoltDiff instruction with a 2500 mV range and the last
2 will be measured with a VoltDiff instruction with a 5000 mV range. It uses
a single array for both the Measurement result and the multipliers and offsets
applied to calculate the results.

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

Example Program 3.1.6-5. Array Notation

►► CRBasic Exercise 3.1.6-3; Array Notation: Arrays.CR1


Objective: Use CRBasic to create a new program to measure two Type T
thermocouples on sequential channels using a single TCDiff instruction. The
program will have the following requirements:

Measure once every second:


CR1000 panel temperature
Battery voltage
Use a single TCDiff instruction to measure two thermocouples:
Air temperature in degrees C with a Type T thermocouple
Air temperature in degrees F with a Type T thermocouple

Store once every five seconds:


Using one instruction: Average air temperature, in both degrees C and F
Using one instruction: Maximum air temperature, in both degrees C and F
Using one instruction: Minimum air temperature, in both degrees C and F

3-38
Section 3. CRBasic and Measurements

Store every One minute:


Using one instruction: Average air temperature, from both TC
Using one instruction: Maximum air temperature, from both TC
Using one instruction: Minimum air temperature, from both TC F
Minimum battery voltage

Save and Send:


Using the “Save and Send” button, save the program as Arrays.CR1 and send
the program to the datalogger and view the variables.

Hint: use snippets of the following:


'Declare Variable Arrays:
Public TC(2)
Public Mult(2) = {1.0,1.8)
Public Offset(2) = {0,32)
Alias TC(1) = Ambient1 : Units Ambient1 = Deg_C
Alias TC(2) = Ambient2 : Units Ambient2 = Deg_F

'Declare Tables; Output with One Instruction :


DataTable (OneMin,1,-1)
DataInterval (0,1,Min,10)
Average (2,TC(),FP2,False) ' use 2 repetitions
EndTable

'Measurement Instruction :
TCDiff (TC(),2,mV2_5C,1,TypeT,PTemp,True ,0,250,Mult,Offset)

3.1.6.8 SubScan Instruction


The SubScan/NextSubScan instruction block can be used for making
measurements at a faster rate than the main scan rate and/or used for
controlling multiplexers.

The SubScan instruction is used to control multiplexers or to measure some


inputs at a faster rate than the program scan and is similar to a simple For/Next
loop.

The SubScan/NextSubScan instructions are placed within the Scan/NextScan


construct of a program. It has the following syntax:
SubScan (SubInterval, Units, Count)
Measurement and Control instructions
NextSubScan
The SubScan instruction has the following parameters:
SubInterval Constant that designates the time interval between the start of subsequent
SubScans. Enter 0 for no delay between the end of one SubScan and the
beginning of the next SubScan (the SubScan will execute as quickly as
possible).
Units Unit of time to be used for the SubInterval parameter. The options are:
microseconds, milliseconds, seconds, and minutes.
SubRatio (also called Count) is a constant integer that is the number of times the
SubScan will run each time the scan runs. The maximum allowed value for
the SubRatio argument is 65,535.

3-39
Section 3. CRBasic and Measurements

NOTE SubScans cannot be nested. If placed in a SlowSequence Scan, the


interval parameter must be 0.
PulseCount and SDM measurements cannot be used within a SubScan.

3.1.6.8.1 SubScan Instruction used to Control a Multiplexer


One of the most common uses of the SubScan instruction is for controlling a
multiplexer. The primary function of a multiplexer is to increase the number of
sensors that can be measured by a datalogger. The multiplexer is positioned
between the sensors and the datalogger. Mechanical relays in the multiplexer
connect each of the sensor channels in turn to a common output destined for
the datalogger. The user program advances the multiplexer through the sensor
channels making measurements and storing data.

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.

FIGURE 3.1.6-7. Multiplexer Control Connections

The PortSet instruction enables or disables the multiplexer and the


SubScan/NextSubScan instruction begins/ends the measurement loop. The
program must also specifically increment an index variable and use that
variable to determine where each measurement is stored. The generalized
CRBasic programming sequence follows:

ACTIVATE MULTIPLEXER Portset (1 ,1) 'Set C1 high to Enable Multiplexer


INITIALIZE VARIABLE I TO 1 I=1
BEGIN MEASUREMENT LOOP SubScan(0,sec,16) 'Measures 16 sets
PULSE CLOCK PORT AND DELAY PulsePort (2,10000) ‘Set Port 2 Hi, delay 10 mSec, Set low
MEASURE BrFull(Var(I),1,mV7_5C,1,VX1,1,2500,-1,-1,0,500,1,0)
INCREMENT INDEX I=I+1
END MEASUREMENT LOOP NextSubScan
DEACTIVATE MULTIPLEXER Portset (1 ,0) 'Set C1 Low to disable Multiplexer

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:

ACTIVATE MULTIPLEXER Portset (1 ,1) 'Set C1 high to Enable Multiplexer


BEGIN MEASUREMENT LOOP For I = 1 to 16 'Measures 16 sets
PULSE CLOCK PORT AND DELAY PulsePort (2,10000) ‘Set Port 2 Hi, delay 10 mSec, Set low
MEASURE BrFull(Variable(I),1,mV7_5C,1,VX1,1,2500,-1,-1,0,500,1,0)
END MEASUREMENT LOOP Next I
DEACTIVATE MULTIPLEXER Portset (1 ,0) 'Set C1 Low to disable Multiplexer

Example Program 3.1.6-6 is for a CR1000 datalogger using C1 for Resetting


(RES) and C2 for Clocking (CLK) the multiplexer. The measurement channel
used will be Differential channel #1, and the excitation will be supplied by
excitation channel EX1. The measurement type will be a Full Bridge
measurement.

' ----------------------------------------------- WIRING ----------------------------------------------------------


‘CR1000 to AM16/32 Mux Control CR1000 to AM16/32 Common
' C1 (Control Port 1) Res (Reset) Diff 1H to Common Even Hi
' C2 (Control Port 2) Clk (Clock) Diff 1L to Common Even Lo
'G GND (Ground) EX1 to Common Odd L
' 12V 12 AG to Common Gnd
'\\\\\\\\\\\\\\\\\\\\\\\DECLARE VARIABLES & CONSTANTS ///////////////////////
Public MVpV(16) : Units MVpV = mV_V 'mV per Volt output from Bridge
Measurement
Dim I
'\\\\\\\\\\\\\\\\\\\\\\\\ OUTPUT SECTION ////////////////////////
DataTable(Table1,True,-1) 'Trigger, auto size
DataInterval(0,0,0,100) 'Synchronous, 100 lapses
Sample (16,mVpV(),IEEE4) ‘Sample raw mV per Volt values
EndTable 'End of table
'\\\\\\\\\\\\\\\\\\\\\\\\MAIN PROGRAM SECTION ////////////////////////
BeginProg 'Line 1 Program begins here
Scan(1,Sec,10,0) 'Line 2 Scan once a Second
PortSet (1 ,1 ) 'Line 3 Turn on AM16/32 using C1
I=1 ‘Line 4 Initialize I to 1
Delay (0,150,mSec) 'required Delay for AM16/32 multiplexer
SubScan (0,0,16)
PulsePort (2,10000) 'Pulse port C2 hi and low to clock the multiplexer
BrFull(MVpV(I),1,mV7_5C,1,VX1,1,2500,-1,-1,0,500,1,0) 'Full Bridge measurement
I=I+1 'Increment I
NextSubScan
PortSet (1 ,0 ) 'Turn off AM16/32 using C1
CallTable Table1
Next Scan ‘Loop up for the next scan
EndProg 'Program ends here

Example Program 3.1.6-6. Sub0Scan use with Multiplexers

3-41
Section 3. CRBasic and Measurements

►► CRBasic Exercise 3.1.6-4; SubScan.CR1


Objective: Use CRBasic to create a new program to measure the voltage
output from two Type T thermocouples on sequential channels on a
multiplexer using a single VoltDiff instruction within a SubScan/NextSubScan
construct. The program will have the following requirements:

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

Save and Send:


Using the “Save and Send” button, save the program as SubScan.CR1 and send
the program to the datalogger and view the variables.

' ----------------------------------------------- WIRING ----------------------------------------------------------


' CR1000 to AM16/32 Mux Control CR1000 to AM16/32 Common
' C1 (Control Port 1) Res (Reset) Diff 1H to Common Even Hi
' C2 (Control Port 2) Clk (Clock) Diff 1L to Common Even Lo
'G GND (Ground) EX1 to Common Odd L
' 12V 12V AG to Common Gnd
Public TempSensor(2)
Public Mult(2) = {200, 300}
Public Offset(2) = {2,5}
Dim I
DataTable (Main,1,1000)
Sample (2,TempSensor(),FP2)
EndTable
BeginProg
Scan (1,Sec,0,0)
PortSet (7,1 ) 'Turn On AM16/32 Mux
I=1
Delay (0,150,mSec) 'Delay only required for AM16/32A Muxes
SubScan (0,0,2) 'Loop through twice, once for each sensor
PulsePort (8,10000) 'Clock port 8 to tie into next bank
VoltDiff (TempSensor(I),1,mV7_5C,8,True ,0,250,Mult(I),Offset(I))
I=I+1
NextSubScan
CallTable Main
PortSet (7,0) 'Turn Off AM16/32 Mux
NextScan
EndProg

CRBasic Exercise 3.1.6-4. SubScan.CR1

3-42
Section 3. CRBasic and Measurements

3.1.7 Field Calibration of Linear Sensors


3.1.7.1 Definition of Calibration
Calibration increases accuracy of a measurement device by adjusting its output,
or the measurement of its output, to match independently verified quantities.
Calibration is periodically necessary when sensor drift or other variation in
sensor output has occurred.

Campbell Scientific’s approach to calibration uses a datalogger’s measurement


and computational capability to calculate the multipliers and/or offsets that will
be used by subsequent measurements. The process requires the ability to tie
raw outputs from the sensor to a known phenomenon in the desired engineering
units. For simple zeroing, this only requires the knowledge, or acceptance, of a
zero basis point. An example of this type of calibration would be a scale that
needed to be tared. A two point calibration requires two different “Known”
states. The logger records the sensor’s corresponding raw outputs at these
states. For a scale, this could entail loading it with 100 pounds and recording
the raw sensor output, then loading it with 400 pounds and again recording the
raw sensor output. Using these two points, we can calculate both the multiplier
and offset that should be used to convert the sensor’s raw output to the selected
engineering units (See Appendix E, Calibration of Linear Sensors for Data
Acquisition for more information about the mathematical techniques used for
calculating multipliers and offsets).

By using the FieldCal () or the FieldCalStrain () instructions in the CR1000


program, a linear output sensor can be Field calibrated through adjusting the
multiplier and/or offset.

Once programmed in the CR1000, calibration functions are accessed through a


software wizard (LoggerNet / RTDAQ | Datalogger | Calibration Wizard) or
through a numeric monitor procedure using optional keyboard display or
software.

Calibration wizards in both RTDAQ and LoggerNet 4.0


support the FieldCal () and FieldCalStrain () functionality.

When calibrating with a Campbell Scientific datalogger, known and measured


values are given as inputs. The results from the calibration then become the
new calibration factors used for the multiplier and offset variables in the
CRBasic program. These calculated multipliers and offsets are stored in a *.cal
file and, if needed, can automatically be reloaded upon program restart (such as
when a power-cycle occurs on the datalogger).

3.1.7.2 Cal File


CAL files are created if a compatible CAL file does not reside in logger
memory when a program using FieldCal or FieldCalStrain is compiled at
program start-up. This CAL file is created automatically on the same CR1000
memory drive and given the same name (with .cal extension) as the program
that creates and uses it, e.g., CPU:MyProg.CR1 generates CPU:MyProg.cal. It
should be noted that these CAL files cannot be opened or manipulated by the
user.

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.

A final storage output table should be configured to store the results of


calibrations that have been performed, and the date and time at which those
calibrations were performed. Only if the user creates this data storage output
table in the CR1000 program will a calibration history be maintained. This
Data Table should be collected, after calibrations are complete, to insure that
you have a history of the calibration coefficients used in determining the stored
output from the sensors.

3.1.7.3 FieldCal CRBasic Instruction


The FieldCal instruction has nine parameters. It should be placed in the
program below the measurement instruction whose multipler and offset it is
affecting. The syntax for the instruction is:

FieldCal(Function, MeasureVar, Reps, MultiplierVariable, OffsetVariable,


Mode, KnownVariable, Index, Avg)
Descriptions for the FieldCal instruction’s parameters follow:

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.

If either Reps is set to 0 or Index is set to a negative value, no calibration


will occur for this instruction. This is useful when two or more FieldCal
instructions share a Mode variable and only a single element of one of the
arrays should be calibrated.

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.

OffsetVar Two Point-Slope Only (Function = 3):


zero can be entered for this parameter (not used).

All other functions: Variable or Variable array which will be populated


with the computed Offset(s) from the calibration(s). OffsetVar 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 OffSetVar is equal to NAN prior to the calibration, then it
will be set equal to 0 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.

KnownVar Zero function(Function =0 ) and Zero Basis (Function = 4):


0 can be entered here (not used).
All other functions: Variable array that holds the set point value(s) to be
used in the calibration routine. KnownVar must be dimensioned to the
same size as the MeasureVar.

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

Note It is recommended that the Reps and Index parameters be non-


constant variables that are initialized to the desired values after the
BeginProgram instruction but before the LoadFieldCal
instruction. This rule can be ignored if setting up calibrations on
single element variables, and the Mode variable parameter for
each FieldCal instruction in the program is represented by a
unique variable.

3.1.7.4 FieldCal Support Instructions


The FieldCal instruction works together with other related CRBasic
instructions to complete the calibration task. The FieldCal family of
instructions are shown in Table 3.1.7-1.

TABLE 3.1.7-1. The FieldCal Instruction “Family”

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.1.7.5 The Four Types of Calibrations


The FieldCal instruction family can perform five basic kinds of calibrations:
Zeroing Calibration, Offset Calibration, Two-point Multiplier/Offset
Calibration (Linear Fit), Two-point Multiplier Only Calibration, and Zero
Basis Point. These calibration types are described below.

3.1.7.5.1 Zero Calibration (Function = 0)


Zeroing is the act of placing a sensor into a zero state, where the measurement
result should be zero, and changing the measurement’s offset variable such that
the measurement result is zero. This is accomplished through measuring the

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.

A simple example of zeroing would be removing all items from a scale


designed to weigh objects. With nothing on the scale, this is the condition in
which the scale should give a “zero” reading for its output. The calibration is
triggered and the offset is adjusted such that the logger returns a zero reading
for that condition.

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.

When writing a program for a Zero function for an array of sensors,


using a single instruction, and it may be desirable to zero all of them in a
single scan, then:
1. The Reps parameter should be a variable whose value is initialized to the
size of the MeasureVar variable array and the Index parameter should be
a variable whose value is initialized to 1.
2. The OffSetVariable should be dimensioned to have the same number of
elements as the MeasureVar variable array.

Example program 3.1.7-1 sets up a measurement instruction with 6 reps for a


zero calibration.
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 Variable for the Calibration
Public RepsZero, ModeZero, IndexZero, AvgZero, LoadTest
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 (0,Accel(),RepsZero,0,Offset(),ModeZero,0,IndexZero,AvgZero)
CallTable Main
CallTable Calib
NextScan
EndProg

Example Program 3.1.7-1. FieldCal Instruction for Zeroing

3-47
Section 3. CRBasic and Measurements

3.1.7.5.2 Offset Calibration (Function = 1)


Offset Calibration is the act of placing a sensor into a state where the output
condition is known to be a certain value and then changing the measurement’s
offset variable such that the logger measurement result is exactly that value. It
is similar to a zeroing calibration, except that the known value is a non-zero
value. By measuring the output of the sensor in this specialized condition (the
known offset condition), the offset variable will be changed to ensure that this
condition results in a measurement value that matches it. Note that this process
only changes the offset variable that is shared between the measurement
instruction and the FieldCal instruction. The multiplier variable is unaffected.

A simple example of offset calibration would be placing an object of known


weight (such as 10 lbs.) on a scale designed to measure the mass of objects.
With a known weight on the scale, this is the condition in which the scale
should give a known reading for its output. First the calibration is triggered,
then the user informs the datalogger about the value of the known weight, and
finally the offset is adjusted to ensure that the scale gives a properly matched
reading for that condition.

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.

When writing a program for an offset function for an array of sensors,


using a single instruction, and it may be desirable to perform the offset
function on all elements of the array during a single scan then:
1. The Reps parameter should be a variable whose value is initialized
to the size of the MeasureVar variable array and the Index
parameter should be a variable whose value is initialized to 1.
2. The OffSetVariable should be dimensioned to have the same
number of elements as the MeasureVar variable array, and
3. The KnownVariable should be dimensioned to have the same
number of elements as the MeasureVar variable array. If desired,
the KnownVariable array elements can be initialized, in the
program, with the offset values for the elements of the
MeasureVar array,

Example program 3.1.7-2 sets up a measurement instruction with 6 reps for a


Offset calibration.

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

Example Program 3.1.7-2. FieldCal Instruction for Offset Calibration

3.1.7.5.3 Two-Point Multiplier and Offset Calibration (Function = 2)


The two-point multiplier and offset calibration sets the gain (slope) and offset
(intercept) using a linear fit technique using two different known states and the
output from the sensor at these states.

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

A simple example of a two-point multiplier and offset calibration would be


placing two objects of known weight (such as 5 lbs. and 15 lbs.) on a
conventional scale at two different times. With the first known weight on the
scale (5 lbs), this is the first condition in which the scale should give a
“known” reading at this condition. The calibration is triggered, the user
informs the datalogger of the value of the known weight, and the measurement
is read. The datalogger then notifies the user that it is ready to measure the
second point.

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.

To setup a 2-Point Multiplier and Offset calibration in the CRBasic program,


hard code the FieldCal instruction’s Function parameter to 2. The Calibration
Wizard can be used walk the user through the two different known conditions
and calculate the new multiplier and offset when the program is running in the
datalogger.

Example program 3.1.7-3 sets up a measurement instruction with 6 reps for a


Two Point multiplier and offset calibration.
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 (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

3.1.7.5.4 Two-Point Multiplier Only Calibration (Function = 3)


The two-point multiplier only calibration sets the gain or multiplier (slope)
using a linear fit technique using two different known states and the output
from the sensor at these states. The offset is unaffected by this calibration. t

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.

Example program 3.1.7-4 sets up a measurement instruction with 6 reps for a


Two Point Multiplier only calibration.

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

3.1.7.5.5 Zero Basis Point Calibration (Function = 4)


The purpose of this calibration function is to simply load pertinent variables’
values into zero point variables to track conditions at the time of the zero
calibration. The syntax for such a calibration would be:

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

G = the sensors gage factor

R0 = the sensor output at the zero state (out of water)

R1 = current output from the sensor

K = the sensors temperature correction coefficient

T0 = The recorded temperature at the time of the zero state

T1 = current temperature measurement result

S0 = The recorded barometric pressure at the time of the zero state

S1 = The current barometric measurement result

Example program 3.1.7-5 is based on such a setup.

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

Public GF1, Temperature1_K, LoadResult, ModeZero1


Public Flag(8), AVWRC

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)

'VW Piezometer measurement : Temperature and Pressure


AVW200(AVWRC,Com1,0,200,VW(1,1),1,1,1,1000,4000,1,_60Hz,1,0)
' Calculate digits and degrees C from the VW measurements
Digits1= (VW(1,1)^2)/1000
Temperature1 = 1/(1.4051E-3+2.369E-4*LN(VW(1,6))+1.019E-7*LN(VW(1,6))^3)-273.15
' Field zeropoints calibration for sensor
‘FieldCal(Function,MeasureVar,Reps,0,OffsetVar,ModeVar,0,Index,Avg)
FieldCal (4,Equation_Parameters(),3,0,ZeroFactor(),ModeZero1,0,1,1)
'Calculate Pore Pressure (PSI) using the Digits, Temperature and calibration constants
Pressure1 = (GF1*(Digit_ZeroPoint - Digits1) + Temperature1_K * (Temperature1 - Temperature_ZeroPoint) _
- (BaroPressure1 - Baro_Zero)*0.014503)
CallTable CalFact
CallTable Table1
NextScan
EndProg

Example Program 3.1.7-5 FieldCal Instruction for Zero Point

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:

Measure once every second:


Use a single VoltDiff instruction to measure two thermocouples.
Use a 2 element array called HotTips for the Dest parameter.
Alias HotTip(1) as GoodTip; HotTip(2) as BadTip
Use a 2 element array for the Mult and Offset parameters.
Initialize the Multipliers to 300
Initialize the Offsets to 5
Set up a Two-Point Multiplier and Offset Field Calibration and a Zero
Field Calibration on the Sensor with array called HotTips:
The Mult, Offset, and KnownVar arrays must all be dimensioned to the
same size as the Measured Variable (2 elements).
The Reps, Index, and Avg parameters for the FieldCal instruction should all
be declared as variables initialized to 1.
Store once every second in Data Table Main:
Using one instruction: a sample of both elements of the HotTips array.
Store once after every calibration in Data Table Calib:
Using one instruction: all calibration constants controlled by FieldCal
instructions in the program.
Save and Send:
Using the “Save and Send” button, save the program as FieldCal2Point.CR1
and send the program to the datalogger and view the variables.

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

3.1.7.6 Performing a Manual Calibration


The easiest method of performing a Field Calibration is to use the Calibration
Wizard supplied with Campbell Scientific’s LoggerNet or RTDAQ software
packages. The process can also be accomplished through manually changing
the state of the mode variable. This section walks the user through this
process.

3.1.7.6.1 Mode Variable used for Calibration Status and Control


To perform a manual calibration (without use of the RTDAQ Calibration
Wizard) on a FieldCal enabled program running in a datalogger, it is necessary
to understand the function of the mode variable that is used as an parameter of
the FieldCal instruction.

In a CRBasic calibration program, a mode variable is declared and associated


with a particular FieldCal instruction, thereby associating it with the
measurement to be calibrated.

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

NOTE For Zeroing and Offset calibration, a mode value of 4 is never


used. The entire calibration process is initiated with the mode
value being set to 1.

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.1.7.6.2 Using the Mode Variable for Zero Calibration Types


These steps demonstrate how to manually perform a Zero Calibration through
manipulating the value of the Mode variable:
ZERO CALIBRATION STEPS (Function = 0)
1. Ensure the status (value of the mode variable) is 0 or 6 before you start.
A. A number greater than 0 that is not 6 indicates that a calibration is in
progress or that the last calibration did not complete properly.
B. A number less than 0 indicates that the calibration process encountered an
error. Resolve the error before proceeding with the calibration then set the
mode value to zero for a fresh start
2. If the Reps and Index parameters are constants, go to Step 3.
If the Reps and Index parameters are variables then either:
A. Individual Sensor Cal: Set the Reps parameter to 1 and select the
individual sensor to be zeroed by setting the Index parameter or;
B. Complete Array Cal: Set the Index parameter to 1 and the Reps
parameter to the number of elements in the MeasVar variable array. This
will zero all of the elements of the array together.
3. Set the Avg parameter to the desired # of measurements to average for the
calibration calculation.
4. Subject the sensor(s) to the zero condition.
5. Change the Mode variable to 1 while the sensor(s) are at their Zero state.
6. The datalogger automatically sets the mode variable to 2 during the calibration
process.
7. The mode variable is set to 6 automatically by the datalogger when the
calibration process completes.
3.1.7.6.3 Using the Mode Variable for Offset Calibration Types
These steps demonstrate how to manually perform a Offset Calibration through
manipulating the value of the Mode variable:
OFFSET CALIBRATION STEPS (Function = 1)
1. Ensure the status (value of the mode variable) is 0 or 6 before you start.
A. A number greater than 0 that is not 6 indicates that a calibration is in
progress or that the last calibration did not complete properly.
B. A number less than 0 indicates that the calibration process encountered an
error. Resolve the error before proceeding with the calibration then set the
mode value to zero for a fresh start
2. If the Reps and Index parameters are constants, go to Step 3.
If the Reps and Index parameters are variables then either:
A. Individual Sensor Cal: Set the Reps parameter to 1 and select the
individual sensor to be zeroed by setting the Index parameter or;
B. Complete Array Cal: Set the Index parameter to 1 and the Reps
parameter to the number of elements in the MeasVar variable array. This
will zero all of the elements of the array together.
3. Set the Avg parameter to the desired # of measurements to average for the
calibration calculation.
4. Subject the sensor(s) to the Offset condition(s).
5. Populate the KnownVar variable array with the desired offset value(s).
5. Change the Mode variable to 1 while the sensor(s) are at their Offset state.
6. The datalogger automatically sets the mode variable to 2 during the calibration
process.
7. The mode variable is set to 6 automatically by the datalogger when the
calibration process completes.

3-56
Section 3. CRBasic and Measurements

3.1.7.6.4 Using the Mode Variable for 2-Point Calibration Types


These steps demonstrate how to manually perform either a Two-Point
Multiplier and Offset Calibration or a Two-Point Multiplier Only
Calibration through the manipulation of the value of the Mode variable:

TWO POINT CALIBRATION STEPS (Function = 2 OR 3)


1. Ensure the status (value of the mode variable) is 0 or 6 before you start.
A. A number greater than 0 that is not 6 indicates that a calibration is in
progress or that the last calibration did not complete properly.
B. A number less than 0 indicates that the calibration process encountered an
error. Resolve the error before proceeding with the calibration then set the
mode value to zero for a fresh start
2. If the Reps and Index parameters are constants, go to Step 2.
If the Reps and Index parameters are variables then either:
A. Individual Sensor Cal: Set the Reps parameter to 1 and select the
individual sensor to be zeroed by setting the Index parameter or;
B. Complete Array Cal: Set the Index parameter to 1 and the Reps
parameter to the number of elements in the MeasVar variable array. All
of the elements of the KnownVar array will have to be set in steps 5 and 8
below. This will calibrate all of the elements of the array together.
3. Set the Avg parameter to the desired # of measurements to average for the
calibration calculation.
4. Subject the sensor(s) to the first Known condition(s).
5. Populate the KnownVar variable array or single element with the first “known
value(s)”, in the desired engineering units, for this condition.
5. Change the Mode variable to 1 while the sensor(s) are at their 1rst known state.
The logger will record this first point(s) and its corresponding voltage
output(s).
6. The datalogger automatically sets the Mode variable to 2 during the first step
of the calibration process.
7. The Mode variable is set to 3 automatically by the datalogger when the first
step of the calibration process is complete. The datalogger is waiting for the
user to place the system into the second point condition.
8. Subject the sensor(s) to the second Known condition(s).
9. Populate the KnownVar variable array, or single element, with the second
“known value(s)”, in the correct engineering units, for this condition.
10. Change the Mode variable to 4 while the sensor(s) are at their 2nd known state.
The logger will record this second point(s) and its corresponding voltage
output(s).
11. The datalogger automatically sets the Mode variable to 5 during this step of the
calibration process. It is during this time that the logger measures the output
from the sensor at the second state and calculates the new calibration factors.
12. If the calibration is successful, the logger changes the state of the Mode
variable to 6.

3-57
Section 3. CRBasic and Measurements

3.1.7.7 Using the Calibration Wizard with Running Programs


The RTDAQ Calibration Wizard provides an easy to use interface which
steps the user through the calibration process described above. By using
simple screens to gather information, the proper changes to the mode variable
and known measurements are performed automatically by the Wizard. The
user only needs to set the sensors to the known value(s), and provide a few
required inputs to the Wizard. This greatly simplifies the user’s interaction
with the sensors and datalogger program.

3.1.7.7.1 Calibration Wizard Basic Operation


When a program with one or more FieldCal instructions is running on a
datalogger, and RTDAQ is connected to that datalogger, you can select
Datalogger | Calibration Wizard from the RTDAQ menu to start the Wizard.
A list of measurements referenced from one or more FieldCal instructions used
within the program is then displayed to the user. The user selects a
measurement for calibration and moves forward by entering known values, if
necessary, and triggering calibration steps.

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.

Enter the number of measurements to be averaged for each step of the


calibration process and click on “Next”.

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

3.1.7.7.3 Using the Wizard to Perform Zeroing Calibrations


In the Wizard, select Zero for the type of calibration.

Select the sensor you wish to calibrate, press Next.

If the variable is configured as an array of sensors, you may select an


individual item to calibrate only that element, or you can select the entire array.

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.1.7.7.4 Using the Wizard to Perform Offset Calibrations


In the Wizard, select Offset for the type of calibration.

Select the sensor you wish to calibrate, press Next.

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.1.7.8 Strain and Shunt Calibration


In addition to the FieldCal instruction that performs calibrations on
measurements, there is a specialized instruction for performing Shunt and Zero
calibrations on strain bridge measurements. This instruction is called
FieldCalStrain. It functions in a similar manner to the FieldCal instruction,
but has additional arguments to meet the specialized needs for strain gauge
calibrations. It uses the same calibration file (*.cal) as well as the other utility
calibration instructions (SampleFieldCal, NewFieldCal, LoadFieldCal). For
more information about how to use these instructions, refer to the Section 4.1
in this manual, FieldCalStrain instruction section of your datalogger manual,
or refer to the online help topic for FieldCalStrain within the CRBasic Editor.

3-64
Section 3. CRBasic and Measurements

3.2 Analog Voltage Measurements


Analog sensors are connected to analog terminals. Analog terminals can be
configured as either Single-ended (measured with respect to ground) or
Differential (measured with respect to another input channel). There are 8
Differential or 16 Single Ended Channels on the CR1000 datalogger.

Differential Single-Ended Differential Single-Ended


Channel Channel Channel Channel
1H => 1 5H => 9
1L => 2 5L => 10
2H => 3 6H => 11
2L => 4 6L => 12
3H => 5 7H => 13
3L => 6 7L => 14
4H => 7 8H => 15
4L => 8 8L => 16

3.2.1 Programmable Gain Input Instrumentation Amplifier


Campbell Scientific dataloggers incorporate a programmable gain input
instrumentation amplifier (PGIA), as illustrated in Figure 3.2-1. The voltage
gain of the instrumentation amplifier is determined by the user selected range
code associated with voltage measurement instructions. The instrumentation
amplifier can be configured to measure either single-ended (SE) or differential
(DIFF) voltages.

For SE measurements the voltage to be measured is connected to the H input


while the L input is internally connected to the signal ground ( ) on the
wiring panel.

For DIFF measurements, the voltage to be measured is connected between the


H and L inputs on the instrumentation amplifier.

FIGURE 3.2-1. Programmable Gain Instrumentation Amplifier

3-65
Section 3. CRBasic and Measurements

An instrumentation amplifier processes the difference between the H and L


inputs, while rejecting voltages that are common to both with respect to the
datalogger ground.

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.

FIGURE 3.2-2. PGIA with Input Signal Decomposition

3.2.1.1 PGIA Input Limits


The Input Limits specifies the voltage range, relative to datalogger ground,
which both H and L input voltages must be within to be processed correctly by
the PGIA. Input Limits for the CR1000, CR3000, and CR5000 dataloggers are
all ±5 V. Input voltages in which VH or VL are beyond the ±5 V Input Limits
may suffer from undetected measurement errors.

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,

Common-mode Range = ± | Input Limits – Vdm/2 |,

This indicates a reduction in Common-mode Range for increasing DIFF signal


amplitudes. For example, with a 5000 mV DIFF signal, the Common-mode
Range is reduced to ±2.5 V, whereas Input Limits are always ±5 V. Hence for
non-negligible DIFF signals, "Input Limits" is more descriptive than
"Common-mode Range."

Example 3.2.1-1: Take the case of a type K thermocouple at about 246


degrees C (thermoelectric voltage of 10 mV) that is floating with a static
charge of 1000 mV. In this case, Vcm = 1000 mV, Vdm= 10 mV, VH =
1005 mV, and VL = 995 mV (See Figure 3.2-3). A valid Differential
measurement can be made using the mV25 range code because the 1000
mV static charge is within the common mode range, the Diff voltage is
below 25 mV, and the total voltage on both the H (VH) and L (VL) inputs
are within the ±5 V Input Limits of the CR1000.

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

FIGURE 3.2-3. Sensor Wired to Differential Channel 1 (Example 3.2.1-1)

3.2.1.2 Nulling of Residual Common Mode Voltage


Range Code C option: Open Sensor Detect

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

Open Input Detect Cautionary Notes

• 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.

3.2.1.3 Voltage Range Selections


The resolution of a measurement is one part in 7500 over the full scale range
(FSR). In general, a voltage measurement should use the smallest fixed input
range that will accommodate the full scale output of the sensor being
measured. This results in the best measurement accuracy and resolution. The
CR1000 has fixed input ranges for voltage measurements and an auto range to
automatically determine the appropriate input voltage range for a given
measurement. Table 3.2-1 lists input voltage ranges and range codes.

TABLE 3.2-1. Analog Voltage Input Ranges with Options for Common
Mode Null (CMN) and Open Input Detect (OID)

Range Code Description


1
mV5000 measures voltages between ±5000 mV
mV25002 measures voltages between ±2500 mV
2
mV250 measures voltages between ±250 mV
mV252 measures voltages between ±25 mV
2
mV7_5 measures voltages between ±7.5 mV
mV2_52 measures voltages between ±2.5 mV
3
AutoRange datalogger determines the most suitable range
1
Append with "C" to enable CMN/OID and set excitation to full-scale DAC
(~2700 mV)
2
Append with "C" to enable CMN/OID
3
Append with "C" to enable CMN/OID on ranges ≤ ±250 mV, CMN on ranges >
±250 mV

3-68
Section 3. CRBasic and Measurements

AutoRange allows the CR1000 to automatically choose the voltage range to


use. The CR1000 AutoRange makes two measurements. The first
measurement determines the range to use. It is made with the 250µS
integration on the ± 2500mV range. The second measurement is made on the
appropriate range using the integration specified in the instruction. AutoRange
optimizes resolution but takes longer, and more power, than a measurement on
a fixed range because of the two measurements required. To avoid problems
with a signal on the edge of a range, AutoRange selects the next larger range
when the signal exceeds 90% of a range.

3.2.2 Single Ended (SE) Voltage Measurement Details


A single-ended measurement is made on a single input which is measured
relative to the datalogger’s analog ground. The voltage to be measured is
connected to the H input of the PGIA (see Figure 3.2-1) while the L input is
internally connected to the signal ground ( ) on the wiring panel. There are
two SE channels per Differential (DIFF) channels. Each DIFF channel can
independently be used as two SE channels or one DIFF channel.

3.2.2.1 SE Voltage Wiring


Note that there are two sets of labels for the analog inputs on Campbell
Scientific dataloggers. On the CR1000, the lower white set, with the DIFF
label, refers to the differential channels. The upper blue set, with the SE label,
refers to the Single Ended channel number. So in Figure 3.2-4, the sensor is
tied to Single Ended channel #2, which would be the low side of Differential
channel #1.

FIGURE 3.2-4. Sensor Wired to Single-Ended Channel #2

3.2.2.2 SE Voltage Pros and Cons, Issues with Using


Pros: Useful for sensors that are designed for SE measurements.

Can double the number of sensors that can fit on the wiring panel.

Sensors with a high signal-to-noise ratio, such as a relative humidity


sensor with a full scale output of 0 to 1000 mV, can normally be

3-69
Section 3. CRBasic and Measurements

measured using a single-ended input without a significant reduction


in accuracy or precision.

Cons: No Common mode noise rejection. One of the benefits of a DIFF


measurement is that common mode noise injected on both the low
and high inputs, are rejected by the Instrumentation amplifier. See
Section 3.2.1. With a SE measurement, the low side of the IA is tied
to ground, pulling the noise on the low side to ground. This
essentially eliminates the IA’s capability of nulling common mode
noise.

Ground potential errors could exist. Because a single ended


measurement is referenced to CR1000 ground, any difference in
ground potential between the sensor and the CR1000 will result in an
error in the measurement. For example, if the measuring junction of
a copper-constantan thermocouple being used to measure soil
temperature is not insulated, and the potential of earth ground is 1 mV
greater at the sensor than at the point where the CR1000 is grounded,
the measured voltage will be 1 mV greater than the thermocouple
output, or approximately 25°C high. Differential measurements
MUST be used when the low input is known to be different from
ground.

Sensors with low signal-to-noise ratio, such as thermocouples, should


normally be measured differentially.

3.2.2.3 Which Instructions use SE Voltage Measurements


CRBasic measurement instructions BRHalf, BRHalf3W, TCSE, and VoltSE
perform Single Ended voltage measurements.

3.2.2.4 Expansion Peripherals


To extend the Voltage Limits of the CR1000, use the VDIV2:1 or the
VDIV10:1 Voltage Divider Terminal Input Modules.

The AM16/32B multiplexer can be tied into a two SE channels on the


datalogger, using the AM16/32B in the 2x32 mode, to measure 64 SE sensors.
A single Voltage Divider can be placed on the logger’s wiring panel for all 64
measurements.

3.2.2.5 Programming SE Voltage Measurements


The VoltSE instruction is used to make Single Ended voltage measurements on
one or more analog channels. It has the following format:

VoltSE( Dest, Reps, Range, SEChan, MeasOffset, Settling, Integ, Mult, Offset )

Parameters and their descriptions are listed next:

Destination — the variable in which to store the results of the measurement.

Repetitions — the number of sensors to be measured (or number of times the


measurement is made if SEChan is entered as negative). Measurements are
made on consecutive channels. If the Repetitions parameter is greater than 1,
the Destination parameter must be a variable array.

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.

MeasOff — Determines whether the ground offset voltage is measured before


the measurement is made on the analog channel. Analog measurement
circuitry in the CR1000 may introduce a small offset voltage to a measurement.
Depending on the magnitude of the signal, this offset voltage may introduce
significant error. For example, an offset of 3 μV on a 2500 mV signal
introduces an error of only 0.00012%; however, the same offset on a 0.25 mV
signal introduces an error of 1.2%. If the ground offset is measured, its value
will be subtracted from subsequent sensor measurements and the result stored
in the Dest variable.

0 = Offset voltage is corrected from background calibration; in most


cases this is adequate.

1 = Offset voltage is measured each scan which increases the


measurement time; used when offset is changing rapidly as it would
during rapid temperature changes.

SettlingTime — the amount of time to delay after setting up a measurement


and before making the measurement. Refer to Table 3.2-2 for default
SettlingTimes. See Section 5.1 for Settling Time issues.

TABLE 3.2-2. Settling Time Entries

Entry Range Integration Settling Time


0 All 250 us 450 us (default)
0 All _50Hz 3 ms (default)
0 All _60Hz 3 ms (default)
>100 All All ms entered

Integ — the amount of time, in microseconds, to integrate a signal for the


channel being measured. See Table 3.2-3.

TABLE 3.2-3. Integration Time Entries

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

3.2.2.6 SE Voltage Measurement Sequence and Timing


The sequence of a Single Ended (SE) voltage measurement is:
1. Setup the measurement and delay 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 SE
Voltage’s Integration parameter.
3. Perform the Analog to Digital conversion.

Figure 3.2-5 depicts the sequence and timing of a SE Voltage measurement


based on the Integration selected.

FIGURE 3.2-5. SE Voltage Measurement Sequence and Timing

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

3.2.2.7 SE Voltage Measurement Programs


Example Program 3.2.2-1 Barometric Pressure VoltSE Example
The VoltSE instruction is used to measure a CS100 barometric pressure
transducer. The CS100 includes a control line to turn it on and off. It is
desired to make and record a measurement once every hour. The CS100 has a
warm up period of 1 second, so we will turn it on 1 minute prior to making the
measurement. Calculate the multiplier and offset and write a program to do the
described.

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:

FIGURE 3.2-6. LogCalc.EXE

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.

FIGURE 3.2-7. X/Y Linear 2 Point Calculation

3-73
Section 3. CRBasic and Measurements

Use the calculated multiplier (0.2) and offset (600) for the measurement
instruction in the program.

FIGURE 3.2-8. VoltSE CRBasic Dialogue Box

'Program Name: Barometric.CR1


SequentialMode
Public pressure
Units pressure = mbar

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

►► Exercise 3.2.2-1 SE Voltage Hot Blooded Program


Create a program that performs a SE voltage measurement on your HotBlood
sensor (Type T Thermocouple). The sensor calibration data shows 0% Hot
blooded for an output of -0.5 mV and 100% Hot Blooded for an output of
+0.5 mV. Calculate the multiplier and offset, and e how Hot Blooded you are.

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.2.3 Differential (DIFF) Voltage Measurement Details


A differential measurement is made on two isolated inputs and the voltage
measured is the relative voltage between the two inputs. This is in contrast to
the SE voltage measurement where the voltage measured is with respect to
datalogger ground.

3.2.3.1 DIFF Voltage Wiring


When using differential measurements, the high side of the sensor output is
connected to the High side of the differential channel and the sensor’s low side
is tied to the differential channels Low. In Figure 3.2-9, the sensor is tied to
Differential channel #1.

FIGURE 3.2-9. Sensor Wired to DIFF Channel #1

3.2.3.2 DIFF Voltage Pros and Cons, Issues with Using


Pros: Common mode noise rejection. One of the benefits of a DIFF measurement is
that common mode noise injected on both the low and high inputs are rejected
by the Instrumentation amplifier. See Section 3.2.1. When a twisted pair of
wires is used, the noise that they see are usually common and will be rejected.
When using SE measurements, the low side of the IA is tied to ground, pulling
the noise on the low side to ground. This essentially eliminates the IA’s
capability of nulling common mode noise.
Ground potential errors eliminated. Since a differential voltage measurement
is not a measurement referenced to the datalogger ground, any difference in
ground potential between the sensor and the CR1000 will not result in an error
in the measurement. Differential measurements MUST be used when the low
input is known to be different from ground.
Measurement Resolution. Through using Input reversal, we can increase the
resolution and accuracy of the measurement over a SE measurement by a
factor of 2. See Appendix C for information on the benefits of using input
reversal.
Sensor requirements. Required for some sensors that dictate differential
measurements (such as any sensor using a Wheatstone bridge).
Cons: Uses two SE channels per sensor.
For floating differential sensors such as thermocouples, the voltages on the
inputs can float outside of the Voltage Limits of the logger. This can be
overcome through using the “C” option on the range code. Since the sensors

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.

3.2.3.3 Which Instructions use DIFF Voltage Measurements


CRBasic instructions BrFull(), BrFull6W(), BrHalf4W(), TCDiff(), and
VoltDiff() perform Differential voltage measurements.

3.2.3.4 Expansion Peripherals


To extend the Voltage Limits of the CR1000, use the VDIV2:1 or the
VDIV10:1 Voltage Divider Terminal Input Modules.

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.

3.2.3.5 Programming DIFF Voltage Measurements


The VoltDiff instruction is used to make a Differential voltage measurement
on one or more analog channels. It has the following format:

VoltDiff( Dest, Reps, Range, DiffChan, RevDiff, Settling, Integ, Mult, Offset )

Parameters and their descriptions are listed next:

Destination — the variable in which to store the results of the measurement.

Repetitions — the number of sensors to be measured (or number of times the


measurement is made if DiffChan is entered as negative). If the Repetitions
parameter is greater than 1, then measurements are made on consecutive
channels and the Destination parameter must be a variable array.

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.

RevDiff — A constant is entered for the RevDiff parameter to determine


whether the inputs are reversed and a second measurement made. This
function will remove any voltage offset errors due to the datalogger
measurement circuitry, including operational input voltage errors. Enabling
this parameter will double measurement time. False (or 0) = Do not make
second measurement; True (or 1) = Reverse inputs and make second
measurement. See Appendix C for information on the benefits of using
RevDiff.

SettlingTime — the amount of time to delay after setting up a measurement


and before making the measurement. Refer to Table 3.2-4 for default
SettlingTimes. See Section 5.2 for Settling Time issues.

3-76
Section 3. CRBasic and Measurements

TABLE 3.2-4. Settling Time Entries

Entr Rang Integratio Settling Time


y e n
0 All 250 us 450 us (default)
0 All _50Hz 3 ms (default)
0 All _60Hz 3 ms (default)
>100 All All ms entered

Integ — the amount of time, in microseconds, to integrate a signal for the


channel being measured. See Table 3.2-5.

TABLE 3.2-5. Integration Time Entries

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.2.3.6 VoltDIFF Measurement Sequence & Timing


The sequence of a Differential (DIFF) voltage measurement without
measurement reversal is the same as for the SE voltage measurement. See
Section 3.2.2.6 for information on this measurement sequence.
The VoltDiff instruction has an additional parameter (RevDiff) allowing for
two separate A/D conversions, one with the inputs to the IA (Instrumentation
Amplifier) with the standard polarity (Φ1), and a secondary A/D conversion
with the inputs reversed (Φ2). Figure 3.2-10 is a depiction of the
multiplexers’, set inline prior to the IA, used to accomplish this.

FIGURE 3.2-10. Reversed Differential Inputs

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.

Figure 3.2-11 depicts the sequence and timing of a Differential Voltage


measurement using reverse Measurement, based on the Integration selected.

FIGURE 3.2-11. VoltDIFF with RevDiff Measurement Sequence & Timing

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.

►► Exercise 3.2.3-1 Amplified Diff Voltage Pressure Transducer


Create a program that measures a 423, five VDC output, pressure transducer
using a differential voltage measurement. Use the Specification sheet shown in
Figure 3.2-12. The full scale output of the transducer is 200 psi, but for our
application we will only see 80 psi. Using the LogCalc.exe program,
determine the multiplier and offset, as well as the voltage range that should be
used. Write the program to measure and store the output from the sensor once
a second. Name the program Pressure.CR1.

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 

FIGURE 3.2-12. Pressure Transducer Specifications

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.

FIGURE 3.2-13. LogCalc Screen

3-79
Section 3. CRBasic and Measurements

3.3 Resistive Bridge Measurements


3.3.1 Resistive Bridge Measurement Details
Bridge measurements combine sensor excitation with voltage measurements
and are used to measure sensors that change their electrical resistance in
response to the environmental phenomenon being monitored.

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.

TABLE 3.3-1. Resistive Bridge TIMs available from Campbell Scientific

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

There are five standard bridge measurement instructions that Campbell


Scientific dataloggers supports. These instructions include three half bridge
and two full bridge (Wheatstone Bridge) measurements. Figure 3.3-1 lists
these five measurement instructions and shows the circuits that would typically
be measured using them. In addition the calculations necessary to compute the
resistance of any single resistor, provided the values of the other resistors in the
bridge circuit are known, are listed. In the diagrams, X is the result from the
measurement, the resistors labeled Rs would normally be the sensors and those
labeled Rf would normally be fixed resistors. Circuits other than those
diagrammed could be measured, provided the excitation and type of
measurements were appropriate.

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

BrHalf X = result w/mult = 1, offset = 0 BRHalf Equations

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

X = result w/mult = 1, offset = 0 BRHalf4W Equations


BrHalf4W
V R Rs = Rf X
H X= 2 = s
V1 Rf Rf = Rs / X
L
H

BRFull and BRFull6W


BrFull Equations
X = result w/mult = 1, offset = 0
(
X 1 = − X / 1000 + R 3 / R 3 + R 4 )
H V1 ⎛ R R2 ⎞
L X = 1000 = 1000⎜⎜ 3
− ⎟⎟ (
R2 1 − X1 )
Vx ⎝ R3 + R4 R1 + R2 ⎠ R1 =
X1
R1X 1
R2 =
1− X1

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

X1 and X2 are intermediate


variables for equation
solution.

FIGURE 3.3-1. Circuits Used with Bridge Measurement Instructions

3-81
Section 3. CRBasic and Measurements

Excitation Voltage: Electrical bridge sensors require either regulated current


or voltage excitation, and the means to read the analogue voltage output from
the bridge circuit. By supplying a precise, known voltage to a resistive circuit,
then measuring the voltage returned, the sensor’s resistance can be calculated.

The excitation voltage can either be Switched or Continuous. The resulting


value (multiplier = 1, offset = 0) is the measured voltage in millivolts divided
by the excitation voltage in volts (i.e., millivolts per volt) for full bridge
instructions. For half bridge instructions, the output is the ratio Volt per Volt.

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.

All of Campbell Scientific’s dataloggers can supply switched excitation


(excitation is only on during the measurement process). Not only does
utilizing switched excitation help eliminate measurement errors due to circuit
self heating, but it also reduces polarization errors with ionic sensors and
conserves power.

The CR9000X, CR5000, and CR3000 have Continuous Analogue Output


(CAOs) channels in addition to the switched excitation channels. Campbell
Scientific also supplies peripherals that supply CAOs for the other loggers and
to augment those loggers which already have CAOs. CAOs can supply a
continuous excitation voltage for bridge measurements. While this can lead to
issues with circuit warming, it reduces measurement issues with settling time
(we will cover Settling time issues in more detail in Section 5.2). For all
loggers, except the CR9000X, two instructions are required when using the
CAOs for bridge measurements: ExciteV to set the CAO, and VoltDiff or
VoltSE to make the measurement.

Reverse Measurement and Excitation: All of the bridge measurements have


the option (RevEx) to make one set of measurements with the excitation as
programmed and another set of measurements with the excitation polarity
reversed. The sign corrected average of the two measurements is returned for
the result. Reversing the excitation polarity eliminates the effects of internal
and external dc offset voltage errors. The excitation channel maintains the
excitation voltage until the hold for the analog to digital conversion is
completed. When more than one measurement per sensor is necessary (four
wire half bridge, three wire half bridge, six wire full bridge), excitation is
applied separately for each measurement. For example, in the four wire half
bridge when the excitation is reversed, the differential measurement of the
voltage drop across the sensor is made with the excitation at both polarities and
then excitation is again applied and reversed for the measurement of the
voltage drop across the fixed resistor.

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

parameter, to allow the signal to settle after the datalogger’s internal


multiplexer has been tied to the specified channel. Excitation: +
Polarity, IA Input: + Polarity
+ Polarity IA Input:

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

Excitation: + Polarity, IA Input: - Polarity


11. Integrate the signal for the length of time specified by the Bridge
IA Input:

measurement instruction’s Integration parameter.


12. Perform the forth Analog to Digital conversion (Conversion D).
13. Calculate the sign corrected average of the four A/D conversion values:
Result = (A-B-C+D)/4.

3-83
Section 3. CRBasic and Measurements

3.3.1.1 Excitation Compliance Current


Care should be taken that the total current requirement for all of the sensors
connected to each individual excitation channel does not exceed the
compliance current for the regulated voltage excitation channels, or the
compliance voltage for the regulated current excitation channels. The
specification sheets for Campbell Scientific’s dataloggers list the specification
for these limits.

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

We can Excite 3 Sensors with 2500 mV.

Example 2: Bridge type: Same as Example 1.

If it is required to use 4 gauges per excitation channel, what is the maximum


excitation voltage that can be used?

PortMaxI × SensorR
ExVolt =
Sensor # Equation3.3-2

25mA × 350ohm
ExVolt = = 2187mV
4

3.3.2 Half Bridge Measurement (BrHalf Instruction)


The BrHalf instruction is used to make a half bridge measurement. This
instruction applies an excitation voltage, delays a specified amount of time, and
then makes a single ended voltage measurement. With a multiplier of 1 and an
offset of 0 the result is the ratio of the measured voltage divided by the
excitation voltage (Vout/Vin). The wiring setup, measurement result, and the
equations used to derive resistance from the measurement result are shown in
Figure 3.3-3. Some sensors have the reference resistor built in, while with
others the resistor must be user supplied.

3-84
Section 3. CRBasic and Measurements

BrHalf Schematic BrHalf Results BRHalf Equations

X = result w/mult = 1, offset = 0 X


Rs = R f − 2RL
1− X
V1 Rs + 2 RL
X= = ( R s + 2 R L )(1 − X )
V x Rs + 2 R L + R f Rf =
Rs + 2 RL

FIGURE 3.3-3. Half Bridge Circuit

Variable definitions for Figure 3.3-3:


X: The result from the measurement,
RL: Represents the line resistance,

RS: Resistor would normally be the sensor


Rf : Resistor would normally be the fixed reference resistor.
V1: Voltage Measurement on first SE channel
VX: Excitation Voltage Source

3.3.2.1 BrHalf Pros and Cons


The main benefits of using the BrHalf instruction over the other Half Bridge
instructions is that it only uses one Single Ended voltage channel and it only
needs a single completion resistor (Rf ).

The drawback of using the BrHalf instruction is that it does nothing to


compensate for lead resistance. When using sensors that have small resistive
changes, this can lead to substantial errors. See the PRT BrHalf example in
Section 3.3.2.3 for an example of the magnitude of the error level when
measuring PRTs.

3.3.2.2 What Sensors use the BrHalf Measurement Instruction


Many sensors are candidates for using the BRHalf instruction. These include
any 2 wire resistive sensor such as thermistors and RTDs, as well as some three
wire sensors such as string potentiometers (see Wind Vane Example below).

3.3.2.3 Programming with the BrHalf Measurement Instruction


The instruction has this format:

BrHalf (Dest, Reps, Range, SEChan, ExChan, MeasPEx, ExmV, RevEx,


SettlingTime, Integ, Mult, Offset)

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.

Wind Vane BrHalf Example


The BrHalf instruction is used to measure the 03001 RM Young Wind Sentry
Vane. With a multiplier of 1 and an offset of 0 the result is the ratio of the
measured voltage divided by the excitation voltage.

Specifications: 10K Ohm potentiometer with a 5 degree deadband between


355 and 360 degrees.

FIGURE 3.3-4. Wind Vane Potentiometer Circuit

FIGURE 3.3-5. Potentiometer ½ Bridge Circuit

3-86
Section 3. CRBasic and Measurements

FIGURE 3.3-6. Half Bridge CRBasic Dialogue Box

BrHalf( Dest, Reps, Range, SEChan, ExChan, MeasPEx, ExmV, RevEx,


SettlingTime, Integ, Mult, Offset )

BrHalf(WindDir,1,mV2500,1,Vx1,1,2500,True,0,_60Hz,355,0)

Example Program 3.3.2-1 Measuring a PRT using a Half Bridge (BrHalf)


The BrHalf instruction is used to measure a 100 ohm PRT with a European
alpha of 0.00385 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. The
temperature is resolved from the measurement result using the PRTCalc
instruction. The input for the PRT instruction is R/R0. A reference resistance
of 10,000 ohms is used. Create a working program, PRT.CR1, and determine
the error due to a lead resistance of 8.25 ohm when the PRT is at 0 degrees C.

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

Program 3.3.2-1. PRT ½ Bridge Circuit

‘Program Name = PRT.CR1


Public BRHalf_R : Units BRHalf_R = ohms
Public PRT_Temp : Units PRT_Temp = Degrees_C
DataTable (Temp,1,1000)
DataInterval (0,1,Sec,10)
Sample (1,BRHalf_R,IEEE4)
Sample (1,PRT_Temp,IEEE4)
EndTable
BeginProg
Scan (1,Sec,0,0)
BrHalf (BRHalf_R,1,mV25C,1,Vx1,1,1700,True ,1000,1000,1.0,0)
BRHalf_R = 100*BRHalf_R/(1-BRHalf_R)
PRTCalc (PRT_Temp,1,BRHalf_R,1,1.0,0)
CallTable Temp
NextScan
EndProg

►► Exercise 3.3.2-1 100 ohm PRT (BrHalf)

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.

3.3.3 Three Wire 1/2 Bridge Measurement: BrHalf3W Instruction


A 3-wire half bridge is used to excite a sensor and determine the ratio of the
sensor’s resistance to a known resistance using a separate voltage sensing wire
from the sensor to compensate for lead wire resistance. See Figure 3.3-7.

BrHalf3W X = result w/mult = 1, offset = 0 BRHalf3W Equations

2 V2 − V1 Rs Rs = Rf X
X= =
VX − V1 Rf Rf = Rs / X

FIGURE 3.3-7. 3 Wire Half Bridge Circuit and Equations

Variable definitions for Figure 3.3-7:


X: The result from the measurement,
RS: Resistor that would normally be the sensor

Rf: Resistor that would normally be the fixed reference resistor.


V1: Voltage Measurement on first SE channel
V2: Voltage Measurement on second SE channel
VX: Excitation Voltage Source

3-88
Section 3. CRBasic and Measurements

The measurement sequence is to apply an excitation voltage and make two


voltage measurements on two adjacent single-ended channels: the first on the
reference resistor and the second on the voltage sensing wire from the sensor.
The reference resistor should be a temperature stable, high precision resistor.

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

3.3.3.1 BrHalf3W Pros and Cons


The advantage of the three wire Half Bridge over the two wire Half Bridge
circuit is that it corrects for lead wire resistance. This compensation method
assumes that the resistance of wire A is the same as the resistance of wire B
(Figure 3.3-7). The disadvantage with using the BRHalf3W over the BrHalf is
that it uses two Single Ended (SE) voltage channels and requires 3 wires
whereas the BRHalf only uses one SE channel and only requires 2 wires.

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.2 What Sensors use the BrHalf3W Measurement Instruction


Many sensors are candidates for using the BRHalf3W instruction. These
include 3 wire resistive sensors such as thermistors, RTDs and PRTs.

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

FIGURE 3.3-8. 3WHB10K TIM Circuit

The 10k Ohm reference resistor is a temperature stable, precision resistor. The
resistor specifications are listed in Table3.3-2.

TABLE 3.3-2. 3WHB10K 10 kOhm Resistor’s Specifications

Tolerance @ 25°C ±0.01%


Temperature coefficient
-55° to 85°C ±0.8 ppm/°C
Power rating @ 70°C 0.25 W

3.3.3.4 Programming with the BrHalf3W Measurement Instruction


The instruction has this format:

BrHalf3W (Dest, Reps, Range, SEChan, ExChan, MeasPEx, ExmV, RevEx,


SettlingTime, Integ, Mult, Offset)

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.

FIGURE 3.3-9. 3 Wire Half Bridge CRBasic Dialogue Box

3-91
Section 3. CRBasic and Measurements

Program 3.3.3-1. PRT Three Wire 1/2 Bridge Circuit

‘Program Name: PRT3W.CR1


Public BRHalf3W_R : Units BRHalf3W_R = ohms
Public PRT_Temp : Units PRT_Temp = Degrees_C
DataTable (Temp,1,1000)
DataInterval (0,1,Sec,10)
Sample (1,BRHalf3W_R,IEEE4)
Sample (1,PRT_Temp,IEEE4)
EndTable
BeginProg
Scan (1,Sec,0,0)
BrHalf3W (BRHalf3W_R,1,mV25C,1,Vx1,1,1700,True ,1000,1000,100,0)
PRTCalc (PRT_Temp,1,BRHalf3W_R,1,1.0,0)
CallTable Temp
NextScan
EndProg

►► Exercise 3.3.3-1 PRT with 3 Wire Half Bridge (BrHalf3W)

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.3.4 Four Wire 1/2 Bridge Measurement: BrHalf4W Instruction


A 4-wire half bridge is used to excite a sensor and determine the ratio of the
sensor resistance to a known resistance using 2 pairs of voltage sensing wires
from the sensor to compensate for lead wire resistance. See Figure 3.3-10.

X = result w/mult = 1, offset = 0 BRHalf4W Equations


BrHalf4W
V R Rs = Rf X
H X= 2 = s
V1 Rf Rf = Rs / X
L
H

FIGURE 3.3-10. 4 Wire Half Bridge Circuit and Equations

Variable definitions for Figure 3.3-10:


X: Result from the measurement,
RS: Resistor that would normally be the sensor

Rf: Resistor that would normally be the fixed reference resistor.


V1: Voltage Measurement on first DIFF channel
V2: Voltage Measurement on second DIFF channel
VX: Excitation Voltage Source

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

The measurement sequence is to apply an excitation voltage and make two


voltage measurements on two adjacent differential (DIFF) channels: the first on
the reference resistor and the second on the voltage sensing wire from the
sensor. The two measurements are used to calculate the resulting value which
is the ratio of the voltage across the sensor to the voltage across the reference
resistor, which is equivalent to the ratio of the Sensor’s resistance to the
reference resistors resistance. Note that virtually no current runs through the
sensing wires from the sensor to the second differential input channel, thus lead
resistance does not affect the measurement quality. The fixed reference
resistor should be a temperature stable, high precision resistor.

3.3.4.1 BrHalf4W Pros and Cons


The advantage of the BrHalf4W circuit is that lead resistance does not affect
the measurement. The disadvantage is that it requires two differential (4 SE)
voltage input channels and 4 wires to the sensor.

3.3.4.2 What Sensors use the BrHalf4W Measurement Instruction


Many sensors are candidates for using the BRHalf4W instruction. These
include most resistive sensors, such as thermistors, RTDs and PRTs, which can
be configured with four wires.

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.

FIGURE 3.3-11. 4WPB TIM Circuit

3-93
Section 3. CRBasic and Measurements

The fixed reference resistor is a temperature stable, precision resistor. The


current limiting resistor is a lower quality resistor, as it will not affect the
measurement accuracy. The resistor specifications are listed in Table 3.3-3.

TABLE 3.3-3. 4WPB TIM Resistor’s


Specifications

Current limiting 10 kOhm Resistor


Tolerance @ 25 °C ±5%
Power rating 0.25 W
Completion Resistor
Tolerance @ 25 °C ±0.01%
Temperature coefficient
0-60 °C 4 ppm/°C
-55-125 °C 8 ppm/°C
Power rating 0.25 W

3.3.4.4 Programming with the BrHalf4W Measurement Instruction


The instruction has this format:

BrHalf4W (Dest, Reps, Range1, Range1, DiffChan, ExChan, MeasPEx, ExmV,


RevEx, RevDiff, SettlingTime, Integ, Mult, Offset)

These parameters are used in a similar way to the BRHalf3W instruction,


except that you use two differential channels and, the ranges for the two
differential measurements are independently specified. You also have the
additional option to reverse the inputs, make a second measurement and use the
sign corrected average of the two for the result. The DiffChan parameter
specifies the first of two Differential (DIFF) channels required for each Rep. If
Reps is more than 1, then the second sensor would be wired to the next two
sequential Differential channels.

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.

Calculating the Excitation Voltage:

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 is equal to I multiplied by the total resistance. To allow for the tolerances


in the actual resistances, it is decided to set the 10 kOhm resistor 5% low (use
9500 ohms), and use 15 ohms for the line resistance:

Vx = I(R1+Rs+Rf + 2RL)

Vx = 0.1805mA x (9500+138.5+100+30)ohms

Vx = 1747 mV

The dialogue box for the BrHalf4W instruction is shown below.

3-95
Section 3. CRBasic and Measurements

FIGURE 3.3-12. 3 Wire Half Bridge CRBasic Dialogue Box

Program 3.3.4-1. PRT Four Wire 1/2 Bridge Circuit

‘ Program Name: PRT4W.CR1


Public BRHalf4W_R : Units BRHalf4W_R = ohms
Public PRT_Temp : Units PRT_Temp = Degrees_C
DataTable (Temp,1,1000)
DataInterval (0,1,Sec,10)
Sample (1,BRHalf4W_R,IEEE4)
Sample (1,PRT_Temp,IEEE4)
EndTable
BeginProg
Scan (1,Sec,0,0)
BrHalf4W(BRHalf4W_R,1,mV25C,mV25C,1,Vx1,1,1700,-1,-1,1000,1000,1,0)
PRTCalc (PRT_Temp,1,BRHalf4W_R,1,1.0,0)
CallTable Temp
NextScan
EndProg

►► Exercise 3.3.4-1Trimmed Potentiometer (BrHalf4W)

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

3.3.5 Four Wire Full Bridge Measurement (BrFull Instruction)


A Wheatstone bridge (Full Bridge) is a measuring circuit/instrument invented
by Samuel Hunter Christie in 1833 and improved and popularized by Sir
Charles Wheatstone in 1843 [1]. The Wheatstone bridge is used to detect and
measure small changes in resistance in one or more of the four legs. See
Figure 3.3-13 for the schematic for the Wheatstone bridge.

BRFull and BRFull6W


Equations

(
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

X1 and X2 are intermediate


variables for equation
solution.

FIGURE 3.3-13. Wheatstone Bridge CRBasic Dialogue Box

Variable definitions for Figure 3.3-13:


X: The result from the measurement,
R#: The resistance in one of the Wheatstone Bridge’s Leg
V1: Voltage Measurement on Differential channel
VX: Excitation Voltage Level

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.

3.3.5.1 Full Bridge (BrFull) Pros and Cons


The Full Bridge (Wheatstone) measurement can resolve a sensor’s resistance
with far greater resolution than a Half Bridge measurement. The trade off is
that the full bridge requires one (4-Wire Full Bridge) or two (6-Wire Full
Bridge) differential channels.

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.

3.3.5.2 What Sensors use a Four Wire Full Bridge Measurement


A short list of sensors that may use 4-Wire Wheatstone bridges, with all four
gages active, include accelerometers, scales, loadcells, and pressure
transducers.

Sensors that might only have one or two active legs, the other legs consisting
of temperature stable precision resistors, include foil bonded strain gages.

3.3.5.3 Programming with the BrFull Measurement Instruction


The BrFull instruction is used to make a 4-Wire Wheatstone bridge
measurement. This instruction applies an excitation voltage, delays a specified
amount of time, and then makes a differential voltage measurement. With a
multiplier of 1 and an offset of 0 the result is the ratio of the measured voltage,
in millivolts, divided by the excitation voltage, in volts. This is commonly
referred to as millivolts per volt (mVout/Vin).

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.

The instruction has this format:

BrFull (Dest, Reps, Range, DiffChan, ExChan, MeasPEx, ExmV, RevEx,


RevDiff, SettlingTime, Integ, Mult, Offset)

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

Example Program 3.3.5-1 Load Cell BrFull Example


Problem: The BrFull instruction is used to measure a load cell. The Full
Scale Output, at 6 pounds, is 2 mV/V. At zero pounds the scale is suppose to
have an output of 0.0 mV/V. But to insure accuracy, a zero reading is to be
stored and used as an offset for the rest of the measurements. Create a program
named FullLoad.CR1.

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.

The BrFull instruction dialogue box is shown in Figure 3.3-14.

FIGURE 3.3-14. Full Bridge CRBasic Dialogue Box

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.

Program 3.3.5-1. LoadCell Full Bridge Measurement

'Program Name = FullLoad.CR1


'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Declare Variables //////////////////////////////////////////////
Public LoadCell 'Result Variable declared and dimensioned
Units LoadCell = lbs_force 'LoadCell units declared
Public Offset 'Offset Variable declared and dimensioned
Public CalFileLoaded As Boolean
Public ModeLoad

' \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Declare Output Tables ////////////////////////////////////////


DataTable(TEST1,True,-1) 'Trigger, auto size
DataInterval(0,10,Sec,100) '10 Sec interval, 100 lapses, autosize
Average(1,LoadCell,IEEE4,False) '1 Reps,Source,Res,Enabled
EndTable 'End of table TEST1

DataTable(CalHist,NewFieldCal,50)
SampleFieldCal
EndTable

BeginProg 'Program begins here


CalFileLoaded = LoadFieldCal(1)

Scan(1,Sec,10,0) 'Scan once every 1 Secs, non-burst


BrFull(LoadCell,1,mV7_5C,1,VX1,1,2500,True,True,1000,1000,3,OffSet)
FieldCal(0,LoadCell,1,0,OffSet,ModeLoad,0,1,1)
'______________________ Output Table Control ______________________
CallTable(CalHist)
CallTable TEST1
Next Scan 'Loop up for the next scan

EndProg 'Program ends here

3.3.6 Six Wire Full Bridge Measurement: BrFull6W Instruction


A 6-wire half bridge is used to excite a full Wheatstone bridge and determine
the ratio of the bridge’s output to its input using 2 pairs of lead wires from the
sensor to compensate for lead wire resistance. One set of wires is for the
excitation and ground return for the sensor. The other set is used for measuring
the true excitation at the sensor (thus removing the lead’s resistance effects).
See Figure 3.3-15.

3-100
Section 3. CRBasic and Measurements

BRFull and BRFull6W


Equations

(
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

X1 and X2 are intermediate


variables for equation
solution.

FIGURE 3.3-15. 4 Wire Half Bridge Circuit and Equations

Variable definitions for Figure 3.3-15:


X: The result from the measurement,
R#: The resistance in one of the Wheatstone Bridge’s Leg
V1: Voltage Measurement on first DIFF channel
V2: Voltage Measurement on second DIFF channel
VX: Excitation Voltage Source

The sensor types and outputs are the same as for the 4-Wire Full Bridge. See
Section 3.3.5.2 for more information.

3.3.6.1 Six Wire Full Bridge (BrFull6W) Pros and Cons


The benefit of the 6-Wire Full Bridge (BrFull6W instruction) over the 4-Wire
Full Bridge (BrFull instruction) is that removes errors due to lead resistance.
The trade off is that it requires two differential measurement channels where
the 4-Wire Full Bridge only requires one differential channel.

3.3.6.2 What Sensors use a 6-Wire Full Bridge Measurement


A few types of sensors that sometimes use 6-Wire Wheatstone bridges, with all
four gages active, include accelerometers, scales, loadcells, and pressure
transducers.

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

3.3.6.3 Programming with the BrFull6W Measurement Instruction


The BrFull6W instruction is used to make a 6-Wire Wheatstone bridge
measurement. This instruction applies an excitation voltage, delays a specified
amount of time, and then makes two differential voltage measurements on two
adjacent differential (DIFF) channels; the first at the excitation nodes and the
second on the output from the Wheatstone bridge. The result is 1000 * the
voltage measured on the second channel (V2) divided by the voltage measured
on the first (V1). The 1000 factor is used so that the result will be in millivolts
output per volt of excitation when using a multiplier of 1 and an offset of 0.

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.

The instruction’s format is:

BrFull (Dest, Reps, Range1, Range2, DiffChan, ExChan, MeasPEx, ExmV,


RevEx, RevDiff, SettlingTime, Integ, Mult, Offset)

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.

Example Program 3.3.6-1 Load Cell BrFull6W Example


Problem: We will use 4 of the same load cells from the example in Section
3.3.5.3. In this example we will assume long leads and use the BrFull6W
instruction to remove their effects. The nominal resistance across the
Wheatstone bridge is 350 ohms. The Full Scale Output for the sensor, at 6
pounds, is 2 mV/V. At zero pounds the scale is suppose to have an output of
0.0 mV/V. But to insure accuracy, a zero reading is to be stored and used as an
offset for the rest of the measurements. Name the Program Load6W.CR1.

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.

The BrFull instruction dialogue box is shown in Figure 3.3-16.

FIGURE 3.3-16. 6 Wire Full Bridge CRBasic Dialogue Box

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

information about Sensor Calibrations using the FieldCal and associated


instructions.

Program 3.3.6-1. Load Cell 6 Wire Full Bridge Measurement

‘Progam Name: Load6W.CR1


' \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Declare Variables //////////////////////////////////////////////
Public LoadCell(4) 'Result Variable declared and dimensioned
Units LoadCell = lbs_force 'LoadCell units declared
Public Offset(4) 'Offset Variable declared and dimensioned
Public CalFileLoaded As Boolean
Public ModeLoad
Public CReps, CIndex
' \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Declare Output Tables ////////////////////////////////////////
DataTable(TEST1,True,-1) 'Trigger, auto size
DataInterval(0,10,Sec,100) '10 Sec interval, 100 lapses, autosize
Average(1,LoadCell,IEEE4,False) '1 Reps,Source,Res,Enabled
EndTable 'End of table TEST1
DataTable(CalHist,NewFieldCal,50)
SampleFieldCal
EndTable

BeginProg 'Program begins here


CalFileLoaded = LoadFieldCal(1)
CReps = 1 'initialize the zeroing such that only one load cell is zeroed at a time
CIndex = 1 'Initialize CIndex such that the first load cell is being calibrated
Scan(1,Sec,10,0) 'Scan once every 1 Secs, non-burst
BrFull6W (LoadCell,4,mV2500,mV7_5,1,Vx1,2,2500,-1,-1 ,1000,1000,3,Offset())
FieldCal(0,LoadCell,1,0,OffSet,ModeLoad,0,1,1)
'__________________ Output Table Control ______________________
CallTable(CalHist)
CallTable TEST1
Next Scan 'Loop up for the next scan
EndProg 'Program ends here

References

[1]. "The Genesis of the Wheatstone Bridge" by Stig Ekelof discusses


Christie’s and Wheatstone’s contributions, and why the bridge carries
Wheatstone's name. Published in "Engineering Science and Education
Journal", volume 10, no 1, February 2001, pages 37 - 40. (Wikipedia)

3-104
Section 3. CRBasic and Measurements

3.4 Pulse Measurements


Pulse sensors are measured on pulse measurement channels. The output signal
generated by a pulse sensor is a series of voltage waves. The sensor couples
change in the measured phenomenon to the output signal by modulating the
wave series frequency. The measurement device detects each wave as the
wave transitions between voltage extremes (high to low or low to high). This
is termed “state transition”. Measurements are processed and presented as
counts, frequency, or timing data.

3.4.1 Pulses to Measure


Figure 3.4-1 illustrates three pulse sensor output signal types.

FIGURE 3.4-1. Pulse Sensor Output Signal Types

3.4.2 Pulse Input Channels


Table 3.4-1 lists devices, channels and options for measuring pulse signals.
TABLE 3.4-1. Pulse Input Channels 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.4.3 Pulse Sensor Wiring


Wiring a pulse sensor to a CR1000 is straight forward, as shown in Figure
3.4-2. Pulse sensors have two active wires, one of which is always ground.
Connect the other wire to a pulse channel. Sometimes the sensor will require
power from the datalogger, so there will be two more wires – one of which is
always ground. Don’t confuse the pulse wire with the positive power wire, or
damage to the sensor or datalogger may result. Some switch closure sensors
may require a pull-up resistor. Consult the CR1000 manual on use of pull-up
resistors.

FIGURE 3.4-2. Pulse Sensor Wiring

3.4.4 Pulse Measurement CRBasic Instructions


As shown in Table 3.4-1, most channels are measured with a single CRBasic
instruction, which is listed in the CRBasic Instruction column. These
instructions have various parameters that customize them to specific
applications. Exceptions are digital I/O ports C1 through C8. Digital I/O ports
can be measured with PulseCount() or TimerIO() instructions. PulseCount()
instruction functions include returning counts or frequency on high frequency
or switch closure signals. TimerIO() instruction has additional capabilities. Its
primary function is to measure the time between state transitions.

3.4.4.1 Frequency Resolution


Using TimerIO() instruction allows a programmer to get high resolution on
frequency measurements ≤ 1 kHz over short (sub-second) intervals. In
contrast, sub-second frequency measurement with PulseCount() produces
measurements of lower resolution.

Consider a 1 kHz input. Equation 3.4-1 calculates frequency resolution of


TimerIO() instruction. Equation 3.4-2 calculates frequency resolution of
PulseCount(). Table 3.4-2 lists frequency resolution to be expected for a 1 kHz
signal measured by TimerIO() and PulseCount() at 0.5 s and 5.0 s scan
intervals.

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

FR = Resolution of the frequency measurement (Hz)


S = Scan Interval of CRBasic Program

TABLE 3.4-2. Frequency Resolution

0.5 s Scan 5.0 s Scan


PulseCount(), POption 1 FR= 2 Hz FR = 0.2 Hz
TimerIO(), Function 2 FR = 0.0011 Hz FR = 0.00011 Hz

Note that longer scan intervals improve frequency resolution. Longer scan
intervals, however, also reduce certainty of the frequency measurement.

3.4.5 Pulse Measurement Pitfalls


3.4.5.1 Pay Attention to Specifications
Table 3.4-3 compares three specifications for pulse input devices to emphasize
the need for matching proper device to specific applications. Always take time
to understand signals to be measured and recommend the most compatible
device.

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

3.4.5.2 Input Filters and Signal Attenuation


Pulse input devices have electronic input filters on pulse input channels to
reduce spurious noise that can cause false counts. The higher the time constant
(τ) of the filter, the tighter the filter. So, while the digital I/O TimerIO()
frequency measurement may be superior for clean signals, a pulse channel
filter (much higher τ) may be required to get a measurement on a dirty signal.

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.

TABLE 3.4-4. Time Constants (τ)

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

TABLE 3.4-5. Increasing Voltage Required at Increasing


Frequencies to Overcome Filter Attenuation on CR1000 Pulse
Channels and LLAC4 Input Channels.*

AC mV (RMS) Maximum Frequency


20 20
200 200
2000 10,000
5000 20,000
*8.5 ms time constant filter (19 Hz 3 dB frequency) for low-amplitude signals. 1 ms time
constant (159 Hz 3 dB frequency) for larger (> 0.7 V) amplitude signals.

3.4.5.3 Pulse Measurement Averaging


When programming the CR1000 to output a useful data set, use the Average()
instruction carefully. Averaging of frequency measurements reduces the
certainty that a measurement truly represents any real aspect of the
phenomenon being measured.

3-108
Section 3. CRBasic and Measurements

3.4.6 Pulse Measurement Tricks


• There is no substitute for experience. Configure and test data acquisition
systems as completely as possible in the lab before deploying to the field.

• 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.

3.4.7 Pulse Measurement Exercise


In example program 3.4.7-1, TimerIO() is used to measure frequency on a
control port.

'Program Name: Program 3.4.7-1 Wind Speed with TimerIO.cr1


'Program to measure simulated wind speed
'Program measures frequency using edge timing techniques
'Wiring from SS100 Sensor Simulator to CR1000
' SS100 CR1000
'----------- ------
'High Freq P ----------1 kOhm Res--------- C1
'High Freq G ----------------------------- G
' 12V ----------------------------- 12V
' G ----------------------------- G

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

3.5 Digital/Serial Measurements


3.5.1 Serial Measurement Details, What They Are, How They
Work, How it is Measured
A serial measurement is receiving multiple values over the same connection.
Just as a PC downloads a series or set of data from a datalogger over a RS232
cable, a datalogger may receive a series of data from a sensor over the same
type of connection.

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.

The clock of serial interfaces may be either synchronous or asynchronous.


Synchronous serial communication requires one device to be the master and
drive a separate clock line to indicate the timing of communication.
Asynchronous serial communication requires each device to have its own clock
circuit running at a predefined baud rate.

Measuring a serial sensor with a datalogger requires several steps. The


interface needs to be configured. Data must be read from a buffer into
temporary variables. Pieces of temporary data must be assigned to separate
variables for data processing. Each of these steps requires their own
instructions in the datalogger. Exceptions are SDI12 and GPS sensors which
integrate multiple steps into single instructions.

3.5.2 Serial Sensor Wiring


As with all sensors, wiring serial sensors correctly is important. Particular
about serial sensors, not only must it be wired correctly, but the interface of the
datalogger must be configured to match that of the sensor.

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

TABLE 3.5-1. Voltage and Logic Levels of Various Standards

Signaling Max Voltage Min Voltage Logic 1 Logic 0

TTL(1) Single Ended 5V 0V >2.2V <0.8V

RS232(2) Single Ended 25V -25V < -3V >3V

RS422(3) Differential 6V -6V <0V >0V

RS485(4) Differential 5V -5V >200mV < -200mV

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.

Datalogger RS232 Device


1K Ohm
Control RS232
Rx Tx
Port Out
4.7Volt
Zener
Digital Signal
G G
Ground Ground

FIGURE 3.5-1. Voltage Clipping Circuit for RS232 on Control Ports

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.

There are two different topologies of two-way communication. Full duplex


allows transmission and reception simultaneously, thus requiring separate lines
for transmission and reception. When connecting full-duplex devices, transmit
from each device is connected to the receive of the other. Half duplex only

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

FIGURE 3.5-2. Full Duplex with Single-ended Signaling

TxA TxA

TxB TxB

RxA RxA

RxB RxB

G G

FIGURE 3.5-3. Full Duplex with Differential Signaling

A A A

B B B

G G G

FIGURE 3.5-4. Half Duplex with Differential Signaling

SDI12 is half-duplex multidrop communication using TTL levels. The standard


also specifies a 12 volt line for powering sensors.

Data Data Data

12V 12V 12V

G G G

FIGURE 3.5-5. SDI12 Wiring

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

FIGURE 3.5-6. GPS16X-HVS to Datalogger Wiring

1. “Transistor-transistor logic”, Wikipedia, Accessed 8/18/2010,


http://en.wikipedia.org/wiki/Transistor-transistor_logic .

2. Christopher E. Strangio, “The RS232 Standard”, CAMI Research Inc.,


Accessed 8/18/2010,
http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html .

3. “RS-422”, Wikipedia, Accessed 8/18/2010,


http://en.wikipedia.org/wiki/Rs422 .

4. “EIA-485”, Wikipedia, Accessed 8/18/2010,


http://en.wikipedia.org/wiki/Rs485 .

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.

Non-numeric values are possible. These can be status flags or text


messages from the sensor.

There is no loss in accuracy between the sensor and the datalogger.

3-113
Section 3. CRBasic and Measurements

Cons: Programming is complex. There are several steps to read a serial


sensor. Exceptions are SDI12 and the GPS instruction.

Higher memory usage is needed in the datalogger to handle the serial


buffer and the string variables. The modern models of dataloggers
have more than sufficient memory to handle the task.

Power consumption from serial interfaces are much higher the


datalogger quiescent current drain.

Analogue measurements are faster.

Internal processing hardware is needed in the sensor. The sensor itself


must handle the measurement and process the raw values for output.
This can make sensors more expensive.

3.5.4 What Type of Sensors use Serial Output


Any sensor outputting several values or needing to maintain full accuracy
might be a serial sensor. A large variety of sensors use serial output and there is
a lot of variety of serial output formats in use.

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

3.5.5 Programming Serial Measurements


The necessary programming steps for measuring a serial sensor are:

• Declare Variables
• Declare Data Tables
• Set Up Communication Port
• Read From Buffer
• Split Read Data.
• Process Split Data

3.5.5.1 Important Questions You Need Answered


There are several important questions you need answered about your serial
sensor to be able to interface it to your datalogger. The answers to these
questions are most likely found in the manual for the sensor. If you do not find
the answers in the manual, you will need to contact the sensor manufacturer.

• 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?

3.5.5.2 Programming Instructions


Following are brief descriptions of the CRBasic instructions used for serial
sensors. Detailed descriptions on the usage of these instructions are in the help
file of the CRBasic Editor. The brief descriptions in this document are meant to
help the reader decide which instructions to add to their program.

SerialOpen (ComPort, BaudRate, Format, TXDelay, BufferSize)

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:

• A sensor outputs 39 bytes at a rate of 2Hz. The datalogger scan rate is 10


seconds.
• 39 bytes/output x 2 outputs/sec x 10 seconds/scan = 780 bytes
received/scan
• 780 bytes + 39 bytes/output = 819 bytes
• BufferSize should be at least 820(819+1) bytes.

FIGURE 3.5-7. Representation of a 23 byte ring buffer that has


received an 18 byte record since last being read

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)

SerialClose is the opposite of SerialOpen. It stops communication on a port and


frees up memory allocated for the buffer. Most programs have no need for it,
but it is available.

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)

This functions checks for activity on a port.

SerialInChk(Comport)

The SerialInChk function reports the number of bytes in a buffer between the
read and write pointers.

SerialInBlock(ComPort,Dest,MaxNumberBytes)

SerialinBlock will directly copy data up to the MaxNumberBytes setting from


a port's buffer into a destination variable. This instruction is for advanced users
only. Data containing null characters can only be read from a buffer with this
instruction.

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)

SerialOut is used for outputting a string on one of the datalogger's ports.

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)

The CheckSum function is used for calculating the checksum of a string.


Checksums are used for checking serial messages for transmission errors. The
use of this instruction is recommended for advanced programmers only.

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.

3.5.5.3 Different Levels of Protocol Complexity


The simplest serial protocol scenario is a continuous output serial sensor
connected to a datalogger. The sensor initiates the communication and sends
data to the datalogger. The datalogger has to be programmed only to receive
the data and process it.

FIGURE 3.5-8. Flow Diagram of a Continuous Output Sensor

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

FIGURE 3.5-9. Flow Diagram of a Polled Sensor

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.

FIGURE 3.5-10. Flow Diagram of Two Host Devices

3.5.5.4 Step by Step Programming Examples


For the programming examples that follow a CR1000 is used. The examples
can be easily modified to work on a CR800, CR850, or CR3000 also. The
equipment required for these examples is a CR1000, a power supply, and two
short pieces of wire. Connect a piece of wire from C1 to C4 on the CR1000,
and the other wire from C2 to C3. We will simulate the serial sensor on the

3-119
Section 3. CRBasic and Measurements

datalogger itself at COM2. However, simulating a sensor on the same


datalogger does not allow testing a programs behavior during communication
errors or time asynchronization.

C1

C2

C3

C4

FIGURE 3.5-11. Wiring for Example Programs

Continuous Output Sensor

With a continuous output serial sensor, data is continually sent to the


datalogger. The datalogger needs to recognize the data it wants and pull those
pieces from the buffer.

For our example, we are going to use an imaginary sensor of these


characteristics:

• 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.

Here are the variable and declarations for our example:

Public RawString as String * 30, SplitStrings(3) as String * 16, FloatValue,


Public IntegerValue as Long
Public NbytesReturned

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.

Example Program 3.5.5-1


Public RawString as String * 30, SplitStrings(3) as String * 16, FloatValue,
Public IntegerValue as Long, NbytesReturned

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

Example Program 3.5.5-2


Public PTemp, batt_volt
Public RawString As String * 30, SplitStrings(3) As String * 16, FloatValue
Public IntegerValue As Long
Public NBytesReturned

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

Example Program 3.5.5-3


Public PTemp, batt_volt
Public RawString As String * 30, SplitStrings(3) As String * 16, FloatValue
Public IntegerValue As Long
Public NBytesReturned

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

Example Program 3.5.5-4


Public PTemp, batt_volt
Public RawString As String * 30, SplitStrings(3) As String * 16, FloatValue
Public IntegerValue As Long
Public NBytesReturned, SensorInput As String * 16

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

Public rawString As String * 50


Public filterString As String * 16
Public option0(5) 'Numeric split will output floating point numbers
Public option1(5) As String * 16
Public option2(5) As String * 16
Public option3(5) As String * 16
Public option4(5) As String * 16
Public option5(5) As String * 16
Public option6(5) As String * 16
Public option7(5) As String * 16
Public option8(5) As String * 16
BeginProg
rawString = "123e+123a123E123b123e-123"
Scan (1,Sec,0,0)
SplitStr (option0(),rawString,filterString,5,0)
SplitStr (option1(),rawString,filterString,5,1)
SplitStr (option2(),rawString,filterString,5,2)
SplitStr (option3(),rawString,filterString,5,3)
SplitStr (option4(),rawString,filterString,5,4)
SplitStr (option5(),rawString,filterString,5,5)
SplitStr (option6(),rawString,filterString,5,6)
SplitStr (option7(),rawString,filterString,5,7)
SplitStr (option8(),rawString,filterString,5,8)
NextScan
EndProg

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.

The GPS instruction only requires 5 parameters.

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.

GPSComPort: The control port pair to which the GPS is connected.

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

Following is an example program using a GPS16X-HVS connected to Com4 on a CR1000.


‘Program Name: GPS.CR1
'GPS16X-HVS at default 38.4 kbaud, no parity, 8 data bits, and 1 stop bit
'*** Wiring ***
'CONTROL PORTS
'C7 GPS16-HVS pulse per second (yellow)
'C8 GPS16-HVS RS-232 TxD (green)
'G GPS16-HVS power control (black)
'POWER OUT
'12V GPS16-HVS power (red)
'G GPS16-HVS power and RS-232 signal reference (orange)

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.

Example 3.5.5.4-1: ECI-1


'The ECI-1 responds to the “M!” command with 5 values after 900 seconds.
'The following program reads an ECI-1 of address 0 attached to C1 at a 20 minute interval
Public PTemp, batt_volt
Public EC1data(5)
Alias EC1data(1)= Chloride : Units Chloride=Volts
Alias EC1data(2)= GSTAT : Units GSTAT=Kohm_cm
Alias EC1data(3)=PSTAT : Units PSTAT= Kohm_cm2
Alias EC1data(4)=DeckTemp : Units DeckTemp= DegreeC
Alias EC1data(5)= OCP : Units OCP= Volts
DataTable (Test,1,1000)
DataInterval (0,1200,Sec,10)
Sample (5,EC1data(),IEEE4)
EndTable
BeginProg
Scan (1,Sec,0,0)
'Other measurements here
NextScan
SlowSequence
Scan (1200,Sec,3,0) '20 minute scan, sensor required 15 min
SDI12Recorder (EC1data(),1,0,"M!",1.0,0)
CallTable Test
NextScan
EndProg

3-127
Section 3. CRBasic and Measurements

3.5.5.5 Terminal Mode W

FIGURE 3.5-12. Terminal Command W

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.

In this case, an electronic compass is attached to COM3. COM3 is selected by


typing '11' then 'Enter'. A prompt asks the user if the data is ASCII. Answering
'N' will display the data in hexadecimal format. Answering 'Y' will display the
data as ASCII characters.

The datalogger needs to have the communication port configured correctly


with SerialOpen for data to appear in Mode W. If using the SDM-SIO1, a serial
input instruction such as SerialInRecord also needs to be in the program before
data will appear in the terminal.

3-128
Section 3. CRBasic and Measurements

FIGURE 3.5-13. ASCII Selection

The electronic compass in this example is configured for continuous output.


The data appearing in the terminal confirms the sensor is outputting data twice
a second.

FIGURE 3.5-14. Example Data in Terminal Mode W

3-129
Section 3. CRBasic and Measurements

3.5.6 Expansion Peripherals and Programming


SC932A

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.

FIGURE 3.5-15. Example Configuration of a SC105

3-130
Section 3. CRBasic and Measurements

MD485

The MD485 is generally used for communication between PakBus devices.


However, when set to Transparent mode, it can be used for half-duplex RS485
connection to a sensor. The CSI/O mode and baud rate can be changed in
Device Configuration. Parity is fixed at none. Stop bits is fixed at one. Data
bits are fixed at eight.

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

3.6 Vibrating Wire (VW) Measurements


3.6.1 Vibrating-Wire Measurement Principle
A vibrating-wire sensor couples an external physical parameter, for example
strain or displacement, to the tension of a taut wire within the gage. See Figure
3.6-1 for a cut away of a vibrating wire sensor.

Vibrating Plucking/
Diaphragm Wire Pickup Coil

FIGURE 3.6-1. Cutaway of Vibrating Wire Sensor

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

where f = fundamental resonant frequency


k = combined wire constants
σ = wire tension (force/area)

The taut wire in a vibrating-wire sensor is similar to a guitar string. By


increasing the tension in the wire (or guitar string), the wire’s resonant
frequency increases. While energy is coupled to a guitar string by plucking it,
energy is coupled to the wire in a vibrating-wire sensor with a frequency-swept
magnetic field that is included in the sensor (see Figure 3.6-2).

FIGURE 3.6-2. Vibrating-Wire Measurement Principles

3-132
Section 3. CRBasic and Measurements

Once the wire is vibrating, data-acquisition equipment determines the resonant


frequency of the wire and converts this resonant frequency into the desired
engineering units.

3.6.2 Vibrating-Wire Measurement Techniques


Up until just a few years ago, the method for reading vibrating-wire sensors
analyzed the response from a sensor as a function of time using period
averaging. This traditional method is susceptible to noise issues. The Time
Domain measurement technique is covered in Section 3.6.2.1 VW Traditional
Time Domain Measurement Technique.

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.6.2.1 VW Traditional Time Domain Measurement Technique


The traditional method for reading vibrating-wire sensors analyzes the
response from a sensor as a function of time using period averaging. This
technique excites the wire and measures the time for a predetermined number
of positive-slope zero crossings (N Cycles) in the wire’s response. The Time is
divided by the Number of crossings to give the average period of the signal:

PeriodResonant = (Measured Time for crossings)/(Number of Crossings)

Figure 3.6-3 demonstrates this process. The resonant frequency is the


reciprocal of resonant period.

FIGURE 3.6-3. VW Cycle Counting Technique

In a low-noise environment, this is an effective method of determining the


resonant frequency of the wire. It has been successfully integrated into many
data acquisition products that simplify its application with dedicated hardware
modules, programming instructions, and software. This approach struggles,

3-133
Section 3. CRBasic and Measurements

however, in noisy environments. Figure 3.6-4 shows the problem of measuring


zero crossings in the presence of external noise.

FIGURE 3.6-4. VW Cycle Counting Technique with Noise

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.6.2.2 New VW Frequency Domain Measurement Technique


The spectral-analysis approach analyzes the response of the wire as a function
of frequency. It makes sense to analyze the response of the wire as a function
of frequency, rather than time, since we are trying to determine the resonant
frequency of a tensioned wire. The new approach applies a Fourier transform
with interpolation to the sampled response to move it from the time-domain to
the frequency domain (see Figure 3.6-3).

FIGURE 3.6-5. Frequency Domain Analysis

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.

To get a result with sufficient resolution, a specialized interpolation method,


developed by Richard Lyons, is required. Using this Spectral-analysis method
achieves measurement precision of 0.001 Hz rms, a significant improvement.
This is about 10 times better resolution than can be achieved with the old time-
domain measurement analysis.

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.6-6. Frequency Domain Analysis with Noise

3.6.2.3 Frequency Domain verses Time Domain Noise Immunity


To demonstrate the noise immunity benefits of using Spectral Analysis over
Time Domain Analysis, a single vibrating wire gage was wired to the common
inputs of a multiplexer, tying one bank to the AVW1 (Time domain) and
another bank to the AVW200 (frequency domain) vibrating interfaces. So in
essence the same sensor was being multiplexed from one interface to the other.
See Figure 3.6-7.

3-135
Section 3. CRBasic and Measurements

Datalogger
Vibrating Wire
Strain Gage Time Domain

AVW1

CR1000

AVW200

Multiplexer Spectral Analysis

FIGURE 3.6-7. VW Comparison Test Setup

The vibrating wire strain gage was subjected to an electrically noisy


environment (variable speed drill) and measurements on the same sensor were
made using the two different techniques. Figure 3.6-8 shows a graph that has
plots for both the Time Domain and the Frequency Domain measurement
analysis. This comparison illustrates the improved noise immunity of the
Spectral Analysis measurement method.

FIGURE 3.6-8. VW Comparison Result

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

FIGURE 3.6-9. VW Diagnostics

In summary, the spectral-analysis approach provides noise immunity, improved


measurement resolution, and useful diagnostics for reading vibrating-wire
sensors—all significant improvements to those who rely on vibrating-wire
sensors.

3.6.3 AVW200 Wiring


There are multiple methods for communications between an AVW200 and a
datalogger. These include through the COM ports, wirelessly through an
RF400 series radio, or though an SDI-12 port. When using PakBus loggers,
any one of the options can be utilized.

• 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

FIGURE 3.6-10. Wiring Options

3.6.3.1 Direct Connect through Serial Ports


When using PakBus loggers with AVW200s, the logical method for
communications is through one of the serial communications ports on the
logger. The most common serial communication setup would be through using
a pair of control ports with an SC110 cable. The AVW200 could control any
multiplexers used. Figure 3.6-11 depicts this connection type.

3-137
Section 3. CRBasic and Measurements

FIGURE 3.6-11. Wiring Options

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

128 - Vibrating Wire Sensors in 4x16 configuration


256 - Vibrating Wire Sensors in 2x32 configuration

FIGURE 3.6-12. Control Port Serial Pairs Wiring

3-138
Section 3. CRBasic and Measurements

We will be using this option in the class.

►► 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:

Red: Coil High


Black: Coil Low
Green: Thermistor High
White: Thermistor Low

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.

FIGURE 3.6-13. AVW200 Wiring; Datalogger Controlled AM16/32B

3-139
Section 3. CRBasic and Measurements

A CABLE4CBL-L cable is used to connect the multiplexer to the datalogger


(see Figure 3.6-14).

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

C1-C4 C1-C8 C1-C8

C1-C4 C1-C8 C1-C8

FIGURE 3.6-14. Datalogger Wiring; Datalogger Controlled AM16/32B

3.6.3.2 Direct Connect through SDI12 Port


The wiring is identical to the wiring shown in Section 3.6.3.1.1 Serial Port
Direct Connection with Logger Controlling the Multiplexers. You would also
need to tie the C1, SDI-12 port on the AVW200 to one of the control ports on
the datalogger. The AVW200 would be setup and controlled through the use
of SDI-12 instructions (see AVW200 manual).

3.6.3.3 Wireless Connection through the RF400 series Radios


The wireless option is the best option for a system with a large number of
sensors. This eliminates not only some of the programming difficulties, it also
eliminates the needs for long leads between the logger and AVW206s.

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

128 - Vibrating Wire Sensors in 4x16 configuration


256 - Vibrating Wire Sensors in 2x32 configuration

FIGURE 3.6-15. Wireless System Setup

3.6.4 VW Pros and Cons, Issues with Using etc.


Vibrating Wire sensors are used for long term monitoring applications. They
are known for their stable output over many years. Most sensors include a
thermistor for monitoring temperature and performing temperature
compensation on the Vibrating Wire measurement.

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.

3.6.5 What Type of Sensors use VW Measurements


There are many types of physical phenomena that can be measured using
vibrating wire technology. Some of these include: strain sensors, pressure
sensors, crack/displacement sensors, load cells, tilt meters, water level, and
temperature.

3.6.6 DeviceConfig Utility


DevConfig supports AVW200 configuration, real-time data display, operating
system download, and vibrating wire spectrum analysis troubleshoot. You will
need to configure the AVW200 if you are using RF (PakBus), SDI-12, and RS-
232 (Terminal Commands). To use DevConfig, the AVW200 must be
connected to a PC and a power source.

To connect to DevConfig, follow the procedure listed below:

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.

4. Under Device Type, click AVW200 Series.

5. Select the Serial Port matching the COM port on your computer in which
the AVW200 is connected.

6. Press the Connect button. The device may take up to 60 seconds to


respond to DevConfig, and for the current settings to be loaded into the
Settings Editor.

3.6.6.1 Deployment Tab: Setting up the AVW200


The Deployment Tab is the settings editor for the AVW200/AVW206. There
are two windows under the Deployment Tab: “Communications” and
“Measurements”.

3.6.6.1.1 Deployment Tab: Communications window


The Station name and running operating system version are shown, in addition
to the basic communication settings for the AVW200. The “Communications”
window is shown in Figure 3.6-16.

FIGURE 3.6-16. DeviceConfig AVW200 Main Page

Description of the Communication Settings follows:

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.

PakBus Address—enter a PakBus Address that matches the PakBus address


specified in the CRBasic program that will control the AVW200. Each device
in a PakBus network must have a unique address. Valid settings are 1 - 4094.

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).

TABLE 3.6-1. AVW206 Power Modes and the Recommended


Corresponding RF401 Power Modes.

AVW206 Power Mode Recommended RF401 Power Mode


<24 ma Always On <24ma Always On - No header
<4 ma 1/2 Second <24ma Always On - No header
<2 ma 1 Second <24 ma Always On - 1 Sec Header
<0.4 ma 8 Second <24ma Always On - 8 Sec Header

►► 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.6.6.1.2 Deployment Tab: Measurements Window


The Deployment/Measurement Tab is used to configure the SDI-12 Address,
multiplexer type, frequency band (begin frequency and end frequency), and the
sensor excitation level (see Figure 3.6-17).

NOTE The Begin Frequency, End Frequency, and excitation parameters


in DevConfig are only used for the RS-232 (terminal commands)
and SDI-12 communication modes. When using the RS-232
(PakBus) or RF (PakBus) communication modes, the settings for
the Begin Frequency, End Frequency, and excitation parameters
are entered in the AVW200() CRBasic instruction (see Section
3.6.7).

FIGURE 3.6-17. DeviceConfig AVW200 Measurement Page

3-143
Section 3. CRBasic and Measurements

Click on the “Measurements” Tab. We are using an AM16/32B multiplexer.


The crack sensors that we are using have a frequency output range from 1200
Hz to 3000 Hz and only require 5 Volts excitation. Since we are not using
SDI-12 for communications, the “SDI-12 Address” setting does not need to be
set. After the settings are entered, click on the “Apply” button and then
reconnect.

3.6.6.2 DeviceConfig’s Data Monitor


The Data Monitor tab in DevConfig can display either the Public Table or
Status Table. The public table displays the current sensor measurement values
as well as the current settings (see Figure 3.6-18).

FIGURE 3.6-18. Data Display/Public Table in DevConfig

See the AVW200 manual for a list of variables in the Status Table.

3.6.6.3 DeviceConfig’s Send OS


For most applications, Campbell Scientific does not anticipate that it will be
necessary to download a new operating system to the AVW200. However, if a
new operating system (OS) is required, in order to send a new OS to the
AVW200 you will need DevConfig 1.10 or greater.

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.

1. Remove power from the AVW200.

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.

3.6.6.4 DeviceConfig Troubleshoot Window


The Troubleshoot tool in DevConfig can be used to evaluate the frequency
spectrum of a sensor and to check the health of the sensor and the quality of the
measurement.

To access the Troubleshoot Tool, use the steps listed below:

1. Follow the connection procedure provided in Section 3.6.6.

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).

FIGURE 3.6-19. Measurement Options

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

Resonant Frequency Noise Frequency

Ending Amplitude
Beginning Amplitude

FIGURE 3.6-20. Graphs for Evaluating Spectral Analysis of a Sensor

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

3.6.7 Programming for Vibrating Wire Measurements


Shortcut does have a generic Vibrating Wire sensor file, but we will be
covering the CRBasic programming for Vibrating Wire sensors. There are two
methods for programming the AVW200:

1. SDI-12 instruction: This programming method is mainly for using the


AVW200 with our older, legacy, loggers and/or with other manufacturer’
equipment. We will not cover this technique in class.

2. AVW200 instruction: This is used to setup the AVW200/AVW206 with


Campbell Scientific’s PakBus loggers. These include the CR800/CR850,
CR1000, and CR3000 dataloggers.

3.6.7.1 AVW200 Serial Communications Support Instructions


Two instructions are required when using the AVW200 serial communications:

1. AVW200 Instruction: Main measurement instructions for controlling the


AVW200.

2. SerialOpen Instruction: Used to setup the serial port used on the datalogger
to communicate with the AVW200.

3.6.7.1.1 AVW200 Measurement Instruction


When using the RS-232 (PakBus) or RF(PakBus) protocol, the datalogger is
programmed using the AVW200 instruction in CRBasic.

NOTE Please ensure that the AVW200 instruction is included in


LoggerNet. If using LoggerNet 2.4.1 or lower, the user needs to
download the most recent version of the operating system (OS)
for the datalogger. This installation installs the required
CRBasic files on the user’s computer so that the AVW200
instruction shows up in the editor.

The AVW200 instruction is used to read measurements from one or more


vibrating wire sensors when the sensors are connected to the AVW200
channels directly or connected to a multiplexer that’s attached to the AVW200.
In addition to frequency, diagnostic information is returned for the sensor (see
the Dest parameter).

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

The AVW200 instruction has the following syntax:

Sytnax
AVW200 (Result, ComPort, Neighbor, PakBusAdr, Dest, AVWChan,
MuxChan, Reps, BeginFreq, EndFreq, ExVolt, ThermInteg, Mult, Offset)

Result The Result parameter is a variable that indicates the success or


failure of the datalogger's communication attempt with the
AVW200. If more than one AVW200 is used, a different result
variable should be specified for each AVW200 (see 6.1.2). The
result codes are as follows:
Code Description
0 Communication successful. Values have been written
to the destination array.
>1 Number of communication failures. NAN values will
be stored in the destination array. Resets to 0 upon
successful communication.
-3 First communication. Values will be available on the
next scan.

ComPort The ComPort parameter is used to specify the communications


port that will be used to communicate with the AVW200.
Enter a numeric or alphanumeric code:

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

Neighbor The NeighborAddr is used to specify a static route to the


AVW200 (e.g., the PakBus address of a "neighbor" device that
the host can go through to communicate with the AVW200). If
0 is entered, the AVW200 is assumed to be a neighbor (i.e., the
host datalogger can communicate with the AVW200 directly).

3-148
Section 3. CRBasic and Measurements

PakBusAdr The PakBusAddr parameter identifies the PakBus address of


the AVW200 with which the host datalogger is trying to
communicate. Valid entries are 1 through 4094. Each PakBus
device in the network must have a unique address.

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.

The values returned for each sensor are:

(1) Frequency in Hertz (fresonant)

The dominate frequency picked up the AVW200 Spectral


Analysis. This should be the wire’s resonant frequency
and is the measurement of interest. In Figure 3.6-21 the
resonant frequency is about 850 Hz.

Samp= 1.16

Signal-to-Noise Ratio=Samp/SNoise

Snoise = 0.6 Signal Amplitude

fnoise

FIGURE 3.6-21. AVW200 Returned Measurements

The second to fourth elements of the array returned by the


AVW200 are diagnostic readings. This can be used to
help monitor the health of the individual sensors.

(2) Amplitude in mV RMS (Samp)

The RMS mV amplitude of the dominate frequency.


Gages that have poor coupling with the pickup coil will
have low amplitudes. The typical amplitude value will
vary for different sensor types. For instance a VW strain

3-149
Section 3. CRBasic and Measurements

gage with a frequency range of 400 to 1000 Hz commonly


have amplitudes in the 1 mV RMS range, where a crack
meter with a frequency range from 1400 to 3000 Hz
commonly have an amplitude of 5 mV RMS. The
Signal’s Amplitude in Figure 3.6-21 is about 1.6 mV
RMS.

(3) Signal-to-noise ratio(Samp/ Snoise)

The dominate frequency’s amplitude divided by the


amplitude of the dominate noise frequency. Only
frequencies within the frequency band notched out by the
BeginFreq/EndFreq instruction parameters will be
considered for the resonant frequency and for the
dominate noise frequency. The Signal to Noise ratio in
Figure 3.6-21 is1.16/0.6 = 1.9. Note that if the user would
have used 400 Hz for the BeginFreq parameter, the signal
to noise ratio would have been about 1.16/0.18 = 6.4.

(4) Noise frequency(fnoise). The dominate noise frequency


within the frequency band notched out by the
BeginFreq/EndFreq instruction parameters. fnoise ~ 120 Hz
in Figure 3.6-21.

(5) Decay ratio(fresonant). The ratio of the input signal’s


amplitude at the end of the measurement period to its
amplitude at the beginning of the measurement period.
Note that the measurement period is about 0.284 seconds
(4096 samples measured at 14,400 Hz). In Figure 3.6-20,
the Signals beginning amplitude is about 28 mV and its
amplitude at the end is about 7.4 mV. So the decay ratio
is about 0.264. VW sensor manufacturers state that if this
value is getting smaller, the sensor is probably going out.

(6) Thermistor resistance in ohms (if measured).

If communication is unsuccessful, NANs are stored.

AVWChan The AVWChan is the channel on the AVW200 where the


sensor or multiplexer is wired. Valid options are 1 (1V+/-) or 2
(2V+/-).

MuxChan The MuxChan is the channel on the multiplexer where


measurements should start. Valid options are 1 through 32;
anything outside of this range returns an error. Enter 1 if a
multiplexer is not used.

Reps The Reps parameter is the number of measurements to be made


on the multiplexer. This parameter does not affect the
AVW200Chan.

3-150
Section 3. CRBasic and Measurements

BeginFreq The BeginFreq parameter is the starting frequency to use for


the vibrating wire measurement. The minimum value that can
be entered is 100. Refer to the specifications of the vibrating
wire sensor for recommended BeginFreq values.

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.

ExVolt The ExVolt parameter is the excitation voltage to be used to


excite the vibrating wire. Valid options are 1 (5 V peak-to-
peak) or 2 (12 V peak-to-peak).

ThermInteg TheTherm50_60Hz parameter is used to set the integration time


for the thermistor in the vibrating wire sensor.

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)

Multiplier The Multiplier parameter is the multiplier to be applied to the


raw frequency (Hz) measurements.

Offset The Offset parameter is the offset to be applied to the raw


frequency (Hz) measurements.

3.6.7.1.2 SerialOpen Instruction


The SerialOpen function is used to set up one of the datalogger's ports for
communication with another device. It is normally inserted after the
BeginProg and Scan instructions.

The SerialOpen instruction has the following syntax

Sytnax
SerialOpen (COM Port , Baud Rate , Format , TX Delay , Buffer Size)

ComPort The ComPort parameter specifies the communication port and


mode that will be used for the exchange of data.

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

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

We will be using Com2 in the class.

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.

Format Determines data type and if PakBus® communications can


occur on the COM port. Using Code 0 for communications with
the AVW200.

Delay The TXDelay parameter specifies the amount of time to delay,


in microseconds, before outputting strings. A delay may be
necessary in some situations, such as half duplex RF media. We
will use a delay of 0, as we directly connected up.

Buffer size The BufferSize parameter specifies the number of bytes


allocated for input on the ComPort. This buffer is set up as ring
memory. For PakBus communication (format option 4, PakBus
protocol active), BufferSize can normally be left at 0. We will
set the buffer to 200.

3.6.7.2 Program Examples


Example 3.6-1 VW Strain Gage
Our first example is a basic program to measure ten Geokon model 4000
Vibrating Wire strain gages and to simply return the raw frequency and
thermistors’ resistances. The gages will be wired up to an AM16/32B
multiplexer that is tied back to the AVW200 channel 1. The AVW200 should
control the multiplexer and is tied to the Logger’s Com2 for communications.
The frequency range for the model 400 VW Strain sensor is 450 to 1200 Hz.
We will store only the raw frequency and raw thermistor readings.

3-152
Section 3. CRBasic and Measurements

Example Program 3.6-1


Public ResultStrain, StrainFreq(10), StrainThermistor(10)
Public AVWStrain(10,6)
Dim I
Units StrainFreq = Hz
Units StrainThermistor = ohms
DataTable (Test,True,-1)
Sample (10,StrainFreq(),IEEE4)
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
StrainFreq(I) = AVWStrain(I,1)
StrainThermistor(I) = AVWStrain(I,6)
Next I
CallTable Test
NextScan
EndProg

Example 3.6-2 VW Strain Gage w/ Diagnostics


As discussed previously, the AVW200 also returns several parameters that
could be used for diagnostics, and for rejecting data. There are multiple ways
that this diagnostics could be used. This example is for a simple application
type to simply reject the bad data.

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.

Example Program 3.6-2


Public ResultStrain, StrainFreq(10), StrainThermistor(10), AVWStrain(10,6), I
Units StrainFreq = Hz : Units StrainThermistor = ohms
DataTable (Test,True,-1)
Sample (10,StrainFreq(),IEEE4)
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)
Else
StrainFreq(I) = NAN
EndIf
If AVWStrain(I,6) < 6000 Then
StrainThermistor(I) = AVWStrain(I,6)
Else
StrainThermistor(I) = NAN
EndIf
Next I
CallTable Test
NextScan
EndProg

3-153
Section 3. CRBasic and Measurements

Example 3.6-3 VW Strain Gage Engineering Units


Next we want to convert the raw outputs into engineering units. Most Geokon
sensors have calibration/specification sheets that deal in Geokon “Units”. A
Unit is frequency (Hz) squared divided by 1000:

f2
Units =
1000

Figure 3.6-22 shows a typical calibration sheet for the model 4000 gage.

FIGURE 3.6-22. Geokon Model 4000 Calibration Sheet

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 ⎟
⎝ ⎠

The equation used to convert the raw thermistor’s resistance to degrees C is


shown in equation 3.6-3

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.

Example Program 3.6-3

Public ResultStrain, uStrain(10), StrainFreq(10), StrainDigits(10)


Public StrainTemp(10), StrainThermistor(10), AVWStrain(10,6)

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

►► Exercise 3.6-1 VW Crack Meter CRBasic Exercise (AVW200)


Create a program that uses the AVW200 instruction to measure a crack meter
whose calibration sheet is shown in Figure 3.6-23 (the class should use the
supplied calibration sheets for their specific sensor). We will use COM2 on the
CR1000 for communications. The sensor should be hooked up to the first
channel on the AM16/32B which is tied back to Channel 1 on the AVW200.
Place logic in the program to load NAN if the amplitude of the resonant
frequency is less than 0.5 mV RMS. Store both the raw data and the data in
engineering units (Degrees C and micro-strain). Save the program as
CrackMeter1.CR1.

FIGURE 3.6-23. Geokon Model 4420 Calibration Sheet

3-156
Section 3. CRBasic and Measurements

3.7 Piezoelectric Sensor Measurements


3.7.1 Piezoelectric Sensor Measurement Details
The piezoelectric effect, that an electrical charge is produced when squeezing
or deforming a crystal, was discovered by Pierre and Jacques Curie in 1880. It
was not until the development of low impedance amplifiers that piezo-
electronics could be effectively used in sensing applications. Amplifiers were
developed during the 1940s, with the first patent being awarded to W.P. Kistler
in 1950. The invention of MOSFET solid-state circuitry provided more stable
and smaller amplifiers, making the piezoelectric more practical during the
1960s.

Accelerometers, pressure sensors, microphones, and strain sensors are the most
common piezoelectric sensor types.

Piezoelectric sensors can be manufactured using either piezoceramic elements


or crystal materials. Either material exhibits near zero deflection, lending itself
to extreme stability and having very high natural frequencies both perfect
qualities for sensors subjected to continual vibration or high shock
environments. The crystal elements are typically gallium phosphate, quartz,
lithium niobate or tourmaline. Gallium phosphate, lithium nibate, and
tourmaline possess extreme stability at very high temperatures (1000 deg C).

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.

3.7.2 Piezoelectric Sensor Classification and Wiring


The user of piezoelectric sensors must be aware of the two main classifications;
high impedance and low impedance. Usually the application dictates the class
of sensor used, with low impedance sensors being the most common.

3.7.2.1 High Impedance Piezoelectric Sensors


High impedance sensors have a charge output that must be converted to a
voltage output. Manufacturers usually list these as “charge mode” sensors. An
external charge amplifier must be used to convert and condition the signal for
connection to a datalogger or other data acquisition devices. Otherwise the
sensor signal could not be measured with a data logger.

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.

3.7.2.2 Low Impedance Piezoelectric Sensors


Low impedance sensors have the charge amplifiers built into the sensor body.
Some manufactures catalogue these as “voltage mode” piezoelectric sensors to
help distinguish from other models. Additionally, every manufacture of low
impedance piezoelectric sensors have either a trademarked name to signify the
use of integrated circuitry or use a common industry term such as IEPE. ICP,
Isotron, and Piezotron are specific names used by the manufacturers. IEPE is
the common non-trademarked name.

Figure 3.7-1 shows a simplified circuit diagram of a low-impedance


piezoelectric sensor.

FIGURE 3.7-1. Low-Impedance Piezoelectric Sensor

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

FIGURE 3.7-2. Constant Current Power Supply for IEPE Sensors

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.

3.7.3 Piezoelectric Sensor Pros and Cons, Issues with Using


Piezoelectric sensing technology is immune to electromagnetic fields and
radiation enabling the usage of piezoelectric sensors in harsh environments and
in the nuclear industry. Piezoelelectric sensors have been used not only in
structural and geotechnical applications, but in controlled explosions, inside
internal combustion engines, and inside nuclear reactors.

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.

If using stand alone charge amplifiers with charge mode accelerometers,


various internal resistors can be selected to better match the frequency response
of the item(s) being measured. Be sure to not limit the upper frequency
response, by selecting the incorrect fixed resistor in the charge amplifier.

Piezoelectric sensors are generally used in dynamic applications, where the


piezoelectric material is undergoing continual change. Measurement types are
usually acceleration, sound, pressure, and strain. There are examples of quasi-
static applications such as slower response pressure transducers, where the
piezoelectric sensor performs well, but generally other sensor types are better
suited for slower applications. Truly static applications however cannot be
measured with piezoelectric sensors. Static forces produce a fixed amount of
charge on the piezo material. When connected to a readout box or data
acquisition system there is a constant loss of electrons resulting in continually
decreasing signal amplitude. When witnessing this, it appears as though the
sensor is defective. A person might test my moving the sensor or applying a
force on the sensor, only to see the amplitude roll off. A good example would
be trying to measure 1G or the Earth’s gravitational pull with a piezoelectric
accelerometer. A reading of 1 G may be momentarily recorded but would
degrade to zero (or below zero) within a couple of seconds. For static
applications, a different sensor technology is required.

The piezoelectric is designed for dynamic measurements. Vibrations, shock


waves, sound waves, structures undergoing movement from wind, earthquakes,
construction and other cyclic movements are ideal applications for
piezoelectric sensors. The study of modes or the behavior of modes within a
structure is enhanced by the use of piezoelectric sensors that have the
measurement speed capability and response time to provide the information for
modal analysis. Piezoelectric material is extremely stiff allowing for very high
frequency measurement without fear of the sensor hitting a resonant frequency.

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.

3.7.4 Piezoelectric Sensor Manufacturers


There are many piezoelectric sensor manufactures. Measurement Specialties,
PCB, Kistler, Dytran, Endevco are all very popular throughout the world.
These manufacturers have many good resources to help select the correct
models and types.

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

3.8 4 to 20 mA Output Sensors


Many applications utilize transducers that output a current signal instead of an
analog signal as a function of the phenomenon they are measuring. This
consists of three parts; a sensor, a current transducer (quite often integrated
with the sensor), and a power supply. Most current output transducers use the
4 – 20 mA signal to represent the low point (4 mA times Resistor value) and
the high point (20 mA times the Resistor value) in their respective data
acquisition applications. Ohm’s law describes how a voltage (V) is generated
by the signal current (I) through a completion resistor(R):

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.1 Typical Applications for 4-20mA transducers


Current (4 – 20mA, typically) transducers can be and are used in almost any
data acquisition applications; from pressure measurements, to flow-meters to
temperature to vibration . Also, some string pots sensors have 4-20mA outputs
when monitoring displacements.

3.8.2 Advantages and Disadvantages for current Transducers


3.8.2.1 Advantages
1- Travel long distances with no degradation in accuracy [up to 1000’s of feet]
A two wire transmitter allows signal and power to be supplied on a single
wire-pair. Because the information is transmitted as current, the signal
is relatively immune to voltage drops from long runs and noise from
motors, relays, switches and industrial equipment.
2- Voltage Independent
Voltage independent means they provide the same accuracy of output
within a range of battery voltage levels. This is important especially since
batteries decrease in voltage as they get older
3- High immunity from electrical noise
4- Low installation cost – only two wires needed,
5- Built-in diagnostic capabilities.

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.8.3 Designing a Current Loop System


3.8.3.1 CSI CURS100
The CURS100 lets a datalogger measure a current signal output by a sensor or
output device by converting the signal to a voltage. It makes accurate
measurement of 4-20 mA and other current output transducers simple; gauges
are measured with a voltage measurement instruction.
The 100 ohm resistor used for the current shunt allows currents up to 25 mA to
be read on a ±2500 mV range (CR10X, CR510) and currents up to 50 mA to be
read on a ±5000 mV range (CR800, CR850, CR1000, CR3000, CR5000,
CR9000X).
The CURS100 output is measured with VoltDiff Instruction in CRBasic and
with Instruction 2 (Differential Voltage) in Edlog. The CURS100 consumes
one differential analog input; an adjacent analog ground channel accepts the
analog "ground prong" of the CURS100. Not all datalogger terminal strips
have this sequence on all channels, so please check your datalogger's wiring
panel to confirm channel assignments, especially if you plan to use multiple
terminal input modules.
The power supply provides the required power to the sensor and transducer.
The sensor signal changes with the phenomenon being measured. The current
transducer converts the sensor signal into a current signal. The current output
changes in a known way with the phenomenon being measured.
3.8.3.2 CSI CURS100 Specifications
Shunt resistor: 100 Ohms Power rating: 0.25 Watts
Tolerance @25°C: ±0.01% Max. Temperature Coefficient: ±0.8 ppm/°C
3.8.3.3 Differential Measurement
The voltage across the completion resistor is measured with the differential
voltage measurement instruction. Use VoltDiff for the CRBasic dataloggers
(i.e., CR1000, CR3000, CR5000 or CR9000X.

The differential voltage measurement measures the difference in voltage


between the low and high terminals. The CURS100 (See Figure 3.8.1)
connects the resistor between the high and low terminals on the datalogger.

3.8.3.4 Common Mode Range


In order to make a voltage measurement, the voltage at the channel inputs must
be within the datalogger's common mode range. The common mode range is
the voltage range, relative to ground within which both inputs of a differential
channel must lie in order for the differential measurement to be made. The
common mode range is ± 2.5 volts for the CR10(X) and ± 5 volts for the 21X,
CR23X, CR800, CR850, CR1000, CR3000, CR5000, CR9000(X), and CR7.

NOTE One side of the completion resistor is attached to the datalogger's


ground (AG for the CR10(X), and for the CR23X, CR800,
CR850, CR1000, CR3000, CR5000, 21X, CR7, and CR9000(X))
to keep the measurement within the datalogger's common mode
range.

3-163
Section 3. CRBasic and Measurements

3.8.3.5 Ground Offset on Single-Ended Measurements


When a current flows through the ground path on the datalogger the actual
voltage measured by the datalogger will be slightly different; created an extra
error in your measurement. This is referred to as a ground loop. You always
want to eliminate ground loops in your application. The small offset voltages
between the ground points are caused because there is resistance (albeit small)
in the ground path and current flowing through a resistance results in a voltage
drop. The offsets in ground voltage cause offsets in single-ended voltage
measurements.
The resistor must be grounded at the datalogger to ensure that the measurement
is within common mode range. The signal (or low) output on the transducer is
higher than the datalogger ground by the voltage drop across the resistor. A
ground-loop error may occur if the signal output is not electrically isolated but
is connected to the sensor's case. If such a sensor is in contact with earth
ground (i.e., a pressure transducer in a well or stream) an alternative path for
current flow is established through earth ground to the datalogger earth ground.
This path is in parallel with the path from the signal output through the resistor;
hence not all the current will pass through the resistor and the measured
voltage will be too low.

3.8.4 Wiring of Transducers to Dataloggers


3.8.4.1 CR10(X), CR23X, CR800, CR850, CR1000, CR3000, CR5000
These dataloggers were designed with separate analog ground (AG on
CR10X,on CR23X, CR800, CR850, CR3000, CR1000, and CR5000) and
ground(G) terminals. Ground (G) terminals are used for power and shield
connections where there is likely to be current flowing. Ground is connected
directly to earth ground (a grounding rod) to provide a path to earth for
transient voltages. By avoiding the use of analog ground as a current path,
analog ground terminals will stay at the same ground potential and not cause
offsets in single-ended measurements.
All ground connections on these dataloggers should be made at a G terminal.
Do NOT use the CURS100's ground terminal which connects to analog
ground.

3.8.4.2 Transducer Wiring


Current transducers differ mainly in how they are powered and in the relative
isolation of the current output. In this section the transducers are grouped by
the total number of wires the transducer uses to obtain power and output the
current.

3-164
Section 3. CRBasic and Measurements

3.8.4.2.1 Basic Two-Wire 4-20mA Current Loop


The resistor must be grounded at the datalogger to ensure that the measurement
is within common mode range. The signal (or low) output on the transducer is
higher than the datalogger ground by the voltage drop across the resistor. A
ground-loop error may occur if the signal output is not electrically isolated but
is connected to the sensor's case. If such a sensor is in contact with earth
ground (i.e., a pressure transducer in a well or stream), an alternative path for
current flow is established through earth ground to the datalogger earth ground.
This path is in parallel with the path from the signal output through the resistor;
hence not all the current will pass through the resistor and the measured
voltage will be too low. See Figures 3.8-1, 3.8-2 and 3.8-3 below for typical
wiring diagrams for two-wire current loop transducers configurations.

FIGURE 3.8-1. 2-Wire with Datalogger Power

FIGURE 3.8-2. 2-Wire with External Power

FIGURE 3.8-3. 2-Wire Single-Ended with Datalogger Power

3-165
Section 3. CRBasic and Measurements

3.8.4.2.2 Basic Three-Wire 4-20mA Current Loop


A three wire current loop transducer has the power supply connected directly to
the transducer. The voltage of the power supply is the voltage applied to the
transducer. The current output returns to power ground. Datalogger ground is
connected to sensor ground and the current output by the sensor must pass
through the resistor before going to ground.

FIUGRE 3.8-4. 3-Wire with Datalogger Power

FIGURE 3.8-5. 3-Wire External Power

3-166
Section 3. CRBasic and Measurements

3.8.4.2.3 Basic Four-Wire 4-20mA Current Loop


A four wire transducer has separate wires for power input and ground and for
signal output and ground. The signal ground may or may not be internally tied
to the power ground. Some transducers have completely isolated outputs. See
Figures 3.8 – 6 and 7 for two wiring diagrams for using 4-wire current
transducers.

FIGURE 3.8-6. 4-Wire with Datalogger Power

FIGURE 3.8-7. 4-Wire External Power

3-167
Section 3. CRBasic and Measurements

3.8.5 Sensor and Programming Example


In the following example, a current transducer is measured with a CR1000
datalogger and using a CURS100 TIM module to convert the current to a
voltage. The voltage is converted to a milli-volt output of the CURS100 and
read as a differential voltage using the VoltDiff instruction within CRBasic.

IMPORTANT Current measurements such as 4-20 mA signals vary widely in


how they can be powered and connected to a datalogger. Please
refer to the CURS100 manual or the Application Note on this
subject which you may obtain from Campbell Scientific. The
measurement of a 4-20 mA signal requires a precision shunt
resistor of either 100 or 125 ohms. Typical ratings on the
resistor are 0.1 percent tolerance, 10 ppm per deg C, and 1/4
watt. (If Campbell Scientific's CURS100 Terminal Input Module
is used, select the 100 ohm value.)

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.

Vmin = [9 V + (20 mA amps * 100 ohms)] = 11 VDC (Example)

NOTE It is important that you monitor your excitation to your


transducer to ensure your excitation is always greater than Vmin.

3-168
Section 3. CRBasic and Measurements

3.8.5.1 Basic Program Example using CR1000 and CURS100


'CR1000
'Created by Short Cut (2.9)
'Sample Program for using a CURS100 measuring a 4 -20 mA transducer

'Declare Variables and Units


Public PTemp_C
Public Measure
Units PTemp_C=Deg C
Units Measure=mA

'Define Data Tables


DataTable(Table1,True,-1)
DataInterval(0,60,Min,10)
Sample(1,Measure,FP2)
EndTable

'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.8.5.2 Important ShortCut Screen Shots for CURS100 Program


3.8.5.2.1 4-20 mA Sensor Selection Screen

3-169
Section 3. CRBasic and Measurements

3.8.5.2.2 Sensor Setup Screen

3.8.5.2.3 Screen showing wiring diagram for sensor to Datalogger

3-170
Section 3. CRBasic and Measurements

3.9 Advanced CRBasic Topics


3.9.1 Expressions, Boolean Logic and Programming for Control
Campbell Scientific’s dataloggers can control connected devices by sending
logic signals or other kinds of excitation or output to them out of control ports.
Knowledge of program calculations and boolean variables is essential when
using these techniques.

3.9.1.1 Mathematical Expressions Exercise


Mathematical expressions can be entered algebraically into program code to
perform processing on measurement values or other variables.

Algebraic expressions can be used in CRBasic programs to easily perform


processing on variables. Expression evaluation follows many of the basic rules
of algebra, such as using parentheses to indicate which operations are evaluated
first.

►► Exercise 3.9.1.1 Mathematical Expression


Start with Example Program 3.1.6-4, Average.CR1. Change the Scan rate to 50
mS. Add a mathematical expression for explicitly converting the module
temperature measurement from degrees Celsius to degrees Fahrenheit.

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.

3.9.1.2 True and False


Conditional processing within a program requires the CR1000 to evaluate an
expression and take one path if the expression is true and another if it is false.
The words true and false are predefined constants in CRBasic.

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.

A true/false condition can be represented as a numeric variable (Float, Long,


or Integer) or a Boolean variable (which has values of only true and false). A
numeric variable with any value other than zero will be considered to be true
when being evaluated within a conditional expression.

Boolean variables are typically used as flags, to represent program conditions,


or to represent hardware which has only two states (on/off, high/low, etc.).
The use of Boolean variables allows CSI’s software to represent the current
state as true/false, on/off, red/blue, etc.

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.

The PreserveVariables instruction can be used to retain the values in Public or


Dim variables at Logger power-down, whether due to a power failure,
programmed controlled stop or manual stop.

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).

3.9.1.3 Using other Words for True and False


The identifiers true and false are predefined constants in CRBasic. Other,
more descriptive, words can be used for representing these values as well.

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.

In the following example, a conditional statement is used to set a flag high


based on the difference between the air and reference temperatures.

Public Flag AS Boolean


Const high = true
Const low = false

‘If DeltaT_C is greater than or equal to 3 then set Flag(1) high, else set it low.

'set Flag(1) 'high' when delta T is >= 3


If DeltaT_C>=3 then
Flag(1)=high
Else
Flag(1)=low
EndIf

The use of Boolean variables allows their display text to be changed in


LoggerNet’s numeric display. Choose the Boolean variable in the Numeric
display, right click and choose Options. Changing the Boolean Strings changes
how they are displayed in the Numeric display. For example, the state of a
light could be displayed as “ON” or “OFF”, or “High” or “Low”, or any other
text based on your preference.

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

3.9.1.4 Conditional Statements


A conditional statement can include multiple and and or operators. The most
common method for programming conditional statements is to use an
If/Then/Else statement block. For example:

If ((TC(1) > 85) and (TC(1) < 95) or (TC(2) < TC(3)) and (TC(3) > 0))Then
Flag(1) = false
Endif

There are two forms of the If .. Then construct:

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.

Single Line Form Syntax

If condition Then thenpart [Else elsepart]


Single Line Form Description
The single line If/Then construct has these parts:
Part Description
If Keyword that begins the simple If...Then control structure.
condition Boolean expression to be evaluated for deciding which path
to take
Then Keyword used to identify the beginning of actions to be
taken if a condition is satisfied.
thenpart Statements or branches performed when condition is true.
Else Keyword used to identify actions taken if condition is not
satisfied. If the Else clause is not present, control passes to
the next statement in the program.
elsepart Statements or branches performed when condition is false.
The single-line form can be used when only one statement is executed for the
true block (If statement) and one statement for the false block (Else statement).
It is used for short, simple, conditional tests. The EndIf statement is not used at
the end with the single-line form.

Block form Syntax

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.

In executing a block If construct, CRBasic tests condition1, the first numeric


expression. If the expression is true, the statements following Then
(statementblock-1) are executed and control jumps to the EndIf instruction,
skipping any ElseIf and Else statements altogether.

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.

Single Line versus Block form Comparison


The multi-line form is usually the recommended format because it provides
more structure and flexibility than the single-line form. It allows multiple lines
of code to be executed in each branch (If/Else). It is usually easier to read,
maintain, and debug. An EndIf statement must close the block form of an
If…Then control structure.

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."

In a single-line block, it looks like this in CRBasic:


If ( (TC(1) > 85) or (TC(2) > 85) ) Then Flag(1)=true Else Flag(1)=false

3-175
Section 3. CRBasic and Measurements

In a multi-line block it looks like this:


If (TC(1) > 85 or TC(2) > 85 ) Then
Flag(1) = true
Else
Flag(1) = false
EndIf

►► Exercise 3.9.1.4: Conditional FlagUsage


Start with Exercise 3.9.1.1 Program: DeltaT.CR1. Add a conditional statement
to have a flag set high only when the difference between the air temperature
and reference temperature is greater than 10 degrees Fahrenheit. Save the
program as DeltaTFlagSet.CR1

Logic text description


‘If DeltaT_F is greater than or equal to 10, Then set Flag true, Else set false.

Single Line Form


If DeltaT_F>=10 Then Flag=true Else Flag=false

Block Form
If DeltaT_F>=10 Then
Flag=true
Else
Flag=false
EndIf

3.9.1.5 Programming for Control


The eight Control Ports can be used to physically control devices.

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)

The Scan instruction parameters.


Port The Control Port number (1-8) that is to be modified.
State The state to set the port (non-zero = high, 0 = low)
The following PortSet example sets Port #1 to match the state of Flag(1). If
you change the state of Flag(1), then the state of Control Port #1 will change
accordingly.

If Flag(1)=true Then
PortSet (1,1)
Else
PortSet (1,0)
EndIf

3-176
Section 3. CRBasic and Measurements

Or an alternative one-line approach would be:

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.

3.9.2 DataTable Modifiers


Within a DataTable declaration optional output trigger modifiers may be used.

Output trigger modifiers, such as DataEvent and DataInterval, were covered in


Section 3. We have two more Output Trigger Modifier instructions to cover:
OpenInterval and FillStop.

3.9.2.1 OpenInterval Instruction


When the DataInterval instruction is included in a data table, the CR1000 uses
only values from within an interval for time series processing (e.g., average,
maximum, minimum, etc.). When data are output every interval, the output
processing instructions reset each time output occurs.

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.)

OpenInterval is used to modify an interval driven table so that time series


processing in the table will include all values processed since the last time the
table output data. Data will be output whenever the table is called on the
output interval (provided the other trigger conditions are met), regardless of
whether or not output occurred on the previous interval.

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

Example 3.9-1 :OpenInterval:


In Example 3.9-1, five thermocouples are measured every 500 milliseconds.
Every 10 seconds, while Flag(1) is true, the averages of the reference and
thermocouple temperatures are output. The user can toggle Flag(1) to enable
or disable the output. Without the OpenInterval Instruction, the first averages
output after Flag(1) is set high would include only the measurements within the
previous 10-second interval (average of 20 values). This is the default and is
what most users desire. With the OpenInterval in the program (remove the
initial single quote (‘) to uncomment the instruction) all the measurements
made while the flag was low will be included in the first averages output after
the flag is set high.

Const RevDiff = 1 'Reverse input to cancel offsets


Const Del = 0 'Use default delay
Const Integ = 0 'Use default Integration
Public RefTemp 'Declare the variable used for reference temperature
Public TC(5) 'Declare the variable used for thermocouple measurements
Public Flag(8)
Units RefTemp=degC '
Units TC=degC

DataTable (AvgTemp,Flag(1),1000) 'Output when Flag(1)=true


DataInterval(0,10,sec,10) 'Output every 10 seconds(while Flag(1)=true)
'OPENINTERVAL 'Uncomment to include data while Flag(1)=false in next Avg
Average(1,RefTemp,IEEE4,0)
Average(5,TC,IEEE4,0)
EndTable

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.9.2.1 FillStop Instruction


DataTables are by default ring memory where, once full, new data are written
over the oldest data. Entering FillStop into a data table declaration sets the
CPU memory for the Datatable as fill and stop. Once the DataTable is filled,
no more data are stored until the DataTable has been reset. The DataTable
can be reset from within the program by executing the ResetTable instruction.
Tables can also be reset from RTDAQ's Status Table window
(Datalogger/Status Table).

See Section 3.1.6.6.3.2 Table Modification Instructions for information on


setting memory allocated for DataTables on a PC card as Fill and Stop.

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

►► Exercise 3.9.2.1: Fill and Stop Exercise


Start with Exercise 3.9.1.5 Program: DeltaTPortSet.CR1. Add a second Data
Table that is a clone of the “Temp” Data Table. Call the new Data Table
“Table2”.

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”.

3.9.3 Multiple Scan…NextScan Instructions


Multiple Scan…NextScan instruction blocks are allowed in a single CRBasic
program. For concurrent measurements using separate Scans, see the Section
on the Slow Sequence instruction.

Multiple Scan…NextScan blocks can be inserted into a CRBasic program.


Control the termination of a Scan...NextScan block by specifying a non-zero
value in the Count parameter or by using the ExitScan instruction.

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

Public Result, FirstScan AVWDest(16,6)


Public Accel
DataTable (VW,1,1000)
Sample (1,Result,IEEE4)
Sample (96,AVWDest(),IEEE4)
EndTable
DataTable (Accels,True,-1)
DataInterval (0,0,0,10)
Sample (1,Accel,IEEE4)
EndTable
BeginProg
SerialOpen (Com1,38400,0,0,50)
Do
Scan (1,min,1,1) ‘Perform 1 Scan with the AVW200
AVW200 (Result(),Com1,-1,200,AVWDest(),1,1,10,450,1200,1,_60Hz,1,0)
CallTable VW
If FirstScan = 1 then ExitScan ‘Setup AVW200 on first Scan
FirstScan = 1
NextScan
Scan (10,mSec,1000,0) 'Measuring Accel as fast as possible
BrFull (Accel,1,mV25C,1,Vx1,1,2500,0,0,0,250,.1256,-0.98)
If IfTime (0,4,Hr) Then ExitScan 'Exit Scan every four hours to make VW Measurements
CallTable Accels
NextScan
Loop ‘Loop back up for the next AVW200 Scan
EndProg

Example Program 3.9-2 Program using Multiple Scan/NextScans

3.9.4 Using Slow Sequence Scans


Use a SlowSequence instruction immediately before a secondary
Scan…NextScan block to execute multiple concurrent scan intervals. A
SlowSequence scan runs at the same time as the main scan, fitting its tasks into
the unused datalogger processing time left available after all the tasks for an
iteration of the main sequence are completed.

NOTE It is possible to have up to four different SlowSequence scans


for measurements that are not needed at the rate of the primary
scan interval.

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 SequentialMode, if the time arrives for measurements to be run in the main


scan while a slow sequence scan is in progress with a particular measurement,
then that measurement in the slow sequence is finished, and then the
measurements in the main scan are run. After the main Scan measurements
are complete, the task sequencer will synch back up to the Slow Sequence
measurement instruction directly following the instruction it last completed
(prior to the main Scan getting priority).

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.

When there is adequate time for all measurements, calibration is performed in


the background to provide continuous adjustment as temperature changes. If
there is not enough time to perform automatic calibration, you may want to
enable it under program control if accuracy is important. If 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

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:

Public RefTemp,Temp1, Calib1(60)


DataTable(Table1,1,600)
DataInterval(0,1,sec,1)
Sample(1,Temp1,FP2)
EndTable
BeginProg
Scan(10,mSec,0,0)
PanelTemp (RefTemp,250)
TCDiff (Temp1,1,mV2_5C,1,TypeT,RefTemp,True ,0,250,1.0,0)
CallTable Table1
NextScan
SlowSequence
Scan (60,Sec,0,0)
Calibrate(Calib1)
NextScan
EndProg

Example Program 3.9-3 Slow Sequence Scan

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 Declare Subroutines and Functions


The use of subroutines and functions is optional. Subroutines and functions are
useful for doing the same thing multiple times. A function returns a value
whereas a subroutine does not. All subroutines and Functions must be defined
in the declarations area of the program (i.e., prior to the BeginProg
statement).

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.

Subroutine Construct Syntax:


Sub(SubName) optional argument list
other instructions
optional ExitSub
other instructions
EndSub
You can call a Subroutine using the name followed by the variable list.
Calling Statement: Call
Call is an optional keyword used to transfer program control to a subroutine.

Call Syntax:
Call SubName(List of Variables) or
SubName(List of Variables) or
SubName

The Scan/NextScan instruction loop can be used within a Subroutine using a


different execution interval than the main program.

Variables declared by Dim within a subroutine or function are local to that


subroutine or function. The same variable name can be used within other
subroutines or functions or as a global variable without conflict. Variables used
as parameters to a subroutine or function are also local.

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.

THE SUB STATEMENT HAS THESE PARTS:


Part Description

Sub Marks the beginning of a Subroutine.

SubName The SubName argument provides the name for the


procedure. Subroutine names follow the same rules that
constrain the names of other variables.

VariableList List of variables that are passed to the Subroutine when it is


called. Multiple variables are separated by commas. The
variable type can be declared as Float, Long, String, or The

3-182
Section 3. CRBasic and Measurements

list of Subroutine variables to pass is optional. Subroutines


can operate on the global program variables declared by the
Public or Dim statements. The advantage of passing
variables is that the subroutine can be used to operate on
whatever program variable is passed (see example).

When the Subroutine is called, the call statement must list


the program variables or values to pass into the subroutine
variable. The number and sequence of the program
variables/values in the call statement must match the number
and sequence of the variable list in the sub declaration.
Changing the value of one of the variables in this list inside
the Subroutine changes the value of the variable passed into
it in the calling procedure. (CRBasic passes all arguments
into a subroutine by reference (that is, a reference to the
memory location of the variable is passed, rather than an
actual value). Therefore, if the value of an argument is
changed by the subroutine, the change will take effect in the
main program as well.)

The call may pass constants or expressions that evaluate to


constants (i.e., do not contain a variable) into some of the
variables. If a constant is passed, the “variable” it is passed
to becomes a constant and cannot be changed by the
subroutine. If constants will be passed, the subroutine
should not attempt to change the value of the “variables”
that they will be passed into.

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).

Exit Sub Causes an immediate exit from a Subroutine. Program


execution continues with the statement following the
statement that called the Subroutine. Any number of Exit
Sub statements can appear anywhere in a Subroutine.

End Sub Marks the end of a Subroutine.

3-183
Section 3. CRBasic and Measurements

Subroutine Example Program 3.9-4


This program calls a Subroutine every hour and measures and calculates the
average temperature of 25 thermocouples. It returns this average to the
AM25T_1_Avg variable.

‘Program Name: Subroutine.cr1


Public AM25T_1_Avg

Sub SlowScan (TempAvg)


Dim I, TempAvg, TC(25), TRef
TempAvg = 0
Scan (10,Sec,3,1)
AM25T (TC(),25,mV25C,1,1,TypeT,TRef,1,2,Vx1,True ,0,250,1,0)
For I = 1 To 25
TempAvg = TempAvg + TC(I)
Next I
TempAvg = TempAvg/25
NextScan
EndSub

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").

A Function call includes the ability to pass in optional parameters. As with a


subroutine declaration, the Function routine parameter list describes local
parameters and optionally their type (Float, Long, Boolean, String). If not
specified, the default parameter type is Float. The number and sequence of the
program variables/values in the Function call must match the number and
sequence of the variable list in the Function declaration. The Function call

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.

THE FUNCTION DECLARATION STATEMENT HAS THESE PARTS:

Part Description

Function Marks the beginning of a Function.

FunctionName The FunctionName argument provides the name for the


Function. The field length is limited to 16 characters.
Function names follow the same rules that constrain the
names of other variables.

VariableList List of variables that are passed to the Function when it is


called. The list of variables to pass is optional. The
advantage of passing variables is that the Function can be
used to operate on whatever program variable(s) is passed.
Multiple variables are separated by commas. The variable
type can be declared as Float, Long, String, or Boolean. To
declare the type, use the "AS" command. The following
construct sets Var1 as a String with 20 characters, Var2 as
a Long, and the value returned by the Function as a
Boolean variable type:
Function FunctionName(Var1 as String * 20,
Var2 as Long) as Boolean.
If 'AS Type' is not specified for a variable, the default
parameter type is Float. When a function is called, the
parameters are copied into the Function's local parameter
list, as is the case when subroutines are called. However,
unlike subroutines which copy the local parameter values
back out to any variables that were passed in, Functions
do not write over (pass back) values to the list of variables
in the Call expression. A Function simply returns a value
to be used by the expression that invoked the function the
same way a built in function would.

statementblock Any group of statements that are executed within the body
of the Function.

Return(expression) Causes an immediate exit from a Function. The value


returned by the Function is determined by the expression
listed as part of the Return instruction. An alternative
method of returning a value is to assign an expression to
the Function's name, as is done in the example code
above: Secant = 1/Cos(F_Angle). If neither method is
used, then NAN will be returned.

ExitFunction Causes an immediate exit from the Function. Any number


of ExitFunction statements can appear anywhere in a
Function. If a value assignment has not been made to the
Function (see Return) prior to encountering the
ExitFunction command, the Function will return NAN.

3-185
Section 3. CRBasic and Measurements

EndFunction Marks the end of the Function. If a value assignment has


not been made to the Function (see Return) prior to
encountering the EndFunction command, the Function will
return NAN.

In Program Example 3.9-5, the function Secant calculates the secant of an


angle. Note that the Angle variable's value (Argument in Secant) would not be
modified by the Function call.

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

►► Exercise 3.9.5.2:Function Exercise


Create a program that has a function, Cotangent, that returns the Cotangent of
an angle. Model this program off of Example Program 3.9-5. Upload and test.

3.9.6 Accessing Data and Properties


Data stored in a table, and properties about a table, can be accessed from within
the program.

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.

In addition to the GetRecord instruction, there is a set of data table access


instructions used to retrieve, not only specific stored data, but also information
about the DataTable itself. Because references to these functions are done
using the specific name of the table and its columns (which are user-defined),
they are excluded from the selection list in the Instruction Panel of the
CRBasic Editor.

3.9.6.1 GetRecord Instruction

NOTE The GetRecord instruction retrieves the entire requested record


with all its fields (columns). Individual field access is performed
using instruction syntax described in Section 3.9.6.2.

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)

GetRecord is the keyword name of the instruction. The three parameters


associated with the GetRecord instruction are:
Dest: The variable array where the Table’s record will be stored. If the Dest variable
is set up as a string, then all data values will be stored in the one variable. The
data values will be separated by commas and the string will have a <crlf>
termination. The record's time stamp will be the first data value. All time
stamps and variables declared as strings will be enclosed in quotes. Time
stamps will be displayed in International ISO format "yyyy-mm-dd hh:mm:ss"
with a fractional seconds if present.
If the Dest variable is set up as a numeric (FP2 or IEEE4) then the destination
array argument (Dest) must be dimensioned large enough to hold all of the
data fields (columns) of the record. Note that this does not include the
TimeStamp or Record column, as these parameters will not be retrieved.
TableName: The name of the Table whose record is to be retrieved.
RecBack: A number indicating how many records back into the table’s history the
program should search to retrieve the desired values. Specifying “1 record
back” will retrieve the most recent record. A negative number can be entered
for the RecsBack parameter to specify the time, in seconds since 1990, for the
record to be retrieved. Tip: use the SecsSince1990 instruction to determine
the seconds since Jan 1, 1990 for a specific date and time.

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.

Public Tref, TCTemp 'TC Reference and Temperature


Public BackRec(2) 'Array to hold GetRecord Results
Public Temp30 'Test for Trigger of GetRecord & Data Storage

DataTable (TC,1,1000) 'TCTemp DataTable


DataInterval (0,1,Sec,10) 'Store data every second
Sample(1,Tref,FP2)
Sample(1,TCTemp,FP2)
EndTable

DataTable(BackData,TCTemp>30,1000) 'BackData DataTable


Sample(2,BackRec(),FP2)
EndTable

BeginProg
Scan(1,Sec,3,0)
PanelTemp( Tref,250)
TCDiff (TCTemp,1,mV2_5C ,1,TypeT,Tref,True ,450,250,1.0,0)

If TCTemp > 30 Then GetRecord(BackRec,TC,3)

CallTable TC
CallTable BackData

NextScan
EndProg

Example Program 3.9-6 GetRecord

3-187
Section 3. CRBasic and Measurements

3.9.6.2 Data Table Access Instructions


These table-access functions must be entered directly into the CRBasic
program using the table-name as part of the syntax of the instruction.

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

PRC Output PRC Output


Abbreviation Processing Name Abbreviation Processing Name
Avg Average MMT Moment
Cov Covariance RFH RainFlow Histogram
Etsz ET Rso Solar Radiation
FFT FFT None required Sample
H4D Histogram4D SMM Sample at Max or Min
Hst Histogram Std Standard Deviation
LCr Level Crossing TMx Time of Max
Max Maximum TMn Time of Min
Med Median Tot Totalize
Min Minimum WVc WindVector

If a time of minimum or maximum is returned by Tablename.Fieldname, the


time is reflected in seconds since 1990. However, if FieldNameIndex is
entered as a negative value, then time is reflected in usec since 1990. This
time value can be converted to a standard datalogger timestamp if the
variable is declared as a Long and is Sampled into a table using the NSEC
data format.
Index Specifies the array element from which to retrieve the data and must always
be specified. Use 1 if the FieldName is a single element array.
Recordsback The number of records back in the data table from the current time (1 is the
most recent record stored, 2 is the record stored prior to the most recent) to
retrieve. A negative number can be entered for the RecordsBack parameter
to specify the time, in seconds since 1990.

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.EventEnd(1,1) returns -1 (True) during a scan when the


last record of the data storage event occurs and returns 0 (false)
during all other scans. This construct should be placed after the
CallTable instruction for the Table in question.

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.

Tablename.Tablesize(1,1) Returns the size, in records, of the table.

Tablename.Timestamp(m,n) = element m of the timestamp output n records ago. where:The


TableName.TimeStamp(m,n) syntax returns the time into an interval
or a timestamp for the record n number of records ago. The name of
the DataTable is entered in place of the TableName parameter.
TableName is limited to 20 characters. The type of timestamp
returned is based on the option specified for m and the format of the
variable in which the timestamp is stored: The timestamp returned
has a 10 micro-second resolution.

Syntax: TimeVariable = TableName.TimeStamp(1,1)

When the variable where the timestamp will be stored is declared as


a Float or Long, the result returned is:
timestamp(0,n) = seconds since 1970
timestamp(1,n) = seconds since 1990
timestamp(2,n) = seconds into the current year
timestamp(3,n) = seconds into the current month
timestamp(4,n) = seconds into the current day
timestamp(5,n) = seconds into the current hour
timestamp(6,n) = seconds into the current minute
timestamp(7,n) = microseconds into the current second

When the variable where the timestamp will be stored is declared as


a String, the result returned is the timestamp using the specified
formats below:

3-189
Section 3. CRBasic and Measurements

timestamp(1,n) = “MM/DD/YYYY hh:mm:ss.sssss


timestamp(3,n) = “DD/MM/YYYY hh:mm:ss.sssss”
timestamp(4,n) = "CCYY-MM-DD hh:mm:ss.sssss"

where:
M = Month
D = D
Y = Year
C = Century
hh = Hour
mm = Minute
ss.sssss = Seconds (10 microsecond resolution)

Tablename.TableFull(1,1) Returns -1 (True)or 0 (False) to indicate if a “Fill and Stop” table is


full, or if a “Ring” memory table has begun overwriting its oldest
data. 0 (False) indicates that the table is not full/overwriting. -1
(True) indicates that the table is full/overwriting.

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.

Public RefTemp, TC(6)


Public EventNum, RecordNum, Tdiff, Flag(8)
DataTable(Table1,True,500)
DataEvent(0,TC(1)>30,TC(2)>30,105)
DataInterval(0,200,msec,10)
CardOut(0,-1)
Average(1,RefTemp,fp2,0)
Average(6,TC(),fp2,0)
EndTable
BeginProg
Scan(50,MSEC,3,0)
PanelTemp(RefTemp,250)
TCDiff(TC(),6,mV2_5C,1,TypeT,RefTemp,True,450,500,1,0)
CallTable Table1 'Call Data Table
EventNum = Table1.EventCount(1,1) 'Track # of data trigger events
If Table1.Output(1,1) then Flag(1)=-1 else Flag(1)=0 'Set Flag(1) based on if data was stored this Scan
If Table1.TableFull(1,1) then Flag(2)=-1 else Flag(2)=0 'Set Flag(2) based on if Table is full
RecordNum = Table1.Record(1,1) 'Track # records written to Table
If RecordNum > 100 then 'If sufficient records then:
Tdiff = Table1.TC_Avg(1,1) - Table1.TC_Avg(1,101) 'Diff between the current TC(1) value and the
Endif 'TC(1) value from 100 records back calculated
NextScan ‘Loop up for next Scan
EndProg

Example Program 3.9-7 Data Table Access

3-190

You might also like