JoKKeR
Full Member level 2
C language problem
Hi !
Im using function(s) before declaration. That is the reason im getting compiling error.
On the other hand reason why im using such program build is, that i like to keep things logical, at least on math level ( scientific equations).
So are there any techniques how to solve a problem im having ?
Thank you !
Added after 2 minutes:
BTW. The location of problem is between 2 or 3
function.
The variable Hour angle keep recurring .
Hi !
Im using function(s) before declaration. That is the reason im getting compiling error.
On the other hand reason why im using such program build is, that i like to keep things logical, at least on math level ( scientific equations).
So are there any techniques how to solve a problem im having ?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double L = 59.10; // latitude
double declination () //declination 583 539 87
{
double d;
d = declination(); //declination();
double N = 0;
N = 100;
d = 23.45 * sin (360 / 365 * (284 + N)) ;
return d;
// d = declination
//N = day number, January 1 = day 1
}
double hour_angle () // Hour angle
{
double Al;
Al = altitude_angle() ;
double L = L;
double D;
D = declination() ;
double H = 0;
double elev = 0;
H = acos ( -1 * (sin (L) * sin (D) - sin (-0.8333 - 0.0347 *(sqrt (elev) ))) / (cos (L) * cos (D))) ;
//H = cos-1[-1 * (sin (L) * sin (D) - sin (-0.8333 - 0.0347 (sqrt (elev)))) / (cos (L) * cos (D))] ;
//Al = Solar altitude angle
//L = Latitude (negative for Southern Hemisphere)
//D = Declination (negative for Southern Hemisphere)
//H = Hour angle
}
double altitude_angle () // Altidue angle
{
double Al = 0;
double L = L;
double D;
D = declination() ;
double H ;
H = hour_angle() ;
//sin(Al) =( cos(L) * cos(D) * cos(H)) + ( sin(L) * sin(D) ) ;
Al =sin(( cos(L) * cos(D) * cos(H)) + ( sin(L) * sin(D) )) ;
//Al = Solar altitude angle
//L = Latitude (negative for Southern Hemisphere)
//D = Declination (negative for Southern Hemisphere)
//H = Hour angle
}
double azimuth_angle()
{
double Az = 0;
double Al;
Al = altitude_angle() ;
double L = L;
double D;
D = declination() ;
//cos (Az) = (sin (Al) * sin (L) - sin (D)) / (cos (Al) * cos (L)) ;
Az = cos((sin (Al) * sin (L) - sin (D)) / (cos (Al) * cos (L))) ;
//Az = Solar azimuth angle
//Al = Solar altitude angle
//L = Latitude (negative for Southern Hemisphere)
//D = Declination (negative for Southern Hemisphere)
}
double EOT () // Equation of time
{
double N = 100;
double B = 0;
double E = 0;
B = (360 * (N - 81)) / 365;
E = (9.87 * sin(2*B)) - (7.53 * cos(B)) - (1.5 * sin(B));
return E;
//N = day number, January 1 = day 1
}
int main()
{
system("PAUSE");
return 0;
}
Thank you !
Added after 2 minutes:
BTW. The location of problem is between 2 or 3
function.
The variable Hour angle keep recurring .