eive-obsw/dummies/helperFactory.cpp

240 lines
12 KiB
C++
Raw Normal View History

2023-03-31 12:11:31 +02:00
#include "helperFactory.h"
2022-09-15 11:58:00 +02:00
2022-09-15 11:54:43 +02:00
#include <dummies/AcuDummy.h>
#include <dummies/BpxDummy.h>
#include <dummies/ComCookieDummy.h>
#include <dummies/ComIFDummy.h>
#include <dummies/CoreControllerDummy.h>
2023-02-24 11:08:50 +01:00
#include <dummies/ExecutableComIfDummy.h>
2023-02-13 15:59:44 +01:00
#include <dummies/GpsCtrlDummy.h>
2023-02-13 13:53:13 +01:00
#include <dummies/GpsDhbDummy.h>
2022-09-15 11:54:43 +02:00
#include <dummies/GyroAdisDummy.h>
#include <dummies/GyroL3GD20Dummy.h>
#include <dummies/ImtqDummy.h>
#include <dummies/MgmLIS3MDLDummy.h>
#include <dummies/MgmRm3100Dummy.h>
2022-09-15 11:54:43 +02:00
#include <dummies/P60DockDummy.h>
#include <dummies/PduDummy.h>
#include <dummies/PlPcduDummy.h>
2023-02-13 17:59:08 +01:00
#include <dummies/PlocMpsocDummy.h>
#include <dummies/PlocSupervisorDummy.h>
2022-09-15 11:54:43 +02:00
#include <dummies/RwDummy.h>
2022-10-20 17:25:27 +02:00
#include <dummies/SaDeploymentDummy.h>
2023-02-13 17:24:56 +01:00
#include <dummies/ScexDummy.h>
2022-09-15 11:54:43 +02:00
#include <dummies/StarTrackerDummy.h>
#include <dummies/SusDummy.h>
2022-09-15 11:54:43 +02:00
#include <dummies/SyrlinksDummy.h>
2023-03-31 12:11:31 +02:00
#include <fsfw/devicehandlers/HealthDevice.h>
2023-02-13 17:59:08 +01:00
#include <fsfw_hal/common/gpio/GpioIF.h>
2023-03-26 16:13:54 +02:00
#include <mission/power/gsDefs.h>
2023-03-24 20:50:33 +01:00
#include <mission/system/acs/ImtqAssembly.h>
2023-03-29 11:44:13 +02:00
#include <mission/system/acs/StrAssembly.h>
2022-11-21 14:01:31 +01:00
#include <mission/system/objects/CamSwitcher.h>
2023-04-13 23:54:23 +02:00
#include <mission/system/tcs/TcsBoardAssembly.h>
2022-09-15 11:58:00 +02:00
2022-11-24 16:40:59 +01:00
#include "TemperatureSensorInserter.h"
2022-11-25 10:27:47 +01:00
#include "dummies/Max31865Dummy.h"
#include "dummies/Tmp1075Dummy.h"
2023-03-26 16:42:00 +02:00
#include "mission/genericFactory.h"
2023-03-24 20:50:33 +01:00
#include "mission/system/acs/acsModeTree.h"
#include "mission/system/com/comModeTree.h"
2023-04-13 23:54:23 +02:00
#include "mission/system/tcs/tcsModeTree.h"
2023-02-13 16:39:26 +01:00
#include "mission/system/tree/payloadModeTree.h"
2023-04-11 22:58:13 +02:00
#include "mission/tcs/defs.h"
2022-09-15 11:54:43 +02:00
2023-02-13 13:53:13 +01:00
void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF) {
2022-09-15 11:54:43 +02:00
new ComIFDummy(objects::DUMMY_COM_IF);
2022-11-25 10:27:31 +01:00
auto* comCookieDummy = new ComCookieDummy();
2023-04-26 17:00:04 +02:00
if (cfg.addBpxBattDummy) {
new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
}
if (cfg.addCoreCtrlCfg) {
2022-09-15 11:54:43 +02:00
new CoreControllerDummy(objects::CORE_CONTROLLER);
}
2022-09-16 14:01:54 +02:00
if (cfg.addRtdComIFDummy) {
2023-02-24 11:08:50 +01:00
new ExecutableComIfDummy(objects::SPI_RTD_COM_IF);
2022-09-16 14:01:54 +02:00
}
2023-02-13 11:49:26 +01:00
std::array<object_id_t, 4> rwIds = {objects::RW1, objects::RW2, objects::RW3, objects::RW4};
std::array<DeviceHandlerBase*, 4> rws;
rws[0] = new RwDummy(objects::RW1, objects::DUMMY_COM_IF, comCookieDummy);
rws[1] = new RwDummy(objects::RW2, objects::DUMMY_COM_IF, comCookieDummy);
rws[2] = new RwDummy(objects::RW3, objects::DUMMY_COM_IF, comCookieDummy);
rws[3] = new RwDummy(objects::RW4, objects::DUMMY_COM_IF, comCookieDummy);
2023-03-16 18:47:51 +01:00
ObjectFactory::createRwAssy(pwrSwitcher, power::Switches::PDU2_CH2_RW_5V, rws, rwIds);
2022-10-20 17:25:27 +02:00
new SaDeplDummy(objects::SOLAR_ARRAY_DEPL_HANDLER);
2023-03-13 18:29:22 +01:00
auto* strAssy = new StrAssembly(objects::STR_ASSY);
strAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
2023-02-13 16:39:26 +01:00
auto* strDummy =
new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy);
2023-03-13 18:29:22 +01:00
strDummy->connectModeTreeParent(*strAssy);
if (cfg.addSyrlinksDummies) {
2023-02-13 17:59:08 +01:00
auto* syrlinksDummy =
new SyrlinksDummy(objects::SYRLINKS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
syrlinksDummy->connectModeTreeParent(satsystem::com::SUBSYSTEM);
}
2023-03-13 18:29:22 +01:00
auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY);
imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
2023-02-10 14:02:27 +01:00
imtqDummy->enableThermalModule(ThermalStateCfg());
2023-03-13 18:29:22 +01:00
imtqDummy->connectModeTreeParent(*imtqAssy);
if (cfg.addOnlyAcuDummy) {
2022-09-15 11:54:43 +02:00
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
} else if (cfg.addPowerDummies) {
2023-05-15 16:53:18 +02:00
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
2022-09-15 11:54:43 +02:00
new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
}
if (cfg.addAcsBoardDummies) {
2023-02-13 13:53:13 +01:00
std::array<DeviceHandlerBase*, 8> assemblyDhbs;
2023-02-13 15:59:44 +01:00
assemblyDhbs[0] =
new MgmLIS3MDLDummy(objects::MGM_0_LIS3_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[1] =
new MgmLIS3MDLDummy(objects::MGM_2_LIS3_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[2] =
new MgmRm3100Dummy(objects::MGM_1_RM3100_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[3] =
new MgmRm3100Dummy(objects::MGM_3_RM3100_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[4] =
new GyroAdisDummy(objects::GYRO_0_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[5] =
new GyroL3GD20Dummy(objects::GYRO_1_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[6] =
new GyroAdisDummy(objects::GYRO_2_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
assemblyDhbs[7] =
new GyroL3GD20Dummy(objects::GYRO_3_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
auto* gpsCtrl = new GpsCtrlDummy(objects::GPS_CONTROLLER);
2023-04-03 18:54:47 +02:00
ObjectFactory::createAcsBoardAssy(pwrSwitcher, assemblyDhbs, gpsCtrl, gpioIF);
2022-09-15 11:54:43 +02:00
}
if (cfg.addSusDummies) {
2023-02-13 11:49:26 +01:00
std::array<DeviceHandlerBase*, 12> suses;
suses[0] =
new SusDummy(objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::DUMMY_COM_IF, comCookieDummy);
suses[1] =
new SusDummy(objects::SUS_1_N_LOC_XBYFZM_PT_XB, objects::DUMMY_COM_IF, comCookieDummy);
suses[2] =
new SusDummy(objects::SUS_2_N_LOC_XFYBZB_PT_YB, objects::DUMMY_COM_IF, comCookieDummy);
suses[3] =
new SusDummy(objects::SUS_3_N_LOC_XFYBZF_PT_YF, objects::DUMMY_COM_IF, comCookieDummy);
suses[4] =
new SusDummy(objects::SUS_4_N_LOC_XMYFZF_PT_ZF, objects::DUMMY_COM_IF, comCookieDummy);
suses[5] =
new SusDummy(objects::SUS_5_N_LOC_XFYMZB_PT_ZB, objects::DUMMY_COM_IF, comCookieDummy);
suses[6] =
new SusDummy(objects::SUS_6_R_LOC_XFYBZM_PT_XF, objects::DUMMY_COM_IF, comCookieDummy);
suses[7] =
new SusDummy(objects::SUS_7_R_LOC_XBYBZM_PT_XB, objects::DUMMY_COM_IF, comCookieDummy);
suses[8] =
new SusDummy(objects::SUS_8_R_LOC_XBYBZB_PT_YB, objects::DUMMY_COM_IF, comCookieDummy);
suses[9] =
new SusDummy(objects::SUS_9_R_LOC_XBYBZB_PT_YF, objects::DUMMY_COM_IF, comCookieDummy);
suses[10] =
new SusDummy(objects::SUS_10_N_LOC_XMYBZF_PT_ZF, objects::DUMMY_COM_IF, comCookieDummy);
suses[11] =
new SusDummy(objects::SUS_11_R_LOC_XBYMZB_PT_ZB, objects::DUMMY_COM_IF, comCookieDummy);
2023-02-13 13:53:13 +01:00
ObjectFactory::createSusAssy(pwrSwitcher, suses);
}
2022-09-16 14:01:54 +02:00
if (cfg.addTempSensorDummies) {
2023-02-13 17:59:08 +01:00
std::map<object_id_t, Max31865Dummy*> rtdSensorDummies;
rtdSensorDummies.emplace(objects::RTD_0_IC3_PLOC_HEATSPREADER,
new Max31865Dummy(objects::RTD_0_IC3_PLOC_HEATSPREADER,
objects::DUMMY_COM_IF, comCookieDummy));
rtdSensorDummies.emplace(objects::RTD_1_IC4_PLOC_MISSIONBOARD,
new Max31865Dummy(objects::RTD_1_IC4_PLOC_MISSIONBOARD,
objects::DUMMY_COM_IF, comCookieDummy));
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_2_IC5_4K_CAMERA,
new Max31865Dummy(objects::RTD_2_IC5_4K_CAMERA, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(objects::RTD_3_IC6_DAC_HEATSPREADER,
new Max31865Dummy(objects::RTD_3_IC6_DAC_HEATSPREADER,
objects::DUMMY_COM_IF, comCookieDummy));
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_4_IC7_STARTRACKER,
new Max31865Dummy(objects::RTD_4_IC7_STARTRACKER, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_5_IC8_RW1_MX_MY,
new Max31865Dummy(objects::RTD_5_IC8_RW1_MX_MY, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_6_IC9_DRO,
new Max31865Dummy(objects::RTD_6_IC9_DRO, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_7_IC10_SCEX,
new Max31865Dummy(objects::RTD_7_IC10_SCEX, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_8_IC11_X8,
new Max31865Dummy(objects::RTD_8_IC11_X8, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_9_IC12_HPA,
new Max31865Dummy(objects::RTD_9_IC12_HPA, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_10_IC13_PL_TX,
new Max31865Dummy(objects::RTD_10_IC13_PL_TX, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_11_IC14_MPA,
new Max31865Dummy(objects::RTD_11_IC14_MPA, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_12_IC15_ACU,
new Max31865Dummy(objects::RTD_12_IC15_ACU, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(objects::RTD_13_IC16_PLPCDU_HEATSPREADER,
new Max31865Dummy(objects::RTD_13_IC16_PLPCDU_HEATSPREADER,
objects::DUMMY_COM_IF, comCookieDummy));
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_14_IC17_TCS_BOARD,
new Max31865Dummy(objects::RTD_14_IC17_TCS_BOARD, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
rtdSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::RTD_15_IC18_IMTQ,
new Max31865Dummy(objects::RTD_15_IC18_IMTQ, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
std::map<object_id_t, Tmp1075Dummy*> tmpSensorDummies;
tmpSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::TMP1075_HANDLER_TCS_0,
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_0, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
tmpSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::TMP1075_HANDLER_TCS_1,
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_1, objects::DUMMY_COM_IF, comCookieDummy));
2023-02-13 17:59:08 +01:00
tmpSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::TMP1075_HANDLER_PLPCDU_0,
new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_0, objects::DUMMY_COM_IF, comCookieDummy));
2023-04-06 13:16:50 +02:00
// damaged.
2023-04-26 17:36:38 +02:00
// tmpSensorDummies.emplace(
// objects::TMP1075_HANDLER_PLPCDU_1,
// new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF,
// comCookieDummy));
2023-02-13 17:59:08 +01:00
tmpSensorDummies.emplace(
2023-01-21 16:51:32 +01:00
objects::TMP1075_HANDLER_IF_BOARD,
new Tmp1075Dummy(objects::TMP1075_HANDLER_IF_BOARD, objects::DUMMY_COM_IF, comCookieDummy));
2023-01-17 16:16:59 +01:00
2023-02-13 17:59:08 +01:00
new TemperatureSensorInserter(objects::THERMAL_TEMP_INSERTER, rtdSensorDummies,
tmpSensorDummies);
2023-04-11 22:58:13 +02:00
TcsBoardAssembly* tcsBoardAssy =
ObjectFactory::createTcsBoardAssy(pwrSwitcher, tcs::TCS_BOARD_SHORTLY_UNAVAILABLE);
2023-02-13 17:59:08 +01:00
for (auto& rtd : rtdSensorDummies) {
2023-02-13 17:04:04 +01:00
rtd.second->connectModeTreeParent(*tcsBoardAssy);
}
2023-02-13 17:59:08 +01:00
for (auto& tmp : tmpSensorDummies) {
tmp.second->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
}
2022-09-16 14:01:54 +02:00
}
2023-05-11 15:05:44 +02:00
if (cfg.addCamSwitcherDummy) {
auto* camSwitcher = new CamSwitcher(objects::CAM_SWITCHER, pwrSwitcher,
power::Switches::PDU2_CH8_PAYLOAD_CAMERA);
camSwitcher->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
}
2023-02-13 17:24:56 +01:00
auto* scexDummy = new ScexDummy(objects::SCEX, objects::DUMMY_COM_IF, comCookieDummy);
2023-03-14 11:21:37 +01:00
scexDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
2023-02-13 17:59:08 +01:00
auto* plPcduDummy =
new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
2023-03-14 11:21:37 +01:00
plPcduDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
2023-02-13 17:59:08 +01:00
if (cfg.addPlocDummies) {
auto* plocMpsocDummy =
new PlocMpsocDummy(objects::PLOC_MPSOC_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
2023-03-14 11:21:37 +01:00
plocMpsocDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
2023-03-16 18:52:32 +01:00
auto* plocSupervisorDummy = new PlocSupervisorDummy(
objects::PLOC_SUPERVISOR_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, pwrSwitcher);
2023-03-14 11:21:37 +01:00
plocSupervisorDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
2023-02-13 17:59:08 +01:00
}
2022-09-15 11:54:43 +02:00
}