Para Juan
NAVDATA.h@10:45e3c7f30950, 2017-06-23 (annotated)
- Committer:
- gstedile
- Date:
- Fri Jun 23 03:58:33 2017 +0000
- Revision:
- 10:45e3c7f30950
- Parent:
- 9:b4232b5aa4ed
- Child:
- 11:c802de4a6b13
20170622
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gstedile | 10:45e3c7f30950 | 1 | /* NAVDATA Module Library |
gstedile | 0:9370c06bf7f3 | 2 | * Copyright (c) 2008-2010, sford |
gstedile | 0:9370c06bf7f3 | 3 | * |
gstedile | 0:9370c06bf7f3 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
gstedile | 0:9370c06bf7f3 | 5 | * of this software and associated documentation files (the "Software"), to deal |
gstedile | 0:9370c06bf7f3 | 6 | * in the Software without restriction, including without limitation the rights |
gstedile | 0:9370c06bf7f3 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
gstedile | 0:9370c06bf7f3 | 8 | * copies of the Software, and to permit persons to whom the Software is |
gstedile | 0:9370c06bf7f3 | 9 | * furnished to do so, subject to the following conditions: |
gstedile | 0:9370c06bf7f3 | 10 | * |
gstedile | 0:9370c06bf7f3 | 11 | * The above copyright notice and this permission notice shall be included in |
gstedile | 0:9370c06bf7f3 | 12 | * all copies or substantial portions of the Software. |
gstedile | 0:9370c06bf7f3 | 13 | * |
gstedile | 0:9370c06bf7f3 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
gstedile | 0:9370c06bf7f3 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
gstedile | 0:9370c06bf7f3 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
gstedile | 0:9370c06bf7f3 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
gstedile | 0:9370c06bf7f3 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
gstedile | 0:9370c06bf7f3 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
gstedile | 0:9370c06bf7f3 | 20 | * THE SOFTWARE. |
gstedile | 0:9370c06bf7f3 | 21 | */ |
gstedile | 0:9370c06bf7f3 | 22 | |
gstedile | 0:9370c06bf7f3 | 23 | /*############################################################################ |
gstedile | 0:9370c06bf7f3 | 24 | ############################################################################## |
gstedile | 0:9370c06bf7f3 | 25 | |
gstedile | 0:9370c06bf7f3 | 26 | */ |
gstedile | 0:9370c06bf7f3 | 27 | |
gstedile | 0:9370c06bf7f3 | 28 | #include "mbed.h" |
gstedile | 0:9370c06bf7f3 | 29 | #include <string> |
gstedile | 4:400b92fb528c | 30 | #include <vector> |
gstedile | 4:400b92fb528c | 31 | using namespace std; |
gstedile | 4:400b92fb528c | 32 | #include <math.h> |
gstedile | 0:9370c06bf7f3 | 33 | |
gstedile | 1:48e2f1194609 | 34 | #ifndef MBED_NAVDATA_H |
gstedile | 1:48e2f1194609 | 35 | #define MBED_NAVDATA_H |
gstedile | 10:45e3c7f30950 | 36 | enum datavars{longitude_f=0, longitude_i, latitude_f, latitude_i, time_f, time_i, distance_p, speed_p, consumption_i, consumption_f, consumption_p, cons_mile_p, cons_hour_p, cons_interpolated, CANT_DATA_VARS }; // Contiene las variables de navegacion de inicio y fin del último período muestreado. (distance_p in nautic miles, speed_p in knots). 0-> real ; 1->interpolated; 2->smoothed; -1-> initial padding |
gstedile | 5:ae5dfda6b0ab | 37 | // VER SI ES CORRECTO DELARARLA AQUI.. |
gstedile | 5:ae5dfda6b0ab | 38 | |
gstedile | 0:9370c06bf7f3 | 39 | |
gstedile | 1:48e2f1194609 | 40 | /** NAVDATA manage and store last navigation data */ |
gstedile | 0:9370c06bf7f3 | 41 | |
gstedile | 0:9370c06bf7f3 | 42 | |
gstedile | 1:48e2f1194609 | 43 | class NAVDATA { |
gstedile | 3:de86e5eb7a8a | 44 | private: |
gstedile | 10:45e3c7f30950 | 45 | |
gstedile | 10:45e3c7f30950 | 46 | //float max_period_time; // Maximo tiempo aceptado entre muestras consecutivas para validar los períodos en horas (hh,hhhh). SETEAR en NAVDATA.cpp |
gstedile | 3:de86e5eb7a8a | 47 | |
gstedile | 10:45e3c7f30950 | 48 | |
gstedile | 10:45e3c7f30950 | 49 | |
gstedile | 10:45e3c7f30950 | 50 | double Klong, Klat, Ksen; //Default value is set to obtain distance in nautic miles and consumption in litres. |
gstedile | 3:de86e5eb7a8a | 51 | |
gstedile | 3:de86e5eb7a8a | 52 | int ZH; |
gstedile | 0:9370c06bf7f3 | 53 | public: |
gstedile | 10:45e3c7f30950 | 54 | int np_concat; // Cantidad máxima de períodos que combinan en uno solo a velocidad constante antes de almacenar los datos.(ver VCODATA::store_data); |
gstedile | 4:400b92fb528c | 55 | |
gstedile | 10:45e3c7f30950 | 56 | float max_period_time; // Maximo tiempo aceptado entre muestras consecutivas para validar los períodos en horas (hh,hhhh). SETEAR en NAVDATA.cpp |
gstedile | 10:45e3c7f30950 | 57 | |
gstedile | 10:45e3c7f30950 | 58 | double time_NMEA2hours (float timetickNMEA); // Convierte formato de hora NMEA a horas con decimales. (hhmmss,ss ---> hh,hhhh) |
gstedile | 10:45e3c7f30950 | 59 | |
gstedile | 10:45e3c7f30950 | 60 | NAVDATA(double Klongitud, double Klatitud, float Ksensor, int ZoneHour, float max_period_time); // Constantes de latitud, longitud, del sensor, zona horaria y tiempo de periodo maximo. |
gstedile | 0:9370c06bf7f3 | 61 | |
gstedile | 4:400b92fb528c | 62 | NAVDATA(); // Sin argumentos |
gstedile | 4:400b92fb528c | 63 | |
gstedile | 10:45e3c7f30950 | 64 | |
gstedile | 10:45e3c7f30950 | 65 | void paddata(); |
gstedile | 10:45e3c7f30950 | 66 | |
gstedile | 10:45e3c7f30950 | 67 | /** Rotacion de los datos almacenados con los entrantes. |
gstedile | 10:45e3c7f30950 | 68 | * @return 0 si hubo una rotacion con datos validados, else -1. |
gstedile | 0:9370c06bf7f3 | 69 | */ |
gstedile | 0:9370c06bf7f3 | 70 | |
gstedile | 10:45e3c7f30950 | 71 | int rotate_data(double x, double y, double t, float c, int v_max); // Longitud, Latitud, Timestamp, Consumption, Velocidad Maxima; |
gstedile | 2:86e9ac5dcacc | 72 | |
gstedile | 3:de86e5eb7a8a | 73 | |
gstedile | 4:400b92fb528c | 74 | //float LAST_NAV_DATA[CANT_DATA_VARS]; // Arrays de datos de navegacion del último período. En caso de agregar variables, modificar enum datavars. |
gstedile | 4:400b92fb528c | 75 | |
gstedile | 10:45e3c7f30950 | 76 | double LAST_NAV_DATA[CANT_DATA_VARS]; |
gstedile | 3:de86e5eb7a8a | 77 | |
gstedile | 0:9370c06bf7f3 | 78 | }; |
gstedile | 0:9370c06bf7f3 | 79 | #endif |
gstedile | 1:48e2f1194609 | 80 |