00001 /* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */ 00002 /* 00003 * Copyright (c) 1999 Regents of the University of California. 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * 3. All advertising materials mentioning features or use of this software 00015 * must display the following acknowledgement: 00016 * This product includes software developed by the MASH Research 00017 * Group at the University of California Berkeley. 00018 * 4. Neither the name of the University nor of the Research Group may be 00019 * used to endorse or promote products derived from this software without 00020 * specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00023 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00026 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00027 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00028 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00029 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00031 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00032 * SUCH DAMAGE. 00033 * 00034 * @(#) $Header: /cvsroot/nsnam/ns-2/satellite/satposition.h,v 1.10 2000/08/18 18:34:01 haoboy Exp $ 00035 * 00036 * Contributed by Tom Henderson, UCB Daedalus Research Group, June 1999 00037 * Modified to use period_ and offer isascending(), Lloyd Wood, March 2000. */ 00038 00039 #ifndef __satposition_h__ 00040 #define __satposition_h__ 00041 00042 #include <stdlib.h> 00043 00044 #include "trace.h" 00045 #include "lib/bsd-list.h" 00046 #include "phy.h" 00047 #include "node.h" 00048 #include "object.h" 00049 #include "satgeometry.h" 00050 00051 // Position types 00052 #define POSITION_SAT 1 00053 #define POSITION_SAT_POLAR 2 00054 #define POSITION_SAT_GEO 3 00055 #define POSITION_SAT_TERM 4 00056 00057 class SatPosition : public TclObject { 00058 public: 00059 SatPosition(); 00060 int type() { return type_; } 00061 double period() { return period_; } 00062 Node* node() { return node_; } 00063 virtual coordinate coord() = 0; 00064 00065 // configuration parameters 00066 static double time_advance_; 00067 protected: 00068 int command(int argc, const char*const* argv); 00069 coordinate initial_; 00070 double period_; 00071 int type_; 00072 Node* node_; 00073 }; 00074 00075 class PolarSatPosition : public SatPosition { 00076 public: 00077 PolarSatPosition(double = 1000, double = 90, double = 0, double = 0, 00078 double = 0); 00079 virtual coordinate coord(); 00080 void set(double Altitude, double Lon, double Alpha, double inclination=90); 00081 bool isascending(); 00082 PolarSatPosition* next() { return next_; } 00083 int plane() { return plane_; } 00084 00085 protected: 00086 int command(int argc, const char*const* argv); 00087 PolarSatPosition* next_; // Next intraplane satellite 00088 int plane_; // Orbital plane that this satellite resides in 00089 double inclination_; // radians 00090 00091 00092 }; 00093 00094 class GeoSatPosition : public SatPosition { 00095 public: 00096 GeoSatPosition(double longitude = 0); 00097 virtual coordinate coord(); 00098 void set(double longitude); 00099 protected: 00100 }; 00101 00102 class TermSatPosition : public SatPosition { 00103 public: 00104 TermSatPosition(double = 0, double = 0); 00105 virtual coordinate coord(); 00106 void set(double latitude, double longitude); 00107 protected: 00108 }; 00109 00110 #endif // __satposition_h__