baseline acs mode tree done

This commit is contained in:
Robin Müller 2022-04-25 10:08:29 +02:00
parent baa6f05f8e
commit bbb4ba2191
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -20,100 +20,284 @@ auto ACS_TABLE_OFF_TRANS =
std::make_pair((acs::CtrlModes::OFF << 8) | 2, FixedArrayList<ModeListEntry, 6>());
auto ACS_SEQUENCE_DETUMBLE =
std::make_pair(acs::CtrlModes::DETUMBLE, FixedArrayList<ModeListEntry, 2>());
std::make_pair(acs::CtrlModes::DETUMBLE, FixedArrayList<ModeListEntry, 3>());
auto ACS_TABLE_DETUMBLE_TGT =
std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 1, FixedArrayList<ModeListEntry, 3>());
std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 1, FixedArrayList<ModeListEntry, 4>());
auto ACS_TABLE_DETUMBLE_TRANS_0 =
std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 2, FixedArrayList<ModeListEntry, 5>());
auto ACS_TABLE_DETUMBLE_TRANS_1 =
std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 3, FixedArrayList<ModeListEntry, 1>());
auto ACS_SEQUENCE_SAFE =
std::make_pair(acs::CtrlModes::SAFE, FixedArrayList<ModeListEntry, 3>());
auto ACS_TABLE_SAFE_TGT =
std::make_pair((acs::CtrlModes::SAFE << 8) | 1, FixedArrayList<ModeListEntry, 4>());
auto ACS_TABLE_SAFE_TRANS_0 =
std::make_pair((acs::CtrlModes::SAFE << 8) | 2, FixedArrayList<ModeListEntry, 5>());
auto ACS_TABLE_SAFE_TRANS_1 =
std::make_pair((acs::CtrlModes::SAFE << 8) | 3, FixedArrayList<ModeListEntry, 1>());
auto ACS_SEQUENCE_IDLE =
std::make_pair(acs::CtrlModes::IDLE, FixedArrayList<ModeListEntry, 3>());
auto ACS_TABLE_IDLE_TGT =
std::make_pair((acs::CtrlModes::IDLE << 8) | 1, FixedArrayList<ModeListEntry, 5>());
auto ACS_TABLE_IDLE_TRANS_0 =
std::make_pair((acs::CtrlModes::IDLE << 8) | 2, FixedArrayList<ModeListEntry, 5>());
auto ACS_TABLE_IDLE_TRANS_1 =
std::make_pair((acs::CtrlModes::IDLE << 8) | 3, FixedArrayList<ModeListEntry, 1>());
auto ACS_SEQUENCE_TARGET_PT =
std::make_pair(acs::CtrlModes::TARGET_PT, FixedArrayList<ModeListEntry, 3>());
auto ACS_TABLE_TARGET_PT_TGT =
std::make_pair((acs::CtrlModes::TARGET_PT << 8) | 1, FixedArrayList<ModeListEntry, 5>());
auto ACS_TABLE_TARGET_PT_TRANS_0 =
std::make_pair((acs::CtrlModes::TARGET_PT << 8) | 2, FixedArrayList<ModeListEntry, 5>());
auto ACS_TABLE_TARGET_PT_TRANS_1 =
std::make_pair((acs::CtrlModes::TARGET_PT << 8) | 3, FixedArrayList<ModeListEntry, 1>());
enum InsertType {
TABLE,
SEQ
};
void satsystem::acsSubsystemInit() {
ModeListEntry entry;
Subsystem* acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 20, 20);
buildOffSequence(acsSubsystem, entry);
buildSafeSequence(acsSubsystem, entry);
buildDetumbleSequence(acsSubsystem, entry);
buildIdleSequence(acsSubsystem, entry);
buildTargetPtSequence(acsSubsystem, entry);
acsSubsystem->setInitialMode(HasModesIF::MODE_OFF);
}
void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildOffSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
CHK(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&]( ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc);
};
auto ih = [&](object_id_t obj, Mode_t mode, Submode_t submode,
// OFF Target table is empty
ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true);
// Build OFF transition
iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
iht(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
iht(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
iht(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true);
// Build OFF sequence
ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false);
ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS.first, 0, false);
ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, false,
true);
}
void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildSafeSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
ArrayList<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&]( ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc);
};
// Build SAFE target
iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TGT.second);
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TGT.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second);
ss->addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_OFF_TGT.first, false, true);
// Build OFF transition
ih(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
ih(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second);
// Build SAFE transition 0
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TRANS_0.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TRANS_0.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TRANS_0.second);
iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second);
iht(objects::RW_ASS, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second);
ss->addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true);
// Build OFF sequence
eh.setTableId(ACS_TABLE_OFF_TGT.first);
eh.setWaitSeconds(0);
eh.setCheckSuccess(false);
CHK(ACS_SEQUENCE_OFF.second.insert(eh), ctxc);
// Build SAFE transition 1
iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second);
ss->addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true);
eh.setTableId(ACS_TABLE_OFF_TRANS.first);
eh.setWaitSeconds(0);
eh.setCheckSuccess(false);
CHK(ACS_SEQUENCE_OFF.second.insert(eh), ctxc);
// Build OFF target
ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true);
ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true);
ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, false,
// Build SAFE sequence
ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TGT.first, 0, false);
ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_0.first, 0, false);
ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_1.first, 0, false);
ss->addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_OFF.first, false,
true);
}
void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildDetumbleSequence";
auto ctxc = context.c_str();
auto ih = [&](object_id_t obj, Mode_t mode, Submode_t submode,
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
ArrayList<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&]( ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc);
};
// Build DETUMBLE target
ih(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second);
ih(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
ih(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
ih(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second);
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second);
ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true);
// Build DETUMBLE transition 0
ih(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
ih(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
ih(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
ih(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
ih(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
iht(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, true);
// Build DETUMBLE transition 1
ih(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second);
// Build full sequence
ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, true);
iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second);
ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, true);
// Build DETUMBLE sequence
ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TGT.first, 0, false);
ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_0.first, 0, false);
ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_1.first, 0, false);
ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first,
ACS_SEQUENCE_DETUMBLE.first, false, true);
}
void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {}
void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {}
void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildIdleSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
ArrayList<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&]( ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc);
};
// Build IDLE target
iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_IDLE_TGT.second);
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_TGT.second);
iht(objects::RW_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second);
ss->addTable(&ACS_TABLE_IDLE_TGT.second, ACS_TABLE_IDLE_TGT.first, false, true);
void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {}
// Build IDLE transition 0
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
iht(objects::RW_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second);
ss->addTable(&ACS_TABLE_IDLE_TRANS_0.second, ACS_TABLE_IDLE_TRANS_0.first, false, true);
// Build IDLE transition 1
iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second);
ss->addTable(&ACS_TABLE_IDLE_TRANS_1.second, ACS_TABLE_IDLE_TRANS_1.first, false, true);
// Build IDLE sequence
ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TGT.first, 0, false);
ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_0.first, 0, false);
ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_1.first, 0, false);
ss->addSequence(&ACS_SEQUENCE_IDLE.second, ACS_SEQUENCE_IDLE.first,
ACS_SEQUENCE_IDLE.first, false, true);
}
void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {
std::string context = "satsystem::buildTargetPtSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode,
ArrayList<ModeListEntry>& sequence) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
CHK(sequence.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&]( ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
CHK(sequence.insert(eh), ctxc);
};
// Build TARGET PT table
iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TGT.second);
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second);
ss->addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true);
// Build TARGET PT transition 0
iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second);
ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false, true);
// Build TARGET PT transition 1
iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TRANS_1.second);
ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false, true);
// Build IDLE sequence
ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TGT.first, 0, false);
ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_0.first, 0, false);
ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_1.first, 0, false);
ss->addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first,
ACS_SEQUENCE_TARGET_PT.first, false, true);
}
void satsystem::checkInsert(ReturnValue_t result, const char* ctx) {
if (result != HasReturnvaluesIF::RETURN_OK) {