LNavCrossSourceFilter.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
40 
41 namespace gnsstk
42 {
45  {
46  }
47 
49  validate(NavMsgList& msgBitsIn, NavMsgList& msgBitsOut)
50  {
51  NavMsgList::const_iterator nmli;
52  for (nmli = msgBitsIn.begin(); nmli != msgBitsIn.end(); nmli++)
53  {
54  LNavFilterData *fd = dynamic_cast<LNavFilterData*>(*nmli);
55  if (fd->timeStamp != currentTime)
56  {
57  // different time, so check out what we have
58  examineSubframes(msgBitsOut);
59  groupedNav.clear();
60  currentTime = fd->timeStamp;
61  }
62  // add the subframe to our collection
63  groupedNav[fd->prn][fd].push_back(*nmli);
64  }
65  }
66 
68  finalize(NavMsgList& msgBitsOut)
69  {
70  examineSubframes(msgBitsOut);
71  groupedNav.clear();
73  }
74 
77  {
78  NavMap::const_iterator nmi;
79  SubframeMap::const_iterator smi;
80  // loop over each PRN/SV
81  for (nmi = groupedNav.begin(); nmi != groupedNav.end(); nmi++)
82  {
83  // count of unique messages
84  size_t uniqueBits = nmi->second.size();
85  // count of total messages
86  size_t msgCount = 0;
87  // store the vote winner here
88  LNavFilterData *winner = NULL;
89  // store the largest number of "votes" for a subframe here
90  size_t voteCount = 0;
91  for (smi = nmi->second.begin(); smi != nmi->second.end(); smi++)
92  {
93  size_t msgs = smi->second.size();
94  msgCount += msgs;
95  // minimum # of useful votes
96  if ((msgs > voteCount) && (msgs >= 2))
97  {
98  voteCount = msgs;
99  winner = smi->first;
100  }
101  }
102  if (msgCount < 3)
103  winner = NULL; // not enough messages to have a useful vote
104 
105  // If winner is NULL, i.e. there is no winner, all
106  // messages will be rejected below. Otherwise only the
107  // winners will be accepted.
108  for (smi = nmi->second.begin(); smi != nmi->second.end(); smi++)
109  {
110  if (smi->first == winner)
111  accept(smi->second, msgBitsOut);
112  else
113  reject(smi->second);
114  }
115  }
116  }
117 }
gnsstk::NavFilter::reject
void reject(NavFilterKey *data)
Definition: NavFilter.hpp:185
NULL
#define NULL
Definition: getopt1.c:64
gnsstk::LNavCrossSourceFilter::LNavCrossSourceFilter
LNavCrossSourceFilter()
Definition: LNavCrossSourceFilter.cpp:44
gnsstk::LNavCrossSourceFilter::finalize
virtual void finalize(NavMsgList &msgBitsOut)
Definition: LNavCrossSourceFilter.cpp:68
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::CommonTime::reset
void reset()
Definition: CommonTime.hpp:399
LNavCrossSourceFilter.hpp
gnsstk::LNavCrossSourceFilter::currentTime
gnsstk::CommonTime currentTime
Most recent time.
Definition: LNavCrossSourceFilter.hpp:98
gnsstk::LNavCrossSourceFilter::groupedNav
NavMap groupedNav
Nav subframes grouped by prn and unique nav bits.
Definition: LNavCrossSourceFilter.hpp:96
gnsstk::NavFilterKey::prn
uint32_t prn
identifier of broadcasting satellite
Definition: NavFilterKey.hpp:78
gnsstk::LNavFilterData
Definition: LNavFilterData.hpp:52
gnsstk::NavFilter::NavMsgList
std::list< NavFilterKey * > NavMsgList
Definition: NavFilter.hpp:58
gnsstk::NavFilter::accept
void accept(NavFilterKey *data, NavMsgList &msgBitsOut)
Definition: NavFilter.hpp:172
gnsstk::LNavCrossSourceFilter::examineSubframes
void examineSubframes(NavMsgList &msgBitsOut)
Definition: LNavCrossSourceFilter.cpp:76
gnsstk::LNavCrossSourceFilter::validate
virtual void validate(NavMsgList &msgBitsIn, NavMsgList &msgBitsOut)
Definition: LNavCrossSourceFilter.cpp:49
gnsstk::NavFilterKey::timeStamp
gnsstk::CommonTime timeStamp
Definition: NavFilterKey.hpp:75


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:39