-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsonnen_position.cpp
More file actions
112 lines (59 loc) · 1.64 KB
/
sonnen_position.cpp
File metadata and controls
112 lines (59 loc) · 1.64 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#include "spa.h"
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
extern int jahr;
extern int monat;
extern int tag;
extern double longitude;
extern double latitude;
extern double azimut_soll;
extern double azimut_ist;
extern string azimut_uhrzeit;
void sonnen_position()
{
spa_data spa;
spa.year = jahr;
spa.month = monat;
spa.day = tag;
spa.hour = 0;
spa.minute = 0;
spa.second = 0;
spa.delta_ut1 = 0;
spa.delta_t = 70.70870833333333333333;
spa.longitude = longitude;
spa.latitude = latitude;
spa.elevation = 114.0;
spa.pressure = 1013.25;
spa.temperature = 20.0;
spa.slope = 0.0;
spa.azm_rotation = 0.0;
spa.atmos_refract = 0.5667;
spa.function = SPA_ZA;
for (int hour = 0; hour <= 24; ++hour)
{
for (int minute = 0; minute < 60; ++minute)
{
spa.hour = hour;
spa.minute = minute;
spa.second = 0;
int result = spa_calculate(&spa);
if (result == 0)
{
if (fabs(spa.azimuth - azimut_soll) < 0.2)
{
azimut_uhrzeit = to_string(hour) + ":" + to_string(minute);
azimut_ist = spa.azimuth;
break;
}
}
}
}
}