📄 commandinput.cpp
字号:
#pragma ident "$Id: CommandInput.cpp 185 2006-10-05 18:21:39Z btolman $"//============================================================================//// This file is part of GPSTk, the GPS Toolkit.//// The GPSTk is free software; you can redistribute it and/or modify// it under the terms of the GNU Lesser General Public License as published// by the Free Software Foundation; either version 2.1 of the License, or// any later version.//// The GPSTk is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU Lesser General Public License for more details.//// You should have received a copy of the GNU Lesser General Public// License along with GPSTk; if not, write to the Free Software Foundation,// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA// // Copyright 2004, The University of Texas at Austin////============================================================================//============================================================================////This software developed by Applied Research Laboratories at the University of//Texas at Austin, under contract to an agency or agencies within the U.S. //Department of Defense. The U.S. Government retains all rights to use,//duplicate, distribute, disclose, or release this software. ////Pursuant to DoD Directive 523024 //// DISTRIBUTION STATEMENT A: This software has been approved for public // release, distribution is unlimited.////=============================================================================/** * @file CommandInput.cpp * Implement command line input, including defaults and validation for program DDBase. *///------------------------------------------------------------------------------------// TD CommandInput.cpp need baseline identifier to Tight and Loose cmds// TD CommandInput.cpp test reasonableness of input station positions//------------------------------------------------------------------------------------// includes// system// GPSTk#include "CommandOption.hpp"#include "CommandOptionParser.hpp"// DDBase#include "DDBase.hpp"// DDBase.hpp includes CommandInput.hpp//------------------------------------------------------------------------------------using namespace std;using namespace gpstk;//------------------------------------------------------------------------------------// local data//------------------------------------------------------------------------------------void CommandInput::SetDefaults(){try { Debug = false; Verbose = false; Screen = true; // TD user input Validate = false; // log file LogFile = string("ddbase.log"); // input data files InputPath = string(""); NavPath = string(""); NavFileNames.clear(); EOPPath = string(""); EOPFileNames.clear(); // time limits BegTime = DayTime::BEGINNING_OF_TIME; EndTime = DayTime::END_OF_TIME; // process configuration Frequency = 1; // for pseudorange solution PRSrmsLimit = 6.5; // this is the PRSolution() default PRSalgebra = false; PRSnIter = 10; PRSconverge = 1.e-9; PRSMinElevation = 10.0; // for modeling residual zenith delay NRZDintervals = 0; RZDtimeconst = 2.0; // hours RZDsigma = 0.5; // meters // DataInterval = -1.0; // editing MinElevation = 10.0; RotatedAntennaElevation = 0.0; RotatedAntennaAzimuth = 0.0; MaxGap = 10; MinDDSeg = 50; PhaseBiasReset = 10; ExSV.clear(); // timetable RefSat = GSatID(-1,SatID::systemGPS); // estimation noEstimate = false; // for Estimation() nIter = 5; // for Estimation() convergence = 5.0e-8; // TD convergence criterion input noRAIM = false; // turn off pseudorange solution (! -> clk?) FixBiases = false; // Don't implement default constraints - this needs more study TightConstraint = 1.e-4; // 1.e-5; LooseConstraint = 1.e-1; // 1.e-1; DefaultTemp = 20.0; // deg C DefaultPress = 1010.0; // mbars at sea level DefaultRHumid = 50.0; // % // output OutputClkFile = string(""); OutputDDDFile = string(""); OutputTDDFile = string(""); OutputRawFile = string(""); OutputRawDDFile = string(""); OutputPRSFile = string(""); OutputDDRFile = string("");}catch(Exception& e) { GPSTK_RETHROW(e); }catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); }catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); }}//------------------------------------------------------------------------------------int CommandInput::GetCmdInput(int argc, char **argv){try { help = false; int i,j; string msg; vector<string> values,field; // set all to default SetDefaults(); // -------------------------------------------------------------------------------- // Define the options // required options: // optional options: // this is here only so it will show up in the help msg... CommandOption dashf(CommandOption::hasArgument, CommandOption::stdType, 'f',"","\n -f<file> Name of file containing more options" " ('#' to EOL : comment)"); // log file CommandOption dashl(CommandOption::hasArgument, CommandOption::stdType, 0,"Log"," --Log <file> Name of output log file (" + LogFile + ")"); dashl.setMaxCount(1); // files // observation CommandOption dashop(CommandOption::hasArgument, CommandOption::stdType, 0,"ObsPath", "\n# Observations:\n --ObsPath <path> Path for input obs file(s) (.)"); dashop.setMaxCount(1); CommandOption dashof(CommandOption::hasArgument, CommandOption::stdType, 0,"ObsFile"," --ObsFile <name,id> Rinex observation file name(s)," " followed by a station label."); // ephemeris CommandOption dashnp(CommandOption::hasArgument, CommandOption::stdType, 0, "NavPath","# Ephemeris and Earth orientation:\n" " --NavPath <dir> Path of navigation file(s) (.)"); dashnp.setMaxCount(1); CommandOption dashnf(CommandOption::hasArgument, CommandOption::stdType, 0,"NavFile"," --NavFile <file> Navigation (Rinex Nav OR SP3) file(s)"); // earth orientation CommandOption dashep(CommandOption::hasArgument, CommandOption::stdType, 0, "EOPPath"," --EOPPath <dir> " "Path of earth orientation file(s)"); dashep.setMaxCount(1); CommandOption dashef(CommandOption::hasArgument, CommandOption::stdType, 0,"EOPFile"," --EOPFile <file> " "Earth orientation parameter (EOPP or IERS format) file(s).\n" " If no EOP file is given, DDBase will search " "for the IERS\n format file 'finals.daily' in the " "current directory."); // station configuration CommandOption dashXYZ(CommandOption::hasArgument, CommandOption::stdType, 0,"PosXYZ", "\n# Station configuration [--Pos.. (1 only) MUST be given for each site]:\n" " --PosXYZ <X,Y,Z,id> Station position in ECEF coordinates (m),\n" " followed by a label identifying the station."); CommandOption dashLLH(CommandOption::hasArgument, CommandOption::stdType, 0,"PosLLH"," --PosLLH <La,Lo,H,id> Station position in geodetic coordinates:\n" " Latitude(deg),Longitude(E,deg),Height(m),label"); CommandOption dashPRS(CommandOption::hasArgument, CommandOption::stdType, 0,"PosPRS"," --PosPRS <id> Let position of station labelled <id> be set" " to the computed\n average pseudorange solution" " for that site."); CommandOption dashtrop(CommandOption::hasArgument, CommandOption::stdType, 0,"TropModel"," --TropModel <trop,id> Use trop model <trop> for station <id>, " "choices are: 'Zero',\n 'Black','NewB','ModHop'," "'ModHopH','Saas' (Saas) [cf. GPSTk]"); msg = string( " --Weather <T,P,H,id> Weather parameters: Temperature(degC),Pressure(mbar),\n" " Humidity(%), followed by a label identifying the\n" " station. (" + StringUtils::asString(CI.DefaultTemp,1) + string(",") + StringUtils::asString(CI.DefaultPress,2) + string(",") + StringUtils::asString(CI.DefaultRHumid,1) + string(")") ); CommandOption dashWx(CommandOption::hasArgument, CommandOption::stdType, 0,"Weather",msg); CommandOption dashfix(CommandOption::hasArgument, CommandOption::stdType, 0,"Fix"," --Fix <id> Hold the station <id> fixed " "in estimation (don't)"); //CommandOption dashant(CommandOption::hasArgument, CommandOption::stdType, // 0,"AntAz"," --AntAz <angle,id> " // "Antenna relative azimuth angle (deg) for station <id> (0.0)"); // configuration CommandOptionNoArg dashnoest(0, "noEstimate", "\n# Configuration:\n" " --noEstimate Quit before performing the estimation."); dashnoest.setMaxCount(1); CommandOption dashfreq(CommandOption::hasArgument, CommandOption::stdType, 0,"Freq"," --Freq <L1|L2|L3> Process L1, L2 or L3(L1+L2) frequency data" " (L3 not validated)"); dashfreq.setMaxCount(1); CommandOption dashnit(CommandOption::hasArgument, CommandOption::stdType, 0,"nIter"," --nIter <n> Maximum number of estimation iterations (" + StringUtils::asString(nIter) + ")"); dashnit.setMaxCount(1); { ostringstream oss; oss << scientific << setprecision(2) << convergence; msg = oss.str(); } CommandOption dashconv(CommandOption::hasArgument, CommandOption::stdType, 0,"Converge"," --Converge <cl> Convergence limit on RSS change in state (" + msg + " m)"); dashconv.setMaxCount(1); CommandOptionNoArg dashfixbias(0, "FixBiases", " --FixBiases " "Perform an extra, last iteration that fixes the phase biases"); dashfixbias.setMaxCount(1); // state model CommandOption dashntrop(CommandOption::hasArgument, CommandOption::stdType, 0,"RZDnIntervals","\n# State model, a priori constraints:\n" " --RZDnIntervals <n> Number of (equal time) residual zenith delay " "intervals (" + StringUtils::asString(NRZDintervals) + ")\n" " (enter 0 to turn off estimation of RZD)"); dashntrop.setMaxCount(1); CommandOption dashttrop(CommandOption::hasArgument, CommandOption::stdType, 0,"RZDtimeconst", " --RZDtimeconst <tau> Time constant (hours) for multiple RZD intervals (" + StringUtils::asString(RZDtimeconst,2) + ")"); dashttrop.setMaxCount(1); CommandOption dashstrop(CommandOption::hasArgument, CommandOption::stdType, 0,"RZDsigma", " --RZDsigma <sig> A priori sigma (m) for residual zenith delay (" + StringUtils::asString(RZDsigma,2) + ")"); dashstrop.setMaxCount(1); // TD need baseline identifier: --Tight <id,id,ppm>. also Loose CommandOption dashtight(CommandOption::hasArgument, CommandOption::stdType, 0,"Tight"," --Tight <ppm> Tight a priori constraint, a fraction " "of baseline (" + StringUtils::asString(TightConstraint,4) + ")"); dashtight.setMaxCount(1); CommandOption dashloose(CommandOption::hasArgument, CommandOption::stdType, 0,"Loose"," --Loose <ppm> Loose a priori constraint, a fraction " "of baseline ("+StringUtils::asString(LooseConstraint,1)+")"); dashloose.setMaxCount(1); // times - don't use CommandOptionWithTimeArg CommandOption dashbt(CommandOption::hasArgument, CommandOption::stdType, 0,"BeginTime", "\n# Time limits:\n --BeginTime <arg> Start time: arg is " "'GPSweek,sow' OR 'YYYY,MM,DD,HH,Min,Sec'"); dashbt.setMaxCount(1); CommandOption dashet(CommandOption::hasArgument, CommandOption::stdType, 0,"EndTime", " --EndTime <arg> End time: arg is 'GPSweek,sow' OR " "'YYYY,MM,DD,HH,Min,Sec'"); dashet.setMaxCount(1); // time table(s) CommandOption dashttab(CommandOption::hasArgument, CommandOption::stdType, 0,"TimeTable","\n# Satellite time table:\n" " --TimeTable <file> Time table file name (if this option does not appear" "\n a time table will be computed and output to log" " file)"); dashttab.setMaxCount(1); CommandOption dashRef(CommandOption::hasArgument, CommandOption::stdType, 0, "Ref", " --Ref <sat> Use <sat> as 'reference' " "in DDs; don't use a timetable"); dashRef.setMaxCount(1); // data editing CommandOption dashelev(CommandOption::hasArgument, CommandOption::stdType, 0,"MinElev","\n# Data editing:\n --MinElev <elev> Ignore data " "below elevation <elev> degrees, DDs only (" + StringUtils::asString(MinElevation,2) + ")"); dashelev.setMaxCount(1); CommandOption dashrotelev(CommandOption::hasArgument, CommandOption::stdType, 0,"AntRotElev"," --AntRotElev <elev> Apply MinElev to antenna rotated " "in elevation by <elev> deg."); dashrotelev.setMaxCount(1); CommandOption dashrotaz(CommandOption::hasArgument, CommandOption::stdType, 0,"AntRotAz"," --AntRotAz <az> Apply MinElev to antenna rotated " "in azimuth by <az> deg."); dashrotaz.setMaxCount(1); CommandOption dashgap(CommandOption::hasArgument, CommandOption::stdType, 0, "MaxGap"," --MaxGap Maximum acceptable gap in data " "[number of --DT intervals] (" + StringUtils::asString(MaxGap) + ")\n" " [Used in raw data editing and synchronization]"); dashgap.setMaxCount(1); CommandOption dashmindd(CommandOption::hasArgument, CommandOption::stdType, 0, "MinDDSeg"," --MinDDSeg Minimum acceptable length of DD data segment" " (" + StringUtils::asString(MinDDSeg) + ")"); dashmindd.setMaxCount(1); CommandOption dashphbias(CommandOption::hasArgument, CommandOption::stdType, 0, "PhaseBiasReset"," --PhaseBiasReset Limit on pt-to-pt change in pha" "se without reset, in cycles (" + StringUtils::asString(PhaseBiasReset) + ")"); dashphbias.setMaxCount(1); CommandOption dashXsat(CommandOption::hasArgument, CommandOption::stdType, 0, "XSat", " --XSat <sat> Exclude this satellite ()"); CommandOption dashDT(CommandOption::hasArgument, CommandOption::stdType, 0, "DT"," --DT <t> Data time interval in sec [will also decimate" " input data]"); dashDT.setMaxCount(1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -