gotthard2: bursts and burst period, written to same register as triggers and delay (kept in server as variables) and set if conditions meet. bursts and burst period only in auto timing and burst mode. Also updating theses registers when switching between timing modes or burst modes

This commit is contained in:
2020-02-25 15:45:40 +01:00
parent f902bb06ad
commit 6a0a931e3e
18 changed files with 1097 additions and 201 deletions

View File

@ -224,3 +224,58 @@ TEST_CASE("inj_ch", "[.cmd]") {
REQUIRE_THROWS(proxy.Call("inj_ch", {}, -1, GET));
}
}
TEST_CASE("bursts", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) {
auto previous = det.getNumberOfBursts().squash(1);
auto previousTrigger = det.getNumberOfTriggers().squash(1);
std::ostringstream oss_set, oss_get;
proxy.Call("bursts", {"3"}, -1, PUT, oss_set);
REQUIRE(oss_set.str() == "bursts 3\n");
// change to trigger and back (bursts should still be same)
proxy.Call("timing", {"trigger"}, -1, PUT);
proxy.Call("triggers", {"2"}, -1, PUT);
proxy.Call("timing", {"auto"}, -1, PUT);
proxy.Call("bursts", {}, -1, GET, oss_get);
REQUIRE(oss_get.str() == "bursts 3\n");
det.setNumberOfBursts(previous);
det.setNumberOfTriggers(previousTrigger);
} else {
REQUIRE_THROWS(proxy.Call("bursts", {}, -1, GET));
}
}
TEST_CASE("burstperiod", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) {
auto previous = det.getBurstPeriod();
std::ostringstream oss_set, oss_get;
proxy.Call("burstperiod", {"30ms"}, -1, PUT, oss_set);
REQUIRE(oss_set.str() == "burstperiod 30ms\n");
proxy.Call("burstperiod", {}, -1, GET, oss_get);
REQUIRE(oss_get.str() == "burstperiod 30ms\n");
// Reset all dacs to previous value
for (int i = 0; i != det.size(); ++i) {
det.setBurstPeriod(previous[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("burstperiod", {}, -1, GET));
}
}