This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathstruct.c
55 lines (51 loc) · 1.73 KB
/
struct.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include "util.h"
#include "struct.h"
Sat *createSat(char *time, char *prn, double *az, double *el, double *snr, double *snr2, double *snr3, double *mp)
{
Sat *satObj = malloc(sizeof(Sat));
(*satObj).time = time;
(*satObj).prn = prn;
(*satObj).az = az;
(*satObj).el = el;
(*satObj).snr = snr;
(*satObj).snr2 = snr2;
(*satObj).snr3 = snr3;
(*satObj).mp = mp;
return satObj;
}
Epoch *createEpoch(char *time, Sat **epochSatArray, int *numSat)
{
Epoch *epochObj = malloc(sizeof(Epoch));
(*epochObj).time = time;
(*epochObj).epochSatArray = epochSatArray;
(*epochObj).numSat = numSat;
return epochObj;
}
Sol *createSol(double *x, double *y, double *z, double *az, double *el)
{
Sol *solObj = malloc(sizeof(Sol));
(*solObj).x = x;
(*solObj).y = y;
(*solObj).z = z; // x is E, y is N, z is U
(*solObj).az = az;
(*solObj).el = el;
return solObj;
}
void printEpochArray(Epoch **epochArray, long int numEpoch)
{
for (long int i = 0; i < numEpoch; i++)
{
int n = *(epochArray[i]->numSat);
printf("======== Epoch %s contains %i satellite signals ========\n", (*epochArray[i]).time, n);
for (int j = 0; j < n; j++)
{
// printf("%s\t%s\t%lf\t%lf\t%lf\n", (*epochArray[i]).epochSatArray[j]->time, (*epochArray[i]).epochSatArray[j]->prn, *(*epochArray[i]).epochSatArray[j]->az, *(*epochArray[i]).epochSatArray[j]->el, *(*epochArray[i]).epochSatArray[j]->snr);
printf("%s\t%s\t%lf\t%lf\t%lf\t%lf\n", (*epochArray[i]).epochSatArray[j]->time, (*epochArray[i]).epochSatArray[j]->prn, *(*epochArray[i]).epochSatArray[j]->az, *(*epochArray[i]).epochSatArray[j]->el, *(*epochArray[i]).epochSatArray[j]->snr, *(*epochArray[i]).epochSatArray[j]->snr2);
}
}
}