#include "acsModeTree.h" #include #include #include #include #include #include #include "eive/objects.h" #include "mission/acsDefs.h" #include "mission/system/objects/definitions.h" #include "util.h" AcsSubsystem satsystem::acs::ACS_SUBSYSTEM(objects::ACS_SUBSYSTEM, 12, 24); namespace { // Alias for checker function const auto check = subsystem::checkInsert; void buildOffSequence(Subsystem& ss, ModeListEntry& eh); void buildDetumbleSequence(Subsystem& ss, ModeListEntry& entryHelper); void buildSafeSequence(Subsystem& ss, ModeListEntry& entryHelper); void buildIdleSequence(Subsystem& ss, ModeListEntry& entryHelper); void buildTargetPtNadirSequence(Subsystem& ss, ModeListEntry& eh); void buildTargetPtSequence(Subsystem& ss, ModeListEntry& entryHelper); void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& entryHelper); void buildTargetPtInertialSequence(Subsystem& ss, ModeListEntry& entryHelper); } // namespace static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; auto SUS_BOARD_NML_TRANS = std::make_pair(0x20, FixedArrayList()); auto ACS_SEQUENCE_OFF = std::make_pair(acs::AcsMode::OFF, FixedArrayList()); auto ACS_TABLE_OFF_TGT = std::make_pair((acs::AcsMode::OFF << 24) | 1, FixedArrayList()); auto ACS_TABLE_OFF_TRANS_0 = std::make_pair((acs::AcsMode::OFF << 24) | 2, FixedArrayList()); auto ACS_TABLE_OFF_TRANS_1 = std::make_pair((acs::AcsMode::OFF << 24) | 3, FixedArrayList()); auto ACS_SEQUENCE_DETUMBLE = std::make_pair(acs::AcsMode::DETUMBLE, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TGT = std::make_pair((acs::AcsMode::DETUMBLE << 24) | 1, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TRANS_0 = std::make_pair((acs::AcsMode::DETUMBLE << 24) | 2, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TRANS_1 = std::make_pair((acs::AcsMode::DETUMBLE << 24) | 3, FixedArrayList()); auto ACS_SEQUENCE_SAFE = std::make_pair(acs::AcsMode::SAFE, FixedArrayList()); auto ACS_TABLE_SAFE_TGT = std::make_pair((acs::AcsMode::SAFE << 24) | 1, FixedArrayList()); auto ACS_TABLE_SAFE_TRANS_0 = std::make_pair((acs::AcsMode::SAFE << 24) | 2, FixedArrayList()); auto ACS_TABLE_SAFE_TRANS_1 = std::make_pair((acs::AcsMode::SAFE << 24) | 3, FixedArrayList()); auto ACS_SEQUENCE_IDLE = std::make_pair(acs::AcsMode::PTG_IDLE, FixedArrayList()); auto ACS_TABLE_IDLE_TGT = std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 1, FixedArrayList()); auto ACS_TABLE_IDLE_TRANS_0 = std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 2, FixedArrayList()); auto ACS_TABLE_IDLE_TRANS_1 = std::make_pair((acs::AcsMode::PTG_IDLE << 24) | 3, FixedArrayList()); auto ACS_TABLE_PTG_TRANS_0 = std::make_pair((acs::AcsMode::PTG_TARGET << 24) | 2, FixedArrayList()); auto ACS_SEQUENCE_PTG_TARGET = std::make_pair(acs::AcsMode::PTG_TARGET, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_TGT = std::make_pair((acs::AcsMode::PTG_TARGET << 24) | 1, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_TRANS_1 = std::make_pair((acs::AcsMode::PTG_TARGET << 24) | 3, FixedArrayList()); auto ACS_SEQUENCE_PTG_TARGET_GS = std::make_pair(acs::AcsMode::PTG_TARGET_GS, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_GS_TGT = std::make_pair((acs::AcsMode::PTG_TARGET_GS << 24) | 1, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_GS_TRANS_1 = std::make_pair((acs::AcsMode::PTG_TARGET_GS << 24) | 3, FixedArrayList()); auto ACS_SEQUENCE_PTG_TARGET_NADIR = std::make_pair(acs::AcsMode::PTG_NADIR, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_NADIR_TGT = std::make_pair((acs::AcsMode::PTG_NADIR << 24) | 1, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_NADIR_TRANS_1 = std::make_pair((acs::AcsMode::PTG_NADIR << 24) | 3, FixedArrayList()); auto ACS_SEQUENCE_PTG_TARGET_INERTIAL = std::make_pair(acs::AcsMode::PTG_INERTIAL, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_INERTIAL_TGT = std::make_pair((acs::AcsMode::PTG_INERTIAL << 24) | 1, FixedArrayList()); auto ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1 = std::make_pair((acs::AcsMode::PTG_INERTIAL << 24) | 3, FixedArrayList()); Subsystem& satsystem::acs::init() { ModeListEntry entry; const char* ctxc = "satsystem::acs::init: generic target"; // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table, bool allowAllSubmodes = false) { entry.setObject(obj); entry.setMode(mode); entry.setSubmode(submode); if (allowAllSubmodes) { entry.allowAllSubmodes(); } check(table.insert(entry), "satsystem::acs::init: generic target"); }; // Build TARGET PT transition 0 iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_PTG_TRANS_0.second); iht(objects::SUS_BOARD_ASS, NML, duallane::A_SIDE, ACS_TABLE_PTG_TRANS_0.second, true); iht(objects::ACS_BOARD_ASS, NML, duallane::A_SIDE, ACS_TABLE_PTG_TRANS_0.second, true); iht(objects::RW_ASSY, NML, 0, ACS_TABLE_PTG_TRANS_0.second); iht(objects::STR_ASSY, NML, 0, ACS_TABLE_PTG_TRANS_0.second); check(ACS_SUBSYSTEM.addTable( TableEntry(ACS_TABLE_PTG_TRANS_0.first, &ACS_TABLE_PTG_TRANS_0.second)), ctxc); // Build SUS board transition iht(objects::SUS_BOARD_ASS, NML, duallane::A_SIDE, SUS_BOARD_NML_TRANS.second, true); check(ACS_SUBSYSTEM.addTable(TableEntry(SUS_BOARD_NML_TRANS.first, &SUS_BOARD_NML_TRANS.second)), ctxc); buildOffSequence(ACS_SUBSYSTEM, entry); buildSafeSequence(ACS_SUBSYSTEM, entry); buildDetumbleSequence(ACS_SUBSYSTEM, entry); buildIdleSequence(ACS_SUBSYSTEM, entry); buildTargetPtSequence(ACS_SUBSYSTEM, entry); buildTargetPtGsSequence(ACS_SUBSYSTEM, entry); buildTargetPtNadirSequence(ACS_SUBSYSTEM, entry); buildTargetPtInertialSequence(ACS_SUBSYSTEM, entry); ACS_SUBSYSTEM.setInitialMode(::acs::AcsMode::SAFE); return ACS_SUBSYSTEM; } namespace { void buildOffSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::acs::buildOffSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); check(table.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); check(sequence.insert(eh), ctxc); }; // OFF Target table is empty check(ss.addTable(TableEntry(ACS_TABLE_OFF_TGT.first, &ACS_TABLE_OFF_TGT.second)), ctxc); // Build OFF transition 0 iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS_0.second); check(ss.addTable(TableEntry(ACS_TABLE_OFF_TRANS_0.first, &ACS_TABLE_OFF_TRANS_0.second)), ctxc); // Build OFF transition 1 iht(objects::IMTQ_ASSY, OFF, 0, ACS_TABLE_OFF_TRANS_1.second); iht(objects::STR_ASSY, OFF, 0, ACS_TABLE_OFF_TRANS_1.second); iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS_1.second); iht(objects::RW_ASSY, OFF, 0, ACS_TABLE_OFF_TRANS_1.second); check(ss.addTable(TableEntry(ACS_TABLE_OFF_TRANS_1.first, &ACS_TABLE_OFF_TRANS_1.second)), ctxc); // Build OFF sequence ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false); ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS_0.first, 0, false); ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS_1.first, 0, false); check(ss.addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, false, true), ctxc); } void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::acs::buildSafeSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& sequence, bool allowAllSubmodes = false) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); if (allowAllSubmodes) { eh.allowAllSubmodes(); } check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); check(sequence.insert(eh), ctxc); }; // Build SAFE target iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::SAFE, ACS_TABLE_SAFE_TGT.second); iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second, true); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second, true); check(ss.addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_SAFE_TGT.first, false, true), ctxc); // Build SAFE transition 0 iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); iht(objects::ACS_BOARD_ASS, NML, duallane::A_SIDE, ACS_TABLE_SAFE_TRANS_0.second, true); iht(objects::SUS_BOARD_ASS, NML, duallane::A_SIDE, ACS_TABLE_SAFE_TRANS_0.second, true); iht(objects::STR_ASSY, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second); iht(objects::RW_ASSY, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second); check(ss.addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true), ctxc); // SUS board transition table is defined above // Build SAFE transition 1 iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::SAFE, ACS_TABLE_SAFE_TRANS_1.second); check(ss.addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true), ctxc); // Build SAFE sequence ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TGT.first, 0, true); 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); check(ss.addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_SAFE.first, false, true), ctxc); } void buildDetumbleSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::acs::buildDetumbleSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& sequence, bool allowAllSubmodes = false) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); if (allowAllSubmodes) { eh.allowAllSubmodes(); } check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); check(sequence.insert(eh), ctxc); }; // Build DETUMBLE target iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::DETUMBLE, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second, true); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second, true); check(ss.addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true), ctxc); // Build DETUMBLE transition 0 iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); iht(objects::ACS_BOARD_ASS, NML, duallane::A_SIDE, ACS_TABLE_DETUMBLE_TRANS_0.second, true); iht(objects::SUS_BOARD_ASS, NML, duallane::A_SIDE, ACS_TABLE_DETUMBLE_TRANS_0.second, true); iht(objects::STR_ASSY, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); iht(objects::RW_ASSY, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); check(ss.addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, true), ctxc); // Build DETUMBLE transition 1 iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::DETUMBLE, ACS_TABLE_DETUMBLE_TRANS_1.second); check(ss.addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, true), ctxc); // Build DETUMBLE sequence ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TGT.first, 0, true); 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); check(ss.addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first, ACS_SEQUENCE_SAFE.first, false, true), ctxc); } void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::acs::buildIdleSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& sequence, bool allowAllSubmodes = false) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); if (allowAllSubmodes) { eh.allowAllSubmodes(); } check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); check(sequence.insert(eh), ctxc); }; // Build IDLE target iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_IDLE, ACS_TABLE_IDLE_TGT.second); iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_IDLE_TGT.second); iht(objects::RW_ASSY, NML, 0, ACS_TABLE_IDLE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second, true); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second, true); ss.addTable(&ACS_TABLE_IDLE_TGT.second, ACS_TABLE_IDLE_TGT.first, false, true); // Build IDLE transition 0 iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_IDLE_TRANS_0.second); iht(objects::ACS_BOARD_ASS, NML, duallane::A_SIDE, ACS_TABLE_IDLE_TRANS_0.second, true); iht(objects::SUS_BOARD_ASS, NML, duallane::A_SIDE, ACS_TABLE_IDLE_TRANS_0.second, true); iht(objects::RW_ASSY, NML, 0, ACS_TABLE_IDLE_TRANS_0.second); iht(objects::STR_ASSY, NML, 0, ACS_TABLE_IDLE_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, NML, acs::AcsMode::PTG_IDLE, ACS_TABLE_IDLE_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, true); ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_1.first, 0, true); ss.addSequence(&ACS_SEQUENCE_IDLE.second, ACS_SEQUENCE_IDLE.first, ACS_SEQUENCE_SAFE.first, false, true); } void buildTargetPtSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::acs::buildTargetPtSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& sequence, bool allowAllSubmodes = false) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); if (allowAllSubmodes) { eh.allowAllSubmodes(); } check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); check(sequence.insert(eh), ctxc); }; // Build TARGET PT table iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_TARGET, ACS_TABLE_PTG_TARGET_TGT.second); iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second, true); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second, true); iht(objects::RW_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); iht(objects::STR_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_TGT.second); check(ss.addTable(&ACS_TABLE_PTG_TARGET_TGT.second, ACS_TABLE_PTG_TARGET_TGT.first, false, true), ctxc); // Transition 0 already built // Build TARGET PT transition 1 iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_TARGET, ACS_TABLE_PTG_TARGET_TRANS_1.second); check(ss.addTable(&ACS_TABLE_PTG_TARGET_TRANS_1.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, false, true), ctxc); // Build IDLE sequence ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TGT.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET.second, ACS_TABLE_PTG_TARGET_TRANS_1.first, 0, true); check(ss.addSequence(&ACS_SEQUENCE_PTG_TARGET.second, ACS_SEQUENCE_PTG_TARGET.first, ACS_SEQUENCE_IDLE.first, false, true), ctxc); } void buildTargetPtNadirSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::acs::buildTargetPtNadirSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& sequence, bool allowAllSubmodes = false) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); if (allowAllSubmodes) { eh.allowAllSubmodes(); } check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); check(sequence.insert(eh), ctxc); }; // Build TARGET PT table iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_TARGET, ACS_TABLE_PTG_TARGET_NADIR_TGT.second); iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second, true); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second, true); iht(objects::RW_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second); iht(objects::STR_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_NADIR_TGT.second); check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_NADIR_TGT.first, &ACS_TABLE_PTG_TARGET_NADIR_TGT.second)), ctxc); // Transition 0 already built // Build TARGET PT transition 1 iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_NADIR, ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.second); check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.first, &ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.second)), ctxc); // Build IDLE sequence ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TGT.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, SUS_BOARD_NML_TRANS.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_TABLE_PTG_TARGET_NADIR_TRANS_1.first, 0, true); check( ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_NADIR.first, &ACS_SEQUENCE_PTG_TARGET_NADIR.second, ACS_SEQUENCE_IDLE.first)), ctxc); } void buildTargetPtGsSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::acs::buildTargetPtGsSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& sequence, bool allowAllSubmodes = false) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); if (allowAllSubmodes) { eh.allowAllSubmodes(); } check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); check(sequence.insert(eh), ctxc); }; // Build TARGET PT table iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_TARGET_GS, ACS_TABLE_PTG_TARGET_GS_TGT.second); iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second, true); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second, true); iht(objects::RW_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); iht(objects::STR_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_GS_TGT.second); check(ss.addTable( TableEntry(ACS_TABLE_PTG_TARGET_GS_TGT.first, &ACS_TABLE_PTG_TARGET_GS_TGT.second)), ctxc); // Transition 0 already built // Build TARGET PT transition 1 iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_TARGET_GS, ACS_TABLE_PTG_TARGET_GS_TRANS_1.second); check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_GS_TRANS_1.first, &ACS_TABLE_PTG_TARGET_GS_TRANS_1.second)), ctxc); // Build IDLE sequence ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TARGET_GS_TGT.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, SUS_BOARD_NML_TRANS.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_TABLE_PTG_TARGET_GS_TRANS_1.first, 0, true); check(ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_GS.first, &ACS_SEQUENCE_PTG_TARGET_GS.second, ACS_SEQUENCE_IDLE.first)), ctxc); } void buildTargetPtInertialSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::acs::buildTargetPtInertialSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& sequence, bool allowAllSubmodes = false) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); if (allowAllSubmodes) { eh.allowAllSubmodes(); } check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); check(sequence.insert(eh), ctxc); }; // Build TARGET PT table iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_INERTIAL, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second); iht(objects::IMTQ_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second, true); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second, true); iht(objects::RW_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second); iht(objects::STR_ASSY, NML, 0, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second); check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_INERTIAL_TGT.first, &ACS_TABLE_PTG_TARGET_INERTIAL_TGT.second)), ctxc); // Transition 0 already built // Build TARGET PT transition 1 iht(objects::ACS_CONTROLLER, NML, acs::AcsMode::PTG_INERTIAL, ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.second); check(ss.addTable(TableEntry(ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.first, &ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.second)), ctxc); // Build IDLE sequence ihs(ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, ACS_TABLE_PTG_TARGET_INERTIAL_TGT.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, SUS_BOARD_NML_TRANS.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, ACS_TABLE_PTG_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, ACS_TABLE_PTG_TARGET_INERTIAL_TRANS_1.first, 0, true); check(ss.addSequence(SequenceEntry(ACS_SEQUENCE_PTG_TARGET_INERTIAL.first, &ACS_SEQUENCE_PTG_TARGET_INERTIAL.second, ACS_SEQUENCE_IDLE.first)), ctxc); } } // namespace