CR800/CR850 Measurement and Control System Revision: 9/07 C o p y r i g h t © 2 0 0 0 - 2 0 0 7 C a m p b e l l S c i e n t i f i c , I n c .
Warranty and Assistance The CR800/CR850 MEASUREMENT AND CONTROL SYSTEM is warranted by CAMPBELL SCIENTIFIC, INC. to be free from defects in materials and workmanship under normal use and service for thirty-six (36) months from date of shipment unless specified otherwise. Batteries have no warranty. CAMPBELL SCIENTIFIC, INC.'s obligation under this warranty is limited to repairing or replacing (at CAMPBELL SCIENTIFIC, INC.'s option) defective products.
CR800/CR850 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. CR800 and CR850 Overview ..................................... OV-1 OV1. Physical Description ......................................................................OV-1 OV1.1 Measurement Inputs ..............................................................OV-1 OV1.1.1 Analog Inputs (SE 1-6, DIFF 1-3) ..........................
CR800/CR850 Table of Contents OV4.4.4 Send the Program...................................................... OV-27 OV4.4.5 Monitor Data Tables ................................................. OV-27 OV4.4.6 Collect Data .............................................................. OV-28 OV4.4.7 View Data ................................................................. OV-29 OV4.5 Programming using the CRBasic Program Editor .............. OV-30 OV5. Keyboard Display.......................................
CR800/CR850 Table of Contents 3. CR800 Measurement Details....................................3-1 3.1 Analog Voltage Measurement Sequence .............................................. 3-1 3.1.1 Voltage Range............................................................................. 3-1 3.1.2 Reversing Excitation or the Differential Input ............................ 3-3 3.1.3 Measuring Single-Ended Offset .................................................. 3-3 3.1.4 SettlingTime..........................
CR800/CR850 Table of Contents 6. Data Table Declarations and Output Processing Instructions ................................................................... 6-1 6.1 6.2 6.3 6.4 Data Table Declaration ......................................................................... 6-1 Trigger Modifiers.................................................................................. 6-2 Export Data Instructions .......................................................................
CR800/CR850 Table of Contents 14.2.5 Communication Peripheral Setup............................................ 14-9 14.2.6 LoggerNet Device Map Configuration.................................. 14-10 14.3 PakBus Concepts ............................................................................ 14-11 14.3.1 Packets .................................................................................. 14-11 14.3.2 PakBus Devices..................................................................... 14-12 14.3.
CR800/CR850 Table of Contents 8-1. Dew Point Temperature over the RH Range for Selected Air Temperatures................................................................................... 8-10 8.2 Effect of RH Errors on Calculated Dew Point .................................... 8-11 14.1-1. PakBus Graph Network View....................................................... 14-5 14.2-1A. Flat Map................................................................................... 14-10 14.2-1B. Tree Map .........
CR800 and CR850 Overview The CR800 and CR850 provide precision measurement capabilities in a rugged, batteryoperated package. The CR800 and CR850 include CPU and analog and digital inputs and outputs. The on-board, BASIC-like programming language includes data processing and analysis routines. PC200, PC400, or LoggerNet software provides program generation and editing, data retrieval, and real-time monitoring. The CR800 and CR850 differ in their keyboard display.
CR800 and CR850 Overview Analog Inputs Voltage VoltDiff VoltSE Thermocouple TCDiff TCSE Bridge measurements (use VX) BrFull BrFull6W BrHalf BrHalf3W BrHalf4W Others PanelTemp PeriodAvg AM25T Ground Lug Switched Voltage Excitation (EX) Excite BrFull BrFull6w BrHalf BrHalf3W BrHalf4W 12 V Power Ground (G), for 5V SW-12 12V SDM Control I/O CS I/O DSP4 (Data Tables and Output) Signal Ground ( Analog Pulse Excitation Sensor Shields Pulse Inputs PulseCount PulseCountReset Control I/O PortGet PortSet Puls
CR800 and CR850 Overview OV1.1.2 Signal Grounds ( ) ) should be used as the reference for Single-ended Analog Signal Grounds ( inputs, Pulse inputs, Excitation returns, and sensor shield wires. Signal returns terminals located next to the Pulse for the Pulse inputs should use the inputs. OV1.1.3 Power Grounds (G) Power Grounds (G) should be used as the returns for the 5V, SW12, 12V, and C1-C8 outputs.
CR800 and CR850 Overview OV1.1.9 Pulse Inputs (P1-2) Two Pulse input channels can count pulses from high-level (5 V square wave), switch closure, or low-level A/C signals. OV1.1.10 Program Status The LED will blink once every 3 seconds if there is power, but no program executing. If there is an executing program, the LED flashes once every 15 seconds. OV1.2 Communication and Data Storage OV1.2.
CR800 and CR850 Overview Pin 5 CS I/O COMPUTER RS232 Pin 9 Pin 1 Pin 6 FIGURE OV1-3. Serial Communication Interfaces OV1.2.2 Computer RS-232 The CR800 RS-232 port is not isolated. Direct connection of the CR800 to a PC is most conveniently done through the "Computer RS232" port (Figure OV1-3). Table OV1-2 gives a brief description of each "Computer RS232" pin. The Computer RS-232 port is a DCE device when connected to a PC with a serial cable.
CR800 and CR850 Overview OV1.3 Power Supply and AC Adapter The CR800 requires a separate 12 V power supply. The PS100 power supply has a 7 amp hour battery with built in charging regulator. Optional adapters for AC power are available. Charging power can also come from a 17-28 VDC input such as a solar panel. OV2. Memory and Operating Concepts OV2.1 Memory The CR800 has 2 MB Flash EEPROM that is used to store the Operating System. Another 128 K of Flash is used to store configuration settings.
CR800 and CR850 Overview OV2.3 Instruction Execution within the Datalogger The execution of instructions within the datalogger is accomplished using three separate task types: measurement, SDM, and processing. As it is named, the measurement task handles measuring the signals received on the datalogger’s wiring panel, as well as outputting signals for control of other devices. The measurement and control hardware is manipulated on a rigidly timed sequence.
CR800 and CR850 Overview is converted to a value determined by the processing included in the instruction, and then the datalogger proceeds to the next instruction. Because of this step-by-step instruction execution, conditional measurements are allowed in sequential mode. The exact time at which measurements are made may vary if other measurements or processing are made conditionally, if there is heavy communications activity or other interrupts. OV2.3.
CR800 and CR850 Overview conflicting use of measurement hardware. In this scheme the main scan has the highest priority and prevents other sequences from using measurement hardware until the main scan is completed (including processing). Other tasks, such as processing from other sequences and communications, can occur while the main sequence is running.
CR800 and CR850 Overview • Datalogger to datalogger communications – Special PakBus instructions simplify transferring data between dataloggers for distributed decision making or control. All devices that send or receive messages in a PakBus network must have a unique PakBus Address. The CR800 default PakBus address is 1. In a PakBus Network each datalogger must be set to a unique address before it is installed in the network. To communicate with the CR800, the PC software (e.g.
CR800 and CR850 Overview • Updates to DevConfig are available from Campbell Scientific's web site. These may be installed over top of older versions. OV3.1 Main DevConfig Screen The DevConfig window is divided into two main sections: the device selection panel on the left side and tabs on the right side. After choosing a device on the left, you will then have a list of the serial ports (COM1, COM2, etc.) installed on your PC.
CR800 and CR850 Overview OV3.2 Deployment Tab The Deployment Tab allows the user to configure the datalogger prior to deploying it. OV3.2.1 Datalogger Serial Number displays the CR800 serial number. This setting is set at the factory and cannot be edited. OS Version displays the operating system version that is in the CR800. Station Name displays the name that is set for this station. PakBus Address allows you to set the PakBus address of the datalogger. The allowable range is between 1 and 4094.
CR800 and CR850 Overview security code. If the user enters the Security1 code, the datalogger program can be changed or retrieved or variables can be set in the Status table. Security Password 2 When this level is set, data collection is unrestricted, requiring no security code. If the user enters the Security2 code, the datalogger clock can be changed and variables in the public table can be changed.
CR800 and CR850 Overview as neighbors on the port specified by Selected Port. As you select items in this list, the values of the Begin and End range controls will change to reflect the selected range. You can add multiple lists of neighbors on the same port. Begin and End Range are used to enter a range of addresses that can either be added to or removed from the neighbors list for the port specified by Selected Port.
CR800 and CR850 Overview OV3.2.3 Advanced Is Router allows you to control whether the datalogger will act as a PakBus router. PakBus Nodes Allocation Specifies the amount of memory that the CR800 Allocates for maintaining PakBus Routing information. This value represents roughly the maximum number of PakBus Nodes that the CR800 will be able to track in its routing tables.
CR800 and CR850 Overview OV3.3 Logger Control Tab The clock in the PC and the datalogger will be checked every second and the difference displayed. The System Clock Setting allows you to configure what offset, if any, should be used with respect to standard time (Local Daylight Time or UTC, Greenwich mean time). The value selected for this control will be remembered between sessions. Clicking the Set Clock Button will synchronize the station clock to the current computer system time.
CR800 and CR850 Overview OV3.4 Send OS Tab - Downloading an Operating System DevConfig can send operating systems to all Campbell Scientific devices with flash replaceable operating systems. An example for the CR800 is shown below: The text at right gives the instructions for downloading the OS. Follow these instructions. When you click the Start button, DevConfig offers a file open dialog box to prompt you for the operating system file (*.obj file).
CR800 and CR850 Overview OV3.5 Settings Editor Tab The CR800 has a number of properties, referred to as “settings”, some of which are specific to the PakBus protocol. PakBus is discussed in more detail in the PakBus Networking Guide available from the Campbell Scientific website (www.campbellsci.com). The Settings Editor tab provides access to most of the PakBus settings, however, the Deployment tab makes configuring some of these settings a bit easier.
CR800 and CR850 Overview Clicking the Revert to Defaults button on the Settings Editor will send a command to the device to revert to its factory default settings. The reverted values will not take effect until the final changes have been applied. This button will remain disabled if the device does not support the DevConfig protocol messages.
CR800 and CR850 Overview OV4. Quick Start Tutorial OV4.1 Software Products for the CR800 PC200W Starter Software supports a direct connection between the PC and the CR800, and includes Short Cut for Windows (Short Cut) for creating CR800 programs. PC200W provides basic tools for setting the datalogger’s clock, sending a program, monitoring sensors, and manually collecting and viewing data. CR800 support was added to PC200W in Version 3.0.
CR800 and CR850 Overview 2. The CRBasic Editor is a program editor used to create more complex CR800 programs. Short Cut generated programs can be imported into the CRBasic Editor for adding instructions, or for functionality not supported by Short Cut. For those users of CR10X dataloggers who are switching to CR800 dataloggers, the Transformer Utility can be used to convert a CR10X program to a CR800 program, which can be imported into the CRBasic Editor.
CR800 and CR850 Overview OV4.3 Setting the CR800 PakBus Address The CR800 default PakBus address is 1 (Section OV2.5). Unless the CR800 is used in a network, there is no need to change the Pakbus address, or any of the other default settings. To change settings, the Device Configuration Utility (DevConfig) is used, as described in Section 0V3. OV4.
CR800 and CR850 Overview OV4.4.1 Creating a CR800 Program using Short Cut Objective: Every one second, measure air temperature in degrees C with a Type T thermocouple, and store one-minute average Battery Voltage, Panel Temperature, and Thermocouple temperature. NOTE A Type T Thermocouple is included with CR800, packaged with the screwdriver. The thermocouple consists of a pair of 5-inch wires with blue/red insulation, soldered together at one end.
CR800 and CR850 Overview Step 2 is to select the sensors to be measured. From the Home page, click the Sensors button. The Sensors worksheet is divided into two sections: the Available sensors tree and the Selected sensors table, as shown below. The sensors you want to measure are chosen from the Available sensors tree. Double click on the Temperature application group to display the available sensors. Double click on the Wiring Panel Temperature sensor to add it the selected sensors table.
CR800 and CR850 Overview Click on the Wiring Diagram tab to view the sensor wiring diagram, as shown below. Wire the Type T Thermocouple (provided) to the CR800 as shown on the diagram. Click the Sensors tab and the Home button to return to the Home page to continue with Step 3. Step 3: Output Processing Step 3 is to define the output processing for the sensor measurements. From the Home page, click the Output button.
CR800 and CR850 Overview Click the Home button to continue with Step 4 to complete the program. Step 4: Finish Step 4 is to finish the program. From the Home page, click the Finish button. Type in QuickStart for the file name. Any errors the compiler may have detected are displayed, along with the names of the files that were created. The file QuickStart.CR8 is the program file that will be sent to the CR800, QuickStart.
CR800 and CR850 Overview OV4.4.2 Configuring the Setup Tab From the Setup/Connect screen, click on the Connect button to establish communications with the CR800. When communications have been established, the text on the button will change to Disconnect. Connect Button OV4.4.3 Synchronize the Clocks Click the Set Clock button to synchronize the datalogger’s clock with the computer’s clock. OV4.4.4 Send the Program Click the Select and Send Program button.
CR800 and CR850 Overview OV4.4.6 Collect Data Click on the Collect Data tab. From the Collect Data window you can choose what data to collect, and where to store the retrieved data. Click on the OneMin Table, with the Option New data from datalogger selected. Click the Collect button and a dialog box appears, prompting for a file name. Click the Save button to use the default file name CR800_OneMin.dat. A progress bar, followed by the message Collection Complete is displayed.
CR800 and CR850 Overview OV4.4.7 View Data To view the collected data, click on the View button (located in the upper right hand corner of the main screen). Options are accessed by using the menus or by selecting the toolbar icons. If you move and hold the mouse over a toolbar icon for a few seconds, a brief description of that icon's function will appear. To open a data file, click the Open file icon, and double click on the file CR800_OneMin.dat in the PC200W folder.
CR800 and CR850 Overview OV4.5 Programming using the CRBasic Program Editor Those users who are moving from the Edlog Program Editor to the CRBasic Program Editor may find Short Cut to be an excellent way to learn CRBasic. First create a program using Short Cut, then open the file with CRBasic to see how Short Cut created the program. The program file listed below is the Short Cut file QuickStart.CR8 from the tutorial after being imported into the CRBasic editor.
CR800 and CR850 Overview OV5. Keyboard Display This section illustrates the use of the CR1000KD or the CR850’s on-board keyboard display. The keyboard displays have a few keys that have special functions which are listed below.
CR800 and CR850 Overview Power Up Screen CR1000KD or CR850 Display CAMPBELL SCIENTIFIC CR800 Datalogger 06/18/2000, 18:24:35 CPU: TRIG.CR1 Running. Press any key for Main Menu (except <, >, ^.
CR800 and CR850 Overview OV5.1 Data Display Data Run/Stop Program File Ports and Status Configure, Settings Move the cursor to Data and press Enter Real Time Tables Real Time Custom Final Storage Data Reset Data Tables Graph Setup List of Data Tables created by active program List of Data Tables created by active program List of Data Tables created by active program All Tables List of Data Tables created by active program Graph Type Roll Scaler Manual Upper: 0.000000 Lower: 0.
CR800 and CR850 Overview OV5.1.1 Real Time Tables List of Data Tables created by active program. For Example, Public Table1 Temps Move the cursor to desired table and press Enter Tref TCTemp(1) TCTemp(2) TCTemp(3) Flag(1) Flag(2) Flag(3) Flag(4) : 23.0234 : 19.6243 : 19.3429 : 21.2003 : -1.0000 : 0.00000 : 0.00000 : 0.00000 Public Table values can be changed. Move the cursor to value and press Enter to edit value.
CR800 and CR850 Overview OV5.1.2 Real Time Custom The first time you navigate to Real Time Custom you will need to set up the display. The CR800 will keep the setup as long as the same program is running. List of Data Tables created by active program.
CR800 and CR850 Overview OV5.1.3 Final Storage Tables List of Data Tables created by active program.
CR800 and CR850 Overview OV5.2 Run/Stop Program Data Run/Stop Program File Ports and Status Configure, Settings Move the cursor to run/stop program and press Enter. If program is running CPU: ProgramName.CR8 Is Running >* Run on Power Up Stop, Retain Data Stop, Delete Data Restart, Retain Data Restart, Delete Data Execute } Select 1 (press Enter) and move the cursor to Execute. Press Enter to execute. Press escape to cancel or get list of available programs. If program is stopped CPU: ProgramName.
CR800 and CR850 Overview OV5.3 File Display Data Run/Stop Program File Ports and Status Configure, Settings New File Name: CPU: .CR8 Move the cursor to File and press Enter CPU: New Edit Copy Delete Run Options Directory Format Copy From To Execute List of files on CPU.
CR800 and CR850 Overview OV5.3.1 File: Edit The CRBasic Program Editor is recommended for writing and editing datalogger programs. Changes in the field can be made with the keyboard display. List of Program files on CPU: For Example: CPU: TCTEMP.CR8 RACE.CR8 0 0 Save Changes? Yes No ESC Move the cursor to desired Program and press Enter CR800 ' TCTemp.
CR800 and CR850 Overview OV5.4 Ports and Status Ports Status Table PortStatus (1): PortStatus (2): PortStatus (3): PortStatus (4): PortStatus (5): PortStatus (6): PortStatus (7): PortStatus (8): OFF OFF OFF OFF OFF OFF OFF OFF Move the cursor to the desired port and press Enter to toggle OFF/ON. The port must be configured as an output to be toggled.
CR800 and CR850 Overview OV5.5 Settings 05/24/2000, 15:10:40 Year 2000 Month 5 Day 24 Hour 15 Minute 10 Set Cancel Routes StationName PakBusAddress Security(1) Security(2) Security(3) IsRouter PakBusNodes Set Time/Date Settings Display : : : : : : : : xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx Turn Off Display Back Light Contrast Adjust Display Timeout: Yes Timeout (min): 4 Move the cursor to time element and press Enter to change OV5.5.
CR800 and CR850 Overview OV5.5.
CR800 and CR850 Overview OV6. Specifications Electrical specifications are valid over a -25° to +50°C range unless otherwise specified; non-condensing environment required. To maintain electrical specifications, Campbell Scientific recommends recalibrating dataloggers every two years. We recommend that you confirm system configuration and critical specifications with Campbell Scientific before purchase. 10 ms to 30 min. @ 10 ms increments 3 differential (DF) or 6 single-ended (SE) individually configured.
CR800 and CR850 Overview This is a blank page.
Section 1. Installation and Maintenance 1.1 Protection from the Environment The normal environmental variables of concern are temperature and moisture. The standard CR800 is designed to operate reliably from -25 to +50°C (-40°C to +85°C, optional) in noncondensing humidity. When humidity tolerances are exceeded, damage to IC chips, microprocessor failure, and/or measurement inaccuracies due to condensation on the PC board may result. Effective humidity control is the responsibility of the user.
Section 1. Installation and Maintenance CAUTION The 12 V and switched 12 V terminals on the wiring panel are not regulated by the CR800; they obtain power directly from the Power In terminal. If you use the CR800 wiring panel to source power to other 12 V devices, be sure the power supply regulates the voltage within the range acceptable to the connected device. The maximum voltage output by a Campbell Scientific power supply is approximately 16 V (the charging voltage at –40°C). 1.
Section 1. Installation and Maintenance TABLE 1.3-1. Typical Alkaline Battery Service and Temperature Temperature (°C) % of 20°C Service 20 - 50 100 15 98 10 94 5 90 0 86 -10 70 -20 50 -30 30 This data is based on one "D" cell under conditions of 50 mA current drain with a 30 ohm load. As the current drain decreases, the percent service improves for a given temperature. NOTE onic - MA V5.1 3 ic A Pan 1.5V AM 1.5V P ana s cino A P -3 AM -MA V5.1 3 aso nic ana -MA V5.
Section 1. Installation and Maintenance 1.3.2 PS100 Lead Acid Power Supply The PS100 power supply includes a 12 V, 7.0 amp-hour lead acid battery, an AC transformer (18 V), and a temperature compensated charging circuit with a charge indicating diode. An AC transformer or solar panel should be connected to the PS100 at all times. The charging source powers the CR800 while float charging the lead acid batteries. The internal lead acid battery powers the datalogger if the charging source is interrupted.
Section 1. Installation and Maintenance Monitor the power supply voltage using the datalogger Battery instruction. Incorporate this instruction into your data acquisition programs to keep track of the state of the power supply. If the system voltage level consistently decreases through time, some element(s) of the charging system has failed. The Battery instruction measures the voltage at the Power In terminals, not the voltage of the lead acid battery.
Section 1. Installation and Maintenance 1. A CR800 equipped with standard lead acid batteries should NEVER be used in applications requiring intrinsically safe equipment. 2. A lead acid battery should not be housed in a gas-tight enclosure. 1.3.3 A100 Null Modem Adapter The A100 Null Modem Adapter is used when 5 volts is needed to power external modems with the PS100 or CH100. The A100 supplies 5 volts to pin 1 of the 9 pin null modem ports. A common use for the A100 is in radiotelemetry networks.
Section 1. Installation and Maintenance CR800 Panel +12V G FIGURE 1.6-1. Connecting CR800 to Vehicle Power Supply 1.7 CR800 Grounding Grounding the CR800 and its peripheral devices and sensors is critical in all applications. Proper grounding will ensure the maximum ESD (electrostatic discharge) protection and higher measurement accuracy. 1.7.1 ESD Protection An ESD (electrostatic discharge) can originate from several sources.
Section 1. Installation and Maintenance on lightning protection or contact a qualified lightning protection consultant. An excellent source of information on lightning protection can be located via the web at http://www.polyphaser.com. In vehicle applications, the earth ground lug should be firmly attached to the vehicle chassis with 12 AWG wire or larger. In laboratory applications, locating a stable earth ground is not always obvious.
Section 1. Installation and Maintenance Examples: 1. Connect 5 Volt, 12 Volt, and control grounds to G terminals. 2. Connect excitation grounds to the closest terminal block. 3. Connect the low side of single-ended sensors to the nearest the analog input terminal blocks. 4. Connect shield wires to the nearest terminal blocks.
Section 1. Installation and Maintenance Make certain that the primary source of power for the CR800 can sustain the current drain for the period of time required. Contact a CSI applications engineer for help in determining a power budget for applications that approach the limits of a given power supply’s capabilities.
Section 1. Installation and Maintenance Other control port activated circuits are possible for applications with greater current/voltage demands than shown in Figures 1.9-1 and 2. For more information contact a Campbell Scientific applications engineer. FIGURE 1.9-1. Relay Driver Circuit with Relay FIGURE 1.9-2. Power Switching without Relay 1.10 Maintenance The CR800 power supplies require a minimum of routine maintenance.
Section 1. Installation and Maintenance 1.10.1 Desiccant The CR800 is shipped with desiccant to reduce humidity. Desiccant should be changed periodically. To prevent corrosion in uncontrolled or condensing atmospheres, the CR800 must be placed inside a weather tight instrument enclosure with desiccant. Do not completely seal the enclosure if lead acid batteries are present. Hydrogen gas generated by the batteries may build up to an explosive concentration. 1.10.
Section 1. Installation and Maintenance FIGURE 1.10-1. CR800 with wiring panel. FIGURE 1.10-2. Use a 3/8” socket wrench to remove CR800 canister from wiring panel.
Section 1. Installation and Maintenance FIGURE 1.10-3. Pull edge with thumbscrew away from wiring panel. FIGURE 1.10-4. Use socket wrench to disassemble canister.
Section 1. Installation and Maintenance FIGURE 1.10-5. Remove and replace battery.
Section 1. Installation and Maintenance This is a blank page.
Section 2. Data Storage and Retrieval The CR800 can store individual measurements or it may use its extensive processing capabilities to calculate averages, maxima, minima, histograms, FFTs, etc., on periodic or conditional intervals. Data are stored in tables. The number of tables and the values to output in each table are selected when running Short Cut (Overview) or when writing a datalogger program directly (Sections 4 – 9). 2.1 Data Storage in CR800 2.1.
Section 2. Data Storage and Retrieval resolution, and requires half the memory space as IEEE 4 byte floating point (2 bytes per value vs 4). TABLE 2.2-2. Resolution and Range Limits of FP2 Data Zero 0.000 Minimum Magnitude ±0.001 Maximum Magnitude ±7999. The resolution of FP2 is reduced to 3 significant digits when the first (left most) digit is 8 or greater (Table 2.2-2). Thus, it may be necessary to use IEEE4 output or an offset to maintain the desired resolution of a measurement.
Section 2. Data Storage and Retrieval "File Format","Station","Logger","Serial No.","OS Ver","DLD File","DLD Sig","Table Name" "TIMESTAMP","RECORD","Field Name","Field Name","Field Name" "TS","RN","Field Units","Field Units","Field Units" "","","Processing","Processing","Processing" "Field Data Type","Field Data Type","Field Data Type","Field Data Type","Field Data Type" timestamp,record number,field data,field data,field data, FIGURE 2.4.1 Header Information File Format The format of the file on disk.
Section 2. Data Storage and Retrieval Time Stamp This field is the date and time stamp for this record. It indicates the time, according to the logger clock, that each record was stored. Record Number This field is the record number of this record. The number will increase up to 2E32 and then start over with zero. The record number will also start over at zero if the table is reset. Field Data This is the data for each of the fields in the record. 2.4.
Section 2. Data Storage and Retrieval When TOB3 files are converted to another format, the number of records may be greater or less than the number requested in the data table declaration. There are always at least two additional frames of data allocated. When the file is converted these will result in additional records if no lapses occurred. If more lapses occur than were anticipated, there may be fewer records in the file than were allocated.
Section 2. Data Storage and Retrieval This is a blank page.
Section 3. CR800 Measurement Details 3.1 Analog Voltage Measurement Sequence The CR800 measures analog voltages with either an integrate and hold or analog to digital (A/D) conversion. The A/D conversion is made with a 13-bit successive approximation technique which resolves the signal voltage to approximately one part in 7500 of the full scale range.
Section 3. CR800 Measurement Details two measurements. The first measurement determines the range to use. It is made with the 250 µs integration on the ±2500 mV range. The second measurement is made on the appropriate range using the integration specified in the instruction. Both measurements use the settling time programmed in the instruction. AutoRange optimizes resolution but takes longer than a measurement on a fixed range, because of the two measurements required.
Section 3. CR800 Measurement Details 3.1.2 Reversing Excitation or the Differential Input Reversing the excitation polarity or the differential input are techniques to cancel voltage offsets that are not part of the signal. For example, if there is a +5 µV offset in the measurement circuitry, a 5 mV signal will be measured as 5.005 mV. When the input is reversed, the measurement will be -4.995 mV. Subtracting the second measurement from the first and dividing by 2 gives the correct answer: 5.005-(-4.
Section 3. CR800 Measurement Details When the CR800 reverses the differential input or the excitation polarity it delays the same settling time after the reversal as it does before the first measurement. Thus there are two delays per channel when either RevDiff or RevEx is used. If both RevDiff and RevEx are selected, there are four measurement segments, positive and negative excitations with the inputs one way and positive and negative excitations with the inputs reversed.
Section 3. CR800 Measurement Details NOTE There are two sets of channel numbers on the analog channels. Differential channels (1-3) have two inputs: high (H) and low (L). Either the high or low side of a differential channel can be used for a single ended measurement. The single-ended channels are numbered 1-6. Because a single ended measurement is referenced to CR800 ground, any difference in ground potential between the sensor and the CR800 will result in an error in the measurement.
Section 3. CR800 Measurement Details A differential measurement has the option of reversing the inputs to cancel offsets as described above. NOTE Sustained voltages in excess of ±16 V will damage the CR800 circuitry. 3.3 Signal Settling Time Whenever an analog input is switched into the CR800 measurement circuitry prior to making a measurement, a finite amount of time is required for the signal to stabilize at it's correct value.
Section 3. CR800 Measurement Details 3.3.2 Measuring the Necessary Settling Time The CR800 can measure the time required for a particular sensor/cable configuration to settle. This is done by making a number of measurements with different settling times. Looking at the series of measurements it is possible to see the settling of the sensor signal. The following example demonstrates measuring the settling time for a differential voltage measurement.
Section 3. CR800 Measurement Details The program was run on a Druck water level pressure transducer with 200 feet of cable. The first six measurements are shown in Table 3.3-1. All 20 values are plotted in Figure 3.3-1. The reading has settled by the fourteenth measurement, PT(14), thus a settling time of 1400 µs is adequate. Table 3.3-1.
Section 3. CR800 Measurement Details junction, which becomes the reference junction, is formed where the other ends of the wires are connected to the measuring device. (With the connectors at the same temperature, the chemical dissimilarity between the thermocouple wire and the connector does not induce any voltage.
Section 3. CR800 Measurement Details Panel Temperature error summary 0.8 Sum of Worst Case Errors 0.7 Thermistor Tolorance CR1000 Measurement Completion Resistor Error 0.6 S&H Err 0.5 0.4 0.3 0.2 0.1 0 -55 -35 -15 5 25 45 65 85 -0.1 FIGURE 3.4-1. Panel Temperature Errors With an external driving gradient, the temperature gradients on the input panel can be much worse. For example, the CR800 was placed in a controlled temperature chamber.
Section 3. CR800 Measurement Details Reference Temperature Errors Due to Panel Gradient Chamber Changed from - 55 to 85 degrees C 12 80 10 Measured - Actual degrees C 8 40 Chanel 1 Chanel 3 Chanel 4 6 Chanel 5 20 Chanel 6 Chanel 8 RefTemp_Avg 4 Chamber Temp 0 2 -20 43 41 39 37 35 33 31 29 27 25 23 21 19 17 15 13 9 11 7 -60 5 -2 3 -40 1 0 Chamber and Reference Temperature degrees C 60 Time Minutes FIGURE 3.4-2.
Section 3. CR800 Measurement Details Thermocouple Limits of Error The standard reference which lists thermocouple output voltage as a function of temperature (reference junction at 0oC) is the National Institute of Standards and Technology Monograph 175 (1993). The American National Standards Institute has established limits of error on thermocouple wire which is accepted as an industry standard (ANSI MC 96.1, 1975). Table 3.
Section 3. CR800 Measurement Details Accuracy of the Thermocouple Voltage Measurement The -25 to 50 °C accuracy of a CR800 differential voltage measurement is specified as ± (0.075% of the measured voltage plus the input offset error of 2 times the basic resolution of the range being used to make the measurement plus 2 µV). The input offset error reduces to the basic resolution if the differential measurement is made utilizing the option to reverse the differential input.
Section 3. CR800 Measurement Details When the thermocouple measurement junction is in electrical contact with the object being measured (or has the possibility of making contact) a differential measurement should be made. Noise on Voltage Measurement The typical input noise on the ±25 mV range for a differential measurement with 250 µs integration and input reversal is 1.2 µV RMS. On a type T thermocouple (approximately 40 µV/oC) this is 0.03 oC.
Section 3. CR800 Measurement Details junction boxes however, must also be within these temperature ranges. Temperature difference measurements made outside of the reference temperature range should be made by obtaining the actual temperatures referenced to a junction within the reference temperature range and subtracting one temperature from the other. Table 3.4-3 gives the reference temperature ranges covered and the limits of error in the linearizations within these ranges.
Section 3. CR800 Measurement Details TABLE 3.4-5. Example of Errors in Thermocouple Temperature Source Reference Temp. TC Output Voltage Measurement Noise Reference Linearization Output Linearization Total Error Error: oC : % of Total Error Single Differential Reversing Differential 250 µs Integration 50/60 Hz Rejection Integration ANSI TC Error TC Error 1% ANSI TC TC Error 1% (1oC) Slope Error (1oC) Slope 0.15o:11.7% 0.15o:31.1% 0.15o:12.4% 0.15o:36.4% o o o 1.0 :78% 0.2 :41.5% 1.0 :82.5% 0.2o:48.
Section 3. CR800 Measurement Details CR9000 CR800 Junction BoxBox Junction H L A' A B' B TC FIGURE 3.4-4. Diagram of Junction Box An external reference junction box must be constructed so that the entire terminal area is very close to the same temperature. This is necessary so that a valid reference temperature can be measured and to avoid a thermoelectric offset voltage which will be induced if the terminals at which the thermocouple leads are connected (points A and B in Figure 3.
Section 3.
Section 3. CR800 Measurement Details I H L H IXR X = result w/mult = 1, offset = 0 Resistance used to measure full bridge X= = H L ⎛ R3 V1 R2 ⎞ ⎟ = Rbridge ⎜ − Ix ⎝ R3 + R4 R1 + R2 ⎠ R3 ( R1 + R2 ) − R2 ( R3 + R4 ) R1 + R2 + R3 + R4 − R2 R4 − X ( R2 + R3 + R4 ) X − R3 R R − X ( R1 + R3 + R4 ) R2 = 1 3 X + R4 − R2 R4 − X ( R1 + R2 + R4 ) R3 = X − R1 R1 = R4 = R1 R3 − X ( R1 + R2 + R3 ) X + R2 IXR FIGURE 3.5-1. Circuits Used with Bridge Measurement Instructions 3.
Section 3. CR800 Measurement Details FIGURE 3.6-1. Model of Resistive Sensor with Ground Loop In Figure 3.6-1, Vx is the excitation voltage, Rf is a fixed resistor, Rs is the sensor resistance, and RG is the resistance between the excited electrode and CR800 earth ground. With RG in the network, the measured signal is: V1 = Vx Rs ( Rs + Rf ) + RsRf / RG [3.6-1] RsRf/RG is the source of error due to the ground loop. When RG is large the equation reduces to the ideal.
Section 3. CR800 Measurement Details synchronized with real time and restarted. The CR800 actually measures the elapsed time since the last time the counters were read when determining frequency so in the case of an overrun, the correct frequency will still be output. The resolution of the pulse counters is one count. The resolution of the calculated frequency depends on the scan interval: frequency resolution = 1/scan interval (e.g., a pulse count in a 1 second scan has a frequency resolution of 1 Hz, a 0.
Section 3. CR800 Measurement Details 2. System background calibration. This automatically takes place in the background while the user program is running. Multiple measurements are not averaged, but a filter is applied to the new gain/offset values obtained. The filter is used so that the calibration values change slowly. The filter combines the newly measured value multiplied by 0.1 with the previous calibration value by 0.9 to arrive at the new calibration value.
Section 4. CRBasic - Native Language Programming The CR800 is programmed in a language that has some similarities to a structured basic. There are special instructions for making measurements and for creating tables of output data. The results of all measurements are assigned variables (given names). Mathematical operations are written out much as they would be algebraically. This section describes a program, its syntax, structure, and sequence. 4.1 Format Introduction 4.1.
Section 4. CRBasic - Native Language Programming 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; and Integration, the length of time to integrate the measurement.
Section 4. CRBasic - Native Language Programming Define Subroutines Program Set scan interval If there is a process or series of calculations that need to be repeated several times in the program, it can be packaged in a subroutine and called when needed rather than repeating all the code each time.
Section 4. CRBasic - Native Language Programming 4.3 Example Program Const RevDiff=1 Const Del=0 'default Const Integ=250 Const Mult=1 Const Offset=0 Declare constants Declare public variables , dimension array, and declare units.
Section 4. CRBasic - Native Language Programming The data table header also has a row that lists units for the output values. The units must be declared for the CR800 to fill this row out (e.g., Units RefTemp = degC). The units are strictly for the user's documentation; the CR800 makes no checks on their accuracy.
Section 4. CRBasic - Native Language Programming Average is an output processing instruction that will output the average of a variable over the output interval. The parameters are repetitions - the number of elements in an array to calculate averages for, the Source variable or array to average, the data format to store the result in (Table 4.3-1), and a disable variable that allows excluding readings from the average if conditions are not met.
Section 4. CRBasic - Native Language Programming is 1 second, three scans are buffered, and the measurements and output continue indefinitely. 4.4 Variable Data Types The declaration of variables (via the DIM or the PUBLIC statement) allow an optional type descriptor AS that specifies the data type. The default data type, without a descriptor, is IEEE4 floating point (FLOAT). The data types are FLOAT, LONG, BOOLEAN, and STRING. 4.4.1 FLOAT “AS FLOAT” specifies the default IEEE4 data type.
Section 4. CRBasic - Native Language Programming 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.) Public FirstName AS STRING * 20 Public LastName AS STRING * 20 4.4.
Section 4. CRBasic - Native Language Programming Expressions are evaluated as long as possible as integers Public X, I AS Long BeginProg I = 126 X = (I+3) * 3.4 ‘I+3 is evaluated as an integer, ‘then converted to FLOAT before ‘it is multiplied by 3.4 EndProg Constants will be converted to Longs and/or Floats at compilation If a constant (either entered as a number or declared with CONST) can be expressed correctly as an integer, the compiler will use the type that is most efficient in each expression.
Section 4. CRBasic - Native Language Programming 4.6 Logical Expression Evaluation 4.6.1 What is True? Several different words get used to describe a condition or the result of a test. The expression, X>5, is either true or false. However, when describing the state of a port or flag, on or off or high or low sounds better. In CRBasic there are a number of conditional tests or instruction parameters the result of which may be described with one of the words in Table 4.6-1.
Section 4. CRBasic - Native Language Programming The CR800 expression evaluator evaluates the expression, X>=5, and returns 1, if the expression is true, and 0, if the expression is false. W=(X>Y) will set W equal to -1 if X>Y or will set W equal to 0 if X<=Y. The CR800 uses -1 rather than some other non-zero number because the and and or operators are the same for logical statements and binary bitwise comparisons (see and and or in Section 8).
Section 4. CRBasic - Native Language Programming TABLE 4.8-1. Rules for Names Name for Maximum Length (number of characters) Allowed characters Variable or Array 16 Letters A-Z, upper or lower. Constant 16 case, underscore “_”, and Alias 16 numbers 0-9. The name must Data Table Name 8 start with a letter. CRBasic is Field name 16 not case sensitive 4.8.1 Expressions in Parameters Many parameters allow the entry of expressions.
Section 4. CRBasic - Native Language Programming Public Pressure(3), Mult(3), Offset(3) DataTable (AvgPress,1,-1) DataInterval (0,60,Min,10) Average (3,Pressure(),IEEE4,0) EndTable BeginProg 'Calibration Factors: Mult(1)=0.123 : Offset(1)=0.23 Mult(2)=0.115 : Offset(2)=0.234 Mult(3)=0.114 : Offset(3)=0.224 Scan (1,Sec,10,0) 'VoltSe instruction using array of multipliers and offsets: VoltSe (Pressure(),3,mV5000,1,True,0,_60Hz,Mult(),Offset()) CallTable AvgPress NextScan EndProg 4.
Section 4. CRBasic - Native Language Programming Tablename.timestamp(m,n) = element m of the timestamp output n records ago where: timestamp(1,n) = microseconds since 1990 timestamp(2,n) = microseconds into the current year timestamp(3,n) = microseconds into the current month timestamp(4,n) = microseconds into the current day timestamp(5,n) = microseconds into the current hour timestamp(6,n) = microseconds into the current minute timestamp(7,n) = microseconds into the current second Tablename.
Section 5. Program Declarations Alias Used to assign a second name to a variable. Syntax Alias VariableA = AliasName Remarks Alias allows assigning a second name to a variable. Within the datalogger program, either name can be used. Only the alias is available for Public variables. The alias is also used as the root name for data table fieldnames. With aliases the program can have the efficiency of arrays for measurement and processing yet still have individually named measurements.
Section 5. Program Declarations AS type The declaration of variables (via the DIM or the PUBLIC statement) allow an optional type descriptor AS that specifies the data type. The default data type, without a descriptor, is IEEE4 floating point (FLOAT). The data types are FLOAT, LONG, BOOLEAN, and STRING. AS FLOAT specifies the default IEEE4 data type. If no data type is explicitly specified with the AS statement, then FLOAT is assumed.
Section 5. Program Declarations Const Declares symbolic constants for use in place of numeric entries. Syntax Const constantname = expression Remarks The Const statement has these parts: Part constantname expression Description Name of the constant. Expression assigned to the constant. It can consist of literals (such as 1.0), other constants, or any of the arithmetic or logical operators. Tip Constants can make your programs easier to modify.
Section 5. Program Declarations ' Create the variable array A with 8 elements Dim A( 8) The maximum number of array dimensions allowed in a Dim statement is 3. If a program uses a subscript that is greater than the dimensioned value, a subscript out of bounds error is recorded. When variables are initialized, they are set to 0. Tip Put Dim statements at the beginning of the program.
Section 5. Program Declarations The example shows the use of the Public declaration. Dim x( 3 ), y, z( 2, 3, 4 ) Public x, y, z Public Dim x( 3 ), y, z( 2, 3, 4 ) Public x( 3 ),y, z( 2, 3, 4 ) Public w 'Dim is optional SequentialMode The SequentialMode instruction is used to configure the datalogger to perform all instructions sequentially as they occur in the program. Syntax SequentialMode Remarks The datalogger has two processing modes: sequential mode and pipeline mode.
Section 5. Program Declarations Sub, Exit Sub, End Sub Declares the name, variables, and code that form a Subroutine. Syntax Sub SubName [(VariableList )] [ statementblock ] [ Exit Sub ] [ statementblock ] End Sub The Sub statement has these parts: Part Description Sub Marks the beginning of a Subroutine. SubName Name of the Subroutine. Subname cannot be the same as any other globally recognized name in the program. VariableList List of variables that are passed to the Subroutine when it is called.
Section 5. Program Declarations 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. A Subroutine is a procedure that can take variables, perform a series of statements, and change the value of the variables. However, a Subroutine can't be used in an expression.
Section 5. Program Declarations 'Subroutine call using Call statement, 'RefT is used for both source and destination. Call ConvertCtoF(RefT, RefT) For I = 1 to 4 'Subroutine call without Call statement: ConvertCtoF(TC_C(I),TC_F(I)) Next I CallTable TempsF NextScan EndProg Units Used to assign a unit name to a field associated with a variable. Syntax Units Variable = UnitName Remarks Units allows assigning a unit name to a field. The unit name appears in the header of the output files.
Section 6. Data Table Declarations and Output Processing Instructions 6.1 Data Table Declaration DataTable (Name, TrigVar, Size) output trigger modifier export data destinations output processing instructions EndTable DataTable is used to declare/define a data table. The name of the table, output trigger and size of the table in RAM are set with DataTable. The Table declaration must be at the beginning of the code prior to BeginProg. The table declaration starts with DataTable and ends with EndTable.
Section 6. Data Table Declarations and Output Processing Instructions 6.2 Trigger Modifiers DataInterval (TintoInt, Interval, Units, Lapses) Used to set the time interval for an output table. DataInterval is inserted into a data table declaration following the DataTable instruction to establish a fixed interval table. The fixed interval table requires less memory than a conditional table because time is not stored with each record.
Section 6. Data Table Declarations and Output Processing Instructions Parameter & Data Type TintoInt Constant Interval Constant Units Constant Lapses Constant Enter The time into the interval (offset to the interval) at which the table is to be output. The units for time are the same as for the interval. Enter the time interval on which the data in the table is to be recorded. The interval may be in µs, ms, s, or minutes, whichever is selected with the Units parameter.
Section 6.
Section 6. Data Table Declarations and Output Processing Instructions DataEvent Example: In this example, 5 type T thermocouples are measured. The trigger for the start of an event is when TCTemp(1) exceeds 30 degrees C. The stop trigger is when TCTemp(1) less than 29 degrees C. The event consists of 20 records prior to the start trigger and continues to store data until 10 records following the stop trigger.
Section 6. Data Table Declarations and Output Processing Instructions WorstCase (TableName, NumCases, MaxMin, Change, RankVar) Allows saving the most significant or “worst-case” events in separate data tables. A data table is created that is sized to hold one event. This table acts as the event buffer. Each event that occurs is stored to this table. This table may use the DataEvent instruction or some other condition to determine when an event is stored.
Section 6. Data Table Declarations and Output Processing Instructions WorstCase Example This program demonstrates the Worst Case Instruction. Five type T thermocouples are measured. The event is similar to that in the example for the DataEvent instruction; the trigger for the start of a data event is when TC(1) exceeds 30 degrees C. However in this example, the stop trigger is set immediately true. This is done to set a fixed size for the event which can be duplicated in the worst case tables.
Section 6. Data Table Declarations and Output Processing Instructions 6.3 Export Data Instructions DSP4 (FlagVar, Rate) Send data to the DSP4. If this instruction appears inside a DataTable, the DSP4 can display the fields of this Table, otherwise, the Public Variables are used by the DSP4. The Instruction can only be used once in a program; hence, only the public variables or a single data table can be viewed.
Section 6. Data Table Declarations and Output Processing Instructions Parameter & Data Type Dest Variable or Array Table Table Name TableOption Constant BufferControl Constant DataFormat Constant Enter The variable that holds a result code for the transmission. The result codes are: Result Code Description 0 Command executed successfully 2 Timed out waiting for STX character from transmitter after SDC addressing 3 Wrong character received after SDC addressing.
Section 6. Data Table Declarations and Output Processing Instructions GOESGPS (GoesArray1(6), GoesArray2(7) ) The GOESGPS instruction is used to store GPS data from the satellite into two variable arrays. Syntax GOESGPS (GoesArray1(6), GoesArray2(7) ) Remarks The GOESGPS instruction returns two arrays. The first array, which must be dimensioned to 6, holds a result code indicating the success of the instruction, followed by global positioning information.
Section 6. Data Table Declarations and Output Processing Instructions See the CRBasic Editor or the SATHDRGOES manual for more detailed information on the instruction GOESStatus (Dest, StatusCommand) The GOESStatus instruction is used to request status and diagnostic information from the SAT HDR GOES satellite transmitter. NOTE When the datalogger sends a command, further processing tasks will be performed only after a response has been received from the HDR GOES Transmitter.
Section 6. Data Table Declarations and Output Processing Instructions Parameter & Data Type Reps Constant Source Enter The number of averages to calculate. When Reps is greater than one, the source must be an array. The name of the Variable that is to be averaged. Variable DataType Constant DisableVar Constant, Variable, or Expression A code to select the data storage format.
Section 6. Data Table Declarations and Output Processing Instructions Parameter& Data Type NumCov Constant Enter The number of covariances to calculate. The maximum number of covariances is Z/2*(Z+1). Where Z= NumVals. If X(1) is the first specified element of the source array, the covariances are calculated and output in the following sequence: X_Cov(1)…X_Cov(Z/2*(Z+1)) = Cov[X(1),X(1)], Cov[X(1),X(2)], Cov[X(1),X(3)], … Cov[X(1),X(Z)], Cov[X(2),X(2)], Cov[X(2),X(3)], … Cov[X(2),X(Z)], … Cov[X(Z),X(Z)].
Section 6. Data Table Declarations and Output Processing Instructions Parameter & Data Type Options Constant Enter A code to indicate what values to calculate and output. Code Result FFT. The output is N/2 complex data points, i.e., the real and 0 imaginary parts of the FFT. The first pair is the DC component and the Niquist component. This first pair is an exception because the DC and Niquist components have no imaginary part. 1 Amplitude spectrum. The output is N/2 magnitudes.
Section 6. Data Table Declarations and Output Processing Instructions Notes: • Power is independent of the sampling rate (1/tau) and of the number of samples (N). • The PSD is proportional to the length of the sampling period (T=N*tau), since the “width” of each bin is 1/T. • The sum of the AC bins (excluding DC) of the Power Spectrum is the Variance (AC Power) of the time series.
Section 6. Data Table Declarations and Output Processing Instructions DataTable(IFFT,1,1) 'inverse FFT fft(y,IEEE4,SIZE_FFT,10 msec,5) EndTable BeginProg Scan(10, msec,0,SIZE_FFT) i=i+1 X(i) = DC + Sin(PI/8+2*PI*CYCLESperT*i/SIZE_FFT) * AMPLITUDE + Sin(PI/2+PI*i) Next Scan CallTable(Amp) CallTable(AmpPhase) CallTable(Power) CallTable(PSD) CallTable(FFT) for i = 1 to SIZE_FFT y(i) = FFT.
Section 6. Data Table Declarations and Output Processing Instructions the datalogger will determine how many fields are created. If the list of names is greater than the number of fields, the extra names are ignored. If the number of fields is greater than the number names in the list of field names, the default names are used for the remaining fields.
Section 6. Data Table Declarations and Output Processing Instructions To obtain the average of the weighted values that occurred while the bin select value was within a particular sub-range, the weighted value output must be divided by the fraction of time that the bin select value was within that particular sub-range (i.e., a standard histogram of the bin select value must also be output; for each bin the weighted value output must be divided by the frequency distribution output).
Section 6. Data Table Declarations and Output Processing Instructions Parameter & Data Type Form Enter The Form argument is 3 digits - ABC Constant Code Form A=0 Reset histogram after each output. A=1 Do not reset histogram. B=0 Divide bins by total count. B=1 Output total in each bin. C=0 Open form. Include outside range values in end bins. C=1 Closed form. Exclude values outside range. 101 means: Do not reset. Divide bins by total count. Closed form.
Section 6. Data Table Declarations and Output Processing Instructions Histogram4D Output Example 'The example program below is an example of using the Histogram4D 'instruction to calculate a 2 dimensional histogram of RPM distribution vs Gear '\\\\\\\\\\\\\\\\\\\\ VARIABLES and CONSTANTS //////////////////// Public RPM, Gear, Port(4) Dim Bin(2) '\\\\\\\\\\\\\\\\\\\\\\\\ OUTPUT SECTION //////////////////////// DataTable (RPMvsG,1,100) DataInterval(0,60,Min,100) Histogram4D(Bin(), FP2, 0,4,8, 0, 0,000,1,0.
Section 6. Data Table Declarations and Output Processing Instructions LevelCrossing (Source, DataType, DisableVar, NumLevels, 2ndDim, CrossingArray, 2ndArray, Hysteresis, Option) Parameter & Data Type Source Variable or Array DataType Constant DisableVar Constant, Variable, or Expression NumLevels Constant 2ndDim Constant Crossing Array Array 2ndArray Array Hysteresis Enter The variable that is tested to determine if it crosses the specified levels.
Section 6. Data Table Declarations and Output Processing Instructions The source value may be the result of a measurement or calculation. Each time the data table with the Level Crossing instruction is called, the source is checked to see if its value has changed from the previous value and if in any change it has crossed any of the specified crossing levels.
Section 6. Data Table Declarations and Output Processing Instructions The second dimension, when greater than 1, is determined by the value of the element in the source array following the element checked for the crossing. It is the value of this variable at the time the crossings are detected that determines the second dimension. 3.5 3 2.5 2 1.5 1 Crossing Levels Crossing Source 2nd Dim Boundary 2ndDim Source 0.5 0 0 1 2 3 4 5 6 FIGURE 6.4-2.
Section 6. Data Table Declarations and Output Processing Instructions Histogram: Cross 1 Cross 1.5 Cross 3 2D < 1.25 0 0 0 1.25<2D<2.25 1 0 0 2.25<2D<3.25 1 1 1 Note that the first bin of the second dimension is always “open”. Any value less than the specified boundary is included in this bin. The last bin of the second dimension is always “closed”. It only includes values that are less than its upper boundary and greater than or equal to the upper boundary of the previous bin.
Section 6. Data Table Declarations and Output Processing Instructions Parameter & Data Type Reps Constant Source Enter The number of maximum values to determine. When repetitions are greater than 1, the source must be an array. The name of the Variable that is the input for the instruction. Variable DataType Constant DisableVar Constant, Variable, or Expression Time Constant A code to select the data storage format.
Section 6. Data Table Declarations and Output Processing Instructions RainFlow (Source, DataType, DisableVar, MeanBins, AmpBins, Lowlimit, Highlimit, MinAmp, Form) Parameter & Data Type Source Variable DataType Constant DisableVar Constant, Variable, or Expression MeanBins Constant AmpBins Constant LowLim Enter The variable that is tested to determine which bin is selected A code to select the data storage format.
Section 6. Data Table Declarations and Output Processing Instructions actual number of closed loop cycles that had the amplitude and average value associated with that bin or the fraction of the total number of cycles counted that were associated with that bin (i.e., number of cycles in bin divided by total number of cycles counted). The user enters the number of mean bins, the number of amplitude bins, and the upper and lower limits of the input data.
Section 6. Data Table Declarations and Output Processing Instructions Sample (Reps, Source, DataType) This instruction stores the current value(s) at the time of output from the specified variable or array. Parameter & Data Type Reps Constant Source Enter The number of values to sample. When repetitions are greater than 1, the source must be an array. The name of the Variable to sample. Variable DataType Constant A code to select the data storage format.
Section 6.
Section 6. Data Table Declarations and Output Processing Instructions Parameter & Data Type DataType Constant DisableVar Constant, Variable, or Expression Enter A code to select the data storage format. Alpha Code Data Format IEEE4 IEEE 4 byte floating point FP2 Campbell Scientific 2 byte floating point A non-zero value will disable intermediate processing. Normally 0 is entered so all inputs are processed. For example, when the disable variable is ≠0 the current input is not included in the total.
Section 6. Data Table Declarations and Output Processing Instructions Parameter & Data Type OutputOpt Constant Enter Value 0 1 2 Outputs (for each rep) 1. Mean horizontal wind speed, S. 2. Unit vector mean wind direction, Θ1. 3. Standard deviation of wind direction, σ(Θ1). Standard deviation is calculated using the Yamartino algorithm. This option complies with EPA guidelines for use with straightline Gaussian dispersion models to model plume transport. 1. Mean horizontal wind speed, S. 2.
Section 6. Data Table Declarations and Output Processing Instructions A sub-interval is specified as a number of scans. The number of scans for a sub-interval is given by: Desired sub-interval (secs) / scan rate (secs) For example if the scan rate is 1 second and the data interval is 60 minutes, the standard deviation is calculated from all 3600 scans when the sub-interval is 0. With a sub-interval of 900 scans (15 minutes) the standard deviation is the average of the four sub-interval standard deviations.
Section 6. Data Table Declarations and Output Processing Instructions where Ux=(Σsin Θi)/N Uy=(Σcos Θi)/N or, in the case of orthogonal sensors Ux=(Σ(Uei/Ui))/N Uy=(Σ(Uni/Ui))/N where Ui=(Uei2+Uni2)1/2 Standard deviation of wind direction, σ(Θ1), using Yamartino algorithm: σ(Θ1)=arc sin(ε)[1+0.1547 ε3] where, ε=[1-((Ux)2+(Uy)2)]1/2 and Ux and Uy are as defined above. Resultant mean horizontal wind speed, U : 2 2 1/2 U =(Ue +Un ) Un U Ue FIGURE 6.4-4.
Section 6. Data Table Declarations and Output Processing Instructions The algorithm for σ(θu) is developed by noting (Figure 6.4-4) that Cos (Θ i ') = U i / si ; where Θi ' = Θi − Θu U Ui Θu Θ 'i si FIGURE 6.4-5. Standard Deviation of Direction The Taylor Series for the Cosine function, truncated after 2 terms is: Cos (Θi ') ≅ 1 − (Θi ' ) 2 / 2 For deviations less than 40 degrees, the error in this approximation is less than 1%. At deviations of 60 degrees, the error is 10%.
Section 6. Data Table Declarations and Output Processing Instructions The term, ∑ ((Θ ' ) i 2 si ' ) / NS , is 0 if the deviations in speed are not correlated with the deviation in direction. This assumption has been verified in tests on wind data by CSI; the Air Resources Laboratory, NOAA, Idaho Falls, ID; and MERDI, Butte, MT. In these tests, the maximum differences in σ (Θu) = ( ∑ (Θ i ' ) 2 / N )1/ 2 and σ (Θu) = (2(1 − U / S ))1/ 2 have never been greater tan a few degrees.
Section 6. Data Table Declarations and Output Processing Instructions This is a blank page.
Section 7. Measurement Instructions 7.1 Voltage Measurements VoltDiff – Differential Voltage Measurement............................................. 7-3 VoltSE – Single-ended Voltage Measurement ............................................ 7-3 7.2 Thermocouple Measurements Measure the Output of Thermocouples and Convert to Temperature. TCDiff – Differential Voltage Measurement of Thermocouple .................. 7-3 TCSE – Single-ended Voltage Measurement of Thermocouple..................
Section 7. Measurement Instructions PortGet - Reads the status of one of the eight control ports....................... 7-18 PortSet – Sets Digital Ports........................................................................ 7-19 PulseCount – Pulse/Frequency Measurement............................................ 7-19 PulseCountReset - Resets Pulse Counters and Running Averages Used in Pulse Count Instruction ........................................................ 7-21 PulsePort .........................
Section 7. Measurement Instructions 7.1 Voltage Measurements VoltDiff (Dest, Reps, Range, DiffChan, RevDiff, SettlingTime, Integ, Mult, Offset) Diff. Channel H Sensor Diff. Channel L. This instruction measures the voltage difference between the HI and Low inputs of a differential channel. Both the high and low inputs must be within ± 5V of the datalogger's ground (See Common Mode Range, Section 3.2).
Section 7. Measurement Instructions TCSE (Dest, Reps, Range, SEChan, TCType, TRef, MeasOfs, SettlingTime, Integ, Mult, Offset) S.E. Channel Thermocouple Ground This instruction measures a thermocouple with a single-ended voltage measurement and calculates the thermocouple temperature (°C) for the thermocouple type selected. The instruction adds the measured voltage to the voltage calculated for the reference temperature relative to 0° C, and converts the combined voltage to temperature in °C.
Section 7. Measurement Instructions Parameter & Data Type RevDiff Constant MeasOfs Constant SettlingTime Constant Integ Constant Mult, Offset Constant, Variable, Array, or Expression Enter Result (Reversing requires twice as much time to complete) Signal is measured with the high side referenced to the low A second measurement is made after reversing the inputs to cancel offsets Code Value Result the Ground offset voltage is subtracted from single ended measurements.
Section 7. Measurement Instructions BrHalf3W (Dest, Reps, Range, SEChan, ExChan, MeasPEx, ExmV, RevEx, SettlingTime, Integ, Mult, Offset) X = result w/mult = 1, offset = 0 X= 2V2 − V1 Rs = Vx − V1 Rf This Instruction is used to determine the ratio of the sensor resistance to a known resistance using a separate voltage sensing wire from the sensor to compensate for lead wire resistance.
Section 7. Measurement Instructions Half Bridge Parameters Parameter & Data Type Dest Variable or Array Reps Enter The Variable in which to store the results of the instruction. When Reps are used the results are stored in an array with the variable name. An array must be dimensioned to have elements for all the Reps. The number of repetitions for the measurement or instruction.
Section 7. Measurement Instructions Parameter & Data Type SettlingTime Constant Integ Constant Mult, Offset Enter The time in microseconds to delay between setting up a measurement (switching to the channel, setting the excitation) and making the measurement. (1 microsecond resolution) Entry Voltage Range Integration Settling Time 0 All 250 µS 450 µS (default) 0 All _50Hz, _60 Hz 3 mS (default) >=100 All All µS entered The time spent on integration in microseconds for each of the channels measured.
Section 7. Measurement Instructions BrFull6W (Dest, Reps, Range1, Range2, DiffChan, ExChan, MeasPEx, ExmV, RevEx, RevDiff, SettlingTime, Integ, Mult, Offset) X = result w/mult = 1, offset = 0 X = 1000 ⎛ R3 V2 R2 ⎞ = 1000⎜ − ⎟ V1 ⎝ R3 + R4 R1 + R2 ⎠ This Instruction applies an excitation voltage and makes two differential voltage measurements. The measurements are made on sequential channels. The result is the voltage measured on the second channel (V2) divided by the voltage measured on the first (V1).
Section 7. Measurement Instructions Parameter & Data Type ExChan Constan MeasPEx Constant ExmV Constant RevEx Constant RevDiff Constant SettlingTime Constant Integ Constant Mult, Offset Enter Enter the excitation channel number to excite the first measurement. Alpha Code/ Result Code Channel VX1 1 Switched excitation channels, are switched to the excitation voltage. VX2 2 for the measurement and switched off between measurements.
Section 7. Measurement Instructions Parameter & Data Type ExChan Constan ExmV Constant XDelay Enter Enter the excitation channel number to excite the first measurement. Alpha Code/ Result Code Channel VX1 1 Switched excitation channels, are switched to the excitation voltage. VX2 2 for the measurement and switched off between measurements. VX3 3 The excitation voltage in millivolts. Allowable range ± 2500 mV.
Section 7. Measurement Instructions Calibrate (Dest, AllRanges) The Calibrate instruction places the CR800 self calibration under program control. Placing the Calibrate instruction in the program disables the automatic self calibration that is normally run in the background (Section 3.8). The Calibrate parameters are optional and are only used to place the results of the calibration in a variable array. With no parameters the Calibrate instruction does not return data.
Section 7. Measurement Instructions Unless the AllRanges option is selected, the calibrate instruction only measures the range and integration combinations that occur in the measurements in the program. For the 250 µs and zero integration calibrations multiple measurements are averaged for the calibration values. The 250 µs integration calibration averages five measurements and the zero integration calibration averages ten measurements.
Section 7.
Section 7. Measurement Instructions InstructionTimes (Dest) The InstructionTimes instruction returns the execution time of each instruction in the program. The InstructionTimes instruction loads the Dest array with execution times for each instruction in the program (in microseconds). InstructionTimes must appear before the BeginProg statement in the program. Each element in the array corresponds to a line number in the program.
Section 7. Measurement Instructions PeriodAvg (Dest, Reps, Range, SEChan, Threshold, PAOption, Cycles, Timeout, Mult, Offset) This instruction measures the period of a signal on any single-ended input channel. The specified number of cycles are timed with a resolution of 92 ns, making the resolution of the period measurement 92 ns divided by the number of cycles chosen. Parameter & Data Type Dest Variable or Array Reps Enter The Variable in which to store the results of the instruction.
Section 7. Measurement Instructions recommended to center the signal at CR800 ground (threshold = 0) because of offset voltage drift along with limited accuracy (± 10 mV) and resolution (1.2 mV) of a threshold other than 0. The minimum pulse width requirements increase (maximum frequency decreases) with increasing gain as shown in range parameter. Signals larger than the specified maximum for a range will saturate the gain stages and prevent operation up to the maximum specified frequency.
Section 7. Measurement Instructions The back-to-back silicon diodes D1 and D2 provide ESD protection of capacitor C and the sensor, and also limit the amplitude of large amplitude sensor signals. These diodes clip large amplitude signals to approximately 1.4 V pk-pk which is within the recommended input signal ranges for all range codes. Diodes D1 and D2 along with resistor R1 are recommended to limit large amplitude sensor signals, even when dc blocking capacitor C is not used.
Section 7. Measurement Instructions PortSet (Port, State) This Instruction will set the specified port high or low. Parameter & Data Type Port Enter The number of the port (1-8) to set with the instruction. Constant, Variable, or Expression State Constant, Variable, or Expression The state (high or low) to set the port to.
Section 7. Measurement Instructions Parameter & Data Type Mult, Offset Constant, Variable, Array, or Expression Enter A multiplier and offset by which to scale the raw results of the measurement. See the measurement description for the units of the raw result; a multiplier of one and an offset of 0 are necessary to output in the raw units. For example, the TCDiff instruction measures a thermocouple and outputs temperature in degrees C. A multiplier of 1.
Section 7. Measurement Instructions counted if centered around +2.5 V with deviations ≥ ± 2.5 V for ≥ 1.2 microseconds. Low Level AC (Pulse Channels Only) Input Hysteresis: 15 mV Maximum Input Voltage: 20 V peak-to-peak Input Voltage and Frequency Range (16 bit counter required above 2.56 kHz) 20 mV 1.0 Hz to 20 Hz 200 mV 0.5 Hz to 200 Hz 2000 mV 0.3 Hz to 10,000 Hz 5000 mV 0.3 Hz to 20,000 Hz Switch Closure • Pulse Channels A switch closure is connected between P1..P2 and analog ground.
Section 7. Measurement Instructions ReadIO (Dest, Mask) ReadIO is used to read the status of selected control I/O channels (ports) on the CR800. There are 8 ports. The status of these ports is considered to be a binary number with a high port (+5 V) signifying 1 and a low port (0 V) signifying 0. For example, if ports 1 and 3 are high and the rest low, the binary representation is 00000101, or 5 decimal.
Section 7. Measurement Instructions Parameter & Data Type Range SEChan ExChan StartFreq EndFreq TSweep Steps DelMeas NumCycles DelReps Mult, Offset Enter The Range parameter is the voltage range for the measurement. An alphanumeric or the numeric code can be entered: Alphanumeric Numeric Description mV250 2 +250 mV mV25 3 +25 mV mV7_5 4 +7.5 mV mV2_5 5 +2.5 mV The SEChan argument is the number of the single-ended channel on which to make the first measurement.
Section 7. Measurement Instructions just as in decimal) and the source is 5 decimal (binary 101) port 3 will be set high and port 2 will be set low. The mask indicates that only 3 and 2 should be set. While the value of the source also has a 1 for port 1, it is ignored because the mask indicates 1 should not be changed. Example WriteIO (&B100, &B100) Parameter & Data Type Mask Constant Source Constant Variable ' Set port 3 high. Enter The Mask allows the read or write to only act on certain ports.
Section 7. Measurement Instructions Parameter & Data Type Mult, Offset Enter The Mult and Offset parameters are each a constant, variable, array, or expression by which to scale the results of the measurement. HydraProbe (Dest, SourceVolts, ProbeType, SoilType) The HydraProbe instruction is used to measure the Stevens Vitel Hydra Probe sensor.
Section 7. Measurement Instructions Parameter & Data Type Dest Reps SEChan ExChan SettlingTime Integ Mult, Offset Enter Dest is the variable in which the results of the measurement will be stored. If the Reps parameter is greater than one, Dest must be an array dimensioned large enough to hold the results for all repetitions. The Reps parameter is the number of times the measurement should be made. Measurements are made on consecutive channels.
Section 7. Measurement Instructions Parameter & Data Type Range Constant Am25tChan Constant DiffChan Constant Enter Alpha Code mV5000 mV2500 mV250 mV25 mV7_5 mV2_5 Autorange mV250C mV25C mV7_5C mV2_5C AutorangeC Voltage Range ± 5000 mV ± 2500 mV ± 250 mV ± 25 mV ± 7.5 mV ± 2.5 mV mV2_5 − mV5000 ± 250 mV ± 25 mV ± 7.5 mV ± 2.5 mV mV2_5 − mV250 Selects range (Sect. 3.
Section 7. Measurement Instructions CS7500 (Dest, Reps, SDMAddress, CS7500Cmd) Communicates with the CS7500 open path CO2 and H2O sensor. See CS7500 manual for more information. Parameter & Data Type Dest Enter The Dest parameter is the input variable name in which to store the data from each CS7500 associated with this instruction. The length of the input variable array will depend on the number of Repetitions and on the selected Command.
Section 7. Measurement Instructions CSAT3 (Dest, Reps, SDMAddress, CSAT3Cmd, CSAT3Opt) Communicates with the CSAT3 three-dimensional sonic anemometer. See CSAT3 manual for more information. Parameter & Data Type Dest Reps SDMAddress Command Option Enter The Dest parameter is a variable in which to store the results of the measurement. This variable must be dimensioned to a length of five to hold the CSAT3 Ux, Uy, Uz, speed of sound, and diagnostic data.
Section 7. Measurement Instructions SDMAO4 (Source, Reps, SDMAdress) This instruction is used to set the voltage to an SDM-AO4 four-channel analog output device. The SDMAO4 instruction has the following parameters: Parameter & Data Type Source Reps SDMAddress Enter The Source parameter is the variable that holds the voltage, in millivolts, which should be sent to the SDM-AO4.
Section 7. Measurement Instructions Parameter & Data Type Enter SDMAddress The SDMAddress parameter defines the address of the SDM-CAN with which to communicate. Valid SDM addresses are 0 through 14. Address 15 is reserved for the SDMTrigger instruction. TimeQuanta The SDM address is entered as a base 10 number, unlike older, jumpersettable SDM instruments that used base 4.
Section 7.
Section 7. Measurement Instructions Parameter & Data Type Enter 27 28 29 30 31 32 Read Transmit, Receive, Overrun, and Watchdog errors. The errors are placed consecutively in the array specified by the Dest parameter. Read Transmit, Receive, Overrun, and Watchdog errors. The errors are placed consecutively in the array specified by the Dest parameter. Reset error counters to 0 after reading. Read SDM-CAN status; result is placed into the array specified in the Dest parameter.
Section 7. Measurement Instructions Parameter & Data Type Enter 2 StartBit 7-34 Self-reception. A frame transmitted from the SDM-CAN that was acknowledged by an external node will also be received by the SDM-CAN but no retransmission will occur in the event of loss of arbitration or error. Frames received correctly from an external node are acknowledged. 3 Normal, retransmission will occur in the event of loss of arbitration or error. Frames received correctly from an external node are acknowledged.
Section 7. Measurement Instructions Parameter & Data Type NumBits Enter The NumBits parameter is used to specify the number of bits that will be used in a transaction. The number can range from 1 to 64 (there are 64 bits in a CAN data frame). The SDM-CAN can be configured to notify the datalogger when new data is available by setting a control port high. This allows data to be stored in the datalogger tables faster than the program execution interval.
Section 7.
Section 7. Measurement Instructions Parameter & Data Type Dest Variable or Array Address Constant Config8_5 Config4_1 Constants Funct8_5 Funct4_1 Constants Enter The array where the results of the instruction are stored. For all output options except Capture All Events, the Dest argument should be a onedimensional array with as many elements as there are programmed INT8 channels. If the "Capture All Events" OutputOption is selected, then the Dest array must be two dimensional.
Section 7. Measurement Instructions Parameter & Data Type Enter For example, 4301 in the second function parameter means to return 3 values: the period for channel 1, (nothing for channel 2) the time between an edge on channel 2 and an edge on channel 3, and the time between an edge on channel 1 and an edge on channel 4. The values are returned in the sequence of the channels, 1 to 16. OutputOpt Note: the destination array must be dimensioned large enough to hold all the functions requested.
Section 7. Measurement Instructions Parameter & Data Type CaptureTrig Constant, Variable, or Expression Mult, Offset Constant, Variable, Array, or Expression Enter This argument is used when the "Capture All Events" output option is used. When CaptureTrig is true, the INT8 will return the last nnnn events. A multiplier and offset by which to scale the raw results of the measurement.
Section 7.
Section 7.
Section 7.
Section 7. Measurement Instructions Parameter & Data Type Mode Mult, Offset Enter The Mode parameter configures a bank of four ports when a Command code 86 through 90 is used (if any other Command Code is used, enter 0 for the Mode). Mode is entered as four digits, where each digit indicates the setting for a port. Ports are represented from the highest port number to the lowest, from left to right (e.g., 16 15 14 13; 12 11 10 9; 8 7 6 5; 4 3 2 1).
Section 7. Measurement Instructions Parameter & Data Type Enter SDMAddress The SDMAddress parameter defines the address of the SIO4 with which to communicate. Valid SDM addresses are 0 through 14. Address 15 is reserved for the SDMTrigger instruction. If the Reps parameter is greater than 1, the datalogger will increment the SDM address for each subsequent SIO4 that it communicates with.
Section 7. Measurement Instructions SDMSpeed (BitPeriod) Changes the rate that the CR800 uses to clock the SDM data. Slowing down the clock rate may be necessary when long cables lengths are used to connect the CR800 and SDM devices. Parameter & Data Type BitPeriod Constant or variable Enter The time per bit, in microseconds. Initial Setting (default): 26.04 µS Resolution: 8.68 µS Min Setting: 8.68 µS Max Setting: 2.2 mS SDMSpeed(30) gives: 26.
Section 7. Measurement Instructions Parameter & Data Type FunctOp Constant StartChan Constant Mult, Offset Constant, Variable, Array, or Expression Enter The FunctOp is used to determine the result that will be returned by the SW8A. Numeric Function Code 0 Returns the state of the signal at the time the instruction is executed. A 0 is stored for low and a 1 is stored for high. 1 Returns the duty cycle of the signal. The result is the percentage of time the signal is high during the scan interval.
Section 7. Measurement Instructions Parameter & Data Type SDMAddress Constant Channel Constant Enter The SDMAddress of the SDMX50 to switch. Valid SDM addresses are 0 through 14.
Section 7. Measurement Instructions Parameter & Data Type WaveAvg Vp Points CableLength Enter The WaveAvg parameter is used to define the number of waveform reflections averaged by the TDR100 to give a single result. A waveform averaging value of 4 provides good signal-to-noise ratio under typical applications. Under high noise conditions averaging can be increased. The maximum averaging possible is 128.
Section 8. Processing and Math Instructions Operators ^ * / + = <> > < >= <= Raise to Power Multiply Divide Add Subtract Equals Not Equal Greater Than Less Than Greater Than or Equal Less Than or Equal ABS (Source) Returns the absolute value of a number. Syntax x = ABS (source) Remarks Source can be any valid numeric expression. The absolute value of a number is its unsigned magnitude. For example, ABS(-1) and ABS(1) both return 1.
Section 8. Processing and Math Instructions ACOS (Source) The ACOS function returns the arc cosine of a number. Syntax x = ACOS (source) Remarks The source can be any valid numeric expression that has a value between -1 and 1 inclusive. The ACOS function takes the ratio of two sides of a right triangle and returns the corresponding angle. The ratio is the length of the side adjacent to the angle divided by the length of the hypotenuse.
Section 8. Processing and Math Instructions AND Used to perform a logical conjunction on two expressions. Syntax result = expr1 And expr2 Remarks If, and only if, both expressions evaluate True, result is True. If either expression evaluates False, result is False.
Section 8. Processing and Math Instructions ASIN (Source) The ASIN function returns the arc sin of a number. Syntax x = ASIN (source) Remarks Source can be any valid numeric expression that has a value between -1 and 1 inclusive. The ASIN function takes the ratio of two sides of a right triangle and returns the corresponding angle. The ratio is the length of the side opposite to the angle divided by the length of the hypotenuse. The result is expressed in radians and is in the range -π/2 to π/2 radians.
Section 8. Processing and Math Instructions Atn FunctionExample The example uses Atn to calculate π. By definition, a full circle is 2π radians. Atn(1) is π/4 radians (45 degrees). Dim Pi Pi = 4 * Atn(1) 'Declare variables. 'Calculate Pi. ATN2() The ATN2 function returns the arctangent of y/x.
Section 8. Processing and Math Instructions AvgSpa (Dest, Swath, Source) Computes the spatial average of the values in the source array. Syntax AvgSpa (Dest, Swath, Source) Remarks Find the average of the values in the given array and place the result in the variable named in Dest. The Source must be a particular element in an array (e.g., Temp(1)); it is the first element in the array to include in the average. The Swath is the number of elements to include in the average.
Section 8. Processing and Math Instructions Parameter & Data Type Dest Variable or Array Reps Constant Number Constant Source Array Enter The variable or array in which to store the average(s). When the source is an array, this is the number of variables in the array to calculate averages for. When the source is not an array or only a single variable of the array is to be averaged, reps should be 1. The number of values to include in the running average.
Section 8. Processing and Math Instructions CosH (Source) The COSH function returns the hyperbolic cosine of an expression or value. Syntax x = COSH (source) Remarks The COSH function takes a value and returns the hyperbolic cosine [COSH(x) = 0.5(ex + e-x)] for that value. COSH Function Example The example uses COSH to calculate the hyperbolic cosine of a voltage input and store the result in the Ans variable. Public Volt1, Ans 'Declare variables.
Section 8. Processing and Math Instructions Parameter & Data Type Dest Variable or Array NumOfCov Constant SizeOfSets Constant CoreArray Array DatArray Array Enter The Variable in which to store the results of the instruction. When multiple covariances are calculated, the results are stored in an array with the variable name. An array must be dimensioned to at least the value of NumOfCov. The number of covariances to be calculated.
Section 8. Processing and Math Instructions where: C1 = 0.61078 C2 = 17.558 C3 = 241.88 Error in the Estimation of Dew Point Tetens’ equation is an approximation of the true variation of saturated vapor pressure as a function of temperature. However, the errors in using the inverted form of the equation result in dew point errors much less than 0.1°C. The largest component of error, in reality, comes from errors in the absolute calibration of the temperature and RH sensor.
Section 8. Processing and Math Instructions FIGURE 8-2. Effect of RH Errors on Calculated Dew Point (±5 RH Unit Error at Three Air Temperatures) Exp (Numeric Expression) Returns e (the base of natural logarithms) raised to a power. Syntax x = Exp (source) Remarks If the value of the source exceeds 709.782712893, an Overflow error occurs. The constant e is approximately 2.718282. NOTE The Exp function complements the action of the Log function and is sometimes referred to as the antilogarithm.
Section 8. Processing and Math Instructions Spectrum; 3) Power Spectrum; 4) Power Spectral Density (PSD); or 5) Inverse FFT. The difference between the FFT instruction (Section 6) and FFTSpa is that FFT is an output instruction that stores the results in a data table and FFTSpa stores its results in an array. Parameter & Data Type Dest Enter The array in which to store the results of FFT. Array Source The name of the Variable array that contains the input data for the FFT.
Section 8. Processing and Math Instructions Normalization details: Complex FFT result i, i = 1 .. N/2: ai*cos(wi*t) + bi*sin(wi*t). wi = 2π(i-1)/T. φi = atan2(bi,ai) (4 quadrant arctan) Power(1) = (a12 + b12)/N2 (DC) Power(i) = 2*( ai2 + bi2)/N2 (i = 2..N/2, AC) PSD(i) = Power(i) * T = Power(i) * N * tau A1 = sqrt(a12 + b12)/N (DC) Ai = 2*sqrt(ai2 + bi2)/N (AC) Notes: • Power is independent of the sampling rate (1/tau) and of the number of samples (N).
Section 8. Processing and Math Instructions Remarks The GetRecord instruction retrieves one entire record from a data table. The destination array must be dimensioned large enough to hold all the fields in the record. Parameter & Data Type Dest Array TableName name RecsBack Const. Or variable Enter The destination variable array in which to store the fields of the record. The array must be dimensioned large enough to hold all the fields in the record.
Section 8. Processing and Math Instructions Parameter & Data Type TintoInt constant Interval constant Units Constant Enter The time into interval sets an offset from the datalogger’s clock to the interval at which the IfTime will be true. For example, if the Interval is set at 60 minutes, and TintoInt is set to 5, IfTime will be True at 5 minutes into the hour, every hour, based on the datalogger's real-time clock. If the TintoInt is set to 0, the IfTime statement is True at the top of the hour.
Section 8.
Section 8. Processing and Math Instructions Dim A, B, C, D BeginProg A = Int(-99.8) B = Fix(-99.8) C = Int(99.8) D = Fix(99.8) EndProg 'Declare variables. 'Returns -100 'Returns -99 'Returns 99 'Returns 99 Ln (Source) Log (Source) Returns the natural logarithm of a number. Ln and Log perform the same function. Syntax x = Log (source) x = Ln (source) Remarks The source can be any valid numeric expression that results in a value greater than 0. The natural logarithm is the logarithm to the base e.
Section 8. Processing and Math Instructions The Number argument can be any valid numeric expression that has a value greater than 0. You can calculate base-n logarithms for any number x by dividing the logarithm base 10 of x by the logarithm base 10 of n as follows: LOGN( x ) = LOG10( x ) / LOG10( n ) LOG10 Function Example This example uses the LOG10 instruction to calculate the log base 2 of 1000. Dim LOG2_1000 'Declare variables.
Section 8. Processing and Math Instructions Parameter & Data Type Dest Variable Swath Constant Source Array Enter The variable in which to store the results of the instruction. The number of values of the source array in which to search of the minimum. The name of the variable array that is the input for the instruction. MinSpa Function Example This example uses MinSpa to find the minimum value of the five elements Temp(6) through Temp(10) and store the result in the variable MinTemp.
Section 8. Processing and Math Instructions Parameter & Data Type Dest Variable or Array Reps Constant Source Array or Expression Reps Constant Enter The variable in which to store the values from the source. The number of elements in the destination array to fill. The name of the variable array or expression that is the source of the values to move. The number of repetitions for the measurement or instruction.
Section 8. Processing and Math Instructions Remarks The following table illustrates how Result is determined: If expr is The result is True False False True Null Null The NOT operator also inverts the bit values of any variable and sets the corresponding bit in result according to the following truth table: If bit in expr1 is The result is 0 1 1 0 NOT Operator Example The example sets the value of the variable Msg depending on the state of Flag(1).
Section 8. Processing and Math Instructions The Or operator also performs a bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following truth table: If bit in expr1 is And bit in expr2 is The result is 0 0 0 0 1 1 1 0 1 1 1 1 Or Operator Example The example sets Msg that depends on the value of variables A, B, and C, assuming that no variable is a Null.
Section 8. Processing and Math Instructions Parameter & Data Type Source Variable or Array Hysteresis Constant Variable or expression Enter The variable or array containing the inputs to check for peaks and valleys. The minimum amount the input has to change to be considered a new peak or valley. This would usually be entered as a constant. The following example uses sine and cosine signal inputs to illustrate the use of PeakValley with two repetitions.
Section 8. Processing and Math Instructions PeakValley(PeakV(1),Change(1),2,XY(1),0.1) ‘Find the peaks and ‘valleys for both ‘inputs. Hysteresis ‘= 0.1 CallTable PV1 CallTable PV2 CallTable PVBoth Next Scan EndProg PRT (Dest, Reps, Source, Mult, Offset) Used to calculate temperature from the resistance of an RTD. Syntax PRT (Dest, Reps, Source, Mult, Offset) Remarks This instruction uses the result of a previous RTD bridge measurement to calculate the temperature.
Section 8. Processing and Math Instructions Randomize (Number) Initializes the random-number generator. Syntax Randomize (Number) Remarks The argument number can be any valid numeric expression. Number is used to initialize the random-number generator by giving it a new seed value. If you omit number, the value returned by the Timer function is used as the new seed value. If Randomize is not used, the Rnd function returns the same sequence of random numbers every time the program is run.
Section 8. Processing and Math Instructions ' Sample(1, Day_of_Year, IEEE4) Sample(9, rTime(), IEEE4) EndTable 'place Day_of_Year in VALUES table 'place all 9 segments in VALUES table BeginProg Scan (1, Sec, 0, 0) RealTime(rTime()) CallTable VALUES Next Scan EndProg RectPolar (Dest, Source) Converts from rectangular to polar coordinates. Parameter & Data Type Dest Variable array Source Variable Array Enter Variable array in which to store the 2 resultant values.
Section 8. Processing and Math Instructions RMSSpa (Dest, Swath, Source) Used to compute the RMS value of an array. Syntax RMSSpa(Dest, Swath, Source) Remarks Spatial RMS, Calculate the root mean square of values in an array. i = j + swath Dest = ∑ ( X (i)) 2 i= j swath Where X(j) = Source Parameter & Data Type Dest Variable Swath Constant Source Array Enter The variable in which to store the RMS value. The number of values of the array to include in the RMS calculation.
Section 8. Processing and Math Instructions To produce random integers in a given range, use this formula: INT( ( upperbound - lowerbound + 1 ) * RND + lowerbound ) Here, upperbound is the highest number in the range, and lowerbound is the lowest number in the range. SatVP (Dest, Temp) SatVP calculates saturation vapor pressure (over water Svpw) in kilopascals from the air temperature (°C) and places it in the destination variable.
Section 8. Processing and Math Instructions Parameter & Data Type Source BrZero BrConfig Enter The source variable array for the measurement(s), the input is expected as millivolts out per volt in (the result of the full bridge instruction with a multiplier of 1 and an offset of 0. The variable array that holds the unstrained reading(s) in millivolts out per volt in. The bridge configuration code can be entered as a positive or negative number: + code: Vr = 0.
Section 8. Processing and Math Instructions StrainCalc Example This example uses StrainCalc to find the microstrain value of a bridge output. ' Program name: STRAIN.
Section 8. Processing and Math Instructions Sgn (Number) Used to find the sign value of a number. Syntax x = Sgn (number) Remarks Returns an integer indicating the sign of a number. The argument number can be any valid numeric expression. Its sign determines the value returned by the Sgn function: If X > 0, then Sgn(X) = 1. If X = 0, then Sgn(X) = 0. If X < 0, then Sgn(X) = -1. Sgn Function Example The example uses Sgn to determine the sign of a number.
Section 8. Processing and Math Instructions Sin Function Example The example uses Sin to calculate the sine of an angle from a Volt input. Dim Degrees, Pi, Radians, Ans Pi = 4 * Atn(1) Degrees = Volt(1) Radians = Degrees * (Pi / 180) Ans = Sin(Radians) 'Declare variables. 'Calculate Pi. 'Get input. 'Convert to radians. ‘The Sine of Degrees. SinH (Expression) The SINH function returns the hyperbolic sine of an expression or value.
Section 8. Processing and Math Instructions Sqr Function Example The example uses Sqr to calculate the square root of Volt(1) value. Dim Msg, Number Number = Volt(1) If Number < 0 Then Msg = 0 'Declare variables. 'Get input. ‘Cannot determine the square root of a negative number. Else Msg = Sqr(Number) End If StdDevSpa (Dest, Swath, Source) Used to find the standard deviation of an array. Syntax StdDevSpa(Dest, Swath, Source) Remarks Spatial standard deviation.
Section 8. Processing and Math Instructions Tan Function Example The example uses Tan to calculate the tangent of an angle from a Volt(1) input. Dim Degrees, Pi, Radians, Ans Pi = 4 * Atn(1) Degrees = Volt(1) Radians = Degrees * (Pi / 180) Ans = Tan(Radians) 'Declare variables. 'Calculate Pi. 'Get user input. 'Convert to radians. ‘The Tangent of Degrees. TANH (Source) The TANH function returns the hyperbolic tangent of an expression or value.
Section 8. Processing and Math Instructions The TimeIntoInterval instruction has the following parts: TintoInt The TintoInt, or time into interval, argument allows the programmer to define an offset from the Interval at which the TimeIntoInterval statement will be evaluated true. For example, if the Interval is set at 60 minutes, and TintoInt is set to 5, TimeIntoInterval will be True at 5 minutes into the hour, every hour, based on the datalogger's real-time clock.
Section 8. Processing and Math Instructions Parameter & Data Type Dest Temp RH WetTemp Pressure Enter The variable in which to store Vp (kPA). The variable containing air temperature (dry-bulb °C). The variable containing RH (%). The variable containing wet-bulb temperature (°C). The variable containing atmospheric pressure (kPa). XOR The XOR function is used to perform a logical exclusion on two expressions.
Section 8. Processing and Math Instructions XOR Operator Example The example sets the variable Msg based on the value of variables A, B, and C, assuming that no variable is a Null. If A = 10, B = 8, and C = 11, the left expression is True and the right expression is False. Because only one comparison expression is True, the XOR expression evaluates True. Dim A, B, C A = 10: B = 8: C = 11 If A > B XOR B > C Then Msg = True Else Msg = False. End If 'Declare variables. 'Assign values. 'Evaluate expressions.
Section 8. Processing and Math Instructions This is a blank page.
Section 9. Program Control Instructions BeginProg … EndProg The BeginProg instruction is used to mark the beginning of a program. EndProg marks the end of a program. Syntax BeginProg ... ... EndProg Remarks All of the instructions for the main program fall between the BeginProg and EndProg statements. Program Variables, DataTables, and Subroutines must be defined before the main program.
Section 9. Program Control Instructions RealTime (TIME) PulseCount (WINDSP,1,1 ,1,1,1.0,0) PulseCount (RAIN,1,2,2,0,1.0,0) CallTable METDATA NextScan EndProg Call The Call statement is used to transfer program control from the main program to a subroutine. Syntax Call Name(list of variables) Remarks Use of the Call keyword when calling a subroutine is optional. The Call statement has these parts: Call Call is an optional keyword used to transfer program control to a subroutine.
Section 9. Program Control Instructions CallTable Example This example uses CallTable to call the ACCEL table. CallTable ACCEL Data … Read … Restore Used to mark the beginning of a data list. Syntax Data list of constants Read [VarExpr] Restore Remarks Data function: A list of floating point constants that can be read (using Read) into an Array Variable. Parameter: A list of floating point constants. Reads Data from Data declaration into an array. Subsequent Read picks up where current Read leaves off.
Section 9. Program Control Instructions ClockSet (Source) Sets the CR800 clock from the values in an array. The most likely use for this is where the CR800 can input the time from a more accurate clock than its own (e.g., a GPS receiver). The input time would periodically or conditionally be converted into the required variable array and ClockSet would be used to set the CR800 clock. Source Array The source must be a seven-element array . array(1)..
Section 9. Program Control Instructions Do … Loop Repeats a block of statements while a condition is true or until a condition becomes true. Syntax 1 Do [{While | Until} condition] [statementblock] [Exit Do] [statementblock] Loop Syntax 2 Do [statementblock] [Exit Do] [statementblock] Loop [{While | Until} condition] The Do...Loop statement has these parts: Part Description Do Must be the first statement in a Do...Loop control structure.
Section 9. Program Control Instructions Alternatively, the same thing can be accomplished by incorporating the range test in the Do...Loop as follows: Dim Reply 'Declare variable. Do Reply = Volt(1) Loop Until Reply > 1 And Reply < 9 The next example show the use of Wend. While X > Y 'Old fashioned way of looping. ......... ......... Wend Do While X > Y ......... ......... Loop 'Much better FileManage The FileManage instruction is used to manage files from within a running datalogger program.
Section 9. Program Control Instructions FileManage Example The statement below uses FileManage to run TEMPS.CR5, which is stored on the datalogger's CPU, when Flag(2) becomes high. If Flag(2) then FileManage( "CPU:TEMPS.CR5" 4 ) '4 means Run Now FileMark (TableName) Parameter & Data Type TableName name Enter The name of the data table in which to insert the filemark.. FileMark is used to insert a filemark into a data file.
Section 9. Program Control Instructions Exit For Only used within a For...Next control structure to provide an alternate way to exit. Any number of Exit For statements may be placed anywhere in the For...Next loop. Often used with the evaluation of some condition (for example, If...Then), Exit For transfers control to the statement immediately following the Next. Next Ends a For...Next loop. Causes increment to be added to counter.
Section 9. Program Control Instructions If ... Then ... Else Statement Allows conditional execution, based on the evaluation of an expression. Syntax 1 If condition Then thenpart [Else elsepart] Syntax 2 If condition1 Then [statementblock-1] [ElseIf condition2 Then [statementblock-2] ] [Else [statementblock-n] ] EndIf Syntax 1 Description The single-line form is often useful for short, simple conditional tests. Syntax 1 has these parts: Part Description If Begins the simple If...Then control structure.
Section 9. Program Control Instructions Part Description If Keyword that begins the block If...Then decision control structure. condition1 Same as condition used in the single-line form shown above. Then Keyword used to identify the actions to be taken if a condition is satisfied. 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.
Section 9. Program Control Instructions If...Then ... Else Statement Example The example illustrates the various forms of the If...Then...Else syntax. Dim X, Y, Temp( 5 ) X = Temp( 1 ) If X < 10 Then Y=1 ElseIf X < 100 Then Y=2 Else Y=3 EndIf . . . . . . . . 'Declare variables. '1 digit. '2 digits. '3 digits. 'Run some code 'Run some code RunProgram The RunProgram instruction is used to run a datalogger program file from the active program file.
Section 9. Program Control Instructions ResetTable Used to reset a data table under program control. Syntax ResetTable( TableName ) Remarks ResetTable is a function that allows a running program to erase and restart a data table. TableName is the name of the table to reset. ResetTable Example The example program line uses ResetTable to reset table MAIN when Flag(2) is high. If Flag(2) then ResetTable( MAIN ) 'resets table MAIN Scan … NextScan Used to establish the program scan rate.
Section 9. Program Control Instructions Parameter & Data Type Option Constant Enter The Option parameter determines how data will be buffered during the Scan…NextScan process. The options are: Option 0, 1, or 2 >3 Result The datalogger uses two buffers when processing measurements. When a measurement begins on a scan, the values of the previous scan are loaded into a buffer. This allows processing to finish on the previous scan during measurement of the current scan.
Section 9. Program Control Instructions Part Description SelectCase Begins the SelectCase decision control structure. Must appear before any other part of the SelectCase structure. testexpression Any numeric or string expression. If testexpression matches the expressionlist associated with a Case clause, the statementblock following that Case clause is executed up to the next Case clause, or for the final one, up to the EndSelect. Control then passes to the statement following EndSelect.
Section 9. Program Control Instructions SelectCase Example The example uses SelectCase to decide what action to take based on user input. Dim X, Y If Not X = Y Then If X > Y Then SelectCase X Case 0 To 9 . . . . . . . . Case 10 To 99 . . . . . . . . CaseElse . . . . EndSelect EndIf Else SelectCase Y Case 1, 3, 5, 7, 9 . . . . Case 0, 2, 4, 6, 8 . . . . CaseElse . . . . . . . . EndSelect EndIf . . . . . . . . 'Declare variables. 'Are they equal 'What is X. 'Must be less than 10. 'Run some code.
Section 9. Program Control Instructions SetStatus ("FieldName", Value) The SetStatus instruction is used to change the value for a setting in the datalogger's Status table. Syntax SetStatus ( "FieldName", Value ) Remarks The FieldName parameter is the name of the setting to be changed; the name must be enclosed in quotes. The Value parameter is the value to which that field should be set. If the value being set is a string (such as in Messages or StationName), it must be enclosed in quotes.
Section 9. Program Control Instructions Slow Sequence The SlowSequence instruction is used to mark the beginning of a section of code that will run concurrently with the main program. Syntax SlowSequence Remarks The SlowSequence statement marks the end of the main program and begins a separate sequence of instructions. The instructions for the slow sequence program are executed when the main program is not running as time allows.
Section 9. Program Control Instructions SlowSequence Example 'CR800 Series Datalogger 'Slow Sequence Example Public Temp107, PanelT, BattVolts DataTable (T107,True,-1) DataInterval (0,1,Min,10) Average (1,Temp107,FP2,False) EndTable BeginProg Scan (1,Sec,10,0) Therm107 (Temp107,1,1,Vx1,0,250,1.
Section 9. Program Control Instructions SubScan (SubInterval, Units, Count) … NextSubScan The SubScan instruction is used to control an AM16/32 multiplexer or to measure some analog inputs at a faster rate than the program scan. Syntax SubScan (SubInterval, Units, Count) Measurements and processing NextSubScan Remarks The SubScan/NextSubScan instructions are placed within the Scan/NextScan instructions of a program.
Section 9. Program Control Instructions Parameter & Data Type TimNo Constant, Variable, or Expression Units Constant TimOpt Constant Enter An integer number for the timer (e.g., 0, 1, 2, . . .) Use low numbers to conserve memory; using TimNo 100 will allocate space for 100 timers even if it is the only timer in the program. The units in which to return the timer value. Alpha Numeric Code Code Units USEC 0 microseconds MSEC 1 milliseconds SEC 2 seconds MIN 3 minutes The action on the timer.
Section 9. Program Control Instructions contains only processing tasks, these tasks can run in conjunction with the main scan. While…Wend The While…Wend instructions are used to executes a series of statements in a loop as long as a given condition is true. Syntax While Condition [StatementBlock] Wend Remarks While…Wend loops can be nested. The While...Wend statement has the following parameters: NOTE While The While statement begins the While...Wend loop control structure.
Section 9. Program Control Instructions This is a blank page.
Section 10. Custom Keyboard Display Menus CRBasic has the capability of creating a custom keyboard display menu for a datalogger program. The custom menu can either appear as submenu of the standard CR800 menu or it can take the place of the standard menu and contain the standard menu as a submenu. An item in the custom menu may do one of four things: 1) display the value of a variable or a field in a data table. 2) display the value of a variable/flag and allow the user to change that value.
Section 10. Custom Keyboard Display Menus 'Define Custom Menu: DisplayMenu ("Example Custom Menu",1) SubMenu("Current Temperatures") DisplayValue("Panel Temp",Tpnl) DisplayValue("TC 1",Ttc(1)) DisplayValue("TC 2",Ttc(2)) EndSubMenu SubMenu("Last 1 Min. Averages") DisplayValue("Panel Temp",Temp.Tpnl_Avg(1,1)) DisplayValue("TC 1",Temp.Ttc_Avg(1,1)) DisplayValue("TC 2",Temp.
Section 10. Custom Keyboard Display Menus Parameter & Data Type MenuName Text AddtoSystem Constant Enter The text that will be shown as the heading for the custom menu. The string is limited to 20 characters, and it should be enclosed in quotation marks. This constant determines if the custom menu is a sub menu or replaces the standard menu..
Section 10. Custom Keyboard Display Menus Parameter & Data Type MenuItemName Text Source Variable Enter The text that will be shown as the heading for the custom menu. The string is limited to 20 characters, and it should be enclosed in quotation marks. The source of the value to display to the right of the text “MenuItemName” The source must be a variable. MenuPick (Item1, Item2, Item3, ...
Section 11. String Functions 11.1 Expressions with Strings 11.1.1 Constant Strings Fixed (constant) strings can be used in expressions using quotation marks “”. For example, FirstName = “Mike” causes the string variable FirstName to be assigned “Mike”. 11.1.2 Add Strings Strings can be concatenated using the ‘+’ operator. For example, FullName = FirstName + “ “ + MiddleName + “ “ + LastName (The “ “ puts a space between the names.) 11.1.
Section 11. String Functions 11.1.5 String Comparison Operators The comparison operators =, >,<,<>, >= and <= operate on strings. The equality operators perform the string subtraction operation noted above and apply the appropriate rule to return either TRUE or FALSE. Example: Find the name “Mike” in the array of Names For ID = 1 to 10 If Names(ID) = “Mike” …. 11.1.
Section 11. String Functions InStr (Start, SearchString, SoughtString, SearchOption ) The InStr instruction is used to find the location of a string within a string. Syntax Variable = InStr (Start, SearchString, SoughtString, SearchOption ) Remarks This instruction returns the integer position of the SoughtString parameter. If the SoughtString is not found, the instruction returns 0. See the CRBasic Editor help for parameter details.
Section 11. String Functions StrComp (String1, String2) The StrComp function is used to compare two strings by subtracting the characters in one string from the characters in another. Syntax Variable = StrComp ( String1, String2 ) Remarks The StrComp instruction is typically used to determine if two strings are identical.
Section 12. Serial Input and Output Functions This set of instructions and functions are meant to be used with (non-PakBus) serial sensors and controllers and for purposes of dialing and paging through generic text based devices. They cover the functionality of the traditional P15 and P97 instructions with additional flexibility. DialModem (ComPort, BaudRate, DialString, ResponseString) The DialModem instruction is used to send a modem dial string out one of the datalogger's ports.
Section 12. Serial Input and Output Functions Remarks The DialSequence instruction indicates the beginning of the code; the EndDialSequence indicates the ending. The code is entered in the declarations section of the program, prior to the main program (defined by the BeginProg/EndProg instructions). Any time an instruction in the main program requires that communication be made with the remote datalogger identified by the PakBusAddr parameter, the DialSequence code for that datalogger will be executed.
Section 12. Serial Input and Output Functions ModBusMaster (ResultCode, ComPort, BaudRate, ModBusAddr, Function, Variable, Start, Length, Tries, TimeOut) The ModBusMaster instruction sets up a datalogger as a ModBus master device to send or retrieve data to/from a ModBus slave. Syntax ModBusMaster ( ResultCode, ComPort, BaudRate, ModBusAddr, Function, Variable, Start, Length, Tries, TimeOut ) Remarks The datalogger supports ModBus functions 01-05, 15, and 16 (see Function parameter below).
Section 12. Serial Input and Output Functions that have used the reverse word order.) Some software packages have a set setting to work with this original ModBus format. For example, the “Modicon 32-bit floating point order (0123 vs. 3210)” advanced option must be enabled for the ModBus object in National Instruments’ Lookout. ModemHangup (ComPort) … EndModemHangup The ModemHangup and EndModemHangup instructions are used to enclose code that should be run when a COM port hangs up communication.
Section 12. Serial Input and Output Functions SerialFlush (ComPort) The SerialFlush instruction is used to clear any characters in the serial input buffer. Syntax SerialFlush ( ComPort ) Remarks This instruction clears the buffer and leaves the port open. If the input buffer should be cleared before each execution of SerialIn, place SerialFlush in the code before the SerialIn instruction. The ComPort parameter specifies the communication port buffer that should be cleared.
Section 12. Serial Input and Output Functions instruction, 0 will be returned by the instruction. This instruction can be used as the expression for the NumberBytes parameter in the SerialOutBlock instruction. ComPort The ComPort parameter specifies the communication port and mode that will be used when receiving the binary data. See the CRBasic Editor help for parameter details.
Section 12. Serial Input and Output Functions One of three conditions determines when the datalogger should proceed to the next instruction: when the WaitString is received, the NumberTries is exhausted, or the TimeOut is met. See the CRBasic Editor help for parameter details. This instruction runs sequentially from the processing task sequencer, regardless of whether the datalogger is in pipeline or sequential mode.
Section 12. Serial Input and Output Functions This is a blank page.
Section 13. PakBus Communication Instructions This set of instructions is used to communicate with other PakBus devices. In general they specify a COM port and a PakBus address. If the route to the device is not yet known, it will try a direct route through the COM port. If the route is through a neighbor that must first be dialed, then it will first try to dial using the user specified DialSequence. The PakBus Address parameter is a variable, so it can be used in a For loop, for example.
Section 13. PakBus Communication Instructions The Timeout parameter in these instructions is in units of .01 seconds. If 0 is used, then the default timeout defined by the time of the best route is used. PakBus “Hop Metrics” are used to calculate this time. Presently there is not a number of tries parameter. It is easy to retry within CRBasic: For I = 1 to 3: SetSettings(ResultCode,….): if ResultCode = 0 Exit For (If needed, we can add a retry parameter or default to more than one try.
Section 13. PakBus Communication Instructions Syntax Routes ( Dest ) Remarks This instruction stores four values for each known route into the Dest parameter. The four values for each route are: ComPort used for communication, neighbor PakBus address, destination PakBus address, and expected response time (in milliseconds). The list of routes is terminated with a -1. Dest must be an array dimensioned large enough to accommodate the number of routes (4*routes), plus one for the termination character.
Section 13. PakBus Communication Instructions See the CRBasic Editor help for parameter details. SendTableDef (ComPort, RouterAddr, PakBusAddr, DataTable) The SendTableDef instruction is used to send the table definitions from a data table to a remote PakBus device. Syntax SendTableDef ( ComPort, RouterAddr, PakBusAddr, DataTable ) Remarks This instruction can be used to send table definitions from a datalogger to a PC running the LoggerNet server. See the CRBasic Editor help for parameter details.
Section 13. PakBus Communication Instructions Note: By default, LoggerNet uses PakBus address 4094 and PC400 uses 4093. TimeUntilTransmit The TimeUntilTransmit instruction returns the time remaining, in seconds, before communication with the host datalogger. Syntax TimeUntilTransmit Remarks The TimeUntilTransmit value is derived from the time slot information that is sent by the host datalogger.
Section 13. PakBus Communication Instructions This is a blank page.
Section 14. PakBus Networking This section is intended as an introduction to PakBus networking with the CR800.
Section 14. PakBus Networking Starting with LoggerNet, the configurations of the devices in the example network are as follows: Example Network – LoggerNet Configuration Setup Description Device Map Map CR800_10 as a router to CR800_20: Note: CR800_10 discovers CR800_20 by neighbor filter so that LoggerNet can communicate with CR800_20 through CR800_10. PakBusAddresses LoggerNet PakBusPort address defaults to 4094.
Section 14. PakBus Networking Neighbor Filter Using Device Configuration Utility, Settings Editor, type into Neighbors Allowed SDC7 “(20, 20)” [Enter] and into Verify Interval SDC7 “60” [Enter]. This will configure a neighbor filter seeking/allowing PakBus address 20 as a neighbor with a verification interval of 60 seconds. Remember to Apply settings. Router Using Device Configuration Utility, Settings Editor, configure CR800_10 as a router by making Is Router equal to “1”. Central Routers Not needed.
Section 14. PakBus Networking Beaconing CR800_20 is discovered by the router neighbor filter. There is no need for the leaf node to beacon. To minimize rf traffic, keep beaconing off (at 0): Baud Rate SDC7 Not user configurable (see Network Configuration Basics, Communication Peripheral Setup, Baud Rates).
Section 14. PakBus Networking FIGURE 14.1-1. PakBus Graph Network View LoggerNet will discover CR800_10 by the device map setup (static link) soon after you click Connect. CR800_10 with its neighbor filter will discover CR800_20. At this point a connection to CR800_10 or CR800_20 is possible and high-level datalogger functions are available (Clock set, program send, data collect, etc.). Go ahead and set the station clock and send a program to CR800_10 and CR800_20.
Section 14. PakBus Networking Example Network – RF401 Stand-alone Router (can replace CR800_10 - RF401 Router) Setup Description General If RF401 settings have changed from factory defaults, use Device Configuration Utility to set factory defaults. Then proceed with setups below. Active Interface (Port) Use Device Configuration Utility for setup. Hopping Sequence Set to 1 (same as the rest of the network). Network Address Set to 2 (same as the rest of the network).
Section 14. PakBus Networking 14.2.1 Router and Leaf-node Configuration The arrangement of routers and leaf-nodes happens early in network planning. The number of network routers can be from none to many extending from the LoggerNet PC to the most remote stations. Routers can include a datalogger and do measurements or employ an RF401 series stand-alone router to only route packets for other dataloggers. Leaf-node devices can be added to any router.
Section 14. PakBus Networking would be marginal is acceptable. Allowing this link to be used would leave the other link (through a router) as a redundant, backup link. Using neighbor filters, you can determine which nodes will be considered potential neighbors. This allows you to force packets to take a particular route, the best route based on your knowledge of the installation.
Section 14. PakBus Networking User configured verification intervals should be based on the timing of normal communications such as scheduled LoggerNet collections or datalogger to dataloggers communications. The idea is to not allow the verification interval to expire before normal communications. If the verification interval expires the devices will initiate hello exchanges to try and regain neighbor status consuming a little bandwith. 14.2.
Section 14. PakBus Networking For program initiated communications such as datalogger-to-datalogger transfers, the program instruction can (1) have its Com port parameter set to 0 to auto-discover the attached communication peripheral’s active interface (port), or (2) be configured to match the peripheral’s port.
Section 14. PakBus Networking FIGURE 14.2-1B. Tree Map In RF4xx networks, with all the remotes in range of LoggerNet’s RF4xx, you can use the ‘flat’ configuration of Figure 14.2-1A. In RF4xx networks where communications requires routers, use the ‘tree’ configuration of Figure 14.2-1B. Here, CR800 is probably neighbor-filter configured as a router to CR800_2, and CR800_2 is probably neighbor-filter configured as a router between CR800 and CR800_3. Referring to Figure 14.
Section 14. PakBus Networking 14.3.2 PakBus Devices A PakBus device is one that is capable of creating and processing PakBus packets. Examples of PakBus devices are: the CR800, LoggerNet, the RF401 (in PakBus Node protocol), the CR10X with PakBus OS, the NL100, and the CR206. A PakBus device has an integer PakBus address (PBA) from 1 to 4094. In order for a network to function properly, each PakBus device must have a unique PakBus address.
Section 14. PakBus Networking In some RF4xx networks with routers, neighbor filters are employed to eliminate unreliable RF links. The idea is to prevent a needed router from being bypassed in favor of a direct link. PakBusGraph Ping Node is used to characterize a link and determine the need to force a route using a neighbor filter (see 14.2.3). Sometimes a carefully designed blend of beaconing and neighbor filters can be employed.
Section 14. PakBus Networking 14.3.5 Verification Intervals The verification interval is the interval at which a PakBus device, which has an established neighbor but hasn’t heard from it during normal communications, tries to reestablish the device as a neighbor by attempting a hello-exchange. The verification interval is either assigned (input by user to Verify Interval xxx) or it is calculated by multiplying a device’s beacon interval by 2.5.
Section 14. PakBus Networking Being a router requires more resources than being a leaf node. Allow as many nodes as possible to be leaf-nodes and allow only routers to beacon. If a CR800 is configured as a router (i.e., the IsRouter setting is set to “1” or “True”) you can view its Routing Table using PakBus Graph. Right-click on the graphic of the CR800 and select Show Settings. You may see something like this: There are three routes in the above routing table.
Section 14. PakBus Networking RoutingTable(3) – PakBus address of the destination PakBus device (LoggerNet in this example) RoutingTable(4) – Hop metric (expected response time in milliseconds) of the destination node. The Standby Mode of RF401s with an RF PakBus protocol affects the hop metric.
Section 14. PakBus Networking 3. All network routers must participate either as a central router or as a branch router 4. All branch routers list the same central routers in their central router fields 5. Central routers have 0 in their central router fields Central Routers: C4094, C1 L4 Branch Routers: B2, B3, B8 L5 BRANCH 1 L6 B3 L7 B2 LoggerNet C4094 RF401 stand-alone C1 BRANCH 2 B8 L12 L9 L11 L10 FIGURE 14.3-1.
Section 14. PakBus Networking 14.3.8 Leaf-Nodes A leaf-node is a PakBus device that doesn’t route packets, although it might be capable of it if so configured. The routing table for a leaf-node is limited to its neighbor list. PakBus Graph, Show Settings will only display the links to a leaf node’s neighbors.
Section 14. PakBus Networking 14.3.10 LoggerNet and RF4xx Communications Consider this example network. LoggerNet communicates via an RF4xx cabled to a PC’s COM Port. CR800B is x miles from the PC. ComPort_2 PakBusPort CR800A CR800B LoggerNet~~~x/2 miles~~~CR800A~~~x/2 miles~~~CR800B RF4xx RF4xx RF4xx FIGURE 14.3-2. Transparent Mode Comms Let’s say we know, from testing with PakBusGraph Ping Node (14.2.
Section 14. PakBus Networking With CR800A positioned as shown above, LoggerNet will be able to connect to CR800B through CR800A provided that CR800A and CR800B discover one another. This will happen by setting up a neighbor filter in CR800A listing CR800B’s PBA as an allowed neighbor. NOTE If you insert an additional router into an RF4xx network employing neighbor filters for discovery, both routers in each of the two new links must list the other as an allowed neighbor or they cannot become neighbors.
Section 14.
Section 14. PakBus Networking 14.5 Network Troubleshooting Symptom Possible Causes Cures LoggerNet doesn’t connect to in-range CR800 in its device map. PakBus address in Device Map disagrees with CR800’s PBA. Configure the same address. After the CR800 switches to a different port LoggerNet still has a link in its routing table via the original CR800 port.
Section 14. PakBus Networking Symptom Possible Causes Cures In an RF4xx network, LoggerNet is ‘jumping over’ the intended router and connecting directly to a station beyond. LoggerNet device map is configured ‘flat’ allowing LN to connect directly to remote station via a static route. Configure the LoggerNet device as a ‘tree’ shape where the remote station is a child of the router. In RF4xx network having 2 or 3 routers, LoggerNet doesn’t connect to CR800.
Section 14. PakBus Networking neighbor list unless the beaconing device’s address is ≥ 4000 (normally LoggerNet). 14-24 Beacon Interval User assigned interval between broadcast beacons. Beacon Interval SDC7 Same as BeaconSDC7. The CR800 setting of the interval between broadcast beacons. Branch Router Typically an RF401 configured as a stand-alone router.
Section 14. PakBus Networking Concurrent Communications A PakBus datalogger’s ability to communicate with several peripherals at the same time (interleaved transfers). CSDC Concurrent Synchronous Device Communications. Refers to clocked (as opposed to asynchronous) communications between datalogger and addressed peripheral which can be interleaved with communications from other addressed (or even M.E.) peripherals. CS I/O Campbell Scientific I/O interface.
Section 14. PakBus Networking 14-26 Hop Metric A measure (issuing from a hello-exchange) indicating the expected maximum response time communicating with a certain node. An RF401 configured for an RF PakBus protocol factors its Standby Mode into the link hop metric. Hopping Sequence The setting for an RF4xx’s pattern of spread spectrum frequency hopping (0 – 6). Leaf Node A PakBus device which is not serving as a router, although it may have the capability if so configured.
Section 14. PakBus Networking Network Address RF4xx Network Address. In a PakBus network all RF4xxs must have the same network address. Node Another term for a PakBus device. A station with PakBus datalogger can be referred to as a PakBus Device or a node. An RF401 series stand-alone router is also a node. Packet A frame, typically 1000 bytes or less, containing a header and data. Packets transfer information between LoggerNet and PakBus dataloggers or between dataloggers, often via routers.
Section 14. PakBus Networking 14-28 Radio Address RF4xx Radio Address. In transparent PakBus networks all RF4xxs are configured to the same radio address. In a PakBus Aware or PakBus Mode network, the Radio Address is not used. Represented Refers to a device that is shown in the LoggerNet device map. Some communication devices, such as the RF4xx, need not be represented in the device map. RF Radio frequency. Having to do with wireless radio transmission and reception.
Section 14. PakBus Networking Transaction An exchange of packets between nodes. An example is the hello-exchange. Most packets come in command/response pairs. Tree Map LoggerNet, Setup device map where succeeding PakBus devices are added as children of the device above. Along with appropriate neighbor filters a tree map can force a certain route to a destination PakBus device. Verification Interval Equivalent to “communication verification interval.
Section 14. PakBus Networking This is a blank page.
Appendix A. CR800 Status Table The CR800 status table contains current system operating status information that can be accessed from the running CR800 program or monitored by PC software. There is also a way to view the status information from the keyboard. Table 1 shows the variables in the status table and a brief explanation of each follows.
Appendix A. CR800 Status Table Status Fieldname Low12VCount5 Low5VCount CompileResults StartUpCode6 ProgErrors VarOutOfBound7 SkippedScan SkippedSlowScan8 SkippedRecord9 ErrorCalib8 MemorySize MemoryFree A-2 Description Variable Default Normal Type Range Keeps a running count of the number of Integer 0 0 occurrences of the 12VLow signal being asserted.
Appendix A. CR800 Status Table Status Fieldname Description ProgMemFree Amount of free space in the CPU ramdisk that is used to store program files. Array of two values. First value is bytes Integer free, the second value is the number of array of small blocks available. 2 A value of 98765 written to this Integer location will do a full memory reset. Full Memory Reset will reinitialize RAM Disk, FinalStorage, PakBus memory, and return DevConfig parameters back to defaults. Number of records in a table.
Appendix A. CR800 Status Table Status Fieldname Description LastSlowScan The last time that this slow scan executed. If the user has slow scans then this variable becomes an array with a value for the system slow scan and each of the users scans. The time in microseconds required to process the current slow scan. If the user has slow scans then this variable becomes an array with a value for the system slow scan and each of the users scans.
Appendix A. CR800 Status Table Status Fieldname Description Variable Default Normal User can Info Type Range change? Type Array of baudrates for comms. Aliased Integer RS232= 1200, Yes, can Config Baudrate15 to: BaudrateRS232, BaudrateME, array of 2400, also use BaudrateCOM310, BaudrateSDC7, 9 115200 4800, SerialOut BaudrateSDC8, BaudrateCOM1, ME9600, instructio BaudrateCOM2, BaudrateCOM3, SDC8 = 19.2k, n to setup. BaudrateCOM4 115200 38.4k, 57.6k, COM1- 115.
Appendix A. CR800 Status Table Status Fieldname Description CalDiffOffset17 Calibration table of differential offset values. Each integration / range combination has a differential offset associated with it. These numbers are updated by the background slow sequence if needed in the program. A-6 Variable Default Normal User can Info Type Range change? Type Integer _ close to 0 _ Calib array of 18 1 The StationName instruction can also be used in a program to write to this field.
Appendix A. CR800 Status Table 13 Security can be changed via DeviceConfig, CR800KD, PBGraph, StatusTable, and SetSecurity instruction. Shows -1 if security code has not been given/deactivated. 14 When the SerialOpen instruction is used CommsConfig is loaded with the format parameter of that instruction. Currently (11/2004), the only formatting option available is 0 = No error checking.
Appendix A. CR800 Status Table This is a blank page.
This is a blank page.
Campbell Scientific Companies Campbell Scientific, Inc. (CSI) 815 West 1800 North Logan, Utah 84321 UNITED STATES www.campbellsci.com info@campbellsci.com Campbell Scientific Africa Pty. Ltd. (CSAf) PO Box 2450 Somerset West 7129 SOUTH AFRICA www.csafrica.co.za cleroux@csafrica.co.za Campbell Scientific Australia Pty. Ltd. (CSA) PO Box 444 Thuringowa Central QLD 4812 AUSTRALIA www.campbellsci.com.au info@campbellsci.com.au Campbell Scientific do Brazil Ltda.