beautypg.com

Define constants – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 132

background image

Section 4. CRBasic – Native Language Programming

data at another rate), as well as the rate that you wish to store the different
measurement parameters.

The raw output for thermocouples measured by CSI loggers, is degrees
Celsius. The raw output for a bridge measurement is mV per Volt
excitation.

EXAMPLE Con't

Full Scale

Storage

Sensor#

Alias

Units

Mult Offset Output

Rate

Type K#1 Ambient Degrees F 1.8

32 34 mV

10 Hz

Type K#2 InletT

Degrees F 1.8

32 34 mV

10 Hz

Type K#3 OutletT

Degrees F 1.8

32 34 mV

10 Hz

Pressure #1 InletP

PSI

50

0

2 mV/V

100 Hz

Pressure #2 OutletP

PSI

200

0

3 mV/V

100 Hz

4) Know your PROGRAMMING TOOLS. Now that the system

requirements are known, you will need to decide which programming tool
to use. SCWin is the most basic, and has limited capabilities. The
CR9000X Program Generator is also a "pick and click" programming tool,
but has more capability, and thus more complexity, than ShortCut. Both of
these tools have good help files/tutorials and are fairly straight forward, so
their use is not covered in this section. If you wish to use the Program
Generator, a good resource is the Quick Start Tutorial at the beginning of
this manual. For most applications, it is recommended to start with the
Program Generator or ShortCut to develop the basics or skeleton of the
program and then modify, if required, using the third option for
programming: the CRBasic editor. Now that we now the system
requirements, we are ready to start programming.

5) Know your PROGRAMMING STRUCTURE. Read Section 4.2.3 and

review its examples to learn the basic structure for a CRBasic program.

6) Know your VARIABLES. Read Section 4.2.4.1 through Section 4.2.4.3

and Section 4.2.5. Define the constants that will be used for scaling the
output from the sensors to the desired engineering units. Declare the
variables that will be used to receive the measured output from the sensors.
Declare the engineering units. If using arrays, declare aliases for the
elements of the arrays. Using a Colon (:) between instructions to insert
multiple instructions on a single line. Unique names can be assigned to
variable array elements using the Alias instruction.

‘Define Constants

Const TCMult = 1.8

:

Const TCOffset = 32

Const P1Mult = 50

:

Const P1Offset = 0

Const P2Mult = 200

:

Const P2offset = 0

Define Public Variables

Public RefTemp, TC(3)

'Variable for ref temp & 3 Element array for

temperatures

Public Press(2)

'Declare 2 Element array for pressures

Declare Units

Units RefTemp = degC : Units TC = degF

: Units Press = psi

Declare Aliasess

Alias TC(1) = Ambient : Alias TC(2) = InletT : Alias TC(3) = OutletT
Alias Press(1) = InletP : Alias Press(2) = OutletP

4-4