MAVS Menu Driven Program NOBSKA Albert J. Williams 3rd awilliams@whoi.edu February 26, 1999 INTRODUCTION The MAVS current meter is controlled internally by an Onset Computer Co. Tattletale 4A processor. This processor runs Tattletale BASIC and MAVS3.TTB, written in Tattletale BASIC (TTB), controls what is measured, when it is measured, how it is stored, and how it is displayed. The kernel of the MAVS program is a set of assembly routines that make the velocity and compass measurements. These are so programmed to run fast. The rest of the program is concerned with the timing of the measurements, the display of the measurements, and the storage of the measurements. The user can select these parameters with a terminal. TTOOLS running on a PC is such a terminal emulator. This document is a guide to the menu driven MAVS program. STARTING UP The MAVS current meter has an underwater connector on the endcap. Remove the protective cover on this connector and plug the cable provided with MAVS onto the connector. The four conductors in the cable are power, ground, RS232 in, and RS232 out. The RS232 signals must be connected to a communications port of a terminal or PC. The power connection is to be 14 to 25 volts positive with respect to the ground connection. Power requirements are 100 ma. If an interface box is provided, the underwater cable can be plugged into the box, a DB-9 communications cable connected to the box, and power provided from the 100 vac to 220 vac power supply or an external 14 to 25 vdc power source. TTOOLS TTOOLS, provided with MAVS, is a terminal emulation program with convenient features for communication with the Tattletale processor in MAVS. TTOOLS and its associated programs should be copied into a directory on the PC and TTOOLS invoked. TTOOLS will work in DOS or in a DOS window within Windows. The TTOOLS screen is a Windows-like environment and the top bar shows menus that can be clicked upon with a mouse or invoked with ALT keys. The CommPort menu should be opened and Port setup selected. Within the Baud Rate/Protocol window, the communications port, to which the RS232 connections have been made, should be selected. Set baud rate to 9600, data bits to 8, stop bits to 1, and handshake and parity to none. If another terminal program is used, set these values into it. A second window under the CommPort menu can be opened with Options. This window is labeled ASCII transfer options. “New” should be checked and the values 1 at a minimum entered in the spaces for Character Delay and Line Delay. These delay values depend on the speed of the PC and may require adjustment if file transfers to the MAVS are flawed. File transfers are not required in normal operation but this delay setting may need adjustment if a revised program is emailed and must be downloaded into MAVS at a later date. POWER ON When power is applied, MAVS sends a sign on message to the terminal, may display parameters for auxiliary sensors, and reports the time from its clock. It next tells what it will do if not reprogrammed in several lines and asks “MORE? (Y in 5 sec)”. Unless a capital “Y” is typed within 5 seconds, the program will do what it said it would. If “Y” is typed, a second question is asked, “STOP? (‘STOP’ in 5 sec)”. Typing “STOP” in capital letters will gain control of the program indicated by the OK prompt. This is required for downloading or uploading files to or from MAVS. If the program is not interrupted, the Top Menu will be presented. While the program will move on after 5 seconds, a simple return or enter will truncate the wait. Note that an enter with no character is equivalent to entering 0. If the program was not interrupted and is in the process of displaying or logging data, typing Control C (the Control key held down while the C key is pressed) can interrupt it and this will break the program and offer the “STOP? (‘STOP’ in 5 sec)” query followed by the Top Menu. Top Menu There are seven choices at the Top Menu. Before the menu is displayed, the present configuration is printed which tells what the program will do if the choice is 0 or enter. A typical display might be: Log from DP=20 with 1-second average, for 5 sample(s) every 1 minute(s) (negative continuous), starting now until memory is filled. If 0 or enter is selected, MAVS will start to log earth coordinate referenced data in bursts every minute. This is also what would have happened in this case if nothing had been typed when power on occurred. The Top Menu looks like this: ***** Top Menu ***** Run Now = 0 Display = 1 Logging = 2 Offload = 3 Parameters = 4 Set Clock = 5 Calibrate = 6 Enter choice now RUN NOW The choice is made by a number followed by enter. In the first case, 0 is automatically assumed if enter is pressed with no other entry. This is fast and allows the selection displayed before the Top Menu screen to be run. DISPLAY Entering 1 goes to a second order menu, the Display Menu. If you want real time data to be displayed on the terminal, this is where the format and sample rate can be selected. Logging can be added to the display if required at the Display Menu. LOGGING Entering 2 goes to a second order menu, the Logging Menu. Many options can be selected on this menu such as sample rate, burst length and burst interval, start and stop times, and the place in the datafile where the data will be stored. Display is also an option in addition to this more complex logging program. The format of data storage can be selected to permit raw velocity components or earth coordinate velocity components to be stored. Before the Logging Menu is presented, the present configuration is displayed. If this is what is required, a simple enter will return you to the Top Menu where the program can be run with another enter. OFFLOAD Entering 3 goes to a second order menu, the Offload Menu. At the Offload Menu, choices about format of the data can be selected. If data were logged in raw velocity format, only binary or hex (hexadecimal ASCII) format can be offloaded. If earth coordinate data were recorded, only earth coordinate formatted data can be offloaded. After each selection in the Offload Menu, the offload format is displayed and the menu presented again. When the selection is finished, offloading can commence from within the menu. PARAMETERS Auxiliary sensors may be present in MAVS and the identification of these sensors and the offset and scale factors required to obtain output in engineering units can be set in a second order menu by entering 4. The Parameters Menu will be disabled if there are no auxiliary sensors. But if there are, it will allow the serial number, the offset, and the scale factor to be changed. Pressure is the most common auxiliary sensor. Omega strain gauge sensors are linear but have an offset and require a scale factor for output in decibars. SET CLOCK When power is removed from MAVS, the clock resets to January 1, 1980 at midnight. When power is returned, the clock starts counting seconds from that time (actually, it counts 100ths of seconds in a 5 byte counter). Selecting 5 allows one to reset the clock. If the clock is not correct, enter year, month, day of month, hour, minute, and second. When the seconds have been entered, the clock will start. The new time will be presented and if not correct, it can be reset. When correct, return to the top menu. CALIBRATE Quality measurements require that the sensors be zeroed. Enter 6 to go to the Calibrate Menu. There, the choices permit zeroing the current sensor, deviating the compass, and leveling the tiltmeter. One can display raw output from the sensors to verify the correct behavior of each sensor. Display Real time display on a terminal is useful for lab work, for remote installations where the MAVS is cabled to the terminal, and for cable lowered applications. The Display Screen has four options: ***** Display Screen ***** Correct = 0 Format = 1 Sample Rate = 2 Logging? = 3 Enter choice now FORMAT Entering 1 takes you to a third order menu to select format. Speed and Direction Cartesian Coordinates Comma Separated Variables? Binary, no rotation “ w/compass between bursts Hex, raw axes Enter choice now = = = = = = 0 1 2 3 4 5 The choices are display in speed and direction, 0; Cartesian coordinates, 1; comma separated variables?, 2 (to change the separator between variables from spaces to commas); binary output for high speed without earth coordinate rotations, 3; binary output for higher speed where the compass is only read between bursts, 4; and hex output of raw velocity axes, 5. After each selection, a display of what has been selected appears before the Display Menu. When it is correct, enter will return to Top Menu and a second enter will start the program running. If the format chosen is binary, beware that binary data are not acceptable to many terminal programs, TTOOLS included. The results of binary data being received are unpredictable, frequently locking up the PC. It is however useful for transferring data to another logger. SAMPLE RATE MAVS samples at a 700 ms rate except in binary mode. Multiple samples can be averaged before display or logging using a boxcar filter. Enter 2 to make this selection. No averaging is selected with an enter. Nominal seconds of averaging are selected with an integer from 0 to 3600. Since the sample interval is 700 ms rather than 500 ms, the actual sample interval is somewhat longer than the number of seconds selected. The time stamp will be the actual time of the measurement. LOGGING? Logging in addition to display is possible. Entering 3 allows you to toggle between simultaneous logging and no logging. When the selection is accepted, the program configuration is displayed and the Display Screen is presented. Logging Logging to the 2 Megabyte datafile requires care and planning. The Logging Screen allows selections that program this feature. There are eight selections in this menu. ***** Logging Screen ***** Return to Top Menu Log Hex Format? Sample Rate Length of Burst Burst Interval Start and Stop Times Reset Datafile Pointer Display? = = = = = = = = 0 1 2 3 4 5 6 7 Enter choice now LOG HEX FORMAT? Entering 1 takes you to a third order menu, the Log Hex Format? Menu. In this menu, a selection can be made between logging data in the raw velocity format or the earth coordinate format. If data are logged in earth coordinate format, they can later be offloaded in either Speed and Direction format or in Cartesian coordinate format. If they are logged in raw axes format, they cannot be offloaded in earth coordinates, only in hex or binary raw formats. SAMPLE RATE Entering 2 permits selecting the sample rate. As in the Display Menu, entry is an integer from 0 to 3600 and represents the nominal number of seconds that the measurements will be boxcar averaged. The integer 0 means no averaging. Measurements are made at 700 ms intervals instead of 500 ms for which the averaging period would be correct. Thus a selection of 10 will be 20 measurements averaged but take 14 seconds. LENGTH OF BURST To set the number of samples logged each burst interval, enter 3. You will be prompted for the length of the burst in number of samples with the present number of samples offered as the default. A burst length that will cause MAVS to overrun the burst interval is acceptable. However, the overrun start time will be skipped and the next interval time will start the next burst instead. BURST INTERVAL Entering 4 will allow you to set the burst interval. The integer is the number of minutes between bursts. A negative number entered here will make the logging be continuous. The range is up to 1440 (24 hours) but only integer fractions of a day are meaningful for the purposes of defining a burst interval. START AND STOP TIMES Delayed start of logging is available by entering 5. Start and stop times are displayed and the option is given to change the start time or change the stop time. A negative number entered as a start time means start now while a negative number entered as stop time means log until memory is full. When the start and stop times are as desired, enter goes back to the Logging Screen. Start and stop times cross the year boundary (including 1999-2000) without difficulty. RESET DATAFILE POINTER The datafile is the section of memory in which data are stored. Customarily, data are stored starting at datafile pointer 20, leaving some room below the data storage area for scratch work. When data have been logged, the starting point for more data logging is by default, the end of the previous logging session. Entering 6 permits restoring the datafile pointer to 20 or to any other value. If the datafile pointer is outside the range 0 to 2 million, there will be an error. DISPLAY? To display simultaneously with logging, enter 7. The simultaneous display of data with logging may be toggled off or on. If Display Status – Simultaneous is selected, you will be returned to the Display Menu where more details may be required, such as the format of display. Offload Data stored in earth coordinate format may be offloaded in Speed and Direction or Cartesian coordinate format, with space separated variables or comma separated variables for capture in Excel. If data were stored in raw velocity format, they can be offloaded in binary or hex format. The range of datafile may be selected for versatility, such as a late portion of a deployment without having to go through the early part first. The format that will be offloaded is displayed before the Offload Screen. ***** Offload Format ***** Return to Top Menu Speed and Direction Cartesian Coordinates Binary output Hex, Raw Axes Comma Separated Variables? Start and Stop DP Offload now = = = = = = = = 0 1 2 3 4 5 6 7 Enter choice now SPEED AND DIRECTION Entering 1 sets the output format to speed and direction. In this format, there are 11 variables in the following format: Day Hr:Min:S Temp Press Pitch Roll Speed Direction Vup where Day is day of the month, Hr is hour of the day, Min is minute, S is second, Temp is temperature of the circuit board, Press is pressure measured at the endcap if there is a pressure sensor, Pitch is the angle of the Y axis above horizontal, Roll is the angle of the X axis above horizontal, Speed is the vector sum of the three components of velocity, Direction is the direction in the horizontal plane towards which the current is flowing, and Vup is the true vertical velocity (W). Units of Temp are decimal degrees C, Press are decimal decibars, Pitch and Roll are decimal degrees, Speed is decimal cm/s, Direction is degrees from magnetic north measured increasing towards the east, and Vup is decimal velocity in cm/s, positive up. CARTESIAN COORDINATES Entering 2 sets the output format to Cartesian coordinates. The 11 variables are the same as in Speed and Direction for the first 8. The last three are Ve, Vn, and Vup. Day Hr:Min:S Temp Press Pitch Roll Ve Vn Vup Ve is signed velocity component in the horizontal plane towards the magnetic east in cm/s. Vn is the signed velocity component in the horizontal plane towards magnetic north in cm/s. Vup is the signed true vertical velocity component, positive upwards, in cm/s. Storage in earth coordinates is in the Cartesian coordinate format except that the values are stored two’s complement and temperature, pitch, and roll are in 100ths of degrees, pressure is in 10ths of decibars, and velocities are in mm/s. The transformation from instrument coordinates to earth coordinates requires some explanation. First the components of the earth’s magnetic field are sensed in the gimbaled, two axis magnetometer, corrected for deviation, and the components in the Y and X direction are converted to direction cosines, My and Mx, by dividing each component by the magnitude. Next, the four velocity components, A, B, C, and D are corrected for zero offset and combined to give instrument coordinate U, V, and W. V=(A+B-CD)/G, U=(A+D-B-C)/G, and W=(A+B+C+D)*707/G*1000 in integer arithmetic. Tilt is measured and corrected for zero offset and the sine and cosine of pitch (Y axis) and roll (X axis) are computed. The pitch angle corrects V and W as Vp=VcosP-WsinP, Wp=WcosP+VsinP, where Vp is the V component of velocity corrected for pitch, Wp is the W component of velocity corrected for pitch, and P is the pitch angle. Then the roll angle corrects U and Wp as Ur=UcosR-WpsinR, Wpr=WpcosR+UsinR, where Ur is the U component of velocity corrected for roll, Wpr is the Wp component of velocity corrected for roll, and R is the roll angle. These are then rotated into magnetic coordinates using the direction cosines My and Mx. Ve=My*Ur-Mx*Vp, Vn=My*Vp+Mx*Ur, Vup=Wpr. Averaging for sample rates other than 0 are done only in earth coordinates. Accumulators of Ve, Vn, and Vu are zeroed at the start of each sample. The measurements are individually converted to earth coordinates and added to the accumulators. At the end of the sample interval, the number of measurements divides the accumulators. To prevent contamination of the average by a bad measurement, a variable is set to zero at the start of the sample interval and if any of the four axes in any of the measurements is bad, the variable is set to a non-zero constant. When the sample interval is done, if the quality variable is not zero, the averages are replaced by the constant 32768, negative full scale, as a flag. BINARY OUTPUT Entering 3 sets the output to a single long record in binary of the data stored in the datafile. As in the other cases, there is a warning before the data are offloaded to permit preparations to receive it. In the case of binary data, a special capture program will be needed as most terminal emulators (and terminals) are unable to accept unblocked binary files. An alternative way to offload binary data using the xmodem protocol is available through TTOOLS. This has a similar result to the binary offload but TTOOLS is able to accept binary data in this form. Alt O opens a file to receive the data and the start and stop data file pointer values permit just the data intended to be offloaded. When the offload is finished, the program returns to the Top Menu. HEX, RAW AXES Entering 4 sets the output to hexadecimal in ASCII. Data will only make sense if they were stored as raw axes. The format is: Day Hr:Min:S A B C D Temp Press Pitch Roll My Mx Where A, B, C, and D are the zero corrected velocity components along the acoustic axes A, B, C, and D, and My and Mx are the direction cosines*1000 of the horizontal component of the earth’s magnetic filed in the Y and X directions respectively. The velocity components are hexadecimal two’s complement representation of the differential travel-times along the acoustic axes. A single bit is 0.046 cm/s (the full scale value is +4096 for 190 cm/s or –4096 for –190 cm/s). The acoustic axes are each inclined 45 degrees to the horizontal and arranged 90 degrees in azimuth. The readings are positive for flow towards the transducers on the ring nearest the pressure case. A and B are the transducers together on the ring nearest the pressure case and represent the Y direction. 90 degrees clockwise looking away from the pressure case towards the rings is the X direction and from the rings towards the pressure case is the Z direction. Transducers are counted A, B, C, and D clockwise on the ring nearest the pressure cases looking away from the pressure case. The retaining rod hole on the sensor endcap is in the –X direction. Temp is temperature as a signed integer with the value of 100ths degree C, Press is pressure as a signed integer in 10ths decibar, Pitch and Roll are signed integers with values in 100ths of degrees. COMMA SEPARATED VARIABLES? CSV is useful in some programs for importing data, programs such as Excel. Entering 5 allows you to toggle between space separated variables and comma separated variables. This selection will also be the default in the display mode and can be toggled there as well. START AND STOP DP Entering 6 allows setting the start and the stop datafile pointers for the offload. The default is the last entered start DP and the most recently written location in the datafile for the stop. OFFLOAD NOW – ALT Z in TTOOLS When the offload parameters displayed above the Offload Screen are as desired, entering 7 can start offloading. There will be a display of what will be offloaded. You can set up capture conditions before starting the offload. Pressing enter initiates it. When the offload process is finished, the program returns to the Top Menu. An offload can be terminated with Control C. Before MAVS sends the data, it tells the format and prompts the user to press enter to start data transmission. This is an opportunity to initialize the Capture feature of TTOOLS. ALT Z opens a Capture window that asks for the name of the file to which the data will be captured. The default name is CAPTURE.TXT and if this file has data already stored, the new data will be appended to the old. Make a new name or use this name and select OPEN or return. The lower bar changes from gray to green and everything shown on the screen will be saved to this file. Now press enter to start the data offload. When the offload is completed, as long as 5 or 6 hours if the full memory is offloaded, ALT Z closes the file and returns bottom bar to gray. Parameters The parameters screen, selected by entering 4 at the Top Menu, allows parameters and serial numbers to be entered for sensors. When the parameters are acceptable, enter returns the program to the Top Menu. Set Clock Entering 5 at the Top Menu allows the clock to be set. The Tattletale clock counts 100ths of seconds since 1/1/80 00:00:00 in a 5 byte register. This will overflow about 2040 so MAVS is immune to the M2K problem. When the time is correct, enter returns to the Top Menu. Calibrate Entering 6 from the Top Menu calls a second order menu, the Calibrate Screen. There are five entries on this menu. ***** Calibrate Screen ***** Quit = 0 Auto-Zero = 1 Compass = 2 Tiltmeter = 3 Axes, Hex = 4 Enter choice now AUTO-ZERO MAVS measures the differential travel time for acoustic pulses passing between a transducer on the upper ring and a transducer on the lower ring. A burst of 15 cycles of 1.8 MHz sound is transmitted and the 14th negative going zero crossing of the signal at the receiving transducer starts an electric charge integrator. The second signal to arrive starts a second charge integrator and when both have been turned on both are stopped and the voltage difference on a pair of integrating capacitors is measured. The transducers are electrically reversed and the measurement is repeated but the results are differenced, removing all delays in the circuitry after the reversing switches. Yet a slight offset remains due to capacitance in the cabling to the transducers. This effect may amount to several cm/s and must be removed before converting to earth coordinates. Selecting Auto-Zero by entering 1 allows the offset in zero flow to be measured, stored, and later subtracted from all measurements. The screen prompts for the sensor being immersed in still fluid. If it is immersed, 16 measurements are averaged and replace the previous zero offset values. The offsets are printed and should be less than 100 if all is well. If the Auto-Zero calibration is attempted with the sensor not immersed, no replacement of the previous values will occur. COMPASS Entering 2 allows the compass to be deviated. Batteries or other ferromagnetic materials create a local field that can cause the compass to read in error. When 2 is selected, you are prompted to make the instrument level. When it is level, enter Y. Then it prompts to rotate the instrument 180 degrees and make it level again. Doing so and typing Y gives a second set of measurements. The average of the two is the deviation since the earth’s field was reversed by the rotation and the residual was local, moving with the instrument. These values are displayed as Yo and Xo. They should be less than 200. This procedure must be done every time a new battery is installed. TILTMETER The two axis tiltmeter has a linear range of 20 degrees and an extended range of 45 degrees. The MAVS sensor has an excellent vertical cosine response to 180 degrees but the compass has gimbals good only to 15 degrees. Thus, the range of instrument tilt that can be accommodated is 15 degrees, with compass degradation beyond this. The offset of tilt must be measured periodically lest there be drift creating error in the rotation of velocity into earth coordinates. Entering 3 prompts for the instrument being level. Typing Y when the instrument is level both in pitch and roll will obtain the offsets that will be used in all subsequent measurements. MAVSOFT The Visual Basic program, MAVSOFT, provides a Windows interface to the Menu Driven MAVS program. When MAVS is plugged into the communications port of a PC running MAVSOFT, it can be controlled from the PC. MAVSOFT issues the configuration variables and captures and displays the MAVS data in boxes on the MAVSOFT screen. MAVSOFT can both display and log data and can accept data stored in MAVS through the Offload options. Within the Menu program is a variable that is set to MAVSOFT if upon initial power on, MORE? (Y in 5 sec) is not answered Y. To ensure that MAVSOFT is enabled, power on with MAVSOFT running and MAVS connected to the communications port. “MORE?” will not be answered with Y and the MAVSOFT configuration will be set. To return to the Menu configuration, power on under TTOOLS and type Y in answer to MORE? HARDWARE MAVS has a velocity range of +/- 300 cm/s unless the flow is exactly along one axis where it is limited to 200 cm/s. The least bit is match approximately to the electronic noise at 0.05 cm/s. The 12 bit A/D measures each axis twice so the full scale range is actually 13 bits. ACOUSTIC CURRENT MEASUREMENTS Flow distortion around the sensor is of three types,. The first is potential flow and is a percentage of the flow speed. This has been calibrated by tow tank testing and is at the 1% level. The obstruction of the rings accelerates the flow so that the measured velocity along the paths is within 1% of the tow speed corrected for angle. This is the cosine response. This effect varies with angle and is within 5% for all horizontal angles and within 15% for all vertical angles, becoming as bad as 15% at 45 degrees. The second type is vortex shedding by the structure of the sensor and is narrow band, having a characteristic diameter comparable to the elements of the structure. In MAVS, this is about 1 cm. This flow distortion is turbulence and has a zero mean. It limits the sensitivity to other fluctuations but is proportional to flow velocity. In MAVS, this becomes the greater source of noise at about 10 cm/s, where it exceeds 0.05 cm/s. At high velocities it is the dominant noise. The third flow distortion is caused by oscillations of the sensor, so called Strouhal oscillations. MAVS is quite stiff and these are not important when the instrument is mounted rigidly but could be a source of noise when the instrument is moored. This source of error is greatest at particular flows and is difficult to determine. Averaging for intervals long compared to the period of oscillation and measuring at a frequency high compared to the Strouhal frequency will attenuate this effect. It is important to understand that there are electronic sources of noise but they are masked by flow noise at higher flow velocities. Thus the noise of MAVS is 0.05 cm/s or 1% of the flow, whichever is higher. ELECTRIC POWER Measurements of velocity take only a brief period. About 6 ms after the power hungry electronic components are turned on, the velocity measurements are made and in another 8 ms the power is turned off. This is repeated every 700 ms during bursts and is skipped between bursts. During bursts, the current drain from the 22 volt alkaline AA batteries in the pack provided is 10 ma. Between bursts, the current is reduced to 4 ma, just powering the switching regulator and the processor. These currents increase to 20 ma and 7 ma respectively when the battery voltage drops to 14 v. A schedule of 10 seconds every minute or sample rate 2 seconds, burst length of 5, burst interval 1 minute, gave 17 days of measurement before the batteries failed. SAMPLE RATE AND CAPACITY The memory is 2 Megabytes of RAM backed up by lithium battery so memory remains alive when the primary battery fails. The earth coordinate record is 18 bytes, the raw axes record is 24 bytes. That is 111,000 earth coordinate or 83,000 raw axes records. The measurement rate is 1.42 Hz (700 ms ) with three exceptions. The Raw axes, 2 seconds logging is really only ½ Hz. And the Raw axes, max rate is 6 Hz. The Raw axes, max rate w/compass every measurement is 3 Hz. The fastest measurement is obtained by only reading the compass between bursts and storing the same value until the next burst.