eive-obsw/mission/devices/devicedefinitions/imtqHandlerDefinitions.h

985 lines
44 KiB
C
Raw Normal View History

2021-03-17 11:14:48 +01:00
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_IMTQDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_IMTQDEFINITIONS_H_
2022-10-19 15:36:57 +02:00
#include <fsfw/datapool/PoolReadGuard.h>
2021-06-12 15:45:24 +02:00
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
2022-10-20 10:44:28 +02:00
class ImtqHandler;
2021-03-17 11:14:48 +01:00
namespace IMTQ {
2022-01-17 13:48:55 +01:00
static const DeviceCommandId_t NONE = 0x0;
static const DeviceCommandId_t GET_ENG_HK_DATA = 0x1;
static const DeviceCommandId_t START_ACTUATION_DIPOLE = 0x2;
static const DeviceCommandId_t GET_COMMANDED_DIPOLE = 0x3;
/** Generates new measurement of the magnetic field */
static const DeviceCommandId_t START_MTM_MEASUREMENT = 0x4;
/** Requests the calibrated magnetometer measurement */
static const DeviceCommandId_t GET_CAL_MTM_MEASUREMENT = 0x5;
/** Requests the raw values measured by the built-in MTM XEN1210 */
static const DeviceCommandId_t GET_RAW_MTM_MEASUREMENT = 0x6;
static const DeviceCommandId_t POS_X_SELF_TEST = 0x7;
static const DeviceCommandId_t NEG_X_SELF_TEST = 0x8;
static const DeviceCommandId_t POS_Y_SELF_TEST = 0x9;
static const DeviceCommandId_t NEG_Y_SELF_TEST = 0xA;
static const DeviceCommandId_t POS_Z_SELF_TEST = 0xB;
static const DeviceCommandId_t NEG_Z_SELF_TEST = 0xC;
static const DeviceCommandId_t GET_SELF_TEST_RESULT = 0xD;
static const uint8_t GET_TEMP_REPLY_SIZE = 2;
static const uint8_t CFGR_CMD_SIZE = 3;
static const uint8_t POINTER_REG_SIZE = 1;
2022-10-19 15:36:57 +02:00
enum SetIds : uint32_t {
ENG_HK = 1,
CAL_MGM = 2,
RAW_MGM = 3,
POS_X_TEST = 4,
NEG_X_TEST = 5,
POS_Y_TEST = 6,
NEG_Y_TEST = 7,
POS_Z_TEST = 8,
NEG_Z_TEST = 9,
DIPOLES = 10
};
2022-01-17 13:48:55 +01:00
static const uint8_t SIZE_ENG_HK_COMMAND = 1;
static const uint8_t SIZE_STATUS_REPLY = 2;
static const uint8_t SIZE_ENG_HK_DATA_REPLY = 24;
static const uint8_t SIZE_GET_COMMANDED_DIPOLE_REPLY = 8;
static const uint8_t SIZE_GET_CAL_MTM_MEASUREMENT = 15;
static const uint8_t SIZE_GET_RAW_MTM_MEASUREMENT = 15;
static const uint16_t SIZE_SELF_TEST_RESULTS = 120;
static const uint16_t MAX_REPLY_SIZE = SIZE_SELF_TEST_RESULTS;
static const uint8_t MAX_COMMAND_SIZE = 9;
/** Define entries in IMTQ specific dataset */
static const uint8_t ENG_HK_SET_POOL_ENTRIES = 11;
static const uint8_t CAL_MTM_POOL_ENTRIES = 4;
static const uint8_t SELF_TEST_DATASET_ENTRIES = 104;
/** Error codes for interpreting the self test error byte */
static const uint8_t I2C_FAILURE_MASK = 0x1;
static const uint8_t SPI_FAILURE_MASK = 0x2; // MTM connectivity
static const uint8_t ADC_FAILURE_MASK = 0x4; // Current/Temp measurement
static const uint8_t PWM_FAILURE_MASK = 0x8; // Coil actuation
static const uint8_t TC_FAILURE_MASK = 0x10; // System failure
static const uint8_t MTM_RANGE_FAILURE_MASK = 0x20; // MTM values outside of expected range
static const uint8_t COIL_CURRENT_FAILURE_MASK = 0x40; // Coil currents outside of expected range
static const uint8_t INVALID_ERROR_BYTE =
0x80; // This is an invalid error byte and should be never replied by the IMTQ
static const uint8_t MAIN_STEP_OFFSET = 43;
/**
* Command code definitions. Each command or reply of an IMTQ request will begin with one of
* the following command codes.
*/
namespace CC {
static const uint8_t START_MTM_MEASUREMENT = 0x4;
static const uint8_t START_ACTUATION_DIPOLE = 0x6;
static const uint8_t SELF_TEST_CMD = 0x8;
static const uint8_t SOFTWARE_RESET = 0xAA;
static const uint8_t GET_ENG_HK_DATA = 0x4A;
static const uint8_t GET_COMMANDED_DIPOLE = 0x46;
static const uint8_t GET_RAW_MTM_MEASUREMENT = 0x42;
static const uint8_t GET_CAL_MTM_MEASUREMENT = 0x43;
static const uint8_t GET_SELF_TEST_RESULT = 0x47;
2022-10-20 16:09:18 +02:00
static const uint8_t PAST_AVAILABLE_RESPONSE_BYTES = 0xff;
2022-01-17 13:48:55 +01:00
}; // namespace CC
namespace SELF_TEST_AXIS {
static const uint8_t ALL = 0x0;
static const uint8_t X_POSITIVE = 0x1;
static const uint8_t X_NEGATIVE = 0x2;
static const uint8_t Y_POSITIVE = 0x3;
static const uint8_t Y_NEGATIVE = 0x4;
static const uint8_t Z_POSITIVE = 0x5;
static const uint8_t Z_NEGATIVE = 0x6;
} // namespace SELF_TEST_AXIS
namespace SELF_TEST_STEPS {
static const uint8_t INIT = 0x0;
static const uint8_t X_POSITIVE = 0x1;
static const uint8_t X_NEGATIVE = 0x2;
static const uint8_t Y_POSITIVE = 0x3;
static const uint8_t Y_NEGATIVE = 0x4;
static const uint8_t Z_POSITIVE = 0x5;
static const uint8_t Z_NEGATIVE = 0x6;
static const uint8_t FINA = 0x7;
} // namespace SELF_TEST_STEPS
2022-10-19 15:36:57 +02:00
enum PoolIds : lp_id_t {
2022-01-17 13:48:55 +01:00
DIGITAL_VOLTAGE_MV,
ANALOG_VOLTAGE_MV,
DIGITAL_CURRENT,
ANALOG_CURRENT,
COIL_X_CURRENT,
COIL_Y_CURRENT,
COIL_Z_CURRENT,
COIL_X_TEMPERATURE,
COIL_Y_TEMPERATURE,
COIL_Z_TEMPERATURE,
MCU_TEMPERATURE,
2022-08-15 10:50:19 +02:00
MGM_CAL_NT,
2022-01-17 13:48:55 +01:00
ACTUATION_CAL_STATUS,
2022-08-18 17:27:39 +02:00
MTM_RAW,
2022-01-17 13:48:55 +01:00
ACTUATION_RAW_STATUS,
2022-10-19 15:36:57 +02:00
DIPOLES_X,
DIPOLES_Y,
DIPOLES_Z,
CURRENT_TORQUE_DURATION,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public:
2022-10-19 15:36:57 +02:00
EngHkDataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, IMTQ::SetIds::ENG_HK) {}
2022-01-17 13:48:55 +01:00
2022-10-19 15:36:57 +02:00
EngHkDataset(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, IMTQ::SetIds::ENG_HK)) {}
2022-01-17 13:48:55 +01:00
lp_var_t<uint16_t> digitalVoltageMv = lp_var_t<uint16_t>(sid.objectId, DIGITAL_VOLTAGE_MV, this);
lp_var_t<uint16_t> analogVoltageMv = lp_var_t<uint16_t>(sid.objectId, ANALOG_VOLTAGE_MV, this);
lp_var_t<float> digitalCurrentmA = lp_var_t<float>(sid.objectId, DIGITAL_CURRENT, this);
lp_var_t<float> analogCurrentmA = lp_var_t<float>(sid.objectId, ANALOG_CURRENT, this);
lp_var_t<float> coilXCurrentmA = lp_var_t<float>(sid.objectId, COIL_X_CURRENT, this);
lp_var_t<float> coilYCurrentmA = lp_var_t<float>(sid.objectId, COIL_Y_CURRENT, this);
lp_var_t<float> coilZCurrentmA = lp_var_t<float>(sid.objectId, COIL_Z_CURRENT, this);
2022-02-03 16:25:16 +01:00
/** All temperatures in [<5B>C] */
lp_var_t<int16_t> coilXTemperature = lp_var_t<int16_t>(sid.objectId, COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> coilYTemperature = lp_var_t<int16_t>(sid.objectId, COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> coilZTemperature = lp_var_t<int16_t>(sid.objectId, COIL_Z_TEMPERATURE, this);
lp_var_t<int16_t> mcuTemperature = lp_var_t<int16_t>(sid.objectId, MCU_TEMPERATURE, this);
2021-03-17 11:14:48 +01:00
};
2021-04-26 07:56:02 +02:00
/**
2021-06-15 15:13:47 +02:00
* @brief This dataset holds the last calibrated MTM measurement.
2021-04-26 07:56:02 +02:00
*/
2022-01-17 13:48:55 +01:00
class CalibratedMtmMeasurementSet : public StaticLocalDataSet<CAL_MTM_POOL_ENTRIES> {
public:
2022-10-19 15:36:57 +02:00
CalibratedMtmMeasurementSet(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, IMTQ::SetIds::CAL_MGM) {}
2022-01-17 13:48:55 +01:00
CalibratedMtmMeasurementSet(object_id_t objectId)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(sid_t(objectId, IMTQ::SetIds::CAL_MGM)) {}
2022-01-17 13:48:55 +01:00
/** The unit of all measurements is nT */
2022-10-19 15:36:57 +02:00
lp_vec_t<int32_t, 3> mgmXyz = lp_vec_t<int32_t, 3>(sid.objectId, MGM_CAL_NT, this);
2022-01-17 13:48:55 +01:00
/** 1 if coils were actuating during measurement otherwise 0 */
lp_var_t<uint8_t> coilActuationStatus =
lp_var_t<uint8_t>(sid.objectId, ACTUATION_CAL_STATUS, this);
2021-04-26 07:56:02 +02:00
};
/**
2021-06-15 15:13:47 +02:00
* @brief This dataset holds the raw MTM measurements.
2021-04-26 07:56:02 +02:00
*/
2022-01-17 13:48:55 +01:00
class RawMtmMeasurementSet : public StaticLocalDataSet<CAL_MTM_POOL_ENTRIES> {
public:
2022-10-19 15:36:57 +02:00
RawMtmMeasurementSet(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, IMTQ::SetIds::RAW_MGM) {}
2022-01-17 13:48:55 +01:00
2022-10-19 15:36:57 +02:00
RawMtmMeasurementSet(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, IMTQ::SetIds::RAW_MGM)) {}
2022-01-17 13:48:55 +01:00
/** The unit of all measurements is nT */
2022-08-18 17:27:39 +02:00
lp_vec_t<float, 3> mtmRawNt = lp_vec_t<float, 3>(sid.objectId, MTM_RAW, this);
2022-01-17 13:48:55 +01:00
/** 1 if coils were actuating during measurement otherwise 0 */
lp_var_t<uint8_t> coilActuationStatus =
lp_var_t<uint8_t>(sid.objectId, ACTUATION_RAW_STATUS, this);
2021-06-04 16:45:54 +02:00
};
/**
2021-06-15 15:13:47 +02:00
* @brief This class can be used to ease the generation of an action message commanding the
* IMTQHandler to configure the magnettorquer with the desired dipoles.
*
* @details Deserialize the packet, write the deserialized data to the ipc store and store the
* the ipc store address in the action message.
*/
class CommandDipolePacket : public SerialLinkedListAdapter<SerializeIF> {
2022-01-17 13:48:55 +01:00
public:
CommandDipolePacket() { setLinks(); }
2022-10-20 10:32:17 +02:00
SerializeElement<uint16_t> xDipole;
SerializeElement<uint16_t> yDipole;
SerializeElement<uint16_t> zDipole;
SerializeElement<uint16_t> duration;
2022-01-17 13:48:55 +01:00
private:
/**
* @brief Constructor
*
* @param xDipole The dipole of the x coil in 10 ^ -4 * Am^2
* @param yDipole The dipole of the y coil in 10 ^ -4 * Am^2
* @param zDipole The dipole of the z coil in 10 ^ -4 * Am^2
* @param duration The duration in milliseconds the dipole will be generated by the coils.
* When set to 0, the dipole will be generated until a new dipole actuation
* command is sent.
*/
CommandDipolePacket(uint16_t xDipole, uint16_t yDipole, uint16_t zDipole, uint16_t duration)
: xDipole(xDipole), yDipole(yDipole), zDipole(zDipole), duration(duration) {}
void setLinks() {
setStart(&xDipole);
xDipole.setNext(&yDipole);
yDipole.setNext(&zDipole);
zDipole.setNext(&duration);
}
2021-06-15 15:13:47 +02:00
};
2022-10-19 15:36:57 +02:00
class DipoleActuationSet : public StaticLocalDataSet<4> {
2022-10-20 10:44:28 +02:00
friend class ::ImtqHandler;
2022-10-19 15:36:57 +02:00
public:
DipoleActuationSet(HasLocalDataPoolIF& owner)
: StaticLocalDataSet(&owner, IMTQ::SetIds::DIPOLES) {}
DipoleActuationSet(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, IMTQ::SetIds::DIPOLES)) {}
2022-10-20 10:51:19 +02:00
// Refresh torque command without changing any of the set dipoles.
2022-10-20 15:08:33 +02:00
void refreshTorqueing(uint16_t durationMs_) { currentTorqueDurationMs = durationMs_; }
2022-10-20 10:51:19 +02:00
2023-01-31 19:12:39 +01:00
void setDipoles(int16_t xDipole_, int16_t yDipole_, int16_t zDipole_,
2022-10-19 15:36:57 +02:00
uint16_t currentTorqueDurationMs_) {
if (xDipole.value != xDipole_) {
2023-02-10 12:48:17 +01:00
xDipole = xDipole_;
2022-10-19 15:36:57 +02:00
}
if (yDipole.value != yDipole_) {
2023-02-10 12:48:17 +01:00
yDipole = yDipole_;
2022-10-19 15:36:57 +02:00
}
if (zDipole.value != zDipole_) {
2023-02-10 12:48:17 +01:00
zDipole = zDipole_;
2022-10-19 15:36:57 +02:00
}
currentTorqueDurationMs = currentTorqueDurationMs_;
}
2022-10-20 10:44:28 +02:00
2023-01-31 19:12:39 +01:00
void getDipoles(int16_t& xDipole_, int16_t& yDipole_, int16_t& zDipole_) {
2022-10-20 10:51:19 +02:00
xDipole_ = xDipole.value;
yDipole_ = yDipole.value;
zDipole_ = zDipole.value;
}
2022-10-20 10:44:28 +02:00
private:
2022-10-20 15:08:33 +02:00
lp_var_t<int16_t> xDipole = lp_var_t<int16_t>(sid.objectId, DIPOLES_X, this);
lp_var_t<int16_t> yDipole = lp_var_t<int16_t>(sid.objectId, DIPOLES_Y, this);
lp_var_t<int16_t> zDipole = lp_var_t<int16_t>(sid.objectId, DIPOLES_Z, this);
2022-10-19 15:36:57 +02:00
lp_var_t<uint16_t> currentTorqueDurationMs =
lp_var_t<uint16_t>(sid.objectId, CURRENT_TORQUE_DURATION, this);
};
2022-10-20 10:44:28 +02:00
2021-06-15 15:13:47 +02:00
/**
* @brief This dataset can be used to store the self test results of the +X self test.
2021-06-04 16:45:54 +02:00
*
* @details Units of measurements:
2021-06-12 15:45:24 +02:00
* Raw magnetic field: [nT]
* Calibrated magnetic field: [nT]
* Coil currents: [mA]
2022-02-03 16:25:16 +01:00
* Temperature: [C]
2021-06-15 15:13:47 +02:00
* The +X self test generates a positive dipole in X direction and measures the magnetic
* field with the built-in MTM. The procedure of the test is as follows:
2021-06-04 16:45:54 +02:00
* 1. All coils off (INIT step)
2021-06-15 15:13:47 +02:00
* 2. +X actuation
2021-06-11 11:53:43 +02:00
* 3. All coils off (FINA step)
2021-06-04 16:45:54 +02:00
*/
2022-01-17 13:48:55 +01:00
class PosXSelfTestSet : public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
PosXSelfTestSet(HasLocalDataPoolIF* owner)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(owner, IMTQ::SetIds::POS_X_TEST) {}
2022-01-17 13:48:55 +01:00
PosXSelfTestSet(object_id_t objectId)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(sid_t(objectId, IMTQ::SetIds::POS_X_TEST)) {}
2022-01-17 13:48:55 +01:00
/** INIT block */
lp_var_t<uint8_t> initErr = lp_var_t<uint8_t>(sid.objectId, INIT_POS_X_ERR, this);
lp_var_t<float> initRawMagX = lp_var_t<float>(sid.objectId, INIT_POS_X_RAW_MAG_X, this);
lp_var_t<float> initRawMagY = lp_var_t<float>(sid.objectId, INIT_POS_X_RAW_MAG_Y, this);
lp_var_t<float> initRawMagZ = lp_var_t<float>(sid.objectId, INIT_POS_X_RAW_MAG_Z, this);
lp_var_t<float> initCalMagX = lp_var_t<float>(sid.objectId, INIT_POS_X_CAL_MAG_X, this);
lp_var_t<float> initCalMagY = lp_var_t<float>(sid.objectId, INIT_POS_X_CAL_MAG_Y, this);
lp_var_t<float> initCalMagZ = lp_var_t<float>(sid.objectId, INIT_POS_X_CAL_MAG_Z, this);
lp_var_t<float> initCoilXCurrent = lp_var_t<float>(sid.objectId, INIT_POS_X_COIL_X_CURRENT, this);
lp_var_t<float> initCoilYCurrent = lp_var_t<float>(sid.objectId, INIT_POS_X_COIL_Y_CURRENT, this);
lp_var_t<float> initCoilZCurrent = lp_var_t<float>(sid.objectId, INIT_POS_X_COIL_Z_CURRENT, this);
lp_var_t<uint16_t> initCoilXTemperature =
lp_var_t<uint16_t>(sid.objectId, INIT_POS_X_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilYTemperature =
lp_var_t<uint16_t>(sid.objectId, INIT_POS_X_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilZTemperature =
lp_var_t<uint16_t>(sid.objectId, INIT_POS_X_COIL_Z_TEMPERATURE, this);
/** +X block */
lp_var_t<uint8_t> err = lp_var_t<uint8_t>(sid.objectId, POS_X_ERR, this);
lp_var_t<float> rawMagX = lp_var_t<float>(sid.objectId, POS_X_RAW_MAG_X, this);
lp_var_t<float> rawMagY = lp_var_t<float>(sid.objectId, POS_X_RAW_MAG_Y, this);
lp_var_t<float> rawMagZ = lp_var_t<float>(sid.objectId, POS_X_RAW_MAG_Z, this);
lp_var_t<float> calMagX = lp_var_t<float>(sid.objectId, POS_X_CAL_MAG_X, this);
lp_var_t<float> calMagY = lp_var_t<float>(sid.objectId, POS_X_CAL_MAG_Y, this);
lp_var_t<float> calMagZ = lp_var_t<float>(sid.objectId, POS_X_CAL_MAG_Z, this);
lp_var_t<float> coilXCurrent = lp_var_t<float>(sid.objectId, POS_X_COIL_X_CURRENT, this);
lp_var_t<float> coilYCurrent = lp_var_t<float>(sid.objectId, POS_X_COIL_Y_CURRENT, this);
lp_var_t<float> coilZCurrent = lp_var_t<float>(sid.objectId, POS_X_COIL_Z_CURRENT, this);
lp_var_t<int16_t> coilXTemperature =
lp_var_t<int16_t>(sid.objectId, POS_X_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> coilYTemperature =
lp_var_t<int16_t>(sid.objectId, POS_X_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> coilZTemperature =
lp_var_t<int16_t>(sid.objectId, POS_X_COIL_Z_TEMPERATURE, this);
2022-01-17 13:48:55 +01:00
/** FINA block */
lp_var_t<uint8_t> finaErr = lp_var_t<uint8_t>(sid.objectId, FINA_POS_X_ERR, this);
lp_var_t<float> finaRawMagX = lp_var_t<float>(sid.objectId, FINA_POS_X_RAW_MAG_X, this);
lp_var_t<float> finaRawMagY = lp_var_t<float>(sid.objectId, FINA_POS_X_RAW_MAG_Y, this);
lp_var_t<float> finaRawMagZ = lp_var_t<float>(sid.objectId, FINA_POS_X_RAW_MAG_Z, this);
lp_var_t<float> finaCalMagX = lp_var_t<float>(sid.objectId, FINA_POS_X_CAL_MAG_X, this);
lp_var_t<float> finaCalMagY = lp_var_t<float>(sid.objectId, FINA_POS_X_CAL_MAG_Y, this);
lp_var_t<float> finaCalMagZ = lp_var_t<float>(sid.objectId, FINA_POS_X_CAL_MAG_Z, this);
lp_var_t<float> finaCoilXCurrent = lp_var_t<float>(sid.objectId, FINA_POS_X_COIL_X_CURRENT, this);
lp_var_t<float> finaCoilYCurrent = lp_var_t<float>(sid.objectId, FINA_POS_X_COIL_Y_CURRENT, this);
lp_var_t<float> finaCoilZCurrent = lp_var_t<float>(sid.objectId, FINA_POS_X_COIL_Z_CURRENT, this);
lp_var_t<int16_t> finaCoilXTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_POS_X_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilYTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_POS_X_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilZTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_POS_X_COIL_Z_TEMPERATURE, this);
2021-04-26 07:56:02 +02:00
};
2021-03-17 11:14:48 +01:00
/**
2021-06-15 15:13:47 +02:00
* @brief This dataset can be used to store the self test results of the -X self test.
2021-03-19 15:33:43 +01:00
*
2021-06-15 15:13:47 +02:00
* @details Units of measurements:
* Raw magnetic field: [nT]
* Calibrated magnetic field: [nT]
* Coil currents: [mA]
2022-02-03 16:25:16 +01:00
* Temperature: [C]
2021-06-15 15:13:47 +02:00
* The -X self test generates a negative dipole in X direction and measures the magnetic
* field with the built-in MTM. The procedure of the test is as follows:
* 1. All coils off (INIT step)
* 2. -X actuation
* 3. All coils off (FINA step)
2021-03-17 11:14:48 +01:00
*/
2022-01-17 13:48:55 +01:00
class NegXSelfTestSet : public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
NegXSelfTestSet(HasLocalDataPoolIF* owner)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(owner, IMTQ::SetIds::NEG_X_TEST) {}
2022-01-17 13:48:55 +01:00
NegXSelfTestSet(object_id_t objectId)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(sid_t(objectId, IMTQ::SetIds::NEG_X_TEST)) {}
2022-01-17 13:48:55 +01:00
/** INIT block */
lp_var_t<uint8_t> initErr = lp_var_t<uint8_t>(sid.objectId, INIT_NEG_X_ERR, this);
lp_var_t<float> initRawMagX = lp_var_t<float>(sid.objectId, INIT_NEG_X_RAW_MAG_X, this);
lp_var_t<float> initRawMagY = lp_var_t<float>(sid.objectId, INIT_NEG_X_RAW_MAG_Y, this);
lp_var_t<float> initRawMagZ = lp_var_t<float>(sid.objectId, INIT_NEG_X_RAW_MAG_Z, this);
lp_var_t<float> initCalMagX = lp_var_t<float>(sid.objectId, INIT_NEG_X_CAL_MAG_X, this);
lp_var_t<float> initCalMagY = lp_var_t<float>(sid.objectId, INIT_NEG_X_CAL_MAG_Y, this);
lp_var_t<float> initCalMagZ = lp_var_t<float>(sid.objectId, INIT_NEG_X_CAL_MAG_Z, this);
lp_var_t<float> initCoilXCurrent = lp_var_t<float>(sid.objectId, INIT_NEG_X_COIL_X_CURRENT, this);
lp_var_t<float> initCoilYCurrent = lp_var_t<float>(sid.objectId, INIT_NEG_X_COIL_Y_CURRENT, this);
lp_var_t<float> initCoilZCurrent = lp_var_t<float>(sid.objectId, INIT_NEG_X_COIL_Z_CURRENT, this);
lp_var_t<int16_t> initCoilXTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_NEG_X_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> initCoilYTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_NEG_X_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> initCoilZTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_NEG_X_COIL_Z_TEMPERATURE, this);
2022-01-17 13:48:55 +01:00
/** -X block */
lp_var_t<uint8_t> err = lp_var_t<uint8_t>(sid.objectId, NEG_X_ERR, this);
lp_var_t<float> rawMagX = lp_var_t<float>(sid.objectId, NEG_X_RAW_MAG_X, this);
lp_var_t<float> rawMagY = lp_var_t<float>(sid.objectId, NEG_X_RAW_MAG_Y, this);
lp_var_t<float> rawMagZ = lp_var_t<float>(sid.objectId, NEG_X_RAW_MAG_Z, this);
lp_var_t<float> calMagX = lp_var_t<float>(sid.objectId, NEG_X_CAL_MAG_X, this);
lp_var_t<float> calMagY = lp_var_t<float>(sid.objectId, NEG_X_CAL_MAG_Y, this);
lp_var_t<float> calMagZ = lp_var_t<float>(sid.objectId, NEG_X_CAL_MAG_Z, this);
lp_var_t<float> coilXCurrent = lp_var_t<float>(sid.objectId, NEG_X_COIL_X_CURRENT, this);
lp_var_t<float> coilYCurrent = lp_var_t<float>(sid.objectId, NEG_X_COIL_Y_CURRENT, this);
lp_var_t<float> coilZCurrent = lp_var_t<float>(sid.objectId, NEG_X_COIL_Z_CURRENT, this);
lp_var_t<int16_t> coilXTemperature =
lp_var_t<int16_t>(sid.objectId, NEG_X_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> coilYTemperature =
lp_var_t<int16_t>(sid.objectId, NEG_X_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> coilZTemperature =
lp_var_t<int16_t>(sid.objectId, NEG_X_COIL_Z_TEMPERATURE, this);
2022-01-17 13:48:55 +01:00
/** FINA block */
lp_var_t<uint8_t> finaErr = lp_var_t<uint8_t>(sid.objectId, FINA_NEG_X_ERR, this);
lp_var_t<float> finaRawMagX = lp_var_t<float>(sid.objectId, FINA_NEG_X_RAW_MAG_X, this);
lp_var_t<float> finaRawMagY = lp_var_t<float>(sid.objectId, FINA_NEG_X_RAW_MAG_Y, this);
lp_var_t<float> finaRawMagZ = lp_var_t<float>(sid.objectId, FINA_NEG_X_RAW_MAG_Z, this);
lp_var_t<float> finaCalMagX = lp_var_t<float>(sid.objectId, FINA_NEG_X_CAL_MAG_X, this);
lp_var_t<float> finaCalMagY = lp_var_t<float>(sid.objectId, FINA_NEG_X_CAL_MAG_Y, this);
lp_var_t<float> finaCalMagZ = lp_var_t<float>(sid.objectId, FINA_NEG_X_CAL_MAG_Z, this);
lp_var_t<float> finaCoilXCurrent = lp_var_t<float>(sid.objectId, FINA_NEG_X_COIL_X_CURRENT, this);
lp_var_t<float> finaCoilYCurrent = lp_var_t<float>(sid.objectId, FINA_NEG_X_COIL_Y_CURRENT, this);
lp_var_t<float> finaCoilZCurrent = lp_var_t<float>(sid.objectId, FINA_NEG_X_COIL_Z_CURRENT, this);
lp_var_t<int16_t> finaCoilXTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_NEG_X_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilYTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_NEG_X_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilZTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_NEG_X_COIL_Z_TEMPERATURE, this);
2021-06-15 15:13:47 +02:00
};
/**
* @brief This dataset can be used to store the self test results of the +Y self test.
*
* @details Units of measurements:
* Raw magnetic field: [nT]
* Calibrated magnetic field: [nT]
* Coil currents: [mA]
2022-02-03 16:25:16 +01:00
* Temperature: [C]
2021-06-15 15:13:47 +02:00
* The +Y self test generates a positive dipole in y direction and measures the magnetic
* field with the built-in MTM. The procedure of the test is as follows:
* 1. All coils off (INIT step)
* 2. +Y actuation
* 3. All coils off (FINA step)
*/
2022-01-17 13:48:55 +01:00
class PosYSelfTestSet : public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
PosYSelfTestSet(HasLocalDataPoolIF* owner)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(owner, IMTQ::SetIds::POS_Y_TEST) {}
2022-01-17 13:48:55 +01:00
PosYSelfTestSet(object_id_t objectId)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(sid_t(objectId, IMTQ::SetIds::POS_Y_TEST)) {}
2022-01-17 13:48:55 +01:00
/** INIT block */
lp_var_t<uint8_t> initErr = lp_var_t<uint8_t>(sid.objectId, INIT_POS_Y_ERR, this);
lp_var_t<float> initRawMagX = lp_var_t<float>(sid.objectId, INIT_POS_Y_RAW_MAG_X, this);
lp_var_t<float> initRawMagY = lp_var_t<float>(sid.objectId, INIT_POS_Y_RAW_MAG_Y, this);
lp_var_t<float> initRawMagZ = lp_var_t<float>(sid.objectId, INIT_POS_Y_RAW_MAG_Z, this);
lp_var_t<float> initCalMagX = lp_var_t<float>(sid.objectId, INIT_POS_Y_CAL_MAG_X, this);
lp_var_t<float> initCalMagY = lp_var_t<float>(sid.objectId, INIT_POS_Y_CAL_MAG_Y, this);
lp_var_t<float> initCalMagZ = lp_var_t<float>(sid.objectId, INIT_POS_Y_CAL_MAG_Z, this);
lp_var_t<float> initCoilXCurrent = lp_var_t<float>(sid.objectId, INIT_POS_Y_COIL_X_CURRENT, this);
lp_var_t<float> initCoilYCurrent = lp_var_t<float>(sid.objectId, INIT_POS_Y_COIL_Y_CURRENT, this);
lp_var_t<float> initCoilZCurrent = lp_var_t<float>(sid.objectId, INIT_POS_Y_COIL_Z_CURRENT, this);
lp_var_t<int16_t> initCoilXTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_POS_Y_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> initCoilYTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_POS_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> initCoilZTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_POS_Y_COIL_Z_TEMPERATURE, this);
2022-01-17 13:48:55 +01:00
/** +Y block */
lp_var_t<uint8_t> err = lp_var_t<uint8_t>(sid.objectId, POS_Y_ERR, this);
lp_var_t<float> rawMagX = lp_var_t<float>(sid.objectId, POS_Y_RAW_MAG_X, this);
lp_var_t<float> rawMagY = lp_var_t<float>(sid.objectId, POS_Y_RAW_MAG_Y, this);
lp_var_t<float> rawMagZ = lp_var_t<float>(sid.objectId, POS_Y_RAW_MAG_Z, this);
lp_var_t<float> calMagX = lp_var_t<float>(sid.objectId, POS_Y_CAL_MAG_X, this);
lp_var_t<float> calMagY = lp_var_t<float>(sid.objectId, POS_Y_CAL_MAG_Y, this);
lp_var_t<float> calMagZ = lp_var_t<float>(sid.objectId, POS_Y_CAL_MAG_Z, this);
lp_var_t<float> coilXCurrent = lp_var_t<float>(sid.objectId, POS_Y_COIL_X_CURRENT, this);
lp_var_t<float> coilYCurrent = lp_var_t<float>(sid.objectId, POS_Y_COIL_Y_CURRENT, this);
lp_var_t<float> coilZCurrent = lp_var_t<float>(sid.objectId, POS_Y_COIL_Z_CURRENT, this);
lp_var_t<int16_t> coilXTemperature =
lp_var_t<int16_t>(sid.objectId, POS_Y_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> coilYTemperature =
lp_var_t<int16_t>(sid.objectId, POS_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> coilZTemperature =
lp_var_t<int16_t>(sid.objectId, POS_Y_COIL_Z_TEMPERATURE, this);
2022-01-17 13:48:55 +01:00
/** FINA block */
lp_var_t<uint8_t> finaErr = lp_var_t<uint8_t>(sid.objectId, FINA_POS_Y_ERR, this);
lp_var_t<float> finaRawMagX = lp_var_t<float>(sid.objectId, FINA_POS_Y_RAW_MAG_X, this);
lp_var_t<float> finaRawMagY = lp_var_t<float>(sid.objectId, FINA_POS_Y_RAW_MAG_Y, this);
lp_var_t<float> finaRawMagZ = lp_var_t<float>(sid.objectId, FINA_POS_Y_RAW_MAG_Z, this);
lp_var_t<float> finaCalMagX = lp_var_t<float>(sid.objectId, FINA_POS_Y_CAL_MAG_X, this);
lp_var_t<float> finaCalMagY = lp_var_t<float>(sid.objectId, FINA_POS_Y_CAL_MAG_Y, this);
lp_var_t<float> finaCalMagZ = lp_var_t<float>(sid.objectId, FINA_POS_Y_CAL_MAG_Z, this);
lp_var_t<float> finaCoilXCurrent = lp_var_t<float>(sid.objectId, FINA_POS_Y_COIL_X_CURRENT, this);
lp_var_t<float> finaCoilYCurrent = lp_var_t<float>(sid.objectId, FINA_POS_Y_COIL_Y_CURRENT, this);
lp_var_t<float> finaCoilZCurrent = lp_var_t<float>(sid.objectId, FINA_POS_Y_COIL_Z_CURRENT, this);
lp_var_t<int16_t> finaCoilXTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_POS_Y_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilYTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_POS_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilZTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_POS_Y_COIL_Z_TEMPERATURE, this);
2021-03-17 11:14:48 +01:00
};
2021-06-15 15:13:47 +02:00
/**
* @brief This dataset can be used to store the self test results of the -Y self test.
*
* @details Units of measurements:
* Raw magnetic field: [nT]
* Calibrated magnetic field: [nT]
* Coil currents: [mA]
2022-02-03 16:25:16 +01:00
* Temperature: [C]
2021-06-15 15:13:47 +02:00
* The -Y self test generates a negative dipole in y direction and measures the magnetic
* field with the built-in MTM. The procedure of the test is as follows:
* 1. All coils off (INIT step)
* 2. -Y actuation
* 3. All coils off (FINA step)
*/
2022-01-17 13:48:55 +01:00
class NegYSelfTestSet : public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
NegYSelfTestSet(HasLocalDataPoolIF* owner)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(owner, IMTQ::SetIds::NEG_Y_TEST) {}
2022-01-17 13:48:55 +01:00
NegYSelfTestSet(object_id_t objectId)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(sid_t(objectId, IMTQ::SetIds::NEG_Y_TEST)) {}
2022-01-17 13:48:55 +01:00
/** INIT block */
lp_var_t<uint8_t> initErr = lp_var_t<uint8_t>(sid.objectId, INIT_NEG_Y_ERR, this);
lp_var_t<float> initRawMagX = lp_var_t<float>(sid.objectId, INIT_NEG_Y_RAW_MAG_X, this);
lp_var_t<float> initRawMagY = lp_var_t<float>(sid.objectId, INIT_NEG_Y_RAW_MAG_Y, this);
lp_var_t<float> initRawMagZ = lp_var_t<float>(sid.objectId, INIT_NEG_Y_RAW_MAG_Z, this);
lp_var_t<float> initCalMagX = lp_var_t<float>(sid.objectId, INIT_NEG_Y_CAL_MAG_X, this);
lp_var_t<float> initCalMagY = lp_var_t<float>(sid.objectId, INIT_NEG_Y_CAL_MAG_Y, this);
lp_var_t<float> initCalMagZ = lp_var_t<float>(sid.objectId, INIT_NEG_Y_CAL_MAG_Z, this);
lp_var_t<float> initCoilXCurrent = lp_var_t<float>(sid.objectId, INIT_NEG_Y_COIL_X_CURRENT, this);
lp_var_t<float> initCoilYCurrent = lp_var_t<float>(sid.objectId, INIT_NEG_Y_COIL_Y_CURRENT, this);
lp_var_t<float> initCoilZCurrent = lp_var_t<float>(sid.objectId, INIT_NEG_Y_COIL_Z_CURRENT, this);
lp_var_t<int16_t> initCoilXTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_NEG_Y_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> initCoilYTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_NEG_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> initCoilZTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_NEG_Y_COIL_Z_TEMPERATURE, this);
2022-01-17 13:48:55 +01:00
/** -Y block */
lp_var_t<uint8_t> err = lp_var_t<uint8_t>(sid.objectId, NEG_Y_ERR, this);
lp_var_t<float> rawMagX = lp_var_t<float>(sid.objectId, NEG_Y_RAW_MAG_X, this);
lp_var_t<float> rawMagY = lp_var_t<float>(sid.objectId, NEG_Y_RAW_MAG_Y, this);
lp_var_t<float> rawMagZ = lp_var_t<float>(sid.objectId, NEG_Y_RAW_MAG_Z, this);
lp_var_t<float> calMagX = lp_var_t<float>(sid.objectId, NEG_Y_CAL_MAG_X, this);
lp_var_t<float> calMagY = lp_var_t<float>(sid.objectId, NEG_Y_CAL_MAG_Y, this);
lp_var_t<float> calMagZ = lp_var_t<float>(sid.objectId, NEG_Y_CAL_MAG_Z, this);
lp_var_t<float> coilXCurrent = lp_var_t<float>(sid.objectId, NEG_Y_COIL_X_CURRENT, this);
lp_var_t<float> coilYCurrent = lp_var_t<float>(sid.objectId, NEG_Y_COIL_Y_CURRENT, this);
lp_var_t<float> coilZCurrent = lp_var_t<float>(sid.objectId, NEG_Y_COIL_Z_CURRENT, this);
lp_var_t<int16_t> coilXTemperature =
lp_var_t<int16_t>(sid.objectId, NEG_Y_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> coilYTemperature =
lp_var_t<int16_t>(sid.objectId, NEG_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> coilZTemperature =
lp_var_t<int16_t>(sid.objectId, NEG_Y_COIL_Z_TEMPERATURE, this);
2022-01-17 13:48:55 +01:00
/** FINA block */
lp_var_t<uint8_t> finaErr = lp_var_t<uint8_t>(sid.objectId, FINA_NEG_Y_ERR, this);
lp_var_t<float> finaRawMagX = lp_var_t<float>(sid.objectId, FINA_NEG_Y_RAW_MAG_X, this);
lp_var_t<float> finaRawMagY = lp_var_t<float>(sid.objectId, FINA_NEG_Y_RAW_MAG_Y, this);
lp_var_t<float> finaRawMagZ = lp_var_t<float>(sid.objectId, FINA_NEG_Y_RAW_MAG_Z, this);
lp_var_t<float> finaCalMagX = lp_var_t<float>(sid.objectId, FINA_NEG_Y_CAL_MAG_X, this);
lp_var_t<float> finaCalMagY = lp_var_t<float>(sid.objectId, FINA_NEG_Y_CAL_MAG_Y, this);
lp_var_t<float> finaCalMagZ = lp_var_t<float>(sid.objectId, FINA_NEG_Y_CAL_MAG_Z, this);
lp_var_t<float> finaCoilXCurrent = lp_var_t<float>(sid.objectId, FINA_NEG_Y_COIL_X_CURRENT, this);
lp_var_t<float> finaCoilYCurrent = lp_var_t<float>(sid.objectId, FINA_NEG_Y_COIL_Y_CURRENT, this);
lp_var_t<float> finaCoilZCurrent = lp_var_t<float>(sid.objectId, FINA_NEG_Y_COIL_Z_CURRENT, this);
lp_var_t<int16_t> finaCoilXTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_NEG_Y_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilYTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_NEG_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilZTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_NEG_Y_COIL_Z_TEMPERATURE, this);
2021-06-15 15:13:47 +02:00
};
/**
* @brief This dataset can be used to store the self test results of the +Z self test.
*
* @details Units of measurements:
* Raw magnetic field: [nT]
* Calibrated magnetic field: [nT]
* Coil currents: [mA]
2022-02-03 16:25:16 +01:00
* Temperature: [C]
2021-06-15 15:13:47 +02:00
* The +Z self test generates a positive dipole in z direction and measures the magnetic
* field with the built-in MTM. The procedure of the test is as follows:
* 1. All coils off (INIT step)
* 2. +Z actuation
* 3. All coils off (FINA step)
*/
2022-01-17 13:48:55 +01:00
class PosZSelfTestSet : public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
PosZSelfTestSet(HasLocalDataPoolIF* owner)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(owner, IMTQ::SetIds::POS_Z_TEST) {}
2022-01-17 13:48:55 +01:00
PosZSelfTestSet(object_id_t objectId)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(sid_t(objectId, IMTQ::SetIds::POS_Z_TEST)) {}
2022-01-17 13:48:55 +01:00
/** INIT block */
lp_var_t<uint8_t> initErr = lp_var_t<uint8_t>(sid.objectId, INIT_POS_Z_ERR, this);
lp_var_t<float> initRawMagX = lp_var_t<float>(sid.objectId, INIT_POS_Z_RAW_MAG_X, this);
lp_var_t<float> initRawMagY = lp_var_t<float>(sid.objectId, INIT_POS_Z_RAW_MAG_Y, this);
lp_var_t<float> initRawMagZ = lp_var_t<float>(sid.objectId, INIT_POS_Z_RAW_MAG_Z, this);
lp_var_t<float> initCalMagX = lp_var_t<float>(sid.objectId, INIT_POS_Z_CAL_MAG_X, this);
lp_var_t<float> initCalMagY = lp_var_t<float>(sid.objectId, INIT_POS_Z_CAL_MAG_Y, this);
lp_var_t<float> initCalMagZ = lp_var_t<float>(sid.objectId, INIT_POS_Z_CAL_MAG_Z, this);
lp_var_t<float> initCoilXCurrent = lp_var_t<float>(sid.objectId, INIT_POS_Z_COIL_X_CURRENT, this);
lp_var_t<float> initCoilYCurrent = lp_var_t<float>(sid.objectId, INIT_POS_Z_COIL_Y_CURRENT, this);
lp_var_t<float> initCoilZCurrent = lp_var_t<float>(sid.objectId, INIT_POS_Z_COIL_Z_CURRENT, this);
lp_var_t<uint16_t> initCoilXTemperature =
lp_var_t<uint16_t>(sid.objectId, INIT_POS_Z_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilYTemperature =
lp_var_t<uint16_t>(sid.objectId, INIT_POS_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilZTemperature =
lp_var_t<uint16_t>(sid.objectId, INIT_POS_Z_COIL_Z_TEMPERATURE, this);
/** +Z block */
lp_var_t<uint8_t> err = lp_var_t<uint8_t>(sid.objectId, POS_Z_ERR, this);
lp_var_t<float> rawMagX = lp_var_t<float>(sid.objectId, POS_Z_RAW_MAG_X, this);
lp_var_t<float> rawMagY = lp_var_t<float>(sid.objectId, POS_Z_RAW_MAG_Y, this);
lp_var_t<float> rawMagZ = lp_var_t<float>(sid.objectId, POS_Z_RAW_MAG_Z, this);
lp_var_t<float> calMagX = lp_var_t<float>(sid.objectId, POS_Z_CAL_MAG_X, this);
lp_var_t<float> calMagY = lp_var_t<float>(sid.objectId, POS_Z_CAL_MAG_Y, this);
lp_var_t<float> calMagZ = lp_var_t<float>(sid.objectId, POS_Z_CAL_MAG_Z, this);
lp_var_t<float> coilXCurrent = lp_var_t<float>(sid.objectId, POS_Z_COIL_X_CURRENT, this);
lp_var_t<float> coilYCurrent = lp_var_t<float>(sid.objectId, POS_Z_COIL_Y_CURRENT, this);
lp_var_t<float> coilZCurrent = lp_var_t<float>(sid.objectId, POS_Z_COIL_Z_CURRENT, this);
lp_var_t<int16_t> coilXTemperature =
lp_var_t<int16_t>(sid.objectId, POS_Z_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> coilYTemperature =
lp_var_t<int16_t>(sid.objectId, POS_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> coilZTemperature =
lp_var_t<int16_t>(sid.objectId, POS_Z_COIL_Z_TEMPERATURE, this);
2022-01-17 13:48:55 +01:00
/** FINA block */
lp_var_t<uint8_t> finaErr = lp_var_t<uint8_t>(sid.objectId, FINA_POS_Z_ERR, this);
lp_var_t<float> finaRawMagX = lp_var_t<float>(sid.objectId, FINA_POS_Z_RAW_MAG_X, this);
lp_var_t<float> finaRawMagY = lp_var_t<float>(sid.objectId, FINA_POS_Z_RAW_MAG_Y, this);
lp_var_t<float> finaRawMagZ = lp_var_t<float>(sid.objectId, FINA_POS_Z_RAW_MAG_Z, this);
lp_var_t<float> finaCalMagX = lp_var_t<float>(sid.objectId, FINA_POS_Z_CAL_MAG_X, this);
lp_var_t<float> finaCalMagY = lp_var_t<float>(sid.objectId, FINA_POS_Z_CAL_MAG_Y, this);
lp_var_t<float> finaCalMagZ = lp_var_t<float>(sid.objectId, FINA_POS_Z_CAL_MAG_Z, this);
lp_var_t<float> finaCoilXCurrent = lp_var_t<float>(sid.objectId, FINA_POS_Z_COIL_X_CURRENT, this);
lp_var_t<float> finaCoilYCurrent = lp_var_t<float>(sid.objectId, FINA_POS_Z_COIL_Y_CURRENT, this);
lp_var_t<float> finaCoilZCurrent = lp_var_t<float>(sid.objectId, FINA_POS_Z_COIL_Z_CURRENT, this);
lp_var_t<int16_t> finaCoilXTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_POS_Z_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilYTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_POS_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilZTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_POS_Z_COIL_Z_TEMPERATURE, this);
2021-06-15 15:13:47 +02:00
};
/**
* @brief This dataset can be used to store the self test results of the -Z self test.
*
* @details Units of measurements:
* Raw magnetic field: [nT]
* Calibrated magnetic field: [nT]
* Coil currents: [mA]
2022-02-03 16:25:16 +01:00
* Temperature: [C]
2021-06-15 15:13:47 +02:00
* The -Z self test generates a negative dipole in z direction and measures the magnetic
* field with the built-in MTM. The procedure of the test is as follows:
* 1. All coils off (INIT step)
* 2. -Z actuation
* 3. All coils off (FINA step)
*/
2022-01-17 13:48:55 +01:00
class NegZSelfTestSet : public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
NegZSelfTestSet(HasLocalDataPoolIF* owner)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(owner, IMTQ::SetIds::NEG_Z_TEST) {}
2022-01-17 13:48:55 +01:00
NegZSelfTestSet(object_id_t objectId)
2022-10-19 15:36:57 +02:00
: StaticLocalDataSet(sid_t(objectId, IMTQ::SetIds::NEG_Z_TEST)) {}
2022-01-17 13:48:55 +01:00
/** INIT block */
lp_var_t<uint8_t> initErr = lp_var_t<uint8_t>(sid.objectId, INIT_NEG_Z_ERR, this);
lp_var_t<float> initRawMagX = lp_var_t<float>(sid.objectId, INIT_NEG_Z_RAW_MAG_X, this);
lp_var_t<float> initRawMagY = lp_var_t<float>(sid.objectId, INIT_NEG_Z_RAW_MAG_Y, this);
lp_var_t<float> initRawMagZ = lp_var_t<float>(sid.objectId, INIT_NEG_Z_RAW_MAG_Z, this);
lp_var_t<float> initCalMagX = lp_var_t<float>(sid.objectId, INIT_NEG_Z_CAL_MAG_X, this);
lp_var_t<float> initCalMagY = lp_var_t<float>(sid.objectId, INIT_NEG_Z_CAL_MAG_Y, this);
lp_var_t<float> initCalMagZ = lp_var_t<float>(sid.objectId, INIT_NEG_Z_CAL_MAG_Z, this);
lp_var_t<float> initCoilXCurrent = lp_var_t<float>(sid.objectId, INIT_NEG_Z_COIL_X_CURRENT, this);
lp_var_t<float> initCoilYCurrent = lp_var_t<float>(sid.objectId, INIT_NEG_Z_COIL_Y_CURRENT, this);
lp_var_t<float> initCoilZCurrent = lp_var_t<float>(sid.objectId, INIT_NEG_Z_COIL_Z_CURRENT, this);
lp_var_t<int16_t> initCoilXTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_NEG_Z_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> initCoilYTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_NEG_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> initCoilZTemperature =
lp_var_t<int16_t>(sid.objectId, INIT_NEG_Z_COIL_Z_TEMPERATURE, this);
2022-01-17 13:48:55 +01:00
/** +Z block */
lp_var_t<uint8_t> err = lp_var_t<uint8_t>(sid.objectId, NEG_Z_ERR, this);
lp_var_t<float> rawMagX = lp_var_t<float>(sid.objectId, NEG_Z_RAW_MAG_X, this);
lp_var_t<float> rawMagY = lp_var_t<float>(sid.objectId, NEG_Z_RAW_MAG_Y, this);
lp_var_t<float> rawMagZ = lp_var_t<float>(sid.objectId, NEG_Z_RAW_MAG_Z, this);
lp_var_t<float> calMagX = lp_var_t<float>(sid.objectId, NEG_Z_CAL_MAG_X, this);
lp_var_t<float> calMagY = lp_var_t<float>(sid.objectId, NEG_Z_CAL_MAG_Y, this);
lp_var_t<float> calMagZ = lp_var_t<float>(sid.objectId, NEG_Z_CAL_MAG_Z, this);
lp_var_t<float> coilXCurrent = lp_var_t<float>(sid.objectId, NEG_Z_COIL_X_CURRENT, this);
lp_var_t<float> coilYCurrent = lp_var_t<float>(sid.objectId, NEG_Z_COIL_Y_CURRENT, this);
lp_var_t<float> coilZCurrent = lp_var_t<float>(sid.objectId, NEG_Z_COIL_Z_CURRENT, this);
lp_var_t<int16_t> coilXTemperature =
lp_var_t<int16_t>(sid.objectId, NEG_Z_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> coilYTemperature =
lp_var_t<int16_t>(sid.objectId, NEG_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> coilZTemperature =
lp_var_t<int16_t>(sid.objectId, NEG_Z_COIL_Z_TEMPERATURE, this);
2022-01-17 13:48:55 +01:00
/** FINA block */
lp_var_t<uint8_t> finaErr = lp_var_t<uint8_t>(sid.objectId, FINA_NEG_Z_ERR, this);
lp_var_t<float> finaRawMagX = lp_var_t<float>(sid.objectId, FINA_NEG_Z_RAW_MAG_X, this);
lp_var_t<float> finaRawMagY = lp_var_t<float>(sid.objectId, FINA_NEG_Z_RAW_MAG_Y, this);
lp_var_t<float> finaRawMagZ = lp_var_t<float>(sid.objectId, FINA_NEG_Z_RAW_MAG_Z, this);
lp_var_t<float> finaCalMagX = lp_var_t<float>(sid.objectId, FINA_NEG_Z_CAL_MAG_X, this);
lp_var_t<float> finaCalMagY = lp_var_t<float>(sid.objectId, FINA_NEG_Z_CAL_MAG_Y, this);
lp_var_t<float> finaCalMagZ = lp_var_t<float>(sid.objectId, FINA_NEG_Z_CAL_MAG_Z, this);
lp_var_t<float> finaCoilXCurrent = lp_var_t<float>(sid.objectId, FINA_NEG_Z_COIL_X_CURRENT, this);
lp_var_t<float> finaCoilYCurrent = lp_var_t<float>(sid.objectId, FINA_NEG_Z_COIL_Y_CURRENT, this);
lp_var_t<float> finaCoilZCurrent = lp_var_t<float>(sid.objectId, FINA_NEG_Z_COIL_Z_CURRENT, this);
lp_var_t<int16_t> finaCoilXTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_NEG_Z_COIL_X_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilYTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_NEG_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<int16_t> finaCoilZTemperature =
lp_var_t<int16_t>(sid.objectId, FINA_NEG_Z_COIL_Z_TEMPERATURE, this);
2021-06-15 15:13:47 +02:00
};
2022-01-17 13:48:55 +01:00
} // namespace IMTQ
2021-03-17 11:14:48 +01:00
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_IMTQDEFINITIONS_H_ */