U.S. Geological Survey Open-File Report 2012-1178
Profile Measurements and Data From the 2011 Optics, Acoustics, and Stress In Situ (OASIS) Project at the Martha's Vineyard Coastal Observatory
This appendix lists the programs written or adapted by the U.S. Geological Survey (USGS) to log data and control instruments during the Optics, Acoustics, and Stress In Situ (OASIS) project deployment. Software falls into the following categories:
"Although this program has been used by the U.S. Geological Survey (USGS), no warranty, expressed or implied, is made by the USGS or the U.S. Government as to the accuracy and functioning of the program and related program material nor shall the fact of distribution constitute any such warranty, and no responsibility is assumed by the USGS in connection therewith." Onshore ScriptsBash shell programs to control the Sequoia Scientific LISST-HOLO digital holographic particle imaging system (LISST-HOLO) and download data from the Moxa were written by Pat Dickhudt and Ellyn Montgomery. These programs resided on the Ubuntu operating system Linux computer at the Bigelow Laboratory at the Woods Hole Oceanographic Institution (WHOI). The programs were launched by cron, a Linux utility that schedules tasks defined by the user. The scheduled jobs are listed in a configuration file normally found in /etc/crontab. On most Unix-type systems, a crontab function can be used to change entries in this file.Table 3-1. Scripts run from the onshore Linux computer for the 2011 OASIS experiment. [Description of Abbreviations and Symbols]
Moxa ProgramsThe Moxa was running Linux 2.7 , firmware version FWR_UC8418_V2.0.4_Build_11062414.hfm. Moxa supplied a subset of standard Linux utilities and provided a version of the Minicom text-based modem control and terminal emulation program (minicom_2.4_xscale.ipk) that was used for testing and troubleshooting serial communications with the sensors. Moxa programs were written by Ellyn Montgomery and Chris Sherwood in C and in Linux bash shell scripting language. The C programs were cross-compiled for the Moxa on computers running Ubuntu operating system (version 11.04) with the GNU ARM tool chain (compiler) for Linux (version 4.2.1.). Compiled executable versions of programs were downloaded to the Moxa via file transfer protocol (ftp) and stored (along with any required input files) in the subdirectory /var/sda/progs. Programs compiled to run on the Moxa had the C code "-c" suffix substituted by an "-mx" suffix (for example, ac.c was compiled to ac-mx), and when test versions were compiled to run on Ubuntu computers, "-ub" replaced "-c".Much of the Moxa code was derived from examples in The Linux Programming Interface (Kerrisk, 2010). Code for handling the SBG Systems IG-20 two-axis inclinometers and three-axis accelerometers was adapted from examples and called library routines (SbgComSerial) provided by SBG Systems with the instruments. Serial-port communications programs used routines from serial.c (an example provided by Moxa) and code graciously provided by Sam Laney (WHOI). A routine for extracting values and changing the endianness of data in the user data protocol (UDP) packets was based on an example from Hyde (2004). Cron and system logging were not enabled on the Moxa by default. The following lines were added the file /etc/inittab to start both features when the Moxa booted:
# start cron The cron scheduler on the Moxa differs from most other Unix or Linux implementations in that there is no crontab function; thus, users are required to edit the /etc/cron.d/crontab table. The contents of /etc/cron.d/crontab used during the deployment are as follows:
# sample sequence (note the fields must be separated by tabs!!!): Tables 3-2 through 3-4 list files changed in the Moxa directory structure and files and programs necessary for arm control and data logging that were loaded onto the user-portion of the Moxa file system during the experiment. The names of the executable versions typically are appended with -mx to indicate they were cross-compiled for the Moxa and sometimes with _em to indicate they were compiled by Ellyn Montgomery from her version of the source code. Table 3-2. System or application files added or modified on Moxa for the 2011 OASIS experiment.
Table 3-3. User executable and data files on the Moxa for the 2011 OASIS experiment. [See the Instrumentation section for a complete description of these instruments. See also Abbreviations and Symbols]
Table 3-4. Programs and scripts on the Moxa for the 2011 OASIS experiment. [Stored in the /var/sda/progs subdirectory. See the Instrumentation section for a complete description of these instruments. See also Abbreviations and Symbols]
Modtronix ProgramThe Modtronix ran one firmware program adapted by Marinna Martini from examples provided by the manufacturer. This program was written in C and cross-compiled in the MPLAB Integrated Development Environment (MPLAB Tools v. 8.63) using a Microchip MPLAB C18 compiler on a Microsoft Windows operating system computer. The main program is mxwebsrvr.c, and a description of the program's functionality is provided in appendix 2.Internet Protocol Addresses and Communication Port AssignmentsInternet protocol (IP) addresses (table 3-5) were assigned to our system by WHOI system administrators and hard-coded into many of the programs. They are listed here to aid in the interpretation of the code.Table 3-5. List of Internet addresses for USGS instruments while deployed at the MVCO node. [See the Instrumentation section for a complete description of these instruments. See also Abbreviations and Symbols]
The Moxa had eight external RS-232 asynchronous communication ports. We used five for the Martha's Vineyard Coastal Observatory OASIS project. The instruments and settings assigned to the five ports are listed in table 3-6 to aid in the interpretation of the source code. Configuration files associated with the interactive communication program Minicom for specific instrument settings were stored (in /etc/minicom) so they could invoked with commands such as minicom adv, which would attempt to launch Minicom with settings appropriate for communicating with the blue SonTek ADV. Table 3-6. Communication port assignments for the Moxa used in the 2011 OASIS experiment. [Add one to each port number to get the corresponding RS-232 connection identification number on outside of Moxa main control computer. See the Instrumentation section for a complete description of these instruments. See also Abbreviations and Symbols]
Sequence for Power and ExecutionSome of the programs assume that other operations or data streams are ready. Although the system was designed to boot and begin operations correctly after a power outage, the ideal starting sequence is as follows:(1) Shoreside computer booted and ready (so that cron jobs for operating the LISST-HOLO and downloading data from the Moxa would run). (2) Node power for side "A" (12 volts direct current (VDC)) applied (this provided power for the Moxa, the internal network switch, and the Web relay and allowed the Moxa to boot and begin receiving internet traffic). (3) Node power for side "B" (24 VDC) applied (this provided power to the arm motor and Modtronix controller, which could then begin monitoring the arm and sending UDP packets to the Moxa; the Modtronix program used address resolution protocol (ARP) to confirm the network address of the Moxa, so it was important that the Moxa booted first). (4) cron jobs execute on even hour. References CitedHyde, R., 2004, Write great code, volume 1-Understanding the machine: San Francisco, California, No Starch Press, 445 p.Kerrisk, M., 2010, The Linux programming interface: San Francisco, Calif., No Starch Press, 1,506 p. |