File size: 3,309 Bytes
5ab75a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
113
114
function I = Nintegrand(t,ca,sa,Rs,Re,NeedIllumination,HW20function)
% Nintegrand - Calculate integrand
% Syntax: I = Nintegrand(t,ca,sa,Rs,Re,NeedIllumination,HW20function);
%
% =========================================================================
%
% Copyright (c)�2024�United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% =========================================================================
%
% Description:
% Calculate the integrand for the number of satellites above an observatory
% using the uniform-shell apporoximation, normalized to a constellation
% number of Nc = 1.
%
% =========================================================================
%
% Initial version: Nov�2024;� Latest update: Nov�2024
%
% ----------------- BEGIN CODE -----------------

if nargin < 7
    HW20function = true;
end

% Integrating this function over zenith angle, theta or t, yields the
% average number of satellites: Na for total above thetamax, Ni for the
% number illuminated by the Sun (at altitude angle a), Ni.

% Also see Hainaut and Williams (2020)

% Constants
Rs2 = Rs^2; Re2 = Re^2;

% Sine and cosine of zenith angle
st = sin(t); % st2 = st.^2;
ct = cos(t); % ct2 = ct.^2;

% Range function
bt = sqrt( Rs2 - Re2*st.^2 ); % b(theta) function

% Range from obs to sat
rho = bt - Re*ct;    
    
% Azimuthal angle for solar illumination

if NeedIllumination
    
    % Calculate the az angle range restricted to illuminated region    
    p0 = NaN(size(t));
    cp0top = sa*(rho.*ct + Re) + sqrt( rho.*(2*ct*Re+rho)  );
    cp0bot = rho.*st*ca;
    cp0 = -cp0top./cp0bot;
    
    % All range of p illuminated
    all_lit = cp0 <= -1;
    p0(all_lit) = pi;
    
    % No range of p illuminated
    all_drk = cp0 >= 1;
    p0(all_drk) = 0;
    
    % Some range of p illuminated
    ndx = ~(all_lit | all_drk);
    p0(ndx) = acos(cp0(ndx));

else
    
    % Az angle extends from -pi <= p <= pi if illimination is not required
    p0 = pi*ones(size(t));
    
end

% Derivative dfsdt

if HW20function

    % Derivative of HW20 eq 10 (ee LightPollution.nb Mathematica file)
    % dfsdt = ( ( 1 - (ct*Re) ./ (Rs*sqrt(1-Re2*st2/Rs2)) ) ...
    %          .* sin( t - asin(Re*st/Rs) ) ) / 2;
    dfsdt = ( ( 1 - (ct*Re) ./ bt ) ...
             .* sin( t - asin(Re*st/Rs) ) ) / 2;
    
    % Integrand function
    I = p0 .* dfsdt / pi;

else
         
    % From CLPUnifShell.nb
    I = (p0 .* st .* rho.^2 ./ bt) / (2*pi*Rs);
         
end

return
end

% ----------------- END OF CODE ------------------
%
% Please record any changes to the software in the change history
% shown below:
%
% ----------------- CHANGE HISTORY ------------------
% Developer |���� Date��� | Description
% ---------------------------------------------------
% D. Hall��� |� 2024-Nov �| Initial version.
% =========================================================================
%
% Copyright (c)�2024�United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% =========================================================================