IMTQ handler complete

This commit is contained in:
Jakob Meier 2021-06-15 15:13:47 +02:00
parent 595abf3899
commit 5e7cdd9f7f
5 changed files with 1916 additions and 249 deletions

View File

@ -542,8 +542,7 @@ void ObjectFactory::produce(void* args){
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
std::string("/dev/i2c-0"));
IMTQHandler* imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
imtqHandler->setStartUpImmediately();
new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
UartCookie* plocUartCookie = new UartCookie(std::string("/dev/ttyUL3"), 115200,
PLOC::MAX_REPLY_SIZE);

2
fsfw

@ -1 +1 @@
Subproject commit 1630682548a8775bd0c293b3c76c29e120de5bf0
Subproject commit d700fb551c85393b58a3ada96fbd3f807217d14b

File diff suppressed because it is too large Load Diff

View File

@ -82,7 +82,12 @@ private:
IMTQ::EngHkDataset engHkDataset;
IMTQ::CalibratedMtmMeasurementSet calMtmMeasurementSet;
IMTQ::RawMtmMeasurementSet rawMtmMeasurementSet;
IMTQ::PosXselfTestSet posXselfTestDataset;
IMTQ::PosXSelfTestSet posXselfTestDataset;
IMTQ::NegXSelfTestSet negXselfTestDataset;
IMTQ::PosYSelfTestSet posYselfTestDataset;
IMTQ::NegYSelfTestSet negYselfTestDataset;
IMTQ::PosZSelfTestSet posZselfTestDataset;
IMTQ::NegZSelfTestSet negZselfTestDataset;
uint8_t commandBuffer[IMTQ::MAX_COMMAND_SIZE];
@ -170,6 +175,11 @@ private:
* @param packet Pointer to the reply data holding the self test result.
*/
void handlePositiveXSelfTestReply(const uint8_t* packet);
void handleNegativeXSelfTestReply(const uint8_t* packet);
void handlePositiveYSelfTestReply(const uint8_t* packet);
void handleNegativeYSelfTestReply(const uint8_t* packet);
void handlePositiveZSelfTestReply(const uint8_t* packet);
void handleNegativeZSelfTestReply(const uint8_t* packet);
/**
* @brief This function checks the error byte of a self test measurement.

View File

@ -29,12 +29,13 @@ namespace IMTQ {
static const uint32_t ENG_HK_DATA_SET_ID = 1;
static const uint32_t CAL_MTM_SET = 2;
static const uint32_t POS_X_TEST_DATASET = 3;
static const uint32_t NEG_X_TEST_DATASET = 4;
static const uint32_t POS_Y_TEST_DATASET = 5;
static const uint32_t NEG_Y_TEST_DATASET = 6;
static const uint32_t POS_Z_TEST_DATASET = 7;
static const uint32_t NEG_Z_TEST_DATASET = 8;
static const uint32_t RAW_MTM_SET = 3;
static const uint32_t POS_X_TEST_DATASET = 4;
static const uint32_t NEG_X_TEST_DATASET = 5;
static const uint32_t POS_Y_TEST_DATASET = 6;
static const uint32_t NEG_Y_TEST_DATASET = 7;
static const uint32_t POS_Z_TEST_DATASET = 8;
static const uint32_t NEG_Z_TEST_DATASET = 9;
static const uint8_t SIZE_ENG_HK_COMMAND = 1;
static const uint8_t SIZE_STATUS_REPLY = 2;
@ -405,7 +406,7 @@ public:
};
/**
* @brief This dataset holds the raw MTM measurements.
* @brief This dataset holds the last calibrated MTM measurement.
*/
class CalibratedMtmMeasurementSet: public StaticLocalDataSet<CAL_MTM_POOL_ENTRIES> {
public:
@ -428,17 +429,17 @@ public:
};
/**
* @brief This dataset holds the last calibrated MTM measurement.
* @brief This dataset holds the raw MTM measurements.
*/
class RawMtmMeasurementSet: public StaticLocalDataSet<CAL_MTM_POOL_ENTRIES> {
public:
RawMtmMeasurementSet(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, CAL_MTM_SET) {
StaticLocalDataSet(owner, RAW_MTM_SET) {
}
RawMtmMeasurementSet(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, CAL_MTM_SET)) {
StaticLocalDataSet(sid_t(objectId, RAW_MTM_SET)) {
}
/** The unit of all measurements is nT */
@ -450,29 +451,71 @@ public:
this);
};
/**
* @brief This dataset can be used to store the self test results of the positve X axis test.
* @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> {
public:
CommandDipolePacket() {
setLinks();
}
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);
}
SerializeElement<uint16_t> xDipole;
SerializeElement<uint16_t> yDipole;
SerializeElement<uint16_t> zDipole;
SerializeElement<uint16_t> duration;
};
/**
* @brief This dataset can be used to store the self test results of the +X self test.
*
* @details Units of measurements:
* Raw magnetic field: [nT]
* Calibrated magnetic field: [nT]
* Coil currents: [mA]
* Temperature: [°C]
* The self test generates for each axis the positive and negative dipole and measures
* the magnetic field with the built-in MTM. The procedure of the test is as follows:
* 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:
* 1. All coils off (INIT step)
* 2. +X (apply current to generate dipole in positive X direction)
* 2. +X actuation
* 3. All coils off (FINA step)
*/
class PosXselfTestSet: public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
class PosXSelfTestSet: public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
PosXselfTestSet(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, POS_X_TEST_DATASET) {
PosXSelfTestSet(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, IMTQ::POS_X_TEST_DATASET) {
}
PosXselfTestSet(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, POS_X_TEST_DATASET)) {
PosXSelfTestSet(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, IMTQ::POS_X_TEST_DATASET)) {
}
/** INIT block */
@ -540,45 +583,451 @@ public:
};
/**
* @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.
* @brief This dataset can be used to store the self test results of the -X self test.
*
* @details Deserialize the packet, write the deserialized data to the ipc store and store the
* the ipc store address in the action message.
* @details Units of measurements:
* Raw magnetic field: [nT]
* Calibrated magnetic field: [nT]
* Coil currents: [mA]
* Temperature: [°C]
* 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)
*/
class CommandDipolePacket : public SerialLinkedListAdapter<SerializeIF> {
class NegXSelfTestSet: public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
CommandDipolePacket() {
setLinks();
NegXSelfTestSet(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, IMTQ::NEG_X_TEST_DATASET) {
}
private:
NegXSelfTestSet(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, IMTQ::NEG_X_TEST_DATASET)) {
}
/** 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<uint16_t> initCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_NEG_X_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_NEG_X_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_NEG_X_COIL_Z_TEMPERATURE, this);
/** -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<uint16_t> coilXTemperature = lp_var_t<uint16_t>(sid.objectId,
NEG_X_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> coilYTemperature = lp_var_t<uint16_t>(sid.objectId,
NEG_X_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> coilZTemperature = lp_var_t<uint16_t>(sid.objectId,
NEG_X_COIL_Z_TEMPERATURE, this);
/** 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<uint16_t> finaCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_NEG_X_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> finaCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_NEG_X_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> finaCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_NEG_X_COIL_Z_TEMPERATURE, this);
};
/**
* @brief Constructor
* @brief This dataset can be used to store the self test results of the +Y self test.
*
* @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.
* @details Units of measurements:
* Raw magnetic field: [nT]
* Calibrated magnetic field: [nT]
* Coil currents: [mA]
* Temperature: [°C]
* 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)
*/
CommandDipolePacket(uint16_t xDipole, uint16_t yDipole, uint16_t zDipole, uint16_t duration) :
xDipole(xDipole), yDipole(yDipole), zDipole(zDipole), duration(duration) {
class PosYSelfTestSet: public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
PosYSelfTestSet(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, IMTQ::POS_Y_TEST_DATASET) {
}
void setLinks() {
setStart(&xDipole);
xDipole.setNext(&yDipole);
yDipole.setNext(&zDipole);
zDipole.setNext(&duration);
PosYSelfTestSet(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, IMTQ::POS_Y_TEST_DATASET)) {
}
SerializeElement<uint16_t> xDipole;
SerializeElement<uint16_t> yDipole;
SerializeElement<uint16_t> zDipole;
SerializeElement<uint16_t> duration;
/** 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<uint16_t> initCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_POS_Y_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_POS_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_POS_Y_COIL_Z_TEMPERATURE, this);
/** +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<uint16_t> coilXTemperature = lp_var_t<uint16_t>(sid.objectId,
POS_Y_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> coilYTemperature = lp_var_t<uint16_t>(sid.objectId,
POS_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> coilZTemperature = lp_var_t<uint16_t>(sid.objectId,
POS_Y_COIL_Z_TEMPERATURE, this);
/** 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<uint16_t> finaCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_POS_Y_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> finaCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_POS_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> finaCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_POS_Y_COIL_Z_TEMPERATURE, this);
};
/**
* @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]
* Temperature: [°C]
* 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)
*/
class NegYSelfTestSet: public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
NegYSelfTestSet(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, IMTQ::NEG_Y_TEST_DATASET) {
}
NegYSelfTestSet(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, IMTQ::NEG_Y_TEST_DATASET)) {
}
/** 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<uint16_t> initCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_NEG_Y_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_NEG_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_NEG_Y_COIL_Z_TEMPERATURE, this);
/** -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<uint16_t> coilXTemperature = lp_var_t<uint16_t>(sid.objectId,
NEG_Y_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> coilYTemperature = lp_var_t<uint16_t>(sid.objectId,
NEG_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> coilZTemperature = lp_var_t<uint16_t>(sid.objectId,
NEG_Y_COIL_Z_TEMPERATURE, this);
/** 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<uint16_t> finaCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_NEG_Y_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> finaCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_NEG_Y_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> finaCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_NEG_Y_COIL_Z_TEMPERATURE, this);
};
/**
* @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]
* Temperature: [°C]
* 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)
*/
class PosZSelfTestSet: public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
PosZSelfTestSet(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, IMTQ::POS_Z_TEST_DATASET) {
}
PosZSelfTestSet(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, IMTQ::POS_Z_TEST_DATASET)) {
}
/** 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<uint16_t> coilXTemperature = lp_var_t<uint16_t>(sid.objectId,
POS_Z_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> coilYTemperature = lp_var_t<uint16_t>(sid.objectId,
POS_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> coilZTemperature = lp_var_t<uint16_t>(sid.objectId,
POS_Z_COIL_Z_TEMPERATURE, this);
/** 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<uint16_t> finaCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_POS_Z_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> finaCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_POS_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> finaCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_POS_Z_COIL_Z_TEMPERATURE, this);
};
/**
* @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]
* Temperature: [°C]
* 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)
*/
class NegZSelfTestSet: public StaticLocalDataSet<SELF_TEST_DATASET_ENTRIES> {
public:
NegZSelfTestSet(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, IMTQ::NEG_Z_TEST_DATASET) {
}
NegZSelfTestSet(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, IMTQ::NEG_Z_TEST_DATASET)) {
}
/** 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<uint16_t> initCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_NEG_Z_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_NEG_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> initCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
INIT_NEG_Z_COIL_Z_TEMPERATURE, this);
/** +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<uint16_t> coilXTemperature = lp_var_t<uint16_t>(sid.objectId,
NEG_Z_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> coilYTemperature = lp_var_t<uint16_t>(sid.objectId,
NEG_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> coilZTemperature = lp_var_t<uint16_t>(sid.objectId,
NEG_Z_COIL_Z_TEMPERATURE, this);
/** 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<uint16_t> finaCoilXTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_NEG_Z_COIL_X_TEMPERATURE, this);
lp_var_t<uint16_t> finaCoilYTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_NEG_Z_COIL_Y_TEMPERATURE, this);
lp_var_t<uint16_t> finaCoilZTemperature = lp_var_t<uint16_t>(sid.objectId,
FINA_NEG_Z_COIL_Z_TEMPERATURE, this);
};
}