Thermal: Some formatting stuff, doc to do

Need to find out how to use the thermal components
This commit is contained in:
Robin Müller 2020-02-15 18:26:25 +01:00
parent a7964c7200
commit e15839b3a6
7 changed files with 72 additions and 38 deletions

View File

@ -16,7 +16,8 @@
*/
/**
* @brief Base class for Temperature Sensor, implements all important interfaces
* @brief Base class for Temperature Sensor, implements all important interfaces.
* Please use the TemperatureSensor class to implement the actual sensors.
* @ingroup thermal
*/
class AbstractTemperatureSensor: public HasHealthIF,

View File

@ -8,7 +8,7 @@
#include <framework/thermal/ThermalModule.h>
#include <framework/thermal/ThermalMonitor.h>
// TODO: Documentaiton, how to use this? only use Thermal COmponent, which inherits core component?
// TODO: Documentaiton, how to use this? only use Thermal Component, which inherits core component?
class CoreComponent: public ThermalComponentIF {
public:
struct Parameters {

View File

@ -10,15 +10,14 @@ public:
Parameters(uint32_t objectIdHeater0, uint32_t objectIdHeater1,
uint8_t switch0Heater0, uint8_t switch1Heater0,
uint8_t switch0Heater1, uint8_t switch1Heater1) :
objectIdHeater0(objectIdHeater0), objectIdHeater1(
objectIdHeater1), switch0Heater0(switch0Heater0), switch1Heater0(
switch1Heater0), switch0Heater1(switch0Heater1), switch1Heater1(
switch1Heater1) {
objectIdHeater0(objectIdHeater0), objectIdHeater1(objectIdHeater1),
switch0Heater0(switch0Heater0),switch1Heater0(switch1Heater0),
switch0Heater1(switch0Heater1), switch1Heater1(switch1Heater1) {
}
Parameters() :
objectIdHeater0(0), objectIdHeater1(0), switch0Heater0(0), switch1Heater0(
0), switch0Heater1(0), switch1Heater1(0) {
objectIdHeater0(0), objectIdHeater1(0), switch0Heater0(0),
switch1Heater0(0), switch0Heater1(0), switch1Heater1(0) {
}
uint32_t objectIdHeater0;

View File

@ -8,14 +8,17 @@
/**
* @brief This building block handles non-linear value conversion and
* range checks for analog temperature sensors.
* @details
*
* @details HOW TO USE
*
*/
template<typename T>
class TemperatureSensor: public AbstractTemperatureSensor {
public:
/**
* What are a,b and c?
*/
struct Parameters {
float a;
float b;
@ -24,11 +27,37 @@ public:
T upperLimit;
float gradient;
};
/**
* How to use me.
* @param setObjectid
* @param inputTemperature
* @param poolVariable
* @param vectorIndex
* @param parameters
* @param datapoolId
* @param outputSet
* @param thermalModule
*/
TemperatureSensor(object_id_t setObjectid,
T *inputTemperature, PoolVariableIF *poolVariable,
uint8_t vectorIndex, Parameters parameters, uint32_t datapoolId,
DataSet *outputSet, ThermalModuleIF *thermalModule) :
AbstractTemperatureSensor(setObjectid, thermalModule), parameters(parameters),
inputTemperature(inputTemperature), poolVariable(poolVariable),
outputTemperature(datapoolId, outputSet, PoolVariableIF::VAR_WRITE),
sensorMonitor(setObjectid, DOMAIN_ID_SENSOR,
DataPool::poolIdAndPositionToPid(poolVariable->getDataPoolId(), vectorIndex),
DEFAULT_CONFIRMATION_COUNT, parameters.lowerLimit,parameters.upperLimit,
TEMP_SENSOR_LOW, TEMP_SENSOR_HIGH),
oldTemperature(20), uptimeOfOldTemperature( { INVALID_TEMPERATURE, 0 }) {
}
struct UsedParameters {
UsedParameters(Parameters parameters) :
a(parameters.a), b(parameters.b), c(parameters.c), gradient(
parameters.gradient) {
}
a(parameters.a), b(parameters.b), c(parameters.c),
gradient(parameters.gradient) {}
float a;
float b;
float c;
@ -118,23 +147,6 @@ protected:
}
public:
TemperatureSensor(object_id_t setObjectid,
T *inputTemperature, PoolVariableIF *poolVariable,
uint8_t vectorIndex, Parameters parameters, uint32_t datapoolId,
DataSet *outputSet, ThermalModuleIF *thermalModule) :
AbstractTemperatureSensor(setObjectid, thermalModule), parameters(
parameters), inputTemperature(inputTemperature), poolVariable(
poolVariable), outputTemperature(datapoolId, outputSet,
PoolVariableIF::VAR_WRITE), sensorMonitor(setObjectid,
DOMAIN_ID_SENSOR,
DataPool::poolIdAndPositionToPid(
poolVariable->getDataPoolId(), vectorIndex),
DEFAULT_CONFIRMATION_COUNT, parameters.lowerLimit,
parameters.upperLimit, TEMP_SENSOR_LOW, TEMP_SENSOR_HIGH), oldTemperature(
20), uptimeOfOldTemperature( { INVALID_TEMPERATURE, 0 }) {
}
float getTemperature() {
return outputTemperature;
}

View File

@ -12,12 +12,10 @@ ThermalComponent::ThermalComponent(object_id_t reportingObjectId,
CoreComponent(reportingObjectId, domainId, temperaturePoolId,
targetStatePoolId, currentStatePoolId, requestPoolId, dataSet,
sensor, firstRedundantSensor, secondRedundantSensor,
thermalModule,
{ parameters.lowerOpLimit, parameters.upperOpLimit,
parameters.heaterOn, parameters.hysteresis,
parameters.heaterSwitchoff }, priority,
ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL), nopParameters(
{ parameters.lowerNopLimit, parameters.upperNopLimit }) {
thermalModule,{ parameters.lowerOpLimit, parameters.upperOpLimit,
parameters.heaterOn, parameters.hysteresis, parameters.heaterSwitchoff },
priority, ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL),
nopParameters({ parameters.lowerNopLimit, parameters.upperNopLimit }) {
}
ThermalComponent::~ThermalComponent() {

View File

@ -3,6 +3,9 @@
#include "CoreComponent.h"
/**
* What is it. How to use
*/
class ThermalComponent: public CoreComponent {
public:
struct Parameters {
@ -15,12 +18,30 @@ public:
float heaterSwitchoff;
};
// TODO: Documentaiton ,what is NOP?
// propably Non-operational?
/**
* Non-Operational Temperatures
*/
struct NopParameters {
float lowerNopLimit;
float upperNopLimit;
};
/**
* How to use.
* @param reportingObjectId
* @param domainId
* @param temperaturePoolId
* @param targetStatePoolId
* @param currentStatePoolId
* @param requestPoolId
* @param dataSet
* @param sensor
* @param firstRedundantSensor
* @param secondRedundantSensor
* @param thermalModule
* @param parameters
* @param priority
*/
ThermalComponent(object_id_t reportingObjectId, uint8_t domainId, uint32_t temperaturePoolId,
uint32_t targetStatePoolId, uint32_t currentStatePoolId, uint32_t requestPoolId,
DataSet *dataSet, AbstractTemperatureSensor *sensor,

View File

@ -4,6 +4,9 @@
#include <framework/monitoring/MonitorReporter.h>
#include <framework/thermal/ThermalComponentIF.h>
/**
* What does it do. How to use it.
*/
class ThermalMonitor: public MonitorReporter<float> {
public:
template<typename ... Args>