-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsimulate-l0.hpp
68 lines (45 loc) · 1.88 KB
/
simulate-l0.hpp
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
#include <cassert>
#include <thread>
#include <ch_frb_io.hpp>
#include <ch_frb_io_internals.hpp>
#include "ch_frb_l1.hpp"
using namespace std;
// -------------------------------------------------------------------------------------------------
//
// l0_params
struct l0_params {
static constexpr int nfreq_coarse = ch_frb_io::constants::nfreq_coarse_tot;
l0_params(const string &filename, double gbps=1.0);
shared_ptr<ch_frb_io::intensity_network_ostream> make_ostream(int ithread, double gbps) const;
void write(ostream &os) const;
void end_streams();
void send_noise(int istream, double num_seconds);
void send_chunk_files(int istream, const std::vector<std::string> &filenames);
void send_chunks(int istream, const std::vector<std::shared_ptr<ch_frb_io::assembled_chunk> > &chunks);
std::vector<std::shared_ptr<ch_frb_io::intensity_network_ostream> > streams;
double gbps = 1.0;
int nbeams_tot = 0;
int nthreads_tot = 0;
int nfreq_fine = 0;
int nt_per_packet = 0;
// The 'ipaddr' and 'port' vectors have the same length 'nstreams'
// nstreams evenly divides nthreads.
// nstreams evenly divides nbeams.
vector<string> ipaddr;
vector<int> port;
int nstreams = 0;
// Optional params with hardcoded defaults
// Note: fpga_counts_per_sample=384 corresponds to ~1ms sampling
// Note: max_packet_size=8900 is appropriate for 9000-byte jumbo ethernet frames, minus 100 bytes for IP and UDP headers.
int fpga_counts_per_sample = 384;
int max_packet_size = 8900;
uint64_t initial_time_index = 0;
// Optional, will be assigned a reasonable default if not specified in the config file.
int nfreq_coarse_per_packet = 0;
// Derived parameters
int nupfreq = 0;
int nbeams_per_stream = 0;
int nthreads_per_stream = 0;
int nfreq_coarse_per_thread = 0;
int packet_size = 0;
};