Skip to content

Commit

Permalink
fix PACMAN max message size, remove unneeded variables and properly l…
Browse files Browse the repository at this point in the history
…ink ZMQ timeout to configuration
  • Loading branch information
Jose Guillermo Panduro Vazquez committed Jul 14, 2021
1 parent ddb068c commit c9f58ad
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 33 deletions.
4 changes: 1 addition & 3 deletions plugins/PacmanCardReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ PacmanCardReader::PacmanCardReader(const std::string& name)
: DAQModule(name)
, m_configured(false)
, m_card_id(0)
, m_logical_unit(0)

{
register_command("conf", &PacmanCardReader::do_configure);
Expand Down Expand Up @@ -90,7 +89,6 @@ PacmanCardReader::do_configure(const data_t& args)
{
m_cfg = args.get<pacmancardreader::Conf>();
m_card_id = m_cfg.card_id;
m_logical_unit = m_cfg.logical_unit;

// Config checks - make some if config values needed, felix example below
/*
Expand All @@ -101,7 +99,7 @@ PacmanCardReader::do_configure(const data_t& args)

// Configure components
TLOG(TLVL_WORK_STEPS) << "Configuring ZMQLinkHandler";
m_zmqlink[0]->set_ids(m_card_id, m_logical_unit);
m_zmqlink[0]->set_ids(m_card_id, 0);
m_zmqlink[0]->conf(args);
}

Expand Down
3 changes: 1 addition & 2 deletions plugins/PacmanCardReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ class PacmanCardReader : public dunedaq::appfwk::DAQModule
module_conf_t m_cfg;

int m_card_id;
int m_logical_unit;


// ZMQLinkConcept
std::map<int, std::unique_ptr<ZMQLinkConcept>> m_zmqlink;

Expand Down
7 changes: 4 additions & 3 deletions python/lbrulibs/app_confgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ def generate(

confcmd = mrccmd("conf", "INITIAL", "CONFIGURED", [
("fake_source",pcr.Conf(
pcr.GeoID(system="kNDLarTPC")
pcr.GeoID(system="kNDLarTPC"),
zmq_receiver_timeout = 10000
)),
] + [
(f"datahandler_{idx}", dlh.Conf(
source_queue_timeout_ms= QUEUE_POP_WAIT_MS,
fake_trigger_flag=1,
latency_buffer_size = 3*CLOCK_SPEED_HZ/(25*12*DATA_RATE_SLOWDOWN_FACTOR),
latency_buffer_size = 10,#3*CLOCK_SPEED_HZ/(25*12*DATA_RATE_SLOWDOWN_FACTOR),
pop_limit_pct = 0.8,
pop_size_pct = 0.1,
apa_number = 0,
Expand All @@ -121,7 +122,7 @@ def generate(
] + [
(f"data_recorder_{idx}", bfs.Conf(
output_file = f"output_{idx}.out",
stream_buffer_size = 8388608
stream_buffer_size = 100#8388608
)) for idx in range(NUMBER_OF_DATA_PRODUCERS)
])

Expand Down
4 changes: 2 additions & 2 deletions python/lbrulibs/fake_NDreadout.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
{
"data": {
"card_id": 0,
"logical_unit": 0
"zmq_receiver_timeout": 10000
},
"match": "fake_source"
},
Expand All @@ -140,7 +140,7 @@
"num_request_handling_threads": 1,
"pop_limit_pct": 0.8,
"pop_size_pct": 0.1,
"source_queue_timeout_ms": 10000
"source_queue_timeout_ms": 100
},
"match": "datahandler_0"
},
Expand Down
6 changes: 3 additions & 3 deletions schema/lbrulibs/pacmancardreader.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ local pacmancardreader = {

conf: s.record("Conf", [
s.field("card_id", self.id, 0,
doc="Physical card identifier (in the same host)"),
doc="FE card identifier"),

s.field("logical_unit", self.count, 0,
doc="Superlogic region of selected card"),
s.field("zmq_receiver_timeout", self.id, 0,
doc="ZMQ Receive Timeout value"),

], doc="Upstream Pacman CardReader DAQ Module Configuration"),

Expand Down
21 changes: 4 additions & 17 deletions src/ZMQLinkConcept.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class ZMQLinkConcept {
public:
ZMQLinkConcept()
: m_card_id(0)
, m_logical_unit(0)
, m_link_tag(0)
{}
~ZMQLinkConcept() {}
Expand All @@ -44,28 +43,16 @@ class ZMQLinkConcept {
virtual void start(const nlohmann::json& args) = 0;
virtual void stop(const nlohmann::json& args) = 0;


void set_ids(int card, int slr) {
void set_ids(int card, int tag) {
m_card_id = card;
m_logical_unit = slr;

std::ostringstream lidstrs;
lidstrs << "ZMQLink["
<< "cid:" << std::to_string(m_card_id) << "|"
<< "slr:" << std::to_string(m_logical_unit) << "|";
//m_ZMQLink_commandLink = lidstrs.str();

std::ostringstream tidstrs;
tidstrs << "ept-" << std::to_string(m_card_id)
<< "-" << std::to_string(m_logical_unit);
//m_ZMQLink_sourceLink = tidstrs.str();
m_link_tag = tag;
}

protected:
dunedaq::lbrulibs::pacmancardreader::Conf m_cfg;
std::shared_ptr<ipm::Subscriber> m_subscriber;
std::chrono::milliseconds m_queue_timeout{1000};
std::chrono::milliseconds m_queue_timeout;
int m_card_id;
int m_logical_unit;
int m_link_tag;
std::string m_ZMQLink_commandLink = "tcp://127.0.0.1:5555";
std::string m_ZMQLink_sourceLink = "tcp://127.0.0.1:5556";
Expand Down
10 changes: 7 additions & 3 deletions src/ZMQLinkModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,24 @@ class ZMQLinkModel : public ZMQLinkConcept {

}

void conf(const data_t& /*args*/) {
void conf(const data_t& args) {
if (m_configured) {
TLOG_DEBUG(5) << "ZMQLinkModel is already configured!";
} else {

m_cfg = args.get<pacmancardreader::Conf>();

m_queue_timeout = std::chrono::milliseconds(m_cfg.zmq_receiver_timeout);

TLOG_DEBUG(5) << "ZMQLinkModel conf: initialising subscriber!";
m_subscriber = dunedaq::ipm::make_ipm_subscriber("ZmqSubscriber");
TLOG_DEBUG(5) << "ZMQLinkModel conf: connecting subscriber!";
m_subscriber->connect_for_receives({ {"connection_string", ZMQLinkConcept::m_ZMQLink_sourceLink} });
m_subscriber->connect_for_receives({ {"connection_string", m_ZMQLink_sourceLink} });
TLOG_DEBUG(5) << "ZMQLinkModel conf: enacting subscription!";
m_subscriber->subscribe("");
TLOG_DEBUG(5) << "Configuring ZMQLinkModel!";

m_parser_thread.set_name(ZMQLinkConcept::m_ZMQLink_sourceLink, ZMQLinkConcept::m_link_tag);
m_parser_thread.set_name(m_ZMQLink_sourceLink, m_link_tag);
m_configured=true;
}
}
Expand Down

0 comments on commit c9f58ad

Please sign in to comment.