struct ln_hrz_posn getAltazFromRadecInDate(struct ln_equ_posn objRaDec, double JD) {
	// Datos de la localización
	struct ln_lnlat_posn localizacion;
	localizacion.lat = 36.7123456;
	localizacion.lng = -4.4123456;

	// Cogemos los datos de la Ascención Recta (1ª ln_dms del array)
	struct lnh_equ_posn objRaDec2;
	objRaDec2.ra = convierteGdHms(objRaDec.ra);
	// Cogemos los datos de la Declinación (2ª ln_dms del array)
	objRaDec2.dec = convierteGdGms(objRaDec.dec);

    // Se realizan las conversiones de posición de objeto y observador
	struct ln_equ_posn object;
    ln_hequ_to_equ(&objRaDec2, &object);
    struct ln_lnlat_posn observer;
    ln_hlnlat_to_lnlat(&localizacion, &observer);
    // Se traducen a AltAz
    struct ln_hrz_posn resultado;
    ln_get_hrz_from_equ(&object, &observer, JD, &resultado);

    // Si es necesario se imprimen por pantalla
    fprintf(stdout, "Alt: %f\n",   resultado.alt);
    fprintf(stdout, "Az:  %f\n\n", resultado.az);
	
	// Creo el JSON de las ln_dmss y lo devuelvo
	return resultado;
}
Exemple #2
0
    StatusResponse CommandInterface::ParseStatusResponse(const CommandResponse &res) {
        StatusResponse result;

        lnh_equ_posn equ_posn = {{0, 0, 0},
                                 {0, 0, 0, 0}};
        HMS ra{};
        DMS dec(res.payload.at("DEC"));

        std::stringstream ss{res.payload.at("RA")};
        ss >> ra;

        equ_posn.ra = ra;
        equ_posn.dec = dec;
        result.equ = {0, 0};
        ln_hequ_to_equ(&equ_posn, &result.equ);

        result.state = ParseState(res.payload.at("STATE"));
        result.executing_goto = res.payload.at("GOTO") == "1";

        return result;
    }
Exemple #3
0
void cmd_libnova_test (BaseSequentialStream *chp, int argc, char *argv) {
       (void) argv;
 	 if (argc > 0) {
 	   chprintf(chp, "Usage: novatest\r\n");
 	   return;
 	 }
	struct lnh_equ_posn hobject, hequ;
	struct lnh_lnlat_posn hobserver;
	struct ln_equ_posn object, equ;
	struct ln_hrz_posn hrz;
	struct lnh_hrz_posn hhrz;
	struct ln_lnlat_posn observer;

	double JD;
	struct ln_date date;

	
	/* 
	 * observers position
	 * longitude is measured positively eastwards
	 * Madrid
	 */
	hobserver.lng.degrees = -3;
	hobserver.lng.minutes = 42;
	hobserver.lng.seconds = 36;
	hobserver.lat.degrees = 40;
	hobserver.lat.minutes = 25;
	hobserver.lat.seconds = 11.99;

	/* Alnilam */
	hobject.ra.hours = 5;
	hobject.ra.minutes = 36;
	hobject.ra.seconds = 12.8;
	hobject.dec.neg = 1;
	hobject.dec.degrees = 1;
	hobject.dec.minutes = 12;
	hobject.dec.seconds = 7;

	chprintf(chp,"ANILAM: RA %d:%d:%f  DEC %d:%d:%f\n", hobject.ra.hours, hobject.ra.minutes,
		hobject.ra.seconds, hobject.dec.degrees, hobject.dec.minutes, hobject.dec.seconds);


        ln_now(&date);
        
	JD = ln_get_julian_day (&date);
	ln_hequ_to_equ (&hobject, &object);
	ln_hlnlat_to_lnlat (&hobserver, &observer);



	ln_get_hrz_from_equ (&object, &observer, JD, &hrz);
	chprintf(chp,"(Alnilam) Equ to Horiz ALT %f\n", hrz.alt);
	chprintf(chp,"(Alnilam) Equ to Horiz AZ %f\n", hrz.az);
	ln_hrz_to_hhrz(&hrz, &hhrz);
	chprintf(chp,"ALT %d:%d:%f  AZ %d:%d:%f\n", hhrz.alt.degrees, hhrz.alt.minutes,
		hhrz.alt.seconds, hhrz.az.degrees, hhrz.az.minutes, hhrz.az.seconds);

	ln_get_equ_from_hrz (&hrz, &observer, JD, &equ);
	chprintf(chp,"(Alnilam) Horiz to Equ RA %f\n", equ.ra);
	chprintf(chp,"(Alnilam) Horiz to Equ DEC %f\n", equ.dec);
	ln_equ_to_hequ(&equ, &hequ);
	chprintf(chp,"RA %d:%d:%f  DEC %d:%d:%f\n", hequ.ra.hours, hequ.ra.minutes,
		hequ.ra.seconds, hequ.dec.degrees, hequ.dec.minutes, hequ.dec.seconds);


}