Menu

Rflex user guide and function reference

John Olsson

Rflex user guide and function reference
Version 1, May 2012
John Olsson, Stefan Simis
Finnish Environment Institute SYKE

The hardware setup
The sensors are mounted on a platform mounted on the shaft of a stepper motor, allowing control of the azimuthal viewing direction of the radiance sensors. Three Ramses sensors from Trios are connected to a Trios IPS box which serves as a serial relay and power supply. The Ips box is connected to the computer serial communication port. The serial protocol used is RS-232.
A GPS is also connected to one of the computer serial ports. To control the pointing platform, a USB-1208 data acquisition device from Measurement computing is used to generate TTL signals to the step motor controller. This digital i/o interface also connects to the proximity switch that is used to periodically calibrate the viewing angle on the center position.

The sensors
The Ramses sensors communicate via serial data, RS-232. To trigger a measurement a start command is sent to the sensor, which replies with a measurement. By changing the content of the start command, different integration times can be chosen, but normally the user will let the sensor decide the integration time automatically. One feature of the program is to manually boost the integration time. In this way, signal strength can be increased, saturating parts of the spectrum. This feature can be useful to increase the signal-to-noise ratio in parts of the spectrum where radiance intensity is low (e.g. UV or near infra-red).
Program description
Rflex 0.3
The program is made to collect hyperspectral reflection at optimal azimuth angles with respect to the sun, on a moving ship. The program will calculate the best position of the stepper motor axis, compensating for sun and ship angles, at 1-s intervals. To program consist of modules for spectrometer control, stepper motor control, measrement triggering, geopositioning, and angle calculations modules. The program can obtain ship heading from a dedicated compass if it sends an NMEA string on a connected COM port. In the absence of a ship compass connection, the GPS heading is used and updates and measurements are paused when the speed drops below 1 kn.

Function reference guide
RFlex 0.3 consists of a series of Labview 2010 virtual instrument modules, allowing the user to rapidly connect to auxilliary hardware. A Windows executable of the compiled program is available. The list below serves as a reference guide for each of the main program functions, organized by module.
Ramses spectrometer control module
The main VIs are
Rflex_Ramses_Initialize.vi
Rflex_Ramses_Poll4Data_and_BroadCast.vi
Rflex_Ramses_trigger_and_Store_Ch[1-3].vi.

Rflex_Ramses_Initialize.vi
Following the data flow, Rflex_Ramses_Initialize.vi gets the port number for the IPS box and the different sensor types from the settings.txt file. The VI finds the three sensors connected to the IPS box and determines the correct start command (based on sensor name,address) for each sensor.

Rflex_Ramses_Trigger_and_Store_Ch[1-3].vi
These VIs runs in parallel with Rflex_Ramses_Poll4Data_and_BroadCast.vi.
The data flow starts when a trigger is received from Rflex_Ramses_Trigger_and_Store.vi. A sensor-specific start command (see Rflex_Ramses_Initialize.vi) is sent to the sensor. Then it waits for data or a time-out (defined in settings.txt, recommended 40 seconds). When the measurement is received in full (8 data blocks per measurement), the VI retrieves the meta data header variable and appends it to the data output file specified in settings.txt. The VI triggers the idle indicator for the respective channel on the front panel and waits for the next trigger.

Example output:
82DB,091209,080512,60.203670,24.960805,,0.000000,3,157,320,46,0.3,,,,0,2,12:13:23,1271,1242,1235,1242,1237,1234,1234,1230,1235,1229,1235,1230,1234,1230,1238,1234,1236,1235,1238,1240,1241,1230,1238,1238,1239,1242,1244,1243,1244,1252,1259,1268,1277,1296,1306,1331,1352,1379,1407,1442,1478,1513,1561,1593,1643,1691,1744,1780,1820,1849,1880,1906,1929,1961,1984,1977,1972,1951,1954,1950,1963,1976,2015,2034,2072,2174,2392,2635,2810,2911,2974,3039,3137,3240,3360,3459,3608,3829,4041,4190,4326,4441,4562,4692,4816,4934,5096,5291,5469,5613,5831,6120,6424,6688,6918,7094,7267,7436,7632,7834,8083,8492,9033,9565,10022,10405,10798,11197,11633,12131,12644,13095,13483,13730,13678,13003,11678,10880,12143,14698,16643,17519,18064,18512,18913,19278,19493,19588,19767,20068,20577,21378,22295,22881,23124,23232,23331,23291,23060,22836,23353,24442,25285,25597,25705,25812,25889,25911,25795,25823,26262,26947,27538,28159,28707,28992,29140,29447,29996,30669,31322,31951,32777,33752,34706,35608,36589,37672,38779,40065,41641,43261,44606,45853,47328,48914,50434,51788,53058,54353,55526,56398,56932,57222,57621,57948,57982,57368,56540,55452,54358,54050,54648,55053,54384,53336,52591,51981,50859,49473,49080,49716,50272,50048,49692,49771,50561,51693,52716,53579,54575,55035,54790,53880,52884,51380,49278,48287,49023,49380,48257,46154,43135,39524,36182,32458,26789,21090,18270,16992,15642,15347,15929,16109,16407,17277,17458,16778,16176,16222,15844,14426,12734,11190,9635,8130,6866,5697,4470,3368,2591,2086,1754,1572,1485,1538

Fields: [SensorSerial,UTCtime,Date,Latitude,Longitude,Heading,Speed,AngleQuality,SunAzimuth,ArmAzimuth,SunElevation,Version,,,,Boost,Integrationtime,StartTime,Rawspectra*]
*Rawspectra is a comma separated vector of 256 values.

Rflex_Ramses_Poll4Data_and_BroadCast.vi
This VI runs continuously checking for new data on the communication port connected to the IPS box. When there is data on the port it is read and character replacements used in the Ramses communications protocol are reverted to their original values. The data are then identified by the source channel and dealt to the appropriate Rflex_Ramses_Trigger_and_Store_Ch[x].vi.

Viewing Angle Optimization module
Rflex_View_Stepper_Main.vi
This VI controls the TTL signals for the stepper motor and reads the proximity switch through communication with the USB-1208 DAQ. It also has an internal calibration routine, where it finds the position of the proximity switch. The VI takes the target position for the stepper motor as input and returns current position. At start-up and at intervals set in the settings file it starts the angle calibration, which pauses sensor triggering.

Rflex_View_OptimalAngles_deg.vi
Returns two optimal viewing angles (clockwise and counter-clockwise) in compass degrees based on the sun azimuth.

Rflex_View_TargetAngle.vi returns the StepperTargetPos variable, based on the angle restrictions, angle offset, and stepper motor step size that are defined in settings.txt, and on the current heading and stepper position.

The loop “Choose view angles and trigger calibrations” updates every second and triggers the calibration in Rflex_View_Stepper_Main. If calibration fails, it re-tries 2 times before it shuts down the program (to prevent damage should sensor movement be blocked). It is assumed that human interaction is needed to restore functionality. Calibration and calibration error will be logged in the log file.

Geoposition, Heading, Celestal calculations, and Data Header modules

Rflex_GPS_main.vi
Reads NMEA data from the GPS, these values are updated continuously and are used by the other modules. The communication port is set in settings.txt. The NMEA0183 protocol is assumed.

Rflex_Compass_Main.vi
If the ship is fitted with a compass providing an NMEA string (identifier HEHDT) this module reads the compass heading. The communication port is set in settings.txt. If a compass is absent, the corresponding line in settings.txt can be set to a non-existing COM port.

The loop “Celestial calculations” calculates the sun azimuth and elevation based on UTC time, date, and GPS position, received from the GPS module.

The loop “Header Maker” updates the output data header every second. When a measurement is triggered, the latest value of the header is stored for Rflex_RamsesTrigger_and_Store.vi. The data header is comma separated with the following structure:

Example header:
,091209,080512,60.203670,24.960805,,0.000000,3,157,320,46,0.3,,,,

Fields:[,UTCtime,Date,Latitude,Longitude,Heading,Speed,AngleQuality,SunAzimuth,ArmAzimuth,SunElevation,Version,,,,]

Rflex_FileIO_Filepaths.vi
The Save file name module produces the data file path from settings.txt. A new file name is generated every day or when the program is restarted.

Trigger and Display Module
Before a measurement trigger is sent a few criteria must be met: (1) the sensor channel should be reported as idle, (2) GPS location is fixed, (3) View angles and sun elevation are within defined limits. The trigger loop contains a bypass that can be configured to ignore one or more of these criteria for debugging and testing:

Ignore Fix switch (Advanced tab, front panel)
For fixed situation like testing and debugging or fixed angle placement of the sensors, a heading input is not required. This switch will cause the trigger loop to send measurement triggers even when GPS data is not available. Note that the data header will still contain system time.

Manual viewing direction control switch and input field (Advanced tab, front panel)
This control can be used to turn the stepper motor to any desidered angle with respect to the offset (compass degrees) defined in settings.txt.

Trigger Channel 2 at low sun elevation (settings.txt)
In settings.txt it is possible to override the sun elevation requirement for Channel 2. It is recommended that the irradiance sensor is connected to this channel, and by enabling this option the software can be configured to collect spectral downwelling irradiance e.g. from dawn until dusk. The interval at which this channel is triggered outside the regular measurement interval can also be set.

If the measurement times out it will be logged in the log file.