eive-obsw/mission/devices/devicedefinitions/GomspaceDefinitions.h
Robin Mueller a14ca283cc
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
using vector for convert enables
2022-04-12 16:36:04 +02:00

797 lines
30 KiB
C++

#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINITIONS_H_
#include <fsfw/datapoollocal/LocalPoolVariable.h>
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/power/definitions.h>
#include <cstdint>
#include "devices/powerSwitcherList.h"
namespace GOMSPACE {
enum class Pdu { PDU1, PDU2 };
using ChannelSwitchHook = void (*)(Pdu pdu, uint8_t channel, bool on, void* args);
static const uint16_t IGNORE_CHECKSUM = 0xbb0;
/** The size of the header of a gomspace CSP packet. */
static const uint8_t GS_HDR_LENGTH = 12;
/** CSP port to ping gomspace devices. */
static const uint8_t PING_PORT = 1;
static const uint8_t REBOOT_PORT = 4;
/** CSP port of gomspace devices to request or set parameters */
static const uint8_t PARAM_PORT = 7;
static const uint8_t P60_PORT_GNDWDT_RESET = 9;
/**
* Device commands are derived from the rparam.h of the gomspace lib..
* IDs above 50 are reserved for device specific commands.
*/
static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t NONE = 2; // Set when no command is pending
static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND]
//!< [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console
static const DeviceCommandId_t PRINT_SWITCH_V_I = 32;
static const DeviceCommandId_t PRINT_LATCHUPS = 33;
} // namespace GOMSPACE
namespace P60System {
enum class BatteryModes : uint8_t { CRITICAL = 1, SAFE = 2, NORMAL = 3, FULL = 4 };
enum class SetIds : uint32_t {
PDU_1_CORE = 1,
PDU_1_AUX = 2,
PDU_2_CORE = 3,
PDU_2_AUX = 4,
P60_CORE = 5,
P60_AUX = 6,
ACU = 7
};
namespace pool {
enum Ids : lp_id_t {
P60_CURRENTS,
P60_VOLTAGES,
P60_OUTPUT_ENABLE,
P60DOCK_TEMPERATURE_1,
P60DOCK_TEMPERATURE_2,
P60DOCK_BOOT_CAUSE,
P60DOCK_BOOT_CNT,
P60DOCK_UPTIME,
P60DOCK_RESETCAUSE,
P60DOCK_BATT_MODE,
P60DOCK_HEATER_ON,
P60DOCK_CONV_5V_ENABLE_STATUS,
LATCHUPS,
P60DOCK_DOCK_VBAT,
P60DOCK_DOCK_VCC_CURRENT,
// Difference between charge and discharge
P60DOCK_BATTERY_CURRENT,
P60DOCK_BATTERY_VOLTAGE,
P60DOCK_BATTERY_TEMPERATURE_1,
P60DOCK_BATTERY_TEMPERATURE_2,
DEVICES_TYPE,
DEVICES_STATUS,
P60DOCK_DEVICE_TYPE_GROUP,
P60DOCK_DEVICE_STATUS_GROUP,
P60DOCK_DEARM_STATUS,
P60DOCK_WDT_CNT_GND,
P60DOCK_WDT_CNT_I2C,
P60DOCK_WDT_CNT_CAN,
P60DOCK_WDT_CNT_CSP_1,
P60DOCK_WDT_CNT_CSP_2,
P60DOCK_WDT_GND_LEFT,
P60DOCK_WDT_I2C_LEFT,
P60DOCK_WDT_CAN_LEFT,
P60DOCK_WDT_CSP_LEFT_1,
P60DOCK_WDT_CSP_LEFT_2,
P60DOCK_BATT_CHARGE_CURRENT,
P60DOCK_BATT_DISCHARGE_CURRENT,
P60DOCK_ANT6_DEPL,
P60DOCK_AR6_DEPL,
// IDs for both PDUs
PDU_CURRENTS,
PDU_VOLTAGES,
PDU_VCC,
PDU_VBAT,
PDU_TEMPERATURE,
PDU_CONV_EN,
PDU_OUT_ENABLE,
PDU_BOOTCAUSE,
PDU_BOOTCNT,
PDU_UPTIME,
PDU_RESETCAUSE,
PDU_BATT_MODE,
PDU_LATCHUPS,
PDU_DEVICES,
PDU_STATUSES,
PDU_WDT_CNT_GND,
PDU_WDT_CNT_I2C,
PDU_WDT_CNT_CAN,
PDU_WDT_CNT_CSP1,
PDU_WDT_CNT_CSP2,
PDU_WDT_GND_LEFT,
PDU_WDT_I2C_LEFT,
PDU_WDT_CAN_LEFT,
PDU_WDT_CSP_LEFT1,
PDU_WDT_CSP_LEFT2,
/** ACU Ids */
ACU_CURRENT_IN_CHANNEL0,
ACU_CURRENT_IN_CHANNEL1,
ACU_CURRENT_IN_CHANNEL2,
ACU_CURRENT_IN_CHANNEL3,
ACU_CURRENT_IN_CHANNEL4,
ACU_CURRENT_IN_CHANNEL5,
ACU_VOLTAGE_IN_CHANNEL0,
ACU_VOLTAGE_IN_CHANNEL1,
ACU_VOLTAGE_IN_CHANNEL2,
ACU_VOLTAGE_IN_CHANNEL3,
ACU_VOLTAGE_IN_CHANNEL4,
ACU_VOLTAGE_IN_CHANNEL5,
ACU_VCC,
ACU_VBAT,
ACU_TEMPERATURE_1,
ACU_TEMPERATURE_2,
ACU_TEMPERATURE_3,
ACU_MPPT_MODE,
ACU_VBOOST_CHANNEL0,
ACU_VBOOST_CHANNEL1,
ACU_VBOOST_CHANNEL2,
ACU_VBOOST_CHANNEL3,
ACU_VBOOST_CHANNEL4,
ACU_VBOOST_CHANNEL5,
ACU_POWER_CHANNEL0,
ACU_POWER_CHANNEL1,
ACU_POWER_CHANNEL2,
ACU_POWER_CHANNEL3,
ACU_POWER_CHANNEL4,
ACU_POWER_CHANNEL5,
ACU_DAC_EN_0,
ACU_DAC_EN_1,
ACU_DAC_EN_2,
ACU_DAC_RAW_0,
ACU_DAC_RAW_1,
ACU_DAC_RAW_2,
ACU_DAC_RAW_3,
ACU_DAC_RAW_4,
ACU_DAC_RAW_5,
ACU_BOOTCAUSE,
ACU_BOOTCNT,
ACU_UPTIME,
ACU_RESET_CAUSE,
ACU_MPPT_TIME,
ACU_MPPT_PERIOD,
ACU_DEVICE_0,
ACU_DEVICE_1,
ACU_DEVICE_2,
ACU_DEVICE_3,
ACU_DEVICE_4,
ACU_DEVICE_5,
ACU_DEVICE_6,
ACU_DEVICE_7,
ACU_DEVICE_0_STATUS,
ACU_DEVICE_1_STATUS,
ACU_DEVICE_2_STATUS,
ACU_DEVICE_3_STATUS,
ACU_DEVICE_4_STATUS,
ACU_DEVICE_5_STATUS,
ACU_DEVICE_6_STATUS,
ACU_DEVICE_7_STATUS,
ACU_WDT_CNT_GND,
ACU_WDT_GND_LEFT,
};
}
} // namespace P60System
namespace P60Dock {
static constexpr uint8_t NUM_DEVS = 8;
namespace hk {
enum Index : uint8_t {
ACU_VCC = 0,
PDU1_VCC = 1,
X3_IDLE_VCC = 2,
PDU2_VCC = 3,
ACU_VBAT = 4,
PDU1_VBAT = 5,
X3_IDLE_VBAT = 6,
PDU2_VBAT = 7,
STACK_VBAT = 8,
STACK_3V3 = 9,
STACK_5V = 10,
GS3V3 = 11,
GS5V = 12,
CHNLS_LEN = 13
};
}
enum SwitchChannels : uint8_t {
ACU = 0,
PDU1 = 1,
X3_IDLE = 2,
PDU2_VCC = 3,
ACU_VBAT = 4,
PDU1_VBAT = 5,
X3_IDLE_VBAT = 6,
PDU2_VBAT = 7,
STACK_VBAT = 8,
STACK_3V3 = 9,
STACK_5V = 10,
GS3V3 = 11,
GS5V = 12
};
/** Max reply size reached when requesting full hk table */
static const uint16_t MAX_REPLY_LENGTH = 407;
static const uint16_t MAX_CONFIGTABLE_ADDRESS = 408;
static const uint16_t MAX_HKTABLE_ADDRESS = 187;
static const uint16_t HK_TABLE_SIZE = 188;
static const uint8_t HK_TABLE_ENTRIES = 100;
/**
* Requesting the full housekeeping table from the P60 dock will generate a reply comprising
* 402 bytes of data.
*/
static const uint16_t HK_TABLE_REPLY_SIZE = 407;
class CoreHkSet : public StaticLocalDataSet<16> {
public:
CoreHkSet(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::P60_CORE)) {}
CoreHkSet(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::P60_CORE))) {}
/** Measured output currents */
lp_vec_t<int16_t, P60Dock::hk::Index::CHNLS_LEN> currents =
lp_vec_t<int16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, P60System::pool::P60_CURRENTS,
this);
/** Measured output voltages */
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN> voltages =
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, P60System::pool::P60_VOLTAGES,
this);
/** Output enable states */
lp_vec_t<uint8_t, P60Dock::hk::Index::CHNLS_LEN> outputEnables =
lp_vec_t<uint8_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId,
P60System::pool::P60_OUTPUT_ENABLE, this);
lp_var_t<uint32_t> bootCount =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_BOOT_CNT, this);
lp_var_t<uint8_t> battMode =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_BATT_MODE, this);
// Difference between charge and discharge current
lp_var_t<int16_t> batteryCurrent =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_BATTERY_CURRENT, this);
lp_var_t<uint16_t> batteryVoltage =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::P60DOCK_BATTERY_VOLTAGE, this);
lp_var_t<int16_t> temperature1 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_TEMPERATURE_1, this);
lp_var_t<int16_t> temperature2 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_TEMPERATURE_2, this);
};
/**
* @brief This class defines a dataset for the hk table of the P60 Dock.
* @details
* The GS port and X3 are not required for EIVE. X3 is another slot on the P60 dock and
* GS is required for a module from Gomspace which is not used.
*/
class HkTableDataset : public StaticLocalDataSet<32> {
public:
HkTableDataset(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::P60_AUX)) {}
HkTableDataset(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::P60_AUX))) {}
/** Number of detected latchups on each output channel */
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN> latchups =
lp_vec_t<uint16_t, P60Dock::hk::Index::CHNLS_LEN>(sid.objectId, P60System::pool::LATCHUPS,
this);
lp_var_t<uint32_t> bootcause =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_BOOT_CAUSE, this);
lp_var_t<uint32_t> uptime =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_UPTIME, this);
lp_var_t<uint16_t> resetcause =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::P60DOCK_RESETCAUSE, this);
/** Battery heater control only possible on BP4 packs */
lp_var_t<uint8_t> heaterOn =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_HEATER_ON, this);
lp_var_t<uint8_t> converter5VStatus =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_CONV_5V_ENABLE_STATUS, this);
lp_var_t<uint16_t> dockVbatVoltageValue =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::P60DOCK_DOCK_VBAT, this);
lp_var_t<int16_t> dockVccCurrent =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_DOCK_VCC_CURRENT, this);
lp_var_t<int16_t> batteryTemperature1 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_BATTERY_TEMPERATURE_1, this);
lp_var_t<int16_t> batteryTemperature2 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_BATTERY_TEMPERATURE_2, this);
lp_var_t<uint8_t> dearmStatus =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_DEARM_STATUS, this);
/** Number of reboots due to gnd, i2c, csp watchdog timeout */
lp_var_t<uint32_t> wdtCntGnd =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CNT_GND, this);
lp_var_t<uint32_t> wdtCntI2c =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CNT_I2C, this);
lp_var_t<uint32_t> wdtCntCan =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CNT_CAN, this);
lp_var_t<uint32_t> wdtCntCsp1 =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CNT_CSP_1, this);
lp_var_t<uint32_t> wdtCntCsp2 =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CNT_CSP_2, this);
lp_var_t<uint32_t> wdtGndLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_GND_LEFT, this);
lp_var_t<uint32_t> wdtI2cLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_I2C_LEFT, this);
lp_var_t<uint32_t> wdtCanLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CAN_LEFT, this);
lp_var_t<uint8_t> wdtCspLeft1 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CSP_LEFT_1, this);
lp_var_t<uint8_t> wdtCspLeft2 =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::P60DOCK_WDT_CSP_LEFT_2, this);
lp_var_t<int16_t> batteryChargeCurrent =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_BATT_CHARGE_CURRENT, this);
lp_var_t<int16_t> batteryDischargeCurrent =
lp_var_t<int16_t>(sid.objectId, P60System::pool::P60DOCK_BATT_DISCHARGE_CURRENT, this);
lp_var_t<int8_t> ant6Depl =
lp_var_t<int8_t>(sid.objectId, P60System::pool::P60DOCK_ANT6_DEPL, this);
lp_var_t<int8_t> ar6Depl =
lp_var_t<int8_t>(sid.objectId, P60System::pool::P60DOCK_AR6_DEPL, this);
lp_vec_t<uint8_t, P60Dock::NUM_DEVS> devicesType =
lp_vec_t<uint8_t, P60Dock::NUM_DEVS>(sid.objectId, P60System::pool::DEVICES_TYPE, this);
lp_vec_t<uint8_t, P60Dock::NUM_DEVS> devicesStatus =
lp_vec_t<uint8_t, P60Dock::NUM_DEVS>(sid.objectId, P60System::pool::DEVICES_STATUS, this);
};
} // namespace P60Dock
/**
* @brief Constants common for both PDU1 and PDU2.
*/
namespace PDU {
/** When retrieving full configuration parameter table */
static const uint16_t MAX_REPLY_LENGTH = 318;
static const uint16_t MAX_CONFIGTABLE_ADDRESS = 316;
static const uint16_t MAX_HKTABLE_ADDRESS = 141;
/** The size of the csp reply containing the housekeeping table data */
static const uint16_t HK_TABLE_REPLY_SIZE = 303;
static const uint8_t HK_TABLE_ENTRIES = 73;
static constexpr uint8_t CHANNELS_LEN = 9;
static constexpr uint8_t DEVICES_NUM = 8;
class PduCoreHk : public StaticLocalDataSet<9> {
public:
PduCoreHk(HasLocalDataPoolIF* owner, uint32_t setId) : StaticLocalDataSet(owner, setId) {}
PduCoreHk(object_id_t objectId, uint32_t setId) : StaticLocalDataSet(sid_t(objectId, setId)) {}
/** Measured output currents */
lp_vec_t<int16_t, 9> currents =
lp_vec_t<int16_t, 9>(sid.objectId, P60System::pool::PDU_CURRENTS, this);
/** Measured output currents */
lp_vec_t<int16_t, 9> voltages =
lp_vec_t<int16_t, 9>(sid.objectId, P60System::pool::PDU_VOLTAGES, this);
/** Output switch states */
lp_vec_t<uint8_t, 9> outputEnables =
lp_vec_t<uint8_t, 9>(sid.objectId, P60System::pool::PDU_OUT_ENABLE, this);
/** Number of reboots */
lp_var_t<uint32_t> bootcount =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_BOOTCNT, this);
/** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */
lp_var_t<uint8_t> battMode =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_BATT_MODE, this);
lp_var_t<int16_t> temperature =
lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU_TEMPERATURE, this);
};
/**
* @brief This class defines a dataset for the hk table of a PDU
*/
class PduAuxHk : public StaticLocalDataSet<36> {
public:
PduAuxHk(HasLocalDataPoolIF* owner, uint32_t setId) : StaticLocalDataSet(owner, setId) {}
PduAuxHk(object_id_t objectId, uint32_t setId) : StaticLocalDataSet(sid_t(objectId, setId)) {}
/** Measured VCC */
lp_var_t<int16_t> vcc = lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU_VCC, this);
/** Measured VBAT */
lp_var_t<int16_t> vbat = lp_var_t<int16_t>(sid.objectId, P60System::pool::PDU_VBAT, this);
/** Output converter enable status */
lp_vec_t<uint8_t, 3> converterEnable =
lp_vec_t<uint8_t, 3>(sid.objectId, P60System::pool::PDU_CONV_EN, this);
lp_var_t<uint32_t> bootcause =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_BOOTCAUSE, this);
/** Uptime in seconds */
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_UPTIME, this);
lp_var_t<uint16_t> resetcause =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::PDU_RESETCAUSE, this);
/** Number of detected latchups on each output channel */
lp_vec_t<uint16_t, 9> latchups =
lp_vec_t<uint16_t, 9>(sid.objectId, P60System::pool::PDU_LATCHUPS, this);
/**
* There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is
* identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18.
*/
lp_vec_t<uint8_t, 8> deviceTypes =
lp_vec_t<uint8_t, 8>(sid.objectId, P60System::pool::PDU_DEVICES, this);
/** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */
lp_vec_t<uint8_t, 8> devicesStatus =
lp_vec_t<uint8_t, 8>(sid.objectId, P60System::pool::PDU_STATUSES, this);
/** Number of reboots triggered by the ground watchdog */
lp_var_t<uint32_t> gndWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CNT_GND, this);
/** Number of reboots triggered through the I2C watchdog. Not relevant for EIVE. */
lp_var_t<uint32_t> i2cWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CNT_I2C, this);
/** Number of reboots triggered through the CAN watchdog */
lp_var_t<uint32_t> canWdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CNT_CAN, this);
/** Number of reboots triggered through the CSP watchdog */
lp_var_t<uint32_t> csp1WdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CNT_CSP1, this);
lp_var_t<uint32_t> csp2WdtReboots =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CNT_CSP2, this);
/** Ground watchdog remaining seconds before rebooting */
lp_var_t<uint32_t> groundWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_GND_LEFT, this);
/** I2C watchdog remaining seconds before rebooting. Not relevant for EIVE. */
lp_var_t<uint32_t> i2cWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_I2C_LEFT, this);
/** CAN watchdog remaining seconds before rebooting. */
lp_var_t<uint32_t> canWatchdogSecondsLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::PDU_WDT_CAN_LEFT, this);
/** CSP watchdogs remaining pings before rebooting. */
lp_var_t<uint8_t> csp2WatchdogPingsLeft =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_WDT_CSP_LEFT1, this);
lp_var_t<uint8_t> csp1WatchdogPingsLeft =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_WDT_CSP_LEFT2, this);
};
} // namespace PDU
namespace PDU1 {
enum Channels : uint8_t {
TCS_BOARD_3V3 = 0,
SYRLINKS = 1,
STR = 2,
MGT = 3,
SUS_NOMINAL = 4,
SOL_CELL_EXPERIMENT = 5,
PLOC = 6,
ACS_A_SIDE = 7,
UNUSED = 8,
LEN = 9
};
/**
* Addresses within configuration table to enable or disable output channels. Refer also to
* gs-man-nanopower-p60-pdu-200.pdf on page 16.
*/
static const uint16_t CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3 = 0x48;
static const uint16_t CONFIG_ADDRESS_OUT_EN_SYRLINKS = 0x49;
static const uint16_t CONFIG_ADDRESS_OUT_EN_STAR_TRACKER = 0x4A;
static const uint16_t CONFIG_ADDRESS_OUT_EN_MGT = 0x4B;
static const uint16_t CONFIG_ADDRESS_OUT_EN_SUS_NOMINAL = 0x4C;
static const uint16_t CONFIG_ADDRESS_OUT_EN_SOLAR_CELL_EXP = 0x4D;
static const uint16_t CONFIG_ADDRESS_OUT_EN_PLOC = 0x4E;
static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A = 0x4F;
static const uint16_t CONFIG_ADDRESS_OUT_EN_CHANNEL8 = 0x50;
class Pdu1CoreHk : public ::PDU::PduCoreHk {
public:
Pdu1CoreHk(HasLocalDataPoolIF* owner)
: PduCoreHk(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_1_CORE)) {}
Pdu1CoreHk(object_id_t objectId)
: PduCoreHk(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_1_CORE)) {}
};
class Pdu1AuxHk : public ::PDU::PduAuxHk {
public:
Pdu1AuxHk(HasLocalDataPoolIF* owner)
: PduAuxHk(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_1_AUX)) {}
Pdu1AuxHk(object_id_t objectId)
: PduAuxHk(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_1_AUX)) {}
};
} // namespace PDU1
namespace PDU2 {
enum Channels : uint8_t {
Q7S = 0,
PAYLOAD_PCDU_CH1 = 1,
RW = 2,
TCS_HEATER_IN = 3,
SUS_REDUNDANT = 4,
DEPY_MECHANISM = 5,
PAYLOAD_PCDU_CH6 = 6,
ACS_B_SIDE = 7,
PAYLOAD_CAMERA = 8,
LEN = 9
};
/**
* Addresses within configuration table to enable or disable output channels. Refer also to
* gs-man-nanopower-p60-pdu-200.pdf on page 16.
*/
static const uint16_t CONFIG_ADDRESS_OUT_EN_Q7S = 0x48;
static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH1 = 0x49;
static const uint16_t CONFIG_ADDRESS_OUT_EN_RW = 0x4A;
static const uint16_t CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN = 0x4B;
static const uint16_t CONFIG_ADDRESS_OUT_EN_SUS_REDUNDANT = 0x4C;
static const uint16_t CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM = 0x4D;
static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH6 = 0x4E;
static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B = 0x4F;
static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA = 0x50;
class Pdu2CoreHk : public ::PDU::PduCoreHk {
public:
Pdu2CoreHk(HasLocalDataPoolIF* owner)
: PduCoreHk(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_2_CORE)) {}
Pdu2CoreHk(object_id_t objectId)
: PduCoreHk(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_2_CORE)) {}
};
class Pdu2AuxHk : public ::PDU::PduAuxHk {
public:
Pdu2AuxHk(HasLocalDataPoolIF* owner)
: PduAuxHk(owner, static_cast<uint32_t>(::P60System::SetIds::PDU_2_AUX)) {}
Pdu2AuxHk(object_id_t objectId)
: PduAuxHk(objectId, static_cast<uint32_t>(::P60System::SetIds::PDU_2_AUX)) {}
};
} // namespace PDU2
namespace ACU {
/* When receiving full housekeeping (telemetry) table */
static const uint16_t MAX_REPLY_LENGTH = 262;
static const uint16_t MAX_CONFIGTABLE_ADDRESS = 26;
static const uint16_t MAX_HKTABLE_ADDRESS = 120;
static const uint8_t HK_TABLE_ENTRIES = 64;
static const uint16_t HK_TABLE_REPLY_SIZE = 262;
/**
* @brief This class defines a dataset for the hk table of the ACU.
*/
class HkTableDataset : public StaticLocalDataSet<HK_TABLE_ENTRIES> {
public:
HkTableDataset(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::ACU)) {}
HkTableDataset(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::ACU))) {}
lp_var_t<int16_t> currentInChannel0 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL0, this);
lp_var_t<int16_t> currentInChannel1 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL1, this);
lp_var_t<int16_t> currentInChannel2 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL2, this);
lp_var_t<int16_t> currentInChannel3 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL3, this);
lp_var_t<int16_t> currentInChannel4 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL4, this);
lp_var_t<int16_t> currentInChannel5 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL5, this);
lp_var_t<uint16_t> voltageInChannel0 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL0, this);
lp_var_t<uint16_t> voltageInChannel1 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL1, this);
lp_var_t<uint16_t> voltageInChannel2 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL2, this);
lp_var_t<uint16_t> voltageInChannel3 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL3, this);
lp_var_t<uint16_t> voltageInChannel4 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL4, this);
lp_var_t<uint16_t> voltageInChannel5 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL5, this);
lp_var_t<uint16_t> vcc = lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VCC, this);
lp_var_t<uint16_t> vbat = lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBAT, this);
lp_var_t<int16_t> temperature1 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_TEMPERATURE_1, this);
lp_var_t<int16_t> temperature2 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_TEMPERATURE_2, this);
lp_var_t<int16_t> temperature3 =
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_TEMPERATURE_3, this);
lp_var_t<uint8_t> mpptMode =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_MPPT_MODE, this);
lp_var_t<uint16_t> vboostInChannel0 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL0, this);
lp_var_t<uint16_t> vboostInChannel1 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL1, this);
lp_var_t<uint16_t> vboostInChannel2 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL2, this);
lp_var_t<uint16_t> vboostInChannel3 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL3, this);
lp_var_t<uint16_t> vboostInChannel4 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL4, this);
lp_var_t<uint16_t> vboostInChannel5 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL5, this);
lp_var_t<uint16_t> powerInChannel0 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL0, this);
lp_var_t<uint16_t> powerInChannel1 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL1, this);
lp_var_t<uint16_t> powerInChannel2 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL2, this);
lp_var_t<uint16_t> powerInChannel3 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL3, this);
lp_var_t<uint16_t> powerInChannel4 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL4, this);
lp_var_t<uint16_t> powerInChannel5 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL5, this);
lp_var_t<uint8_t> dac0Enable =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DAC_EN_0, this);
lp_var_t<uint8_t> dac1Enable =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DAC_EN_1, this);
lp_var_t<uint8_t> dac2Enable =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DAC_EN_2, this);
lp_var_t<uint16_t> dacRawChannelVal0 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_0, this);
lp_var_t<uint16_t> dacRawChannelVal1 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_1, this);
lp_var_t<uint16_t> dacRawChannelVal2 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_2, this);
lp_var_t<uint16_t> dacRawChannelVal3 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_3, this);
lp_var_t<uint16_t> dacRawChannelVal4 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_4, this);
lp_var_t<uint16_t> dacRawChannelVal5 =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_5, this);
lp_var_t<uint32_t> bootCause =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_BOOTCAUSE, this);
lp_var_t<uint32_t> bootcnt = lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_BOOTCNT, this);
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_UPTIME, this);
lp_var_t<uint16_t> resetCause =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_RESET_CAUSE, this);
lp_var_t<uint16_t> mpptTime =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_MPPT_TIME, this);
lp_var_t<uint16_t> mpptPeriod =
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_MPPT_PERIOD, this);
lp_var_t<uint8_t> device0 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_0, this);
lp_var_t<uint8_t> device1 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_1, this);
lp_var_t<uint8_t> device2 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_2, this);
lp_var_t<uint8_t> device3 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_3, this);
lp_var_t<uint8_t> device4 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_4, this);
lp_var_t<uint8_t> device5 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_5, this);
lp_var_t<uint8_t> device6 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_6, this);
lp_var_t<uint8_t> device7 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_7, this);
lp_var_t<uint8_t> device0Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_0_STATUS, this);
lp_var_t<uint8_t> device1Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_1_STATUS, this);
lp_var_t<uint8_t> device2Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_2_STATUS, this);
lp_var_t<uint8_t> device3Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_3_STATUS, this);
lp_var_t<uint8_t> device4Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_4_STATUS, this);
lp_var_t<uint8_t> device5Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_5_STATUS, this);
lp_var_t<uint8_t> device6Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_6_STATUS, this);
lp_var_t<uint8_t> device7Status =
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_7_STATUS, this);
lp_var_t<uint32_t> wdtCntGnd =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_WDT_CNT_GND, this);
lp_var_t<uint32_t> wdtGndLeft =
lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_WDT_GND_LEFT, this);
};
} // namespace ACU
namespace pcdu {
enum PoolIds : uint32_t { PDU1_SWITCHES, PDU2_SWITCHES };
/* Switches are uint8_t datatype and go from 0 to 255 */
enum Switches : power::Switch_t {
PDU1_CH0_TCS_BOARD_3V3,
PDU1_CH1_SYRLINKS_12V,
PDU1_CH2_STAR_TRACKER_5V,
PDU1_CH3_MGT_5V,
PDU1_CH4_SUS_NOMINAL_3V3,
PDU1_CH5_SOLAR_CELL_EXP_5V,
PDU1_CH6_PLOC_12V,
PDU1_CH7_ACS_A_SIDE_3V3,
PDU1_CH8_UNOCCUPIED,
PDU2_CH0_Q7S,
PDU2_CH1_PL_PCDU_BATT_0_14V8,
PDU2_CH2_RW_5V,
PDU2_CH3_TCS_BOARD_HEATER_IN_8V,
PDU2_CH4_SUS_REDUNDANT_3V3,
PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
PDU2_CH6_PL_PCDU_BATT_1_14V8,
PDU2_CH7_ACS_BOARD_SIDE_B_3V3,
PDU2_CH8_PAYLOAD_CAMERA
};
static constexpr uint8_t NUMBER_OF_SWITCHES = 18;
static const uint8_t ON = 1;
static const uint8_t OFF = 0;
// Output states after reboot of the PDUs
const std::array<uint8_t, PDU::CHANNELS_LEN> INIT_SWITCHES_PDU1 = {
// Because the TE0720 is not connected to the PCDU, this switch is always on
#ifdef TE0720_1CFA
ON,
#else
OFF,
#endif
OFF, OFF, OFF, OFF, OFF, OFF, OFF, OFF,
};
const std::array<uint8_t, PDU::CHANNELS_LEN> INIT_SWITCHES_PDU2 = {ON, OFF, OFF, OFF, OFF,
OFF, OFF, OFF, OFF};
static constexpr uint32_t SWITCHER_SET_ID = 0;
class SwitcherStates : public StaticLocalDataSet<NUMBER_OF_SWITCHES> {
public:
SwitcherStates(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SWITCHER_SET_ID) {}
SwitcherStates(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, SWITCHER_SET_ID)) {}
lp_vec_t<uint8_t, PDU::CHANNELS_LEN> pdu1Switches =
lp_vec_t<uint8_t, PDU::CHANNELS_LEN>(sid.objectId, PDU1_SWITCHES, this);
lp_vec_t<uint8_t, PDU::CHANNELS_LEN> pdu2Switches =
lp_vec_t<uint8_t, PDU::CHANNELS_LEN>(sid.objectId, PDU2_SWITCHES, this);
};
} // namespace pcdu
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINITIONS_H_ */