Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.

Remove Iono decoder #359

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/libswiftnav/ephemeris.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010, 2016 Swift Navigation Inc.
* Copyright (C) 2010 Swift Navigation Inc.
* Contact: Henry Hallam <[email protected]>
* Fergus Noble <[email protected]>
*
Expand Down
4 changes: 1 addition & 3 deletions include/libswiftnav/ionosphere.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015, 2016 Swift Navigation Inc.
* Copyright (C) 2015 Swift Navigation Inc.
* Contact: Leith Bade <[email protected]>
*
* This source is subject to the license found in the file 'LICENSE' which must
Expand Down Expand Up @@ -27,6 +27,4 @@ double calc_ionosphere(const gps_time_t *t_gps,
double a, double e,
const ionosphere_t *i);

void decode_iono_parameters(const u32 *subframe4_words, ionosphere_t *iono);

#endif /* LIBSWIFTNAV_IONOSHPERE_H */
6 changes: 1 addition & 5 deletions include/libswiftnav/nav_msg.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010, 2016 Swift Navigation Inc.
* Copyright (C) 2010 Swift Navigation Inc.
* Contact: Henry Hallam <[email protected]>
*
* This source is subject to the license found in the file 'LICENSE' which must
Expand All @@ -15,7 +15,6 @@

#include <libswiftnav/common.h>
#include <libswiftnav/ephemeris.h>
#include <libswiftnav/ionosphere.h>

#define NAV_MSG_SUBFRAME_BITS_LEN 14 /* Buffer 448 nav bits. */

Expand Down Expand Up @@ -47,9 +46,6 @@ typedef struct {
ephemeris_t ephemeris;
bool ephemeris_upd_flag;

ionosphere_t iono;
bool iono_corr_upd_flag;

u32 gps_l2c_sv_capability;
bool gps_l2c_sv_capability_upd_flag;
} gps_l1ca_decoded_data_t;
Expand Down
16 changes: 2 additions & 14 deletions python/swiftnav/nav_msg.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2012, 2016 Swift Navigation Inc.
# Copyright (C) 2012 Swift Navigation Inc.
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
Expand Down Expand Up @@ -30,21 +30,9 @@ cdef extern from "libswiftnav/nav_msg.h":
u8 next_subframe_id
s8 bit_polarity

ctypedef struct ionosphere_t:
double a0
double a1
double a2
double a3
double b0
double b1
double b2
double b3

ctypedef struct gps_l1ca_decoded_data_t:
ephemeris_t ephemeris
bool ephemeris_upd_flag
ionosphere_t iono
bool iono_corr_upd_flag
u32 gps_l2c_sv_capability
bool gps_l2c_sv_capability_upd_flag

Expand All @@ -58,4 +46,4 @@ cdef class NavMsg:
cdef nav_msg_t _thisptr

cdef class GpsL1CADecodedData:
cdef gps_l1ca_decoded_data_t _thisptr
cdef gps_l1ca_decoded_data_t _thisptr
2 changes: 1 addition & 1 deletion python/swiftnav/nav_msg.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2012, 2016 Swift Navigation Inc.
# Copyright (C) 2012 Swift Navigation Inc.
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
Expand Down
35 changes: 1 addition & 34 deletions src/ionosphere.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015, 2016 Swift Navigation Inc.
* Copyright (C) 2015 Swift Navigation Inc.
* Contact: Leith Bade <[email protected]>
*
* This source is subject to the license found in the file 'LICENSE' which must
Expand All @@ -12,11 +12,9 @@
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <string.h>

#include <libswiftnav/constants.h>
#include <libswiftnav/ionosphere.h>
#include <libswiftnav/logging.h>

/** \defgroup ionosphere Ionospheric models
* Implemenations of ionospheric delay correction models.
Expand Down Expand Up @@ -109,35 +107,4 @@ double calc_ionosphere(const gps_time_t *t_gps,
return d_l1;
}

/** The function decodes ionospheric parameters
* \param subframe4_words pointer to received frame word,
* Note: Ionospheric parmeters are passed in subframe 4,
* pass function parameters accordingly.
* \param iono pointer to ionosphere_t where decoded data should be stored
*/
void decode_iono_parameters(const u32 *subframe4_words, ionosphere_t *iono)
{
union {
s8 s8;
u8 u8;
} onebyte;

onebyte.u8 = subframe4_words[3-3] >> (30-16) & 0xff; /* alfa 0 */
iono->a0 = onebyte.s8 * pow(2, -30);
onebyte.u8 = subframe4_words[3-3] >> (30-24) & 0xff; /* alfa 1 */
iono->a1 = onebyte.s8 * pow(2, -27);
onebyte.u8 = subframe4_words[4-3] >> (30-8) & 0xff; /* alfa 2 */
iono->a2 = onebyte.s8 * pow(2, -24);
onebyte.u8 = subframe4_words[4-3] >> (30-16) & 0xff; /* alfa 3 */
iono->a3 = onebyte.s8 * pow(2, -24);
onebyte.u8 = subframe4_words[4-3] >> (30-24) & 0xff; /* beta 0 */
iono->b0 = onebyte.s8 * pow(2, 11);
onebyte.u8 = subframe4_words[5-3] >> (30-8) & 0xff; /* beta 1 */
iono->b1 = onebyte.s8 * pow(2, 14);
onebyte.u8 = subframe4_words[5-3] >> (30-16) & 0xff; /* beta 2 */
iono->b2 = onebyte.s8 * pow(2, 16);
onebyte.u8 = subframe4_words[5-3] >> (30-24) & 0xff; /* beta 3 */
iono->b3 = onebyte.s8 * pow(2, 16);
}

/** \} */
11 changes: 1 addition & 10 deletions src/nav_msg.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010, 2016 Swift Navigation Inc.
* Copyright (C) 2010 Swift Navigation Inc.
* Contact: Henry Hallam <[email protected]>
*
* This source is subject to the license found in the file 'LICENSE' which must
Expand Down Expand Up @@ -302,15 +302,6 @@ s8 process_subframe(nav_msg_t *n, gnss_signal_t sid,
data->gps_l2c_sv_capability_upd_flag = true;
}

/* check Word 3 bits 2..7 (63..69) for Page ID 18,
* which contains iono data
* Page 18 has ID 56, see IS-200H, pg. 109-110 */
if ((n->frame_words[3][3-3] >> (30-8) & 0x3f) == 56) {
/* decode ionospheric correction data */
decode_iono_parameters(n->frame_words[3], &data->iono);
data->iono_corr_upd_flag = true;
}

/* Got all of subframes 1 to 4 */
n->next_subframe_id = 1; /* Make sure we start again next time */

Expand Down
66 changes: 0 additions & 66 deletions tests/check_ionosphere.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
/*
* Copyright (C) 2016 Swift Navigation Inc.
* Contact: Dmitry Tatarinov <[email protected]>
*
* This source is subject to the license found in the file 'LICENSE' which must
* be be distributed together with this source. All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*/

#include <check.h>
#include <stdio.h>

#include <libswiftnav/constants.h>
#include <libswiftnav/ionosphere.h>
Expand Down Expand Up @@ -61,65 +48,12 @@ START_TEST(test_calc_ionosphere)
}
END_TEST

START_TEST(test_decode_iono_parameters)
{
#define tol 1e-12
struct {
u32 frame_words[8];
ionosphere_t result;
} t_case = {
.frame_words = {
/* 4th SF real data at 11-May-2016 */
0x1e0300c9,0x7fff8c24,0x23fbdc2,0,0,0,0,0
},
.result = { /* reference data provided by u-blox receiver */
.a0 = 0.0000000111758,
.a1 = 0.0000000223517,
.a2 = -0.0000000596046,
.a3 = -0.0000001192092,
.b0 = 98304.0,
.b1 = 131072.0,
.b2 = -131072.0,
.b3 = -589824.0,
}
};
ionosphere_t i;
decode_iono_parameters(t_case.frame_words, &i);
fail_unless(fabs(i.a0 - t_case.result.a0) < tol,
"alfa 0 == %30.20f, expected %30.20f, tolerance = %30.20f",
i.a0, t_case.result.a0, tol);
fail_unless(fabs(i.a1 - t_case.result.a1) < tol,
"alfa 1 == %30.20f, expected %30.20f, tolerance = %30.20f",
i.a1, t_case.result.a1, tol);
fail_unless(fabs(i.a2 - t_case.result.a2) < tol,
"alfa 2 == %30.20f, expected %30.20f, tolerance = %30.20f",
i.a2, t_case.result.a2, tol);
fail_unless(fabs(i.a3 - t_case.result.a3) < tol,
"alfa 3 == %30.20f, expected %30.20f, tolerance = %30.20f",
i.a3, t_case.result.a3, tol);
fail_unless(fabs(i.b0 - t_case.result.b0) < tol,
"beta 0 == %30.20f, expected %30.20f, tolerance = %30.20f",
i.b0, t_case.result.b0, tol);
fail_unless(fabs(i.b1 - t_case.result.b1) < tol,
"beta 1 == %30.20f, expected %30.20f, tolerance = %30.20f",
i.b1, t_case.result.b1, tol);
fail_unless(fabs(i.b2 - t_case.result.b2) < tol,
"beta 2 == %30.20f, expected %30.20f, tolerance = %30.20f",
i.b2, t_case.result.b2, tol);
fail_unless(fabs(i.b3 - t_case.result.b3) < tol,
"beta 3 == %30.20f, expected %30.20f, tolerance = %30.20f",
i.b3, t_case.result.b3, tol);

}
END_TEST

Suite* ionosphere_suite(void)
{
Suite *s = suite_create("Ionosphere");

TCase *tc_core = tcase_create("Core");
tcase_add_test(tc_core, test_calc_ionosphere);
tcase_add_test(tc_core, test_decode_iono_parameters);
suite_add_tcase(s, tc_core);

return s;
Expand Down