mirror of
https://github.com/eddyem/small_tel.git
synced 2025-12-06 02:35:14 +03:00
add sun
This commit is contained in:
parent
b25c15cbfc
commit
5eda1fae3f
21
Auxiliary_utils/Sun/Makefile
Normal file
21
Auxiliary_utils/Sun/Makefile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# run `make DEF=...` to add extra defines
|
||||||
|
PROGRAM = noon
|
||||||
|
LDFLAGS := -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--discard-all
|
||||||
|
LDFLAGS += -lnova
|
||||||
|
SRCS := $(wildcard *.c)
|
||||||
|
DEFINES := $(DEF) -D_GNU_SOURCE -D_XOPEN_SOURCE=1111
|
||||||
|
CFLAGS += -O2 -Wno-trampolines -std=gnu99
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
|
|
||||||
|
LINKS := sunrise sunset
|
||||||
|
|
||||||
|
all : $(LINKS)
|
||||||
|
|
||||||
|
$(LINKS) : $(PROGRAM)
|
||||||
|
@echo "make links"
|
||||||
|
ln -s $< $@ || true
|
||||||
|
|
||||||
|
$(PROGRAM): sun.c
|
||||||
|
@echo -e "\t\tCC $<"
|
||||||
|
$(CC) $(LDFLAGS) $(CFLAGS) $(DEFINES) -o $@ $<
|
||||||
9
Auxiliary_utils/Sun/Readme
Normal file
9
Auxiliary_utils/Sun/Readme
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Calculates times of sunrise, sunset and noon, gives @ stdout just UNIX time of event
|
||||||
|
|
||||||
|
Sunrise/sunset - for particular angle below horizon (default: -18degr).
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
- just `noon`, `sunrise` or `sunset` for default angles;
|
||||||
|
- `sunrise/sunset angle` for `angle` in degrees below horizon;
|
||||||
|
- `sunrise/sunset "standard"|"civil"|"nautic"|"astro" - calculates event for -0.833degr, -6degr, -12degr and -18degr.
|
||||||
73
Auxiliary_utils/Sun/sun.c
Normal file
73
Auxiliary_utils/Sun/sun.c
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Library General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
Copyright (C) 2003 Liam Girdwood <liam@gnova.org>
|
||||||
|
|
||||||
|
|
||||||
|
A simple example showing some solar calculations.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <libnova/solar.h>
|
||||||
|
#include <libnova/julian_day.h>
|
||||||
|
#include <libnova/rise_set.h>
|
||||||
|
#include <libnova/transform.h>
|
||||||
|
|
||||||
|
static const double horizons[] = {LN_SOLAR_STANDART_HORIZON, LN_SOLAR_CIVIL_HORIZON, LN_SOLAR_NAUTIC_HORIZON, LN_SOLAR_ASTRONOMICAL_HORIZON};
|
||||||
|
static const char *hnames[] = {"standard", "civil", "nautic", "astro"};
|
||||||
|
|
||||||
|
int main (int argc, char **argv){
|
||||||
|
struct ln_equ_posn equ;
|
||||||
|
struct ln_rst_time rst;
|
||||||
|
struct ln_zonedate rise;
|
||||||
|
struct ln_lnlat_posn observer;
|
||||||
|
double JD, angle = LN_SOLAR_ASTRONOMICAL_HORIZON;
|
||||||
|
time_t t;
|
||||||
|
|
||||||
|
if(argc == 2){
|
||||||
|
if(isdigit(*argv[1])) angle = -atof(argv[1]); // angle value
|
||||||
|
else{ // angle name
|
||||||
|
for(int i = 0; i < sizeof(horizons)/sizeof(double); ++i){
|
||||||
|
if(strcasecmp(argv[1], hnames[i]) == 0){
|
||||||
|
angle = horizons[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(argc > 2){
|
||||||
|
fprintf(stderr, "Usage: %s [positive angle in degr] OR %s [\"standard\"|\"civil\"|\"nautic\"|\"astro\"]\n",
|
||||||
|
argv[0], argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
observer.lat = 43.653528;
|
||||||
|
observer.lng = 41.4414375;
|
||||||
|
JD = ln_get_julian_from_sys();
|
||||||
|
ln_get_solar_equ_coords (JD, &equ);
|
||||||
|
if(ln_get_solar_rst_horizon(JD, &observer, angle, &rst) == 1) return 1;
|
||||||
|
if(strcasecmp(basename(argv[0]), "sunrise") == 0)
|
||||||
|
ln_get_timet_from_julian(rst.rise, &t);
|
||||||
|
else if(strcasecmp(basename(argv[0]), "sunset") == 0)
|
||||||
|
ln_get_timet_from_julian(rst.set, &t);
|
||||||
|
else
|
||||||
|
ln_get_timet_from_julian(rst.transit, &t);
|
||||||
|
printf("%zd\n", t);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
0
Auxiliary_utils/bash_scripts/getflats
Normal file → Executable file
0
Auxiliary_utils/bash_scripts/getflats
Normal file → Executable file
0
Auxiliary_utils/bash_scripts/park_tel.sh
Normal file → Executable file
0
Auxiliary_utils/bash_scripts/park_tel.sh
Normal file → Executable file
0
Auxiliary_utils/bash_scripts/point_AH.sh
Normal file → Executable file
0
Auxiliary_utils/bash_scripts/point_AH.sh
Normal file → Executable file
0
Auxiliary_utils/bash_scripts/point_get_flat.sh
Normal file → Executable file
0
Auxiliary_utils/bash_scripts/point_get_flat.sh
Normal file → Executable file
0
Auxiliary_utils/bash_scripts/run
Normal file → Executable file
0
Auxiliary_utils/bash_scripts/run
Normal file → Executable file
0
Auxiliary_utils/bash_scripts/run_w_arrays
Executable file → Normal file
0
Auxiliary_utils/bash_scripts/run_w_arrays
Executable file → Normal file
0
Daemons/README_install/netdaemons_start
Normal file → Executable file
0
Daemons/README_install/netdaemons_start
Normal file → Executable file
0
Daemons/astrosib/HWoff
Executable file → Normal file
0
Daemons/astrosib/HWoff
Executable file → Normal file
0
Daemons/astrosib/HWon
Executable file → Normal file
0
Daemons/astrosib/HWon
Executable file → Normal file
0
Daemons/astrosib/STARTobs
Executable file → Normal file
0
Daemons/astrosib/STARTobs
Executable file → Normal file
0
Daemons/astrosib/STOPobs
Executable file → Normal file
0
Daemons/astrosib/STOPobs
Executable file → Normal file
0
Daemons/netsocket/HWpoweroff
Normal file → Executable file
0
Daemons/netsocket/HWpoweroff
Normal file → Executable file
0
Daemons/netsocket/HWpoweron
Normal file → Executable file
0
Daemons/netsocket/HWpoweron
Normal file → Executable file
0
Daemons/netsocket/MOUNTpoweronoff
Normal file → Executable file
0
Daemons/netsocket/MOUNTpoweronoff
Normal file → Executable file
0
Daemons/weatherdaemon/chkweather
Executable file → Normal file
0
Daemons/weatherdaemon/chkweather
Executable file → Normal file
0
Docs/Alignment/makelist
Normal file → Executable file
0
Docs/Alignment/makelist
Normal file → Executable file
0
Docs/focus
Normal file → Executable file
0
Docs/focus
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user