-
Notifications
You must be signed in to change notification settings - Fork 6
/
TileAntenna.cc
99 lines (87 loc) · 3.33 KB
/
TileAntenna.cc
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
//# TileAntenna.cc: Semi-analytical model of a LOFAR HBA tile.
//#
//# Copyright (C) 2013
//# ASTRON (Netherlands Institute for Radio Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
//#
//# This file is part of the LOFAR software suite.
//# The LOFAR software suite is free software: you can redistribute it and/or
//# modify it under the terms of the GNU General Public License as published
//# by the Free Software Foundation, either version 3 of the License, or
//# (at your option) any later version.
//#
//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
//#
//# $Id$
#include "TileAntenna.h"
#include "Constants.h"
#include "MathUtil.h"
#include "ElementResponse.h"
namespace LOFAR
{
namespace StationResponse
{
TileAntenna::TileAntenna(const TileConfig &config)
: itsConfig(config)
{
}
void TileAntenna::setConfig(const TileConfig &config)
{
itsConfig = config;
}
const TileAntenna::TileConfig &TileAntenna::config() const
{
return itsConfig;
}
raw_array_factor_t TileAntenna::rawArrayFactor(real_t freq,
const vector3r_t &direction, const vector3r_t &direction0) const
{
// Angular wave number.
real_t k = Constants::_2pi * freq / Constants::c;
// We need to compute the phase difference between a signal arriving from
// the target direction and a signal arriving from the reference direction,
// both relative to the center of the tile.
//
// This phase difference can be computed using a single dot product per
// dipole element by exploiting the fact that the dot product is
// distributive over vector addition:
//
// a . b + a . c = a . (b + c)
//
vector3r_t difference = direction - direction0;
complex_t af(0.0, 0.0);
for(TileConfig::const_iterator element_it = itsConfig.begin(),
element_end = itsConfig.end(); element_it != element_end; ++element_it)
{
// Compute the effective delay for a plane wave approaching from the
// direction of interest with respect to the position of element i
// when beam forming in the reference direction using time delays.
real_t shift = k * dot(difference, *element_it);
af += complex_t(cos(shift), sin(shift));
}
real_t size = itsConfig.size();
raw_array_factor_t result = {{{af, af}}, {{size, size}}};
return result;
}
matrix22c_t TileAntenna::elementResponse(real_t freq,
const vector3r_t &direction) const
{
// The positive X dipole direction is SW of the reference orientation,
// which translates to a phi coordinate of 5/4*pi in the topocentric
// spherical coordinate system. The phi coordinate is corrected for this
// offset before evaluating the antenna model.
vector2r_t thetaphi = cart2thetaphi(direction);
thetaphi[1] -= 5.0 * Constants::pi_4;
matrix22c_t response;
element_response_hba(freq, thetaphi[0], thetaphi[1],
reinterpret_cast<std::complex<double> (&)[2][2]>(response));
return response;
}
} //# namespace StationResponse
} //# namespace LOFAR