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 * @ingroup thermal
*/ */
class AbstractTemperatureSensor: public HasHealthIF, class AbstractTemperatureSensor: public HasHealthIF,

View File

@ -8,7 +8,7 @@
#include <framework/thermal/ThermalModule.h> #include <framework/thermal/ThermalModule.h>
#include <framework/thermal/ThermalMonitor.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 { class CoreComponent: public ThermalComponentIF {
public: public:
struct Parameters { struct Parameters {

View File

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

View File

@ -8,14 +8,17 @@
/** /**
* @brief This building block handles non-linear value conversion and * @brief This building block handles non-linear value conversion and
* range checks for analog temperature sensors. * range checks for analog temperature sensors.
* @details * @details HOW TO USE
*
* *
*/ */
template<typename T> template<typename T>
class TemperatureSensor: public AbstractTemperatureSensor { class TemperatureSensor: public AbstractTemperatureSensor {
public: public:
/**
* What are a,b and c?
*/
struct Parameters { struct Parameters {
float a; float a;
float b; float b;
@ -24,11 +27,37 @@ public:
T upperLimit; T upperLimit;
float gradient; 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 { struct UsedParameters {
UsedParameters(Parameters parameters) : UsedParameters(Parameters parameters) :
a(parameters.a), b(parameters.b), c(parameters.c), gradient( a(parameters.a), b(parameters.b), c(parameters.c),
parameters.gradient) { gradient(parameters.gradient) {}
}
float a; float a;
float b; float b;
float c; float c;
@ -118,23 +147,6 @@ protected:
} }
public: 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() { float getTemperature() {
return outputTemperature; return outputTemperature;
} }

View File

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

View File

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

View File

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