head 1.1; access ; symbols ; locks oasisa:1.1; strict; comment @ * @; 1.1 date 2001.06.19.13.01.34; author oasisa; state Exp; branches ; next ; desc @Periodic Update w/ changes to utils plus new utils 6/19/2001 (klh) @ 1.1 log @Initial revision @ text @/****************************************************************************/ /* Copyright (C) 2001 MBARI */ /* Author: Kent Headley */ /****************************************************************************/ /* */ /* MBARI provides this documentation and code "as is", with no warranty, */ /* express or implied, of its quality or consistency. It is provided without*/ /* support and without obligation on the part of the Monterey Bay Aquarium */ /* Research Institute to assist in its use, correction, modification, or */ /* enhancement. This information should not be published or distributed to */ /* third parties without specific written permission from MBARI. */ /* */ /****************************************************************************/ // Convac9 for converting raw modaps to wetview data #include #include #include "C:\LW\INCLUDE\utility.h" #include "C:\LW\INCLUDE\userint.h" #include "C:\LW\INCLUDE\formatio.h" #include "C:\LW\INCLUDE\lwsystem.h" #include "ccommon.h" void ReadDevFile(); int MeterModel(long serial); int File_Pos(int Line, FILE *Stream); int OutputACValues(); double MathStuff(double csig, double cref, double k, double x, double t,double to, double kt); float CountToTemp (short count); long ZeroBased (long raw) { long MAXLONG=0xFFFF; long ten=10L; if (starttime < 0) starttime = raw; else if (raw < prevtime) timeoverflow += MAXLONG + 1; prevtime = raw; return ten * (raw + timeoverflow - starttime); } void ReadDevFile() { long serial; int t, cnt; char channel[20],color[20]; File_Pos(2,devFileStream); // Get serial number to determine channels fscanf(devFileStream,"%lx",&serial); MeterModel(serial); File_Pos(5,devFileStream); fscanf(devFileStream,"%lf%lf",&depth0,&depthCal); File_Pos(7,devFileStream); fscanf(devFileStream,"%lf",&pathLength); File_Pos(8,devFileStream); for (t=0;t> 24; switch (type) { case AC9xMeterID: case AC9MeterID: case AC9yMeterID: case AC9MMeterID: maxvals = 18; maxlines= 10; break; case AC3MeterID : maxvals = 18; maxlines= 10; break; default: maxvals = 18; maxlines= 10; break; } } int File_Pos(int line, FILE *stream) { // Moves file pointer to a specific line int currentLine = 1; fpos_t yPos; unsigned char in; yPos = 0; fsetpos(stream,&yPos); while (currentLine < line) { if (feof(stream)) { return (FALSE); } fread(&in,1,1,stream); if (in==0x0A) currentLine++; } return(TRUE); } double MathStuff(double csig, double cref, double k, double x, double t,\ double to, double kt) { double rtemp; if ((csig > 0.0) && (cref > 0.0)) { rtemp = k - log (csig / cref) / x; rtemp += (t-to) * kt; return (rtemp); } else return(0.0); } int OutputACValues() { double value, avgAref, avgCref; int t, lnum; avgAref = (ref [6] + ref [7] + ref [8]) / 3.0; avgCref = (ref [15] + ref [16] + ref [17]) / 3.0; ref [6] = avgAref; /* use average of (a412, a456, a488) for a412, a456, a488 */ ref [7] = avgAref; ref [8] = avgAref; ref [15] = avgCref; /* use average of (c412, c456, c488) for c412, c456, c488 */ ref [16] = avgCref; ref [17] = avgCref; for (lnum=0;lnum 599) return (countTemp [599] / (float)1000.0); return ((countTemp [count] / (float)1000.0)); } @