Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
8d364ca0
Commit
8d364ca0
authored
18 years ago
by
Ruud Overeem
Browse files
Options
Downloads
Patches
Plain Diff
BugID: 1000
Did some reformatting while studing the sources. Nothing is changed yet.
parent
e77efe15
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
MAC/APL/PAC/BeamServer/src/Beam.cc
+160
-89
160 additions, 89 deletions
MAC/APL/PAC/BeamServer/src/Beam.cc
MAC/APL/PAC/BeamServer/src/Beam.h
+2
-0
2 additions, 0 deletions
MAC/APL/PAC/BeamServer/src/Beam.h
MAC/APL/PAC/BeamServer/src/BeamServer.cc
+91
-31
91 additions, 31 deletions
MAC/APL/PAC/BeamServer/src/BeamServer.cc
with
253 additions
and
120 deletions
MAC/APL/PAC/BeamServer/src/Beam.cc
+
160
−
89
View file @
8d364ca0
...
...
@@ -47,10 +47,16 @@ using namespace BS_Protocol;
using
namespace
std
;
using
namespace
RTC
;
//
// Beam(name, subarray, nrSubbands)
//
Beam
::
Beam
(
string
name
,
string
subarrayname
,
int
nsubbands
)
:
m_name
(
name
),
m_subarrayname
(
subarrayname
),
m_nsubbands
(
nsubbands
)
{}
//
// ~Beam
//
Beam
::~
Beam
()
{
deallocate
();
...
...
@@ -58,6 +64,9 @@ Beam::~Beam()
// TODO: free beamlets
}
//
// allocate(beamletAllocation, beamlets, nrSubbands)
//
bool
Beam
::
allocate
(
Beamlet2SubbandMap
allocation
,
Beamlets
&
beamlets
,
int
nsubbands
)
{
if
(
0
==
allocation
().
size
()
...
...
@@ -91,6 +100,9 @@ bool Beam::allocate(Beamlet2SubbandMap allocation, Beamlets& beamlets, int nsubb
return
false
;
}
//
// modify(BeamletAllocation)
//
bool
Beam
::
modify
(
BS_Protocol
::
Beamlet2SubbandMap
allocation
)
{
// check for equal size
...
...
@@ -110,11 +122,17 @@ bool Beam::modify(BS_Protocol::Beamlet2SubbandMap allocation)
return
true
;
}
//
// getAllocation()
//
Beamlet2SubbandMap
Beam
::
getAllocation
()
const
{
return
m_allocation
;
}
//
// deallocate()
//
void
Beam
::
deallocate
()
{
// release beamlets
...
...
@@ -135,21 +153,33 @@ void Beam::deallocate()
m_allocation
().
clear
();
}
//
// addPointing(pointing)
//
void
Beam
::
addPointing
(
const
Pointing
&
pointing
)
{
m_pointing_queue
.
push
(
pointing
);
}
//
// setSubarray(array)
//
void
Beam
::
setSubarray
(
const
CAL
::
SubArray
&
array
)
{
m_array
=
array
;
}
//
// setCalibration(gains)
//
void
Beam
::
setCalibration
(
const
CAL
::
AntennaGains
&
gains
)
{
m_gains
=
gains
;
}
//
// getCalibration()
//
const
CAL
::
AntennaGains
&
Beam
::
getCalibration
()
const
{
return
m_gains
;
...
...
@@ -173,6 +203,9 @@ static int setNonblocking(int fd)
#endif
}
//
// logPointing(pointing)
//
void
Beam
::
logPointing
(
Pointing
pointing
)
{
double
hh
,
mm
,
ss
,
deg
,
degmm
,
degss
;
...
...
@@ -234,132 +267,146 @@ void Beam::logPointing(Pointing pointing)
}
#endif
int
Beam
::
convertPointings
(
RTC
::
Timestamp
begintime
,
int
compute_interval
,
AMC
::
Converter
*
conv
)
//
// convertPointings(begintime, interval, amcConverter)
//
int
Beam
::
convertPointings
(
RTC
::
Timestamp
begintime
,
int
compute_interval
,
AMC
::
Converter
*
conv
)
{
// remember last pointing from previous call
Pointing
current_pointing
=
m_pointing
;
// remember last pointing from previous call
Pointing
current_pointing
=
m_pointing
;
Pointing
track
[
compute_interval
];
bool
pset
[
compute_interval
];
for
(
int
i
=
0
;
i
<
compute_interval
;
i
++
)
pset
[
i
]
=
false
;
// reset lmns array
m_lmns
.
resize
(
compute_interval
,
3
);
m_lmns
=
0.0
;
LOG_INFO_STR
(
"computing weights for interval ["
<<
begintime
<<
" : "
<<
begintime
+
(
long
)(
compute_interval
-
1
)
<<
"]"
);
while
(
!
m_pointing_queue
.
empty
())
{
Pointing
pointing
=
m_pointing_queue
.
top
();
LOG_INFO_STR
(
"Process pointing for time "
<<
pointing
.
time
());
if
(
pointing
.
time
()
<
begintime
)
{
Pointing
track
[
compute_interval
];
bool
pset
[
compute_interval
];
for
(
int
i
=
0
;
i
<
compute_interval
;
i
++
)
{
pset
[
i
]
=
false
;
}
//
// Deadline missed, print warning but execute the command anyway
// as soon as possible.
//
LOG_WARN_STR
(
"Deadline missed by "
<<
(
begintime
.
sec
()
-
pointing
.
time
().
sec
())
<<
" seconds ("
<<
pointing
.
angle0
()
<<
","
<<
pointing
.
angle1
()
<<
") "
<<
"@ "
<<
pointing
.
time
());
// reset lmns array
m_lmns
.
resize
(
compute_interval
,
3
);
m_lmns
=
0.0
;
pointing
.
setTime
(
begintime
);
}
LOG_INFO_STR
(
"computing weights for interval ["
<<
begintime
<<
" : "
<<
begintime
+
(
long
)(
compute_interval
-
1
)
<<
"]"
);
if
(
pointing
.
time
()
<
begintime
+
(
long
)
compute_interval
)
{
// for all pointing in the queue
while
(
!
m_pointing_queue
.
empty
())
{
Pointing
pointing
=
m_pointing_queue
.
top
();
m_pointing_queue
.
pop
();
// remove from queue
LOG_INFO_STR
(
"Process pointing for time "
<<
pointing
.
time
());
//
// insert converted LM coordinate at correct
// position in the m_lmns array
//
register
int
tsec
=
pointing
.
time
().
sec
()
-
begintime
.
sec
();
// Deadline missed?
if
(
pointing
.
time
()
<
begintime
)
{
// print warning but execute the command anyway as soon as possible.
LOG_WARN_STR
(
"Deadline missed by "
<<
(
begintime
.
sec
()
-
pointing
.
time
().
sec
())
<<
" seconds ("
<<
pointing
.
angle0
()
<<
","
<<
pointing
.
angle1
()
<<
") "
<<
"@ "
<<
pointing
.
time
());
if
(
(
tsec
<
0
)
||
(
tsec
>=
compute_interval
)
)
{
pointing
.
setTime
(
begintime
);
}
LOG_ERROR_STR
(
"
\n
invalid point
in
g
t
ime"
<<
pointing
.
time
());
continue
;
}
// with
in t
his period?
if
(
pointing
.
time
()
<
begintime
+
(
long
)
compute_interval
)
{
m_pointing_queue
.
pop
();
// remove from queue
track
[
tsec
]
=
pointing
;
pset
[
tsec
]
=
true
;
// insert converted LM coordinate at correct
// position in the m_lmns array
register
int
tsec
=
pointing
.
time
().
sec
()
-
begintime
.
sec
();
m_pointing
=
pointing
;
// remember current pointing
}
else
{
// done with this period
break
;
}
}
if
(
(
tsec
<
0
)
||
(
tsec
>=
compute_interval
)
)
{
LOG_ERROR_STR
(
"
\n
invalid pointing time"
<<
pointing
.
time
());
continue
;
}
//
// track array will have unset values because
// there are not necessarily pointings at each second
// these holes are fixed up in this loop
// and each pointing is converted to LMN coordinates
//
for
(
int
t
=
0
;
t
<
compute_interval
;
++
t
)
{
track
[
tsec
]
=
pointing
;
pset
[
tsec
]
=
true
;
if
(
!
pset
[
t
])
{
track
[
t
]
=
current_pointing
;
}
else
{
current_pointing
=
track
[
t
];
}
m_pointing
=
pointing
;
// remember current pointing
}
else
{
// done with this period
break
;
}
}
/* set time and convert to LMN */
track
[
t
].
setTime
(
begintime
+
(
long
)
t
);
blitz
::
Array
<
double
,
1
>
loc
=
getSubarray
().
getGeoLoc
();
Position
location
((
loc
(
0
)
*
M_PI
)
/
180.0
,
// location must be in WGS84 radians/meters
(
loc
(
1
)
*
M_PI
)
/
180.0
,
loc
(
2
),
Position
::
WGS84
);
LOG_DEBUG_STR
(
"Geographical location "
<<
loc
);
Pointing
lmn
=
track
[
t
].
convertToLMN
(
conv
,
&
location
);
/* store in m_lmns and calculate normalized n-coordinate */
m_lmns
(
t
,
0
)
=
lmn
.
angle0
();
m_lmns
(
t
,
1
)
=
lmn
.
angle1
();
m_lmns
(
t
,
2
)
=
::
sqrt
(
1.0
-
((
m_lmns
(
t
,
0
)
*
m_lmns
(
t
,
0
))
+
(
m_lmns
(
t
,
1
)
*
m_lmns
(
t
,
1
))));
//
// track array will have unset values because
// there are not necessarily pointings at each second
// these holes are fixed up in this loop
// and each pointing is converted to LMN coordinates
//
for
(
int
t
=
0
;
t
<
compute_interval
;
++
t
)
{
if
(
!
pset
[
t
])
{
track
[
t
]
=
current_pointing
;
}
else
{
current_pointing
=
track
[
t
];
}
/* set time and convert to LMN */
track
[
t
].
setTime
(
begintime
+
(
long
)
t
);
blitz
::
Array
<
double
,
1
>
loc
=
getSubarray
().
getGeoLoc
();
// location must be in WGS84 radians/meters
Position
location
((
loc
(
0
)
*
M_PI
)
/
180.0
,
(
loc
(
1
)
*
M_PI
)
/
180.0
,
loc
(
2
),
Position
::
WGS84
);
LOG_DEBUG_STR
(
"Geographical location "
<<
loc
);
Pointing
lmn
=
track
[
t
].
convertToLMN
(
conv
,
&
location
);
/* store in m_lmns and calculate normalized n-coordinate */
m_lmns
(
t
,
0
)
=
lmn
.
angle0
();
m_lmns
(
t
,
1
)
=
lmn
.
angle1
();
m_lmns
(
t
,
2
)
=
::
sqrt
(
1.0
-
((
m_lmns
(
t
,
0
)
*
m_lmns
(
t
,
0
))
+
(
m_lmns
(
t
,
1
)
*
m_lmns
(
t
,
1
))));
#if 0
if ((fabs(m_lmns(t,0)) > 1.0 + eps) || (fabs(m_lmns(t,1)) > 1.0 + eps)) {
if ((fabs(m_lmns(t,0)) > 1.0 + eps) || (fabs(m_lmns(t,1)) > 1.0 + eps)) {
LOG_WARN("\nl or m coordinate out of range -1.0 < l < 1.0, setting to (l,m) to (0.0, 0.0)\n");
m_lmns(t,0) = 0.0;
m_lmns(t,1) = 0.0;
m_lmns(t,2) = 1.0;
}
LOG_WARN("\nl or m coordinate out of range -1.0 < l < 1.0, setting to (l,m) to (0.0, 0.0)\n");
m_lmns(t,0) = 0.0;
m_lmns(t,1) = 0.0;
m_lmns(t,2) = 1.0;
}
#endif
LOG_INFO_STR
(
formatString
(
"direction=(%f,%f,%f) @ "
,
m_lmns
(
t
,
0
),
m_lmns
(
t
,
1
),
m_lmns
(
t
,
2
))
<<
track
[
t
].
time
());
}
LOG_INFO_STR
(
formatString
(
"direction=(%f,%f,%f) @ "
,
m_lmns
(
t
,
0
),
m_lmns
(
t
,
1
),
m_lmns
(
t
,
2
))
<<
track
[
t
].
time
());
}
LOG_DEBUG_STR
(
"Current pointing ("
<<
current_pointing
.
angle0
()
<<
", "
<<
current_pointing
.
angle1
()
<<
") @ time "
<<
current_pointing
.
time
());
//logPointing(current_pointing);
LOG_DEBUG_STR
(
"Current pointing ("
<<
current_pointing
.
angle0
()
<<
", "
<<
current_pointing
.
angle1
()
<<
") @ time "
<<
current_pointing
.
time
());
//logPointing(current_pointing);
return
0
;
return
0
;
}
//
// getLMNCoordinates()
//
const
Array
<
double
,
2
>&
Beam
::
getLMNCoordinates
()
const
{
return
m_lmns
;
}
//
// getSPW()
//
const
CAL
::
SpectralWindow
&
Beam
::
getSPW
()
const
{
return
m_array
.
getSPW
();
}
// -------------------- Beams --------------------
//
// Beams(nrBeamlets, nrSubbands)
//
Beams
::
Beams
(
int
nbeamlets
,
int
nsubbands
)
:
m_beamlets
(
nbeamlets
),
m_nsubbands
(
nsubbands
)
{
}
//
// ~Beams()
//
Beams
::~
Beams
()
{
for
(
map
<
Beam
*
,
uint32
>::
iterator
bi
=
m_beams
.
begin
();
bi
!=
m_beams
.
end
();
++
bi
)
...
...
@@ -369,6 +416,9 @@ Beams::~Beams()
m_beams
.
clear
();
}
//
// get(nodeid, subarrayname, beamletAllocation)
//
Beam
*
Beams
::
get
(
string
nodeid
,
string
subarrayname
,
Beamlet2SubbandMap
allocation
)
{
Beam
*
beam
=
new
Beam
(
nodeid
,
subarrayname
,
m_nsubbands
);
...
...
@@ -387,12 +437,18 @@ Beam* Beams::get(string nodeid, string subarrayname, Beamlet2SubbandMap allocati
return
beam
;
}
//
// setCalibrationHandle(beam, handle)
//
void
Beams
::
setCalibrationHandle
(
Beam
*
beam
,
uint32
handle
)
{
m_handle2beam
[
handle
]
=
beam
;
m_beams
[
beam
]
=
handle
;
}
//
// findCalibrationHandle(beam)
//
uint32
Beams
::
findCalibrationHandle
(
Beam
*
beam
)
const
{
map
<
Beam
*
,
uint32
>::
const_iterator
it
=
m_beams
.
find
(
beam
);
...
...
@@ -404,6 +460,9 @@ uint32 Beams::findCalibrationHandle(Beam* beam) const
return
0
;
}
//
// updateCalibration(handle, gains)
//
bool
Beams
::
updateCalibration
(
uint32
handle
,
CAL
::
AntennaGains
&
gains
)
{
map
<
uint32
,
Beam
*>::
iterator
it
=
m_handle2beam
.
find
(
handle
);
...
...
@@ -415,6 +474,9 @@ bool Beams::updateCalibration(uint32 handle, CAL::AntennaGains& gains)
return
true
;
}
//
// exists(beam)
//
bool
Beams
::
exists
(
Beam
*
beam
)
{
// if beam not found, return 0
...
...
@@ -425,6 +487,9 @@ bool Beams::exists(Beam *beam)
return
true
;
}
//
// destroy(beam)
//
bool
Beams
::
destroy
(
Beam
*
beam
)
{
// remove from handle2beam map
...
...
@@ -445,6 +510,9 @@ bool Beams::destroy(Beam* beam)
return
false
;
}
//
// calculate_weigths(time, interval, weights, AMCConverter)
//
void
Beams
::
calculate_weights
(
Timestamp
timestamp
,
int
compute_interval
,
blitz
::
Array
<
std
::
complex
<
double
>
,
3
>&
weights
,
...
...
@@ -462,6 +530,9 @@ void Beams::calculate_weights(Timestamp timestamp,
m_beamlets
.
calculate_weights
(
weights
);
}
//
// getSubbandSelection()
//
Beamlet2SubbandMap
Beams
::
getSubbandSelection
()
{
Beamlet2SubbandMap
selection
;
...
...
This diff is collapsed.
Click to expand it.
MAC/APL/PAC/BeamServer/src/Beam.h
+
2
−
0
View file @
8d364ca0
...
...
@@ -251,6 +251,8 @@ namespace LOFAR {
static
const
int
N_TIMESTEPS
=
20
;
// number of timesteps to calculate ahead
};
// ------------------------------ Class Beams ------------------------------
/**
* Factory class for Beam. This class manages the collection of Beams
* that are active in the BeamServer at a particular point in time.
...
...
This diff is collapsed.
Click to expand it.
MAC/APL/PAC/BeamServer/src/BeamServer.cc
+
91
−
31
View file @
8d364ca0
...
...
@@ -107,6 +107,9 @@ void BeamServer::parseOptions(int argc,
}
// for loop
}
//
// BeamServer(name, argc, argv)
//
BeamServer
::
BeamServer
(
string
name
,
int
argc
,
char
**
argv
)
:
GCFTask
((
State
)
&
BeamServer
::
initial
,
name
),
m_beams_modified
(
false
),
...
...
@@ -132,14 +135,23 @@ BeamServer::BeamServer(string name, int argc, char** argv)
m_calserver
.
init
(
*
this
,
MAC_SVCMASK_CALSERVER
+
instanceID
,
GCFPortInterface
::
SAP
,
CAL_PROTOCOL
);
}
//
// ~BeamServer
//
BeamServer
::~
BeamServer
()
{}
//
// isEnabled()
//
bool
BeamServer
::
isEnabled
()
{
return
m_rspdriver
.
isConnected
()
&&
m_calserver
.
isConnected
();
}
//
// initial(event, port)
//
GCFEvent
::
TResult
BeamServer
::
initial
(
GCFEvent
&
e
,
GCFPortInterface
&
port
)
{
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
...
...
@@ -165,8 +177,7 @@ GCFEvent::TResult BeamServer::initial(GCFEvent& e, GCFPortInterface& port)
case
F_CONNECTED
:
{
LOG_INFO
(
formatString
(
"CONNECTED: port '%s' connected"
,
port
.
getName
().
c_str
()));
if
(
isEnabled
())
{
if
(
isEnabled
())
{
RSPGetconfigEvent
getconfig
;
m_rspdriver
.
send
(
getconfig
);
}
...
...
@@ -224,6 +235,9 @@ GCFEvent::TResult BeamServer::initial(GCFEvent& e, GCFPortInterface& port)
return
status
;
}
//
// undertaker()
//
void
BeamServer
::
undertaker
()
{
for
(
list
<
GCFPortInterface
*>::
iterator
it
=
m_dead_clients
.
begin
();
...
...
@@ -236,14 +250,16 @@ void BeamServer::undertaker()
m_dead_clients
.
clear
();
}
//
// destroyAllBeams(port)
//
void
BeamServer
::
destroyAllBeams
(
GCFPortInterface
*
port
)
{
ASSERT
(
port
);
// deallocate all beams for this client
for
(
set
<
Beam
*>::
iterator
beamit
=
m_client_beams
[
port
].
begin
();
beamit
!=
m_client_beams
[
port
].
end
();
++
beamit
)
{
beamit
!=
m_client_beams
[
port
].
end
();
++
beamit
)
{
if
(
!
m_beams
.
destroy
(
*
beamit
))
{
LOG_WARN
(
"Beam not found..."
);
}
...
...
@@ -251,6 +267,9 @@ void BeamServer::destroyAllBeams(GCFPortInterface* port)
m_client_beams
.
erase
(
port
);
}
//
// newBeam(beamTransaction, port , name, subarray, beamletAllocation)
//
Beam
*
BeamServer
::
newBeam
(
BeamTransaction
&
bt
,
GCFPortInterface
*
port
,
std
::
string
name
,
std
::
string
subarrayname
,
BS_Protocol
::
Beamlet2SubbandMap
allocation
)
{
...
...
@@ -282,6 +301,9 @@ Beam* BeamServer::newBeam(BeamTransaction& bt, GCFPortInterface* port,
return
(
beam
);
}
//
// deleteBeam(beamTransaction)
//
void
BeamServer
::
deleteBeam
(
BeamTransaction
&
bt
)
{
ASSERT
(
bt
.
getPort
()
&&
bt
.
getBeam
());
...
...
@@ -301,6 +323,9 @@ void BeamServer::deleteBeam(BeamTransaction& bt)
m_beams_modified
=
true
;
}
//
// enabled(event, port)
//
GCFEvent
::
TResult
BeamServer
::
enabled
(
GCFEvent
&
e
,
GCFPortInterface
&
port
)
{
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
...
...
@@ -464,6 +489,9 @@ GCFEvent::TResult BeamServer::enabled(GCFEvent& e, GCFPortInterface& port)
return
status
;
}
//
// cleanup(event, port)
//
GCFEvent
::
TResult
BeamServer
::
cleanup
(
GCFEvent
&
e
,
GCFPortInterface
&
port
)
{
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
...
...
@@ -536,6 +564,9 @@ GCFEvent::TResult BeamServer::cleanup(GCFEvent& e, GCFPortInterface& port)
return
status
;
}
//
// beamalloc_state(event, port)
//
GCFEvent
::
TResult
BeamServer
::
beamalloc_state
(
GCFEvent
&
e
,
GCFPortInterface
&
port
)
{
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
...
...
@@ -620,6 +651,9 @@ GCFEvent::TResult BeamServer::beamalloc_state(GCFEvent& e, GCFPortInterface& por
return
status
;
}
//
// beamfree_state(event, port)
//
GCFEvent
::
TResult
BeamServer
::
beamfree_state
(
GCFEvent
&
e
,
GCFPortInterface
&
port
)
{
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
...
...
@@ -692,6 +726,9 @@ GCFEvent::TResult BeamServer::beamfree_state(GCFEvent& e, GCFPortInterface& port
return
status
;
}
//
// beamalloc_start(AllocEvent, port)
//
bool
BeamServer
::
beamalloc_start
(
BSBeamallocEvent
&
ba
,
GCFPortInterface
&
port
)
{
...
...
@@ -713,6 +750,9 @@ bool BeamServer::beamalloc_start(BSBeamallocEvent& ba,
return
true
;
}
//
// beamfree_start(freeEvent, port)
//
bool
BeamServer
::
beamfree_start
(
BSBeamfreeEvent
&
bf
,
GCFPortInterface
&
port
)
{
...
...
@@ -737,33 +777,37 @@ bool BeamServer::beamfree_start(BSBeamfreeEvent& bf,
return
true
;
}
//
// beampointto_action(pointEvent, port)
//
bool
BeamServer
::
beampointto_action
(
BSBeampointtoEvent
&
pt
,
GCFPortInterface
&
/*port*/
)
GCFPortInterface
&
/*port*/
)
{
bool
status
=
true
;
Beam
*
beam
=
(
Beam
*
)
pt
.
handle
;
Beam
*
beam
=
(
Beam
*
)
pt
.
handle
;
if
(
m_beams
.
exists
(
beam
))
{
LOG_INFO_STR
(
"new coordinates for "
<<
beam
->
getName
()
<<
": "
<<
pt
.
pointing
.
angle0
()
<<
", "
<<
pt
.
pointing
.
angle1
()
<<
", time="
<<
pt
.
pointing
.
time
());
// check if beam exists.
if
(
!
m_beams
.
exists
(
beam
))
{
LOG_ERROR
(
formatString
(
"BEAMPOINTTO: invalid beam handle (%d)"
,
pt
.
handle
));
return
(
false
);
}
//
// If the time is not set, then activate the command
// 2 * COMPUTE_INTERVAL seconds from now, because that's how
// long it takes the command to flow through the pipeline.
//
Timestamp
actualtime
;
actualtime
.
setNow
(
2
*
COMPUTE_INTERVAL
);
if
(
Timestamp
(
0
,
0
)
==
pt
.
pointing
.
time
())
pt
.
pointing
.
setTime
(
actualtime
);
beam
->
addPointing
(
pt
.
pointing
);
}
else
{
LOG_ERROR
(
formatString
(
"BEAMPOINTTO: invalid beam handle (%d)"
,
pt
.
handle
));
status
=
false
;
}
LOG_INFO_STR
(
"new coordinates for "
<<
beam
->
getName
()
<<
": "
<<
pt
.
pointing
.
angle0
()
<<
", "
<<
pt
.
pointing
.
angle1
()
<<
", time="
<<
pt
.
pointing
.
time
());
//
// If the time is not set, then activate the command
// 2 * COMPUTE_INTERVAL seconds from now, because that's how
// long it takes the command to flow through the pipeline.
//
Timestamp
actualtime
;
actualtime
.
setNow
(
2
*
COMPUTE_INTERVAL
);
if
(
Timestamp
(
0
,
0
)
==
pt
.
pointing
.
time
())
{
pt
.
pointing
.
setTime
(
actualtime
);
}
beam
->
addPointing
(
pt
.
pointing
);
return
status
;
return
(
true
)
;
}
BZ_DECLARE_FUNCTION_RET
(
convert2complex_int16_t
,
complex
<
int16_t
>
)
...
...
@@ -777,11 +821,12 @@ inline complex<int16_t> convert2complex_int16_t(complex<double> cd)
(
int16_t
)(
round
(
cd
.
imag
()
*
g_bf_gain
)));
}
/**
* This method is called once every period
* of COMPUTE_INTERVAL seconds
* to calculate the weights for all beamlets.
*/
//
// compute_weights(time)
//
// This method is called once every period of COMPUTE_INTERVAL seconds
// to calculate the weights for all beamlets.
//
void
BeamServer
::
compute_weights
(
Timestamp
time
)
{
// calculate weights for all beamlets
...
...
@@ -793,6 +838,9 @@ void BeamServer::compute_weights(Timestamp time)
LOG_DEBUG
(
formatString
(
"sizeof(m_weights16) = %d"
,
m_weights16
.
size
()
*
sizeof
(
int16_t
)));
}
//
// send_weights(time)
//
void
BeamServer
::
send_weights
(
Timestamp
time
)
{
...
...
@@ -816,6 +864,9 @@ void BeamServer::send_weights(Timestamp time)
}
}
//
// send_sbselection()
//
void
BeamServer
::
send_sbselection
()
{
if
(
!
GET_CONFIG
(
"BeamServer.DISABLE_SETSUBBANDS"
,
i
))
{
...
...
@@ -866,6 +917,9 @@ void BeamServer::send_sbselection()
}
}
//
// defer(event, port)
//
void
BeamServer
::
defer
(
GCFEvent
&
e
,
GCFPortInterface
&
p
)
{
char
*
event
=
new
char
[
sizeof
(
e
)
+
e
.
length
];
...
...
@@ -874,6 +928,9 @@ void BeamServer::defer(GCFEvent& e, GCFPortInterface& p)
LOG_DEBUG_STR
(
">>> deferring event "
<<
m_deferred_queue
.
size
()
<<
" <<<"
);
}
//
// recall(port)
//
GCFEvent
::
TResult
BeamServer
::
recall
(
GCFPortInterface
&
/*p*/
)
{
GCFEvent
::
TResult
status
=
GCFEvent
::
NOT_HANDLED
;
...
...
@@ -889,6 +946,9 @@ GCFEvent::TResult BeamServer::recall(GCFPortInterface& /*p*/)
return
status
;
}
//
// main
//
int
main
(
int
argc
,
char
**
argv
)
{
/* daemonize if required */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment